From a2cf76cb88ba73d787874b07c4f6f9f9f9958120 Mon Sep 17 00:00:00 2001 From: Kima Date: Thu, 25 Jan 2024 21:14:05 +0100 Subject: [PATCH] fixed bell delay buttons and added option to new place --- .../lib/screens/settings/settings_helper.dart | 5 +- .../settings/submenu/general_screen.dart | 46 +++++++++++++++++-- 2 files changed, 44 insertions(+), 7 deletions(-) diff --git a/filcnaplo_mobile_ui/lib/screens/settings/settings_helper.dart b/filcnaplo_mobile_ui/lib/screens/settings/settings_helper.dart index 66f8726..e2b0e85 100755 --- a/filcnaplo_mobile_ui/lib/screens/settings/settings_helper.dart +++ b/filcnaplo_mobile_ui/lib/screens/settings/settings_helper.dart @@ -483,7 +483,8 @@ class _BellDelaySettingState extends State return Column( children: [ FilterBar( - scrollable: false, + scrollable: true, + tabAlignment: TabAlignment.center, items: [ Tab(text: SettingsLocalization("delay").i18n), Tab(text: SettingsLocalization("hurry").i18n), @@ -525,7 +526,7 @@ class _BellDelaySettingState extends State child: Column( children: [ MaterialActionButton( - backgroundColor: AppColors.of(context).filc, + backgroundColor: Theme.of(context).colorScheme.primary, child: Text(SettingsLocalization("sync").i18n), onPressed: () { final lessonProvider = diff --git a/filcnaplo_mobile_ui/lib/screens/settings/submenu/general_screen.dart b/filcnaplo_mobile_ui/lib/screens/settings/submenu/general_screen.dart index 4bbf8f4..944f17a 100644 --- a/filcnaplo_mobile_ui/lib/screens/settings/submenu/general_screen.dart +++ b/filcnaplo_mobile_ui/lib/screens/settings/submenu/general_screen.dart @@ -1,10 +1,12 @@ -// import 'package:filcnaplo/models/settings.dart'; +import 'package:filcnaplo/models/settings.dart'; import 'package:filcnaplo/theme/colors/colors.dart'; import 'package:filcnaplo_mobile_ui/common/panel/panel_button.dart'; +import 'package:filcnaplo_mobile_ui/common/splitted_panel/splitted_panel.dart'; +import 'package:filcnaplo_mobile_ui/screens/settings/settings_helper.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_feather_icons/flutter_feather_icons.dart'; -// import 'package:provider/provider.dart'; +import 'package:provider/provider.dart'; import 'submenu_screen.i18n.dart'; class MenuGeneralSettings extends StatelessWidget { @@ -38,12 +40,17 @@ class MenuGeneralSettings extends StatelessWidget { } } -class GeneralSettingsScreen extends StatelessWidget { +class GeneralSettingsScreen extends StatefulWidget { const GeneralSettingsScreen({super.key}); + @override + GeneralSettingsScreenState createState() => GeneralSettingsScreenState(); +} + +class GeneralSettingsScreenState extends State { @override Widget build(BuildContext context) { - // SettingsProvider settings = Provider.of(context); + SettingsProvider settingsProvider = Provider.of(context); return Scaffold( appBar: AppBar( @@ -59,7 +66,36 @@ class GeneralSettingsScreen extends StatelessWidget { padding: const EdgeInsets.symmetric(vertical: 16.0, horizontal: 24.0), child: Column( children: [ - + SplittedPanel( + padding: const EdgeInsets.only(top: 8.0), + cardPadding: const EdgeInsets.all(4.0), + isSeparated: true, + children: [ + PanelButton( + onPressed: () { + SettingsHelper.bellDelay(context); + setState(() {}); + }, + title: Text("bell_delay".i18n), + leading: Icon( + FeatherIcons.sun, + size: 22.0, + color: AppColors.of(context).text.withOpacity(0.95), + ), + trailingDivider: true, + trailing: Switch( + onChanged: (v) => + settingsProvider.update(bellDelayEnabled: v), + value: settingsProvider.bellDelayEnabled, + activeColor: Theme.of(context).colorScheme.secondary, + ), + borderRadius: const BorderRadius.vertical( + top: Radius.circular(12.0), + bottom: Radius.circular(12.0), + ), + ), + ], + ), ], ), ),