mirror of
https://github.com/lifegpc/eh_downloader_flutter.git
synced 2026-06-20 02:44:19 +08:00
Fix title may always be default title
This commit is contained in:
@@ -38,7 +38,7 @@ final _router = GoRouter(
|
||||
routes: [
|
||||
GoRoute(
|
||||
path: HomePage.routeName,
|
||||
builder: (context, state) => const HomePage(),
|
||||
builder: (context, state) => HomePage(key: state.pageKey),
|
||||
),
|
||||
GoRoute(
|
||||
path: ServerUrlSettingsPage.routeName,
|
||||
@@ -212,7 +212,7 @@ final _router = GoRouter(
|
||||
}),
|
||||
GoRoute(
|
||||
path: UsersPage.routeName,
|
||||
builder: (context, state) => const UsersPage(),
|
||||
builder: (context, state) => UsersPage(key: state.pageKey),
|
||||
),
|
||||
GoRoute(
|
||||
path: NewUserPage.routeName,
|
||||
|
||||
@@ -65,7 +65,7 @@ class HomeDrawer extends StatelessWidget {
|
||||
}
|
||||
}
|
||||
|
||||
class HomePage extends HookWidget {
|
||||
class HomePage extends HookWidget with IsTopWidget {
|
||||
const HomePage({super.key});
|
||||
|
||||
static const String routeName = '/';
|
||||
@@ -75,7 +75,10 @@ class HomePage extends HookWidget {
|
||||
tryInitApi(context);
|
||||
var mode = useState(MainApp.of(context).themeMode);
|
||||
mode.value = MainApp.of(context).themeMode;
|
||||
setCurrentTitle("", Theme.of(context).primaryColor.value, usePrefix: true);
|
||||
if (isTop(context)) {
|
||||
setCurrentTitle("", Theme.of(context).primaryColor.value,
|
||||
usePrefix: true);
|
||||
}
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text(AppLocalizations.of(context)!.titleBar),
|
||||
|
||||
@@ -128,10 +128,14 @@ class _LoginPageState extends State<LoginPage>
|
||||
_tryPoped = true;
|
||||
return Container();
|
||||
}
|
||||
final i18n = AppLocalizations.of(context)!;
|
||||
if (isTop(context)) {
|
||||
setCurrentTitle(i18n.login, Theme.of(context).primaryColor.value);
|
||||
}
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
leading: Container(),
|
||||
title: Text(AppLocalizations.of(context)!.login),
|
||||
title: Text(i18n.login),
|
||||
actions: [
|
||||
buildThemeModeIcon(context),
|
||||
buildMoreVertSettingsButon(context),
|
||||
@@ -153,8 +157,7 @@ class _LoginPageState extends State<LoginPage>
|
||||
child: TextFormField(
|
||||
decoration: InputDecoration(
|
||||
border: const OutlineInputBorder(),
|
||||
labelText:
|
||||
AppLocalizations.of(context)!.username,
|
||||
labelText: i18n.username,
|
||||
),
|
||||
initialValue: _username,
|
||||
onChanged: _usernameChanged,
|
||||
@@ -164,8 +167,7 @@ class _LoginPageState extends State<LoginPage>
|
||||
child: TextFormField(
|
||||
decoration: InputDecoration(
|
||||
border: const OutlineInputBorder(),
|
||||
labelText:
|
||||
AppLocalizations.of(context)!.password,
|
||||
labelText: i18n.password,
|
||||
suffixIcon: IconButton(
|
||||
icon: Icon(
|
||||
_passwordVisible
|
||||
@@ -195,8 +197,7 @@ class _LoginPageState extends State<LoginPage>
|
||||
} else {
|
||||
final snackBar = SnackBar(
|
||||
content: Text(
|
||||
AppLocalizations.of(context)!
|
||||
.incorrectUserPassword));
|
||||
i18n.incorrectUserPassword));
|
||||
ScaffoldMessenger.of(context)
|
||||
.showSnackBar(snackBar);
|
||||
setState(() {
|
||||
@@ -209,10 +210,8 @@ class _LoginPageState extends State<LoginPage>
|
||||
e is! (int, String);
|
||||
final snackBar = SnackBar(
|
||||
content: Text(isNetworkError
|
||||
? AppLocalizations.of(context)!
|
||||
.networkError
|
||||
: AppLocalizations.of(context)!
|
||||
.internalError));
|
||||
? i18n.networkError
|
||||
: i18n.internalError));
|
||||
ScaffoldMessenger.of(context)
|
||||
.showSnackBar(snackBar);
|
||||
setState(() {
|
||||
@@ -221,7 +220,7 @@ class _LoginPageState extends State<LoginPage>
|
||||
});
|
||||
}
|
||||
: null,
|
||||
child: Text(AppLocalizations.of(context)!.login)),
|
||||
child: Text(i18n.login)),
|
||||
])))),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -16,7 +16,8 @@ class CacheSettingsPage extends StatefulWidget {
|
||||
State<CacheSettingsPage> createState() => _CacheSettingsPage();
|
||||
}
|
||||
|
||||
class _CacheSettingsPage extends State<CacheSettingsPage> with ThemeModeWidget {
|
||||
class _CacheSettingsPage extends State<CacheSettingsPage>
|
||||
with ThemeModeWidget, IsTopWidget2 {
|
||||
bool _oriEnableImageCache = false;
|
||||
bool _enableImageCache = false;
|
||||
@override
|
||||
@@ -103,8 +104,10 @@ class _CacheSettingsPage extends State<CacheSettingsPage> with ThemeModeWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final i18n = AppLocalizations.of(context)!;
|
||||
setCurrentTitle("${i18n.settings} - ${i18n.cache}",
|
||||
Theme.of(context).primaryColor.value);
|
||||
if (isTop(context)) {
|
||||
setCurrentTitle("${i18n.settings} - ${i18n.cache}",
|
||||
Theme.of(context).primaryColor.value);
|
||||
}
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
leading: IconButton(
|
||||
|
||||
@@ -18,7 +18,7 @@ class DisplaySettingsPage extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _DisplaySettingsPage extends State<DisplaySettingsPage>
|
||||
with ThemeModeWidget {
|
||||
with ThemeModeWidget, IsTopWidget2 {
|
||||
bool _oriDisplayAd = false;
|
||||
Lang _oriLang = Lang.system;
|
||||
bool _oriPreventScreenCapture = false;
|
||||
@@ -185,8 +185,10 @@ class _DisplaySettingsPage extends State<DisplaySettingsPage>
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final i18n = AppLocalizations.of(context)!;
|
||||
setCurrentTitle("${i18n.settings} - ${i18n.display}",
|
||||
Theme.of(context).primaryColor.value);
|
||||
if (isTop(context)) {
|
||||
setCurrentTitle("${i18n.settings} - ${i18n.display}",
|
||||
Theme.of(context).primaryColor.value);
|
||||
}
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
leading: IconButton(
|
||||
|
||||
@@ -17,7 +17,7 @@ class ServerUrlSettingsPage extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _ServerUrlSettingsPage extends State<ServerUrlSettingsPage>
|
||||
with ThemeModeWidget {
|
||||
with ThemeModeWidget, IsTopWidget2 {
|
||||
String _serverUrl = "";
|
||||
String _apiPath = "/api/";
|
||||
bool _isValid = false;
|
||||
@@ -78,8 +78,10 @@ class _ServerUrlSettingsPage extends State<ServerUrlSettingsPage>
|
||||
buildThemeModeIcon(context),
|
||||
];
|
||||
if (hasBaseUrl) actions.add(buildMoreVertSettingsButon(context));
|
||||
setCurrentTitle("${i18n.settings} - ${i18n.setServerUrl}",
|
||||
Theme.of(context).primaryColor.value);
|
||||
if (isTop(context)) {
|
||||
setCurrentTitle("${i18n.settings} - ${i18n.setServerUrl}",
|
||||
Theme.of(context).primaryColor.value);
|
||||
}
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text(i18n.setServerUrl),
|
||||
|
||||
@@ -231,7 +231,8 @@ class UserSettingsPage extends StatefulWidget {
|
||||
State<StatefulWidget> createState() => _UserSettingsPage();
|
||||
}
|
||||
|
||||
class _UserSettingsPage extends State<UserSettingsPage> with ThemeModeWidget {
|
||||
class _UserSettingsPage extends State<UserSettingsPage>
|
||||
with ThemeModeWidget, IsTopWidget2 {
|
||||
void _onStateChanged(dynamic _) {
|
||||
setState(() {});
|
||||
}
|
||||
@@ -310,8 +311,10 @@ class _UserSettingsPage extends State<UserSettingsPage> with ThemeModeWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final i18n = AppLocalizations.of(context)!;
|
||||
setCurrentTitle("${i18n.settings} - ${i18n.user}",
|
||||
Theme.of(context).primaryColor.value);
|
||||
if (isTop(context)) {
|
||||
setCurrentTitle("${i18n.settings} - ${i18n.user}",
|
||||
Theme.of(context).primaryColor.value);
|
||||
}
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
leading: IconButton(
|
||||
|
||||
Reference in New Issue
Block a user