mirror of
https://github.com/lifegpc/eh_downloader_flutter.git
synced 2026-06-06 05:49:03 +08:00
refactor: Remove primaryColor parameter from setCurrentTitle function
This commit is contained in:
@@ -494,7 +494,7 @@ String? _currentTitle;
|
||||
String? _prefix;
|
||||
final _titleLog = Logger("Title");
|
||||
|
||||
void setCurrentTitle(String title, int primaryColor,
|
||||
void setCurrentTitle(String title,
|
||||
{bool isPrefix = false,
|
||||
bool includePrefix = true,
|
||||
bool usePrefix = false}) {
|
||||
@@ -519,8 +519,7 @@ void setCurrentTitle(String title, int primaryColor,
|
||||
if (isPrefix) _prefix = title;
|
||||
} else {
|
||||
SystemChrome.setApplicationSwitcherDescription(
|
||||
ApplicationSwitcherDescription(
|
||||
label: title, primaryColor: primaryColor))
|
||||
ApplicationSwitcherDescription(label: title))
|
||||
.then((_) {
|
||||
_currentTitle = title;
|
||||
if (isPrefix) _prefix = title;
|
||||
|
||||
@@ -477,8 +477,7 @@ class _MainApp extends State<MainApp> with WidgetsBindingObserver {
|
||||
routerConfig: _router,
|
||||
onGenerateTitle: (context) {
|
||||
final title = AppLocalizations.of(context)!.title;
|
||||
setCurrentTitle(title, Theme.of(context).primaryColor.value,
|
||||
isPrefix: true);
|
||||
setCurrentTitle(title, isPrefix: true);
|
||||
return title;
|
||||
},
|
||||
locale: _lang.toLocale(),
|
||||
|
||||
@@ -180,7 +180,7 @@ class _GalleriesPage extends State<GalleriesPage>
|
||||
? i18n.categoryGalleries(widget.category!)
|
||||
: i18n.galleries;
|
||||
if (isTop(context)) {
|
||||
setCurrentTitle(title, Theme.of(context).primaryColor.value);
|
||||
setCurrentTitle(title);
|
||||
}
|
||||
if (auth.canManageTasks == true &&
|
||||
!widget.hasExtra &&
|
||||
|
||||
@@ -140,13 +140,11 @@ class _GalleryPage extends State<GalleryPage>
|
||||
: i18n.gallery;
|
||||
if (isTop(context)) {
|
||||
if (!kIsWeb || (_data != null && kIsWeb)) {
|
||||
setCurrentTitle(title, Theme.of(context).primaryColor.value,
|
||||
includePrefix: false);
|
||||
setCurrentTitle(title, includePrefix: false);
|
||||
} else if (kIsWeb && widget.title != null) {
|
||||
// 设置预加载标题
|
||||
// Chrome 和 Firefox 必须尽快设置标题以确保在历史记录菜单显示正确的标题
|
||||
setCurrentTitle(widget.title!, Theme.of(context).primaryColor.value,
|
||||
includePrefix: false);
|
||||
setCurrentTitle(widget.title!, includePrefix: false);
|
||||
}
|
||||
}
|
||||
return Scaffold(
|
||||
|
||||
@@ -94,8 +94,7 @@ class _HomePage extends State<HomePage> with ThemeModeWidget, IsTopWidget2 {
|
||||
Widget build(BuildContext context) {
|
||||
tryInitApi(context);
|
||||
if (isTop(context)) {
|
||||
setCurrentTitle("", Theme.of(context).primaryColor.value,
|
||||
usePrefix: true);
|
||||
setCurrentTitle("", usePrefix: true);
|
||||
}
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
|
||||
@@ -134,7 +134,7 @@ class _LoginPageState extends State<LoginPage>
|
||||
}
|
||||
final i18n = AppLocalizations.of(context)!;
|
||||
if (isTop(context)) {
|
||||
setCurrentTitle(i18n.login, Theme.of(context).primaryColor.value);
|
||||
setCurrentTitle(i18n.login);
|
||||
}
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
|
||||
@@ -113,9 +113,8 @@ class _SessionsPage extends State<SessionsPage>
|
||||
final isLoading = _tokens == null && _error == null;
|
||||
if (isLoading && !_isLoading) _fetchData();
|
||||
final i18n = AppLocalizations.of(context)!;
|
||||
final th = Theme.of(context);
|
||||
if (isTop(context)) {
|
||||
setCurrentTitle(i18n.sessionManagemant, th.primaryColor.value);
|
||||
setCurrentTitle(i18n.sessionManagemant);
|
||||
}
|
||||
return Scaffold(
|
||||
appBar: _tokens == null && (auth.isAdmin != true || _users == null)
|
||||
|
||||
@@ -35,7 +35,7 @@ class _SettingsPage extends State<SettingsPage>
|
||||
tryInitApi(context);
|
||||
final i18n = AppLocalizations.of(context)!;
|
||||
if (isTop(context)) {
|
||||
setCurrentTitle(i18n.settings, Theme.of(context).primaryColor.value);
|
||||
setCurrentTitle(i18n.settings);
|
||||
}
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
|
||||
@@ -105,8 +105,7 @@ class _CacheSettingsPage extends State<CacheSettingsPage>
|
||||
Widget build(BuildContext context) {
|
||||
final i18n = AppLocalizations.of(context)!;
|
||||
if (isTop(context)) {
|
||||
setCurrentTitle("${i18n.settings} - ${i18n.cache}",
|
||||
Theme.of(context).primaryColor.value);
|
||||
setCurrentTitle("${i18n.settings} - ${i18n.cache}");
|
||||
}
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
|
||||
@@ -247,8 +247,7 @@ class _DisplaySettingsPage extends State<DisplaySettingsPage>
|
||||
Widget build(BuildContext context) {
|
||||
final i18n = AppLocalizations.of(context)!;
|
||||
if (isTop(context)) {
|
||||
setCurrentTitle("${i18n.settings} - ${i18n.display}",
|
||||
Theme.of(context).primaryColor.value);
|
||||
setCurrentTitle("${i18n.settings} - ${i18n.display}");
|
||||
}
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
|
||||
@@ -60,8 +60,7 @@ class _SearchSettingsPage extends State<SearchSettingsPage>
|
||||
Widget build(BuildContext context) {
|
||||
final i18n = AppLocalizations.of(context)!;
|
||||
if (isTop(context)) {
|
||||
setCurrentTitle("${i18n.settings} - ${i18n.search}",
|
||||
Theme.of(context).primaryColor.value);
|
||||
setCurrentTitle("${i18n.settings} - ${i18n.search}");
|
||||
}
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
|
||||
@@ -119,9 +119,8 @@ class _ServerSettingsPage extends State<ServerSettingsPage>
|
||||
final isLoading = _config == null && _error == null;
|
||||
if (isLoading && !_isLoading) _fetchData();
|
||||
final i18n = AppLocalizations.of(context)!;
|
||||
final cs = Theme.of(context).colorScheme;
|
||||
if (isTop(context)) {
|
||||
setCurrentTitle("${i18n.settings} - ${i18n.server}", cs.primary.value);
|
||||
setCurrentTitle("${i18n.settings} - ${i18n.server}");
|
||||
}
|
||||
return Scaffold(
|
||||
appBar: isLoading
|
||||
@@ -167,7 +166,9 @@ class _ServerSettingsPage extends State<ServerSettingsPage>
|
||||
u.userInfo.isNotEmpty ||
|
||||
u.hasFragment ||
|
||||
!u.hasEmptyPath ||
|
||||
!u.hasScheme) return i18n.invalidURLOrigin;
|
||||
!u.hasScheme) {
|
||||
return i18n.invalidURLOrigin;
|
||||
}
|
||||
if (u.scheme != "http" && u.scheme != "https") {
|
||||
return i18n.httpHttpsNeeded;
|
||||
}
|
||||
|
||||
@@ -79,8 +79,7 @@ class _ServerUrlSettingsPage extends State<ServerUrlSettingsPage>
|
||||
];
|
||||
if (hasBaseUrl) actions.add(buildMoreVertSettingsButon(context));
|
||||
if (isTop(context)) {
|
||||
setCurrentTitle("${i18n.settings} - ${i18n.setServerUrl}",
|
||||
Theme.of(context).primaryColor.value);
|
||||
setCurrentTitle("${i18n.settings} - ${i18n.setServerUrl}");
|
||||
}
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
|
||||
@@ -312,8 +312,7 @@ class _UserSettingsPage extends State<UserSettingsPage>
|
||||
Widget build(BuildContext context) {
|
||||
final i18n = AppLocalizations.of(context)!;
|
||||
if (isTop(context)) {
|
||||
setCurrentTitle("${i18n.settings} - ${i18n.user}",
|
||||
Theme.of(context).primaryColor.value);
|
||||
setCurrentTitle("${i18n.settings} - ${i18n.user}");
|
||||
}
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
|
||||
@@ -276,7 +276,7 @@ class _TaskManagerPage extends State<TaskManagerPage>
|
||||
}
|
||||
final i18n = AppLocalizations.of(context)!;
|
||||
if (isTop(context)) {
|
||||
setCurrentTitle(i18n.taskManager, Theme.of(context).primaryColor.value);
|
||||
setCurrentTitle(i18n.taskManager);
|
||||
}
|
||||
final size = MediaQuery.of(context).size;
|
||||
return Scaffold(
|
||||
|
||||
@@ -68,9 +68,8 @@ class _UsersPage extends State<UsersPage> with ThemeModeWidget, IsTopWidget2 {
|
||||
final isLoading = _users == null && _error == null;
|
||||
if (isLoading && !_isLoading) _fetchData();
|
||||
final i18n = AppLocalizations.of(context)!;
|
||||
final th = Theme.of(context);
|
||||
if (isTop(context)) {
|
||||
setCurrentTitle(i18n.userManagemant, th.primaryColor.value);
|
||||
setCurrentTitle(i18n.userManagemant);
|
||||
}
|
||||
return Scaffold(
|
||||
appBar: _users == null
|
||||
|
||||
@@ -299,8 +299,7 @@ class _SinglePageViewer extends State<SinglePageViewer>
|
||||
: AppLocalizations.of(context)!.loading;
|
||||
if (isTop(context)) {
|
||||
if (!kIsWeb || (_data != null && kIsWeb)) {
|
||||
setCurrentTitle(title, Theme.of(context).primaryColor.value,
|
||||
includePrefix: false);
|
||||
setCurrentTitle(title, includePrefix: false);
|
||||
}
|
||||
}
|
||||
if (_data == null || _files == null) {
|
||||
|
||||
Reference in New Issue
Block a user