diff --git a/lib/dialog.dart b/lib/dialog.dart index 4469f680..9aec3835 100644 --- a/lib/dialog.dart +++ b/lib/dialog.dart @@ -1,31 +1,6 @@ import "dart:ui"; import "package:flutter/material.dart"; -Future showCustomDialog(BuildContext context, Widget child) { - return showGeneralDialog( - context: context, - barrierLabel: MaterialLocalizations.of(context).modalBarrierDismissLabel, - barrierDismissible: true, - barrierColor: Colors.black.withOpacity(0.5), - transitionDuration: Duration.zero, - transitionBuilder: (_, anim, __, child) { - return FadeTransition( - opacity: anim, - child: child, - ); - }, - pageBuilder: (_, __, ___) { - return Container( - // width: MediaQuery.of(context).size.width - 10, - // height: MediaQuery.of(context).size.height - 80, - color: Colors.white, - margin: const EdgeInsets.symmetric(horizontal: 250, vertical: 0), - child: child, - ); - }, - ); -} - showAlert(BuildContext context, String title, String message) { showDialog( context: context, diff --git a/lib/state.dart b/lib/state.dart index 0a14d019..ab6fd2b8 100644 --- a/lib/state.dart +++ b/lib/state.dart @@ -12,6 +12,7 @@ import "package:only_bible_app/screens/chapter_view_screen.dart"; import 'package:only_bible_app/dialog.dart'; import "package:only_bible_app/models.dart"; import "package:only_bible_app/widgets/actions_sheet.dart"; +import "package:only_bible_app/widgets/scaffold_menu.dart"; import "package:only_bible_app/widgets/settings_sheet.dart"; import "package:provider/provider.dart"; import "package:shared_preferences/shared_preferences.dart"; @@ -133,14 +134,25 @@ class AppModel extends ChangeNotifier { } showSettings(BuildContext context) { - showModalBottomSheet( - context: context, - isDismissible: true, - enableDrag: true, - showDragHandle: true, - useSafeArea: true, - builder: (context) => const SettingsSheet(), - ); + // if (isWide(context)) { + // Navigator.of(context).push( + // createNoTransitionPageRoute( + // const ScaffoldMenu( + // backgroundColor: Color(0xFFF2F2F7), + // child: SettingsSheet(), + // ), + // ), + // ); + // } else { + showModalBottomSheet( + context: context, + isDismissible: true, + enableDrag: true, + showDragHandle: true, + useSafeArea: true, + builder: (context) => const SettingsSheet(), + ); + // } } showActions(BuildContext context) { diff --git a/lib/widgets/more_button.dart b/lib/widgets/more_button.dart deleted file mode 100644 index 1d5f5941..00000000 --- a/lib/widgets/more_button.dart +++ /dev/null @@ -1,41 +0,0 @@ -import "package:flutter/material.dart"; -import "package:only_bible_app/state.dart"; - -class MoreButton extends StatelessWidget { - const MoreButton({super.key}); - - @override - Widget build(BuildContext context) { - // showModalBottomSheet( - // context: context, - // enableDrag: false, - // shape: RoundedRectangleBorder( - // borderRadius: BorderRadius.vertical( - // top: Radius.circular(20), - // ), - // ), - // clipBehavior: Clip.antiAliasWithSaveLayer, - // builder: (context) => DraggableScrollableSheet( - // expand: false, - // initialChildSize: 0.9, - // minChildSize: 0.5, - // maxChildSize: 0.9, - // builder: (context, scrollController) { - // return SingleChildScrollView( - // child: new Container( - // color: Colors.white, - // child: buildTitleWidget(), - // ), - // ); - // }, - // ), - // isDismissible: false, - // isScrollControlled: true, - // ); - return IconButton( - padding: EdgeInsets.zero, - onPressed: () => AppModel.ofEvent(context).showSettings(context), - icon: const Icon(Icons.more_vert), - ); - } -} diff --git a/lib/widgets/scaffold_menu.dart b/lib/widgets/scaffold_menu.dart index fe0ddb1e..0d66c85a 100644 --- a/lib/widgets/scaffold_menu.dart +++ b/lib/widgets/scaffold_menu.dart @@ -3,8 +3,9 @@ import "package:only_bible_app/state.dart"; class ScaffoldMenu extends StatelessWidget { final Widget child; + final Color? backgroundColor; - const ScaffoldMenu({super.key, required this.child}); + const ScaffoldMenu({super.key, required this.child, this.backgroundColor}); @override Widget build(BuildContext context) { @@ -15,7 +16,7 @@ class ScaffoldMenu extends StatelessWidget { color: Colors.black.withOpacity(0.7), margin: EdgeInsets.only(left: isWide(context) ? 250 : 0), child: Container( - color: Theme.of(context).colorScheme.background, + color: backgroundColor ?? Theme.of(context).colorScheme.background, margin: EdgeInsets.only(right: isWide(context) ? 650 : 0), child: child, ), diff --git a/lib/widgets/settings_sheet.dart b/lib/widgets/settings_sheet.dart index 6fa15f95..6a323700 100644 --- a/lib/widgets/settings_sheet.dart +++ b/lib/widgets/settings_sheet.dart @@ -15,14 +15,11 @@ class SettingsSheet extends StatelessWidget { final iconColor = Theme.of(context).textTheme.bodyMedium!.color; return Column( children: [ - const Padding( - padding: EdgeInsets.only(bottom: 15), + Padding( + padding: const EdgeInsets.only(bottom: 20), child: Text( "Settings", - style: TextStyle( - fontSize: 18, - fontWeight: FontWeight.w500, - ), + style: Theme.of(context).textTheme.headlineMedium, ), ), Expanded( diff --git a/lib/widgets/sliver_tile_grid.dart b/lib/widgets/sliver_tile_grid.dart index 412e683e..be5b3f3d 100644 --- a/lib/widgets/sliver_tile_grid.dart +++ b/lib/widgets/sliver_tile_grid.dart @@ -1,7 +1,28 @@ import "package:flutter/material.dart"; import "package:only_bible_app/state.dart"; -enum ListType { small, large } +enum ListType { + small, + large; + + int crossAxisCount() { + switch (this) { + case ListType.small: + return 5; + case ListType.large: + return 2; + } + } + + double childAspectRatio(bool isDesktop) { + switch (this) { + case ListType.small: + return isDesktop ? 2.33 : 1.4; + case ListType.large: + return isDesktop ? 5 : 4; + } + } +} class SliverTileGrid extends StatelessWidget { final ListType listType; @@ -16,18 +37,10 @@ class SliverTileGrid extends StatelessWidget { return SliverPadding( padding: const EdgeInsets.symmetric(horizontal: 20), sliver: SliverGrid.count( - crossAxisCount: listType == ListType.large - ? 2 - : isDesktop - ? 6 - : 5, + crossAxisCount: listType.crossAxisCount(), crossAxisSpacing: spacing, mainAxisSpacing: spacing, - childAspectRatio: listType == ListType.large - ? 4 - : isDesktop - ? 1.6 - : 1.5, + childAspectRatio: listType.childAspectRatio(isDesktop), children: children, ), );