Skip to content

Commit

Permalink
better theme setting page
Browse files Browse the repository at this point in the history
  • Loading branch information
Predidit committed May 27, 2024
1 parent 85a3ae0 commit 2c3225e
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions lib/pages/settings/theme_settings_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import 'package:kazumi/pages/popular/popular_controller.dart';
import 'package:kazumi/bean/appbar/sys_app_bar.dart';
import 'package:kazumi/bean/settings/color_type.dart';
import 'package:kazumi/bean/settings/settings.dart';
import 'package:provider/provider.dart';
import 'package:kazumi/pages/menu/menu.dart';
import 'package:kazumi/utils/utils.dart';

class ThemeSettingsPage extends StatefulWidget {
Expand All @@ -30,6 +32,8 @@ class _ThemeSettingsPageState extends State<ThemeSettingsPage> {
@override
void initState() {
super.initState();
navigationBarState =
Provider.of<NavigationBarState>(context, listen: false);
defaultThemeMode =
setting.get(SettingBoxKey.themeMode, defaultValue: 'system');
defaultThemeColor =
Expand All @@ -38,7 +42,8 @@ class _ThemeSettingsPageState extends State<ThemeSettingsPage> {
}

void onBackPressed(BuildContext context) {
Modular.to.navigate('/tab/my/');
// Modular.to.navigate('/tab/my/');
navigationBarState.showNavigate();
}

void setTheme(Color? color) {
Expand Down Expand Up @@ -112,8 +117,11 @@ class _ThemeSettingsPageState extends State<ThemeSettingsPage> {
// The Flutter framework has been optimized to make rerunning build methods
// fast, so that you can just rebuild anything that needs updating rather
// than having to individually change instances of widgets.
WidgetsBinding.instance.addPostFrameCallback((_) {
navigationBarState.hideNavigate();
});
return PopScope(
canPop: false,
canPop: true,
onPopInvoked: (bool didPop) async {
onBackPressed(context);
},
Expand Down

0 comments on commit 2c3225e

Please sign in to comment.