diff --git a/lib/routes/route_generator.dart b/lib/routes/route_generator.dart index 95aa9f4..159702f 100644 --- a/lib/routes/route_generator.dart +++ b/lib/routes/route_generator.dart @@ -195,7 +195,7 @@ class RouteGenerator { data: MediaQuery.of(context).copyWith( textScaleFactor: 1.0, size: Size( - deviceSize.width / 16 * 9, + deviceSize.height * 9 / 16, deviceSize.height, ), ), diff --git a/lib/utils/action_sheet.dart b/lib/utils/action_sheet.dart index bbb3c2c..b23009a 100644 --- a/lib/utils/action_sheet.dart +++ b/lib/utils/action_sheet.dart @@ -9,21 +9,33 @@ import 'package:didvan/models/view/action_sheet_data.dart'; import 'package:didvan/models/view/alert_data.dart'; import 'package:didvan/views/widgets/didvan/button.dart'; import 'package:didvan/views/widgets/didvan/text.dart'; +import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:rive/rive.dart'; class ActionSheetUtils { static late BuildContext context; + static MediaQueryData get mediaQueryData { + final ds = MediaQuery.of(context).size; + double width = ds.width; + final shortestSide = ds.shortestSide; + final bool useMobileLayout = shortestSide < 600; + if (kIsWeb && !useMobileLayout) { + width = ds.height * 9 / 16; + } + return MediaQuery.of(context).copyWith(size: Size(width, ds.height)); + } + static Future showLogoLoadingIndicator() async { await showDialog( barrierDismissible: false, context: context, - builder: (context) => Padding( - padding: EdgeInsets.symmetric( - horizontal: MediaQuery.of(context).size.width / 3, + builder: (context) => Center( + child: SizedBox( + width: mediaQueryData.size.width * 0.4, + child: RiveAnimation.asset(Assets.logoLoadingAnimation), ), - child: RiveAnimation.asset(Assets.logoLoadingAnimation), ), ); } @@ -76,6 +88,9 @@ class ActionSheetUtils { static Future showBottomSheet({required ActionSheetData data}) async { await showModalBottomSheet( + constraints: BoxConstraints( + maxWidth: mediaQueryData.size.width, + ), backgroundColor: Colors.transparent, isScrollControlled: true, context: context, @@ -168,7 +183,8 @@ class ActionSheetUtils { shape: const RoundedRectangleBorder( borderRadius: DesignConfig.mediumBorderRadius, ), - child: Padding( + child: Container( + width: mediaQueryData.size.width * 0.8, padding: const EdgeInsets.all(24.0), child: Column( mainAxisSize: MainAxisSize.min, diff --git a/lib/views/home/widgets/category_item.dart b/lib/views/home/widgets/category_item.dart index eaf6cf6..a0c1311 100644 --- a/lib/views/home/widgets/category_item.dart +++ b/lib/views/home/widgets/category_item.dart @@ -60,10 +60,10 @@ class CategoryItem extends StatelessWidget { child: Container( width: !_useWebMobileLayout(context) ? _width(context) / 2 - : ds.width / 5, + : ds.width / 7, height: !_useWebMobileLayout(context) ? _width(context) / 2 - : ds.width / 5, + : ds.width / 7, decoration: BoxDecoration( color: Theme.of(context).colorScheme.surface, boxShadow: DesignConfig.defaultShadow, diff --git a/lib/views/widgets/didvan/bnb.dart b/lib/views/widgets/didvan/bnb.dart index a89de8f..b142dd9 100644 --- a/lib/views/widgets/didvan/bnb.dart +++ b/lib/views/widgets/didvan/bnb.dart @@ -3,7 +3,9 @@ import 'package:didvan/config/design_config.dart'; import 'package:didvan/config/theme_data.dart'; import 'package:didvan/constants/app_icons.dart'; import 'package:didvan/models/enums.dart'; +import 'package:didvan/models/view/action_sheet_data.dart'; import 'package:didvan/services/media/media.dart'; +import 'package:didvan/utils/action_sheet.dart'; import 'package:didvan/views/home/studio/studio_details/studio_details_state.dart'; import 'package:didvan/views/home/studio/studio_details/widgets/studio_details_widget.dart'; import 'package:didvan/views/home/studio/studio_state.dart'; @@ -275,70 +277,77 @@ class _PlayerNavBar extends StatelessWidget { } final state = context.read(); showModalBottomSheet( + constraints: BoxConstraints( + maxWidth: ActionSheetUtils.mediaQueryData.size.width, + ), backgroundColor: Colors.transparent, context: context, isScrollControlled: true, builder: (context) => ChangeNotifierProvider.value( value: state, child: Consumer( - builder: (context, state, child) => ExpandableBottomSheet( - key: sheetKey, - background: Align( - alignment: Alignment.bottomCenter, - child: Container( - height: MediaQuery.of(context).size.height * 0.7, - color: Theme.of(context).colorScheme.surface, + builder: (context, state, child) => MediaQuery( + data: ActionSheetUtils.mediaQueryData, + child: ExpandableBottomSheet( + key: sheetKey, + background: Align( + alignment: Alignment.bottomCenter, + child: Container( + height: MediaQuery.of(context).size.height * 0.7, + color: Theme.of(context).colorScheme.surface, + ), ), - ), - persistentHeader: GestureDetector( - onVerticalDragUpdate: (details) { - if (details.delta.dy > 10) { - Navigator.of(context).pop(); - } - }, - child: Column( - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - AudioPlayerWidget( - podcast: MediaService.currentPodcast!, - ), - Container( - width: MediaQuery.of(context).size.width, - color: Theme.of(context).colorScheme.surface, - child: Column( - children: [ - DidvanIconButton( - size: 32, - icon: DidvanIcons.angle_up_regular, - onPressed: () { - if (!isExpanded) { - sheetKey.currentState?.expand(); - isExpanded = true; - } else { - isExpanded = false; - sheetKey.currentState?.contract(); - } - }, - ), - const SizedBox(height: 16), - ], + persistentHeader: GestureDetector( + onVerticalDragUpdate: (details) { + if (details.delta.dy > 10) { + Navigator.of(context).pop(); + } + }, + child: Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + AudioPlayerWidget( + podcast: MediaService.currentPodcast!, ), - ), - ], + Container( + width: MediaQuery.of(context).size.width, + color: Theme.of(context).colorScheme.surface, + child: Column( + children: [ + DidvanIconButton( + size: 32, + icon: DidvanIcons.angle_up_regular, + onPressed: () { + if (!isExpanded) { + sheetKey.currentState?.expand(); + isExpanded = true; + } else { + isExpanded = false; + sheetKey.currentState?.contract(); + } + }, + ), + const SizedBox(height: 16), + ], + ), + ), + ], + ), ), - ), - expandableContent: state.appState == AppState.busy - ? Container( - height: MediaQuery.of(context).size.height / 2, - alignment: Alignment.center, - child: SpinKitSpinningLines( - color: Theme.of(context).colorScheme.primary, + expandableContent: state.appState == AppState.busy + ? Container( + height: MediaQuery.of(context).size.height / 2, + alignment: Alignment.center, + child: SpinKitSpinningLines( + color: Theme.of(context).colorScheme.primary, + ), + ) + : StudioDetailsWidget( + onMarkChanged: (id, value) => context + .read() + .changeMark(id, value, true), ), - ) - : StudioDetailsWidget( - onMarkChanged: (id, value) => - context.read().changeMark(id, value, true), - ), + ), ), ), ), diff --git a/lib/views/widgets/didvan/page_view.dart b/lib/views/widgets/didvan/page_view.dart index 881db84..d256d10 100644 --- a/lib/views/widgets/didvan/page_view.dart +++ b/lib/views/widgets/didvan/page_view.dart @@ -235,31 +235,34 @@ class _DidvanPageViewState extends State { borderRadius: DesignConfig.lowBorderRadius, ), alignment: Alignment.center, - child: DidvanCard( - child: Column( - mainAxisSize: MainAxisSize.min, - children: [ - Row( - children: [ - Icon( - DidvanIcons.info_circle_solid, - color: Theme.of(context).colorScheme.primary, - ), - const SizedBox(width: 8), - DidvanText( - element!.text, - style: Theme.of(context).textTheme.subtitle2, - ), - ], - ), - const SizedBox(height: 8), - DidvanText(href.split('-').last), - const SizedBox(height: 16), - const DidvanButton( - title: 'بستن', - onPressed: ActionSheetUtils.pop, - ), - ], + child: SizedBox( + width: ActionSheetUtils.mediaQueryData.size.width, + child: DidvanCard( + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + Row( + children: [ + Icon( + DidvanIcons.info_circle_solid, + color: Theme.of(context).colorScheme.primary, + ), + const SizedBox(width: 8), + DidvanText( + element!.text, + style: Theme.of(context).textTheme.subtitle2, + ), + ], + ), + const SizedBox(height: 8), + DidvanText(href.split('-').last), + const SizedBox(height: 16), + const DidvanButton( + title: 'بستن', + onPressed: ActionSheetUtils.pop, + ), + ], + ), ), ), ), diff --git a/web/index.html b/web/index.html index b00093f..2ffa504 100644 --- a/web/index.html +++ b/web/index.html @@ -1,7 +1,7 @@ - - - + - - - + + + - - - - - + + + + + - - + + - Didvan - - - - -
- -
- - - + }; + +