diff --git a/lib/presentation/calendar/screens/calendar_screen.dart b/lib/presentation/calendar/screens/calendar_screen.dart index c8cfde33..3417c1ee 100644 --- a/lib/presentation/calendar/screens/calendar_screen.dart +++ b/lib/presentation/calendar/screens/calendar_screen.dart @@ -124,6 +124,7 @@ class _CalendarScreenState extends State { Future _openCreateScheduleSheet(BuildContext context) async { final saved = await showModalBottomSheet( context: context, + isDismissible: false, isScrollControlled: true, backgroundColor: Colors.transparent, builder: (context) => diff --git a/lib/presentation/shared/components/bottom_nav_bar_scaffold.dart b/lib/presentation/shared/components/bottom_nav_bar_scaffold.dart index 2f0f00f1..28b0a4de 100644 --- a/lib/presentation/shared/components/bottom_nav_bar_scaffold.dart +++ b/lib/presentation/shared/components/bottom_nav_bar_scaffold.dart @@ -101,6 +101,7 @@ class _BottomNavigationBarScaffoldState extends State { onPressed: () { showModalBottomSheet( context: context, + isDismissible: false, isScrollControlled: true, backgroundColor: Colors.transparent, builder: (context) => const ScheduleCreateScreen(), @@ -174,10 +175,7 @@ class _HomeIcon extends StatelessWidget { semanticsLabel: AppLocalizations.of(context)!.home, height: iconTheme.size, fit: BoxFit.contain, - colorFilter: ColorFilter.mode( - iconTheme.color!, - BlendMode.srcIn, - ), + colorFilter: ColorFilter.mode(iconTheme.color!, BlendMode.srcIn), ); } } @@ -194,10 +192,7 @@ class _MyIcon extends StatelessWidget { semanticsLabel: AppLocalizations.of(context)!.myPage, height: iconTheme.size, fit: BoxFit.contain, - colorFilter: ColorFilter.mode( - iconTheme.color!, - BlendMode.srcIn, - ), + colorFilter: ColorFilter.mode(iconTheme.color!, BlendMode.srcIn), ); } } diff --git a/lib/presentation/shared/components/cupertino_picker_modal.dart b/lib/presentation/shared/components/cupertino_picker_modal.dart index 267c66d8..bbaa330a 100644 --- a/lib/presentation/shared/components/cupertino_picker_modal.dart +++ b/lib/presentation/shared/components/cupertino_picker_modal.dart @@ -8,10 +8,10 @@ extension ModalBottomSheetExtension on BuildContext { required Duration initialValue, required CupertinoTimerPickerMode mode, required Function(Duration value) onSaved, - Function? onDisposed, + VoidCallback? onDisposed, }) { showModalBottomSheet( - isDismissible: false, + isDismissible: true, context: this, builder: (BuildContext context) { final textTheme = Theme.of(context).textTheme; @@ -41,18 +41,20 @@ extension ModalBottomSheetExtension on BuildContext { Expanded( flex: 1, child: ElevatedButton( - onPressed: () { - //calling order matters - Navigator.pop(context); - onDisposed?.call(); - }, - style: ButtonStyle( - backgroundColor: WidgetStatePropertyAll( - Color.fromARGB(255, 220, 227, 255)), - foregroundColor: WidgetStatePropertyAll( - Color.fromARGB(255, 92, 121, 251)), + onPressed: () { + //calling order matters + Navigator.pop(context); + }, + style: ButtonStyle( + backgroundColor: WidgetStatePropertyAll( + Color.fromARGB(255, 220, 227, 255), ), - child: Text(AppLocalizations.of(this)!.cancel)), + foregroundColor: WidgetStatePropertyAll( + Color.fromARGB(255, 92, 121, 251), + ), + ), + child: Text(AppLocalizations.of(this)!.cancel), + ), ), SizedBox(width: 20.0), Expanded( @@ -61,7 +63,6 @@ extension ModalBottomSheetExtension on BuildContext { onPressed: () { Navigator.pop(context); onSaved(duration); - onDisposed?.call(); }, child: Text(AppLocalizations.of(this)!.ok), ), @@ -73,17 +74,19 @@ extension ModalBottomSheetExtension on BuildContext { ), ); }, - ); + ).whenComplete(() { + onDisposed?.call(); + }); } void showCupertinoMinutePickerModal({ required String title, required Duration initialValue, required Function(Duration value) onSaved, - Function? onDisposed, + VoidCallback? onDisposed, }) { showModalBottomSheet( - isDismissible: false, + isDismissible: true, context: this, builder: (BuildContext context) { final textTheme = Theme.of(context).textTheme; @@ -92,8 +95,10 @@ extension ModalBottomSheetExtension on BuildContext { borderRadius: BorderRadius.vertical(top: Radius.circular(20.0)), child: Container( color: Theme.of(context).colorScheme.surface, - padding: - const EdgeInsets.symmetric(horizontal: 29.0, vertical: 28.0), + padding: const EdgeInsets.symmetric( + horizontal: 29.0, + vertical: 28.0, + ), child: SizedBox( height: 334, child: Column( @@ -106,16 +111,19 @@ extension ModalBottomSheetExtension on BuildContext { width: 69.0, child: CupertinoPicker( scrollController: FixedExtentScrollController( - initialItem: initialValue.inMinutes), + initialItem: initialValue.inMinutes, + ), looping: true, itemExtent: 32, onSelectedItemChanged: (int value) { minutes = value; }, children: List.generate( - 60, - (index) => Text( - (index < 10 ? '0' : '') + index.toString())), + 60, + (index) => Text( + (index < 10 ? '0' : '') + index.toString(), + ), + ), ), ), ), @@ -127,18 +135,20 @@ extension ModalBottomSheetExtension on BuildContext { Expanded( flex: 1, child: ElevatedButton( - onPressed: () { - //calling order matters - Navigator.pop(context); - onDisposed?.call(); - }, - style: ButtonStyle( - backgroundColor: WidgetStatePropertyAll( - Color.fromARGB(255, 220, 227, 255)), - foregroundColor: WidgetStatePropertyAll( - Color.fromARGB(255, 92, 121, 251)), + onPressed: () { + //calling order matters + Navigator.pop(context); + }, + style: ButtonStyle( + backgroundColor: WidgetStatePropertyAll( + Color.fromARGB(255, 220, 227, 255), + ), + foregroundColor: WidgetStatePropertyAll( + Color.fromARGB(255, 92, 121, 251), ), - child: Text(AppLocalizations.of(this)!.cancel)), + ), + child: Text(AppLocalizations.of(this)!.cancel), + ), ), SizedBox(width: 20.0), Expanded( @@ -147,7 +157,6 @@ extension ModalBottomSheetExtension on BuildContext { onPressed: () { Navigator.pop(context); onSaved(Duration(minutes: minutes)); - onDisposed?.call(); }, child: Text(AppLocalizations.of(this)!.ok), ), @@ -160,7 +169,9 @@ extension ModalBottomSheetExtension on BuildContext { ), ); }, - ); + ).whenComplete(() { + onDisposed?.call(); + }); } void showCupertinoDatePickerModal({ @@ -168,10 +179,10 @@ extension ModalBottomSheetExtension on BuildContext { required DateTime initialValue, required Function(DateTime value) onSaved, required CupertinoDatePickerMode mode, - Function? onDisposed, + VoidCallback? onDisposed, }) { showModalBottomSheet( - isDismissible: false, + isDismissible: true, context: this, builder: (BuildContext context) { final textTheme = Theme.of(context).textTheme; @@ -203,18 +214,20 @@ extension ModalBottomSheetExtension on BuildContext { Expanded( flex: 1, child: ElevatedButton( - onPressed: () { - //calling order matters - Navigator.pop(context); - onDisposed?.call(); - }, - style: ButtonStyle( - backgroundColor: WidgetStatePropertyAll( - Color.fromARGB(255, 220, 227, 255)), - foregroundColor: WidgetStatePropertyAll( - Color.fromARGB(255, 92, 121, 251)), + onPressed: () { + //calling order matters + Navigator.pop(context); + }, + style: ButtonStyle( + backgroundColor: WidgetStatePropertyAll( + Color.fromARGB(255, 220, 227, 255), + ), + foregroundColor: WidgetStatePropertyAll( + Color.fromARGB(255, 92, 121, 251), ), - child: Text(AppLocalizations.of(this)!.cancel)), + ), + child: Text(AppLocalizations.of(this)!.cancel), + ), ), SizedBox(width: 20.0), Expanded( @@ -223,7 +236,6 @@ extension ModalBottomSheetExtension on BuildContext { onPressed: () { Navigator.pop(context); onSaved(dateTime); - onDisposed?.call(); }, child: Text(AppLocalizations.of(this)!.ok), ), @@ -235,6 +247,8 @@ extension ModalBottomSheetExtension on BuildContext { ), ); }, - ); + ).whenComplete(() { + onDisposed?.call(); + }); } }