Compare commits
2 Commits
8e76ff3f84
...
1b41c847a6
Author | SHA1 | Date | |
---|---|---|---|
1b41c847a6 | |||
b1af6c2c97 |
18
api/Passport/Deal Abuse Report.bru
Normal file
18
api/Passport/Deal Abuse Report.bru
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
meta {
|
||||||
|
name: Deal Abuse Report
|
||||||
|
type: http
|
||||||
|
seq: 3
|
||||||
|
}
|
||||||
|
|
||||||
|
put {
|
||||||
|
url: {{endpoint}}/cgi/id/reports/abuse/3/status
|
||||||
|
body: json
|
||||||
|
auth: inherit
|
||||||
|
}
|
||||||
|
|
||||||
|
body:json {
|
||||||
|
{
|
||||||
|
"status": "processed",
|
||||||
|
"message": "相关附件已经进行评级处理,未来会将该项权限下放到帖主以及社区成员。"
|
||||||
|
}
|
||||||
|
}
|
@ -203,6 +203,11 @@
|
|||||||
"other": "{} comments"
|
"other": "{} comments"
|
||||||
},
|
},
|
||||||
"settingsAppearance": "Appearance",
|
"settingsAppearance": "Appearance",
|
||||||
|
"settingsCustomFonts": "Custom Fonts",
|
||||||
|
"settingsCustomFontsDescription": "Set custom fonts for the application.",
|
||||||
|
"settingsCustomFontFamily": "Custom Font Family",
|
||||||
|
"settingsCustomFontFamilyHint": "Use comma to separate fonts, higher priority comes first",
|
||||||
|
"settingsCustomFontApplied": "Custom font has been applied.",
|
||||||
"settingsDisplayLanguage": "Display Language",
|
"settingsDisplayLanguage": "Display Language",
|
||||||
"settingsDisplayLanguageDescription": "Set the application language.",
|
"settingsDisplayLanguageDescription": "Set the application language.",
|
||||||
"settingsDisplayLanguageSystem": "Follow System",
|
"settingsDisplayLanguageSystem": "Follow System",
|
||||||
|
@ -201,6 +201,11 @@
|
|||||||
"other": "{} 条评论"
|
"other": "{} 条评论"
|
||||||
},
|
},
|
||||||
"settingsAppearance": "外观",
|
"settingsAppearance": "外观",
|
||||||
|
"settingsCustomFonts": "自定义字体",
|
||||||
|
"settingsCustomFontsDescription": "设置应用程序使用的字体。",
|
||||||
|
"settingsCustomFontFamily": "应用字体",
|
||||||
|
"settingsCustomFontFamilyHint": "使用英文逗号分割每一种字体,越前优先级越高",
|
||||||
|
"settingsCustomFontApplied": "自定义字体已经应用。",
|
||||||
"settingsDisplayLanguage": "显示语言",
|
"settingsDisplayLanguage": "显示语言",
|
||||||
"settingsDisplayLanguageDescription": "设置应用程序使用的语言",
|
"settingsDisplayLanguageDescription": "设置应用程序使用的语言",
|
||||||
"settingsDisplayLanguageSystem": "跟随系统",
|
"settingsDisplayLanguageSystem": "跟随系统",
|
||||||
|
@ -201,6 +201,11 @@
|
|||||||
"other": "{} 條評論"
|
"other": "{} 條評論"
|
||||||
},
|
},
|
||||||
"settingsAppearance": "外觀",
|
"settingsAppearance": "外觀",
|
||||||
|
"settingsCustomFonts": "自定義字體",
|
||||||
|
"settingsCustomFontsDescription": "設置應用程序使用的字體。",
|
||||||
|
"settingsCustomFontFamily": "應用字體",
|
||||||
|
"settingsCustomFontFamilyHint": "使用英文逗號分割每一種字體,越前優先級越高",
|
||||||
|
"settingsCustomFontApplied": "自定義字體已經應用。",
|
||||||
"settingsDisplayLanguage": "顯示語言",
|
"settingsDisplayLanguage": "顯示語言",
|
||||||
"settingsDisplayLanguageDescription": "設置應用程序使用的語言",
|
"settingsDisplayLanguageDescription": "設置應用程序使用的語言",
|
||||||
"settingsDisplayLanguageSystem": "跟隨系統",
|
"settingsDisplayLanguageSystem": "跟隨系統",
|
||||||
|
@ -201,6 +201,11 @@
|
|||||||
"other": "{} 條評論"
|
"other": "{} 條評論"
|
||||||
},
|
},
|
||||||
"settingsAppearance": "外觀",
|
"settingsAppearance": "外觀",
|
||||||
|
"settingsCustomFonts": "自定義字體",
|
||||||
|
"settingsCustomFontsDescription": "設置應用程序使用的字體。",
|
||||||
|
"settingsCustomFontFamily": "應用字體",
|
||||||
|
"settingsCustomFontFamilyHint": "使用英文逗號分割每一種字體,越前優先級越高",
|
||||||
|
"settingsCustomFontApplied": "自定義字體已經應用。",
|
||||||
"settingsDisplayLanguage": "顯示語言",
|
"settingsDisplayLanguage": "顯示語言",
|
||||||
"settingsDisplayLanguageDescription": "設置應用程序使用的語言",
|
"settingsDisplayLanguageDescription": "設置應用程序使用的語言",
|
||||||
"settingsDisplayLanguageSystem": "跟隨系統",
|
"settingsDisplayLanguageSystem": "跟隨系統",
|
||||||
|
@ -18,6 +18,7 @@ const kAppNotifyWithHaptic = 'app_notify_with_haptic';
|
|||||||
const kAppExpandPostLink = 'app_expand_post_link';
|
const kAppExpandPostLink = 'app_expand_post_link';
|
||||||
const kAppExpandChatLink = 'app_expand_chat_link';
|
const kAppExpandChatLink = 'app_expand_chat_link';
|
||||||
const kAppRealmCompactView = 'app_realm_compact_view';
|
const kAppRealmCompactView = 'app_realm_compact_view';
|
||||||
|
const kAppCustomFonts = 'app_custom_fonts';
|
||||||
|
|
||||||
const Map<String, FilterQuality> kImageQualityLevel = {
|
const Map<String, FilterQuality> kImageQualityLevel = {
|
||||||
'settingsImageQualityLowest': FilterQuality.none,
|
'settingsImageQualityLowest': FilterQuality.none,
|
||||||
|
@ -13,8 +13,16 @@ class ThemeProvider extends ChangeNotifier {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void reloadTheme({Color? seedColorOverride, bool? useMaterial3}) {
|
void reloadTheme({
|
||||||
createAppThemeSet(seedColorOverride: seedColorOverride, useMaterial3: useMaterial3).then((value) {
|
Color? seedColorOverride,
|
||||||
|
bool? useMaterial3,
|
||||||
|
String? customFonts,
|
||||||
|
}) {
|
||||||
|
createAppThemeSet(
|
||||||
|
seedColorOverride: seedColorOverride,
|
||||||
|
useMaterial3: useMaterial3,
|
||||||
|
customFonts: customFonts,
|
||||||
|
).then((value) {
|
||||||
theme = value;
|
theme = value;
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
});
|
});
|
||||||
|
@ -65,14 +65,18 @@ class _UserScreenState extends State<UserScreen>
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<List<SnCheckInRecord>> _getCheckInRecords() async {
|
List<SnCheckInRecord>? _records;
|
||||||
|
|
||||||
|
Future<void> _getCheckInRecords() async {
|
||||||
try {
|
try {
|
||||||
final sn = context.read<SnNetworkProvider>();
|
final sn = context.read<SnNetworkProvider>();
|
||||||
final resp =
|
final resp =
|
||||||
await sn.client.get('/cgi/id/users/${widget.name}/check-in?take=14');
|
await sn.client.get('/cgi/id/users/${widget.name}/check-in?take=14');
|
||||||
return List.from(
|
setState(() {
|
||||||
resp.data['data']?.map((x) => SnCheckInRecord.fromJson(x)) ?? [],
|
_records = List.from(
|
||||||
);
|
resp.data['data']?.map((x) => SnCheckInRecord.fromJson(x)) ?? [],
|
||||||
|
);
|
||||||
|
});
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
if (mounted) context.showErrorDialog(err);
|
if (mounted) context.showErrorDialog(err);
|
||||||
rethrow;
|
rethrow;
|
||||||
@ -213,6 +217,7 @@ class _UserScreenState extends State<UserScreen>
|
|||||||
|
|
||||||
_fetchStatus();
|
_fetchStatus();
|
||||||
_fetchPublishers();
|
_fetchPublishers();
|
||||||
|
_getCheckInRecords();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
final rel = context.read<SnRelationshipProvider>();
|
final rel = context.read<SnRelationshipProvider>();
|
||||||
@ -542,12 +547,10 @@ class _UserScreenState extends State<UserScreen>
|
|||||||
SliverToBoxAdapter(child: const Divider()),
|
SliverToBoxAdapter(child: const Divider()),
|
||||||
const SliverGap(12),
|
const SliverGap(12),
|
||||||
SliverToBoxAdapter(
|
SliverToBoxAdapter(
|
||||||
child: FutureBuilder<List<SnCheckInRecord>>(
|
child: Builder(
|
||||||
key: GlobalKey(),
|
builder: (context) {
|
||||||
future: _getCheckInRecords(),
|
if (_records == null) return const SizedBox.shrink();
|
||||||
builder: (context, snapshot) {
|
if (_records!.length <= 1) {
|
||||||
if (!snapshot.hasData) return const SizedBox.shrink();
|
|
||||||
if (snapshot.data!.length <= 1) {
|
|
||||||
return Text(
|
return Text(
|
||||||
'accountCheckInNoRecords',
|
'accountCheckInNoRecords',
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
@ -557,11 +560,10 @@ class _UserScreenState extends State<UserScreen>
|
|||||||
.center()
|
.center()
|
||||||
.padding(horizontal: 20, vertical: 8);
|
.padding(horizontal: 20, vertical: 8);
|
||||||
}
|
}
|
||||||
final records = snapshot.data!;
|
|
||||||
return SizedBox(
|
return SizedBox(
|
||||||
width: double.infinity,
|
width: double.infinity,
|
||||||
height: 240,
|
height: 240,
|
||||||
child: CheckInRecordChart(records: records),
|
child: CheckInRecordChart(records: _records!),
|
||||||
).padding(
|
).padding(
|
||||||
right: 24,
|
right: 24,
|
||||||
left: 16,
|
left: 16,
|
||||||
|
@ -48,6 +48,7 @@ class _SettingsScreenState extends State<SettingsScreen> {
|
|||||||
late final SharedPreferences _prefs;
|
late final SharedPreferences _prefs;
|
||||||
String _docBasepath = '/';
|
String _docBasepath = '/';
|
||||||
|
|
||||||
|
final TextEditingController _customFontController = TextEditingController();
|
||||||
final TextEditingController _serverUrlController = TextEditingController();
|
final TextEditingController _serverUrlController = TextEditingController();
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -62,11 +63,15 @@ class _SettingsScreenState extends State<SettingsScreen> {
|
|||||||
final config = context.read<ConfigProvider>();
|
final config = context.read<ConfigProvider>();
|
||||||
_prefs = config.prefs;
|
_prefs = config.prefs;
|
||||||
_serverUrlController.text = config.serverUrl;
|
_serverUrlController.text = config.serverUrl;
|
||||||
|
if (_prefs.getString(kAppCustomFonts) != null) {
|
||||||
|
_customFontController.text = _prefs.getString(kAppCustomFonts) ?? '';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void dispose() {
|
void dispose() {
|
||||||
_serverUrlController.dispose();
|
_serverUrlController.dispose();
|
||||||
|
_customFontController.dispose();
|
||||||
super.dispose();
|
super.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -330,6 +335,47 @@ class _SettingsScreenState extends State<SettingsScreen> {
|
|||||||
setState(() {});
|
setState(() {});
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
ListTile(
|
||||||
|
leading: const Icon(Symbols.font_download),
|
||||||
|
title: Text('settingsCustomFonts').tr(),
|
||||||
|
subtitle: Text('settingsCustomFontsDescription').tr(),
|
||||||
|
contentPadding: const EdgeInsets.only(left: 24, right: 14),
|
||||||
|
trailing: IconButton(
|
||||||
|
padding: EdgeInsets.zero,
|
||||||
|
constraints: const BoxConstraints(),
|
||||||
|
icon: const Icon(Icons.clear),
|
||||||
|
onPressed: () {
|
||||||
|
_prefs.remove(kAppCustomFonts);
|
||||||
|
context.showSnackbar('settingsCustomFontApplied'.tr());
|
||||||
|
final theme = context.read<ThemeProvider>();
|
||||||
|
_customFontController.clear();
|
||||||
|
theme.reloadTheme();
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
TextField(
|
||||||
|
controller: _customFontController,
|
||||||
|
decoration: InputDecoration(
|
||||||
|
border: const OutlineInputBorder(),
|
||||||
|
labelText: 'settingsCustomFontFamily'.tr(),
|
||||||
|
helperText: 'settingsCustomFontFamilyHint'.tr(),
|
||||||
|
prefixIcon: const Icon(Symbols.format_paint),
|
||||||
|
suffixIcon: IconButton(
|
||||||
|
icon: const Icon(Symbols.save),
|
||||||
|
onPressed: () {
|
||||||
|
_prefs.setString(
|
||||||
|
kAppCustomFonts,
|
||||||
|
_customFontController.text,
|
||||||
|
);
|
||||||
|
context.showSnackbar('settingsCustomFontApplied'.tr());
|
||||||
|
final theme = context.read<ThemeProvider>();
|
||||||
|
theme.reloadTheme();
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
onTapOutside: (_) =>
|
||||||
|
FocusManager.instance.primaryFocus?.unfocus(),
|
||||||
|
).padding(horizontal: 16, top: 8, bottom: 4),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
Column(
|
Column(
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:google_fonts/google_fonts.dart';
|
|
||||||
import 'package:shared_preferences/shared_preferences.dart';
|
import 'package:shared_preferences/shared_preferences.dart';
|
||||||
import 'package:surface/providers/config.dart';
|
import 'package:surface/providers/config.dart';
|
||||||
|
|
||||||
@ -13,10 +12,18 @@ class ThemeSet {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<ThemeSet> createAppThemeSet(
|
Future<ThemeSet> createAppThemeSet(
|
||||||
{Color? seedColorOverride, bool? useMaterial3}) async {
|
{Color? seedColorOverride, bool? useMaterial3, String? customFonts}) async {
|
||||||
return ThemeSet(
|
return ThemeSet(
|
||||||
light: await createAppTheme(Brightness.light, useMaterial3: useMaterial3),
|
light: await createAppTheme(
|
||||||
dark: await createAppTheme(Brightness.dark, useMaterial3: useMaterial3),
|
Brightness.light,
|
||||||
|
useMaterial3: useMaterial3,
|
||||||
|
customFonts: customFonts,
|
||||||
|
),
|
||||||
|
dark: await createAppTheme(
|
||||||
|
Brightness.dark,
|
||||||
|
useMaterial3: useMaterial3,
|
||||||
|
customFonts: customFonts,
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -24,6 +31,7 @@ Future<ThemeData> createAppTheme(
|
|||||||
Brightness brightness, {
|
Brightness brightness, {
|
||||||
Color? seedColorOverride,
|
Color? seedColorOverride,
|
||||||
bool? useMaterial3,
|
bool? useMaterial3,
|
||||||
|
String? customFonts,
|
||||||
}) async {
|
}) async {
|
||||||
final prefs = await SharedPreferences.getInstance();
|
final prefs = await SharedPreferences.getInstance();
|
||||||
|
|
||||||
@ -41,11 +49,17 @@ Future<ThemeData> createAppTheme(
|
|||||||
final useM3 =
|
final useM3 =
|
||||||
useMaterial3 ?? (prefs.getBool(kMaterialYouToggleStoreKey) ?? true);
|
useMaterial3 ?? (prefs.getBool(kMaterialYouToggleStoreKey) ?? true);
|
||||||
|
|
||||||
|
final inUseFonts = (customFonts ?? prefs.getString(kAppCustomFonts))
|
||||||
|
?.split(',')
|
||||||
|
.map((ele) => ele.trim())
|
||||||
|
.toList();
|
||||||
|
|
||||||
return ThemeData(
|
return ThemeData(
|
||||||
useMaterial3: useM3,
|
useMaterial3: useM3,
|
||||||
colorScheme: colorScheme,
|
colorScheme: colorScheme,
|
||||||
brightness: brightness,
|
brightness: brightness,
|
||||||
textTheme: GoogleFonts.rubikTextTheme(),
|
fontFamily: inUseFonts?.firstOrNull,
|
||||||
|
fontFamilyFallback: inUseFonts?.sublist(1),
|
||||||
iconTheme: IconThemeData(
|
iconTheme: IconThemeData(
|
||||||
fill: 0,
|
fill: 0,
|
||||||
weight: 400,
|
weight: 400,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user