From 6db2968557be9c5fde8137e16f5a716d49ea49ab Mon Sep 17 00:00:00 2001 From: DenserMeerkat Date: Wed, 19 Jun 2024 12:49:30 +0530 Subject: [PATCH] fix: bottom appbar inset padding --- .../mobile/requests_page/requests_page.dart | 105 ++++++++++-------- lib/widgets/splitviews.dart | 86 +++++++------- 2 files changed, 101 insertions(+), 90 deletions(-) diff --git a/lib/screens/mobile/requests_page/requests_page.dart b/lib/screens/mobile/requests_page/requests_page.dart index 3cde85cf..d506b6d4 100644 --- a/lib/screens/mobile/requests_page/requests_page.dart +++ b/lib/screens/mobile/requests_page/requests_page.dart @@ -8,6 +8,7 @@ import 'package:hooks_riverpod/hooks_riverpod.dart'; import '../../home_page/collection_pane.dart'; import '../../home_page/editor_pane/url_card.dart'; import '../../home_page/editor_pane/details_card/code_pane.dart'; +import '../../home_page/editor_pane/editor_default.dart'; import '../../common/main_editor_widgets.dart'; import '../widgets/page_base.dart'; import 'request_response_tabs.dart'; @@ -56,9 +57,11 @@ class _RequestResponsePageState extends ConsumerState ), leftDrawerContent: const CollectionPane(), actions: const [Padding(padding: kPh8, child: EnvironmentDropdown())], - mainContent: RequestResponseTabs( - controller: requestResponseTabController, - ), + mainContent: id == null + ? const RequestEditorDefault() + : RequestResponseTabs( + controller: requestResponseTabController, + ), bottomNavigationBar: RequestResponsePageBottombar( requestResponseTabController: requestResponseTabController, ), @@ -77,54 +80,60 @@ class RequestResponsePageBottombar extends ConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { - return Container( - height: 60 + MediaQuery.paddingOf(context).bottom, - width: MediaQuery.sizeOf(context).width, - padding: EdgeInsets.only( - bottom: MediaQuery.paddingOf(context).bottom, - left: 16, - right: 16, - ), - decoration: BoxDecoration( - color: Theme.of(context).colorScheme.surface, - border: Border( - top: BorderSide( - color: Theme.of(context).colorScheme.onInverseSurface, - width: 1, + final selecetdId = ref.watch(selectedIdStateProvider); + return Padding( + padding: MediaQuery.of(context).viewInsets, + child: Container( + height: 60 + MediaQuery.paddingOf(context).bottom, + width: MediaQuery.sizeOf(context).width, + padding: EdgeInsets.only( + bottom: MediaQuery.paddingOf(context).bottom, + left: 16, + right: 16, + ), + decoration: BoxDecoration( + color: Theme.of(context).colorScheme.surface, + border: Border( + top: BorderSide( + color: Theme.of(context).colorScheme.onInverseSurface, + width: 1, + ), ), ), - ), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - IconButton.filledTonal( - style: IconButton.styleFrom( - shape: const RoundedRectangleBorder( - borderRadius: BorderRadius.all(Radius.circular(12)), - ), - ), - onPressed: () { - Navigator.of(context).push( - MaterialPageRoute( - builder: (context) => const PageBase( - title: 'View Code', - scaffoldBody: CodePane(), - addBottomPadding: false, - ), - fullscreenDialog: true, + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + IconButton.filledTonal( + style: IconButton.styleFrom( + shape: const RoundedRectangleBorder( + borderRadius: BorderRadius.all(Radius.circular(12)), ), - ); - }, - icon: const Icon(Icons.code_rounded), - ), - SendButton( - onTap: () { - if (requestResponseTabController.index != 1) { - requestResponseTabController.animateTo(1); - } - }, - ), - ], + ), + onPressed: selecetdId == null + ? null + : () { + Navigator.of(context).push( + MaterialPageRoute( + builder: (context) => const PageBase( + title: 'View Code', + scaffoldBody: CodePane(), + addBottomPadding: false, + ), + fullscreenDialog: true, + ), + ); + }, + icon: const Icon(Icons.code_rounded), + ), + SendButton( + onTap: () { + if (requestResponseTabController.index != 1) { + requestResponseTabController.animateTo(1); + } + }, + ), + ], + ), ), ); } diff --git a/lib/widgets/splitviews.dart b/lib/widgets/splitviews.dart index 06d4a9bd..52f2aae7 100644 --- a/lib/widgets/splitviews.dart +++ b/lib/widgets/splitviews.dart @@ -143,51 +143,53 @@ class TwoDrawerScaffold extends StatelessWidget { return Container( padding: (kIsWindows || kIsMacOS) ? kPt28 : EdgeInsets.zero, color: Theme.of(context).colorScheme.surface, - child: Scaffold( - key: scaffoldKey, - backgroundColor: Theme.of(context).colorScheme.surface, - onDrawerChanged: onDrawerChanged, - onEndDrawerChanged: onEndDrawerChanged, - drawerEdgeDragWidth: context.width, - appBar: AppBar( + child: SafeArea( + child: Scaffold( + key: scaffoldKey, backgroundColor: Theme.of(context).colorScheme.surface, - scrolledUnderElevation: 0, - shape: const ContinuousRectangleBorder(), - leading: IconButton( - icon: const Icon(Icons.format_list_bulleted_rounded), - onPressed: () { - scaffoldKey.currentState!.openDrawer(); - }, - ), - title: title, - titleSpacing: 0, - actions: [ - ...actions ?? [], - (rightDrawerContent != null - ? Padding( - padding: const EdgeInsets.all(8.0), - child: IconButton( - icon: Icon( - rightDrawerIcon ?? Icons.arrow_forward, - color: Theme.of(context).colorScheme.onBackground, + onDrawerChanged: onDrawerChanged, + onEndDrawerChanged: onEndDrawerChanged, + drawerEdgeDragWidth: context.width, + appBar: AppBar( + backgroundColor: Theme.of(context).colorScheme.surface, + scrolledUnderElevation: 0, + shape: const ContinuousRectangleBorder(), + leading: IconButton( + icon: const Icon(Icons.format_list_bulleted_rounded), + onPressed: () { + scaffoldKey.currentState!.openDrawer(); + }, + ), + title: title, + titleSpacing: 0, + actions: [ + ...actions ?? [], + (rightDrawerContent != null + ? Padding( + padding: const EdgeInsets.all(8.0), + child: IconButton( + icon: Icon( + rightDrawerIcon ?? Icons.arrow_forward, + color: Theme.of(context).colorScheme.onBackground, + ), + onPressed: () { + scaffoldKey.currentState!.openEndDrawer(); + }, ), - onPressed: () { - scaffoldKey.currentState!.openEndDrawer(); - }, - ), - ) - : const SizedBox.shrink()), - ], + ) + : const SizedBox.shrink()), + ], + ), + drawer: Drawer( + shape: const ContinuousRectangleBorder(), + backgroundColor: Theme.of(context).colorScheme.surface, + surfaceTintColor: kColorTransparent, + child: leftDrawerContent, + ), + endDrawer: rightDrawerContent, + body: mainContent, + bottomNavigationBar: bottomNavigationBar, ), - drawer: Drawer( - shape: const ContinuousRectangleBorder(), - backgroundColor: Theme.of(context).colorScheme.surface, - surfaceTintColor: kColorTransparent, - child: leftDrawerContent, - ), - endDrawer: rightDrawerContent, - body: mainContent, - bottomNavigationBar: bottomNavigationBar, ), ); }