fix: bottom appbar inset padding

This commit is contained in:
DenserMeerkat
2024-06-19 12:49:30 +05:30
parent afd9c1c38a
commit 6db2968557
2 changed files with 101 additions and 90 deletions

View File

@ -8,6 +8,7 @@ import 'package:hooks_riverpod/hooks_riverpod.dart';
import '../../home_page/collection_pane.dart'; import '../../home_page/collection_pane.dart';
import '../../home_page/editor_pane/url_card.dart'; import '../../home_page/editor_pane/url_card.dart';
import '../../home_page/editor_pane/details_card/code_pane.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 '../../common/main_editor_widgets.dart';
import '../widgets/page_base.dart'; import '../widgets/page_base.dart';
import 'request_response_tabs.dart'; import 'request_response_tabs.dart';
@ -56,9 +57,11 @@ class _RequestResponsePageState extends ConsumerState<RequestResponsePage>
), ),
leftDrawerContent: const CollectionPane(), leftDrawerContent: const CollectionPane(),
actions: const [Padding(padding: kPh8, child: EnvironmentDropdown())], actions: const [Padding(padding: kPh8, child: EnvironmentDropdown())],
mainContent: RequestResponseTabs( mainContent: id == null
controller: requestResponseTabController, ? const RequestEditorDefault()
), : RequestResponseTabs(
controller: requestResponseTabController,
),
bottomNavigationBar: RequestResponsePageBottombar( bottomNavigationBar: RequestResponsePageBottombar(
requestResponseTabController: requestResponseTabController, requestResponseTabController: requestResponseTabController,
), ),
@ -77,54 +80,60 @@ class RequestResponsePageBottombar extends ConsumerWidget {
@override @override
Widget build(BuildContext context, WidgetRef ref) { Widget build(BuildContext context, WidgetRef ref) {
return Container( final selecetdId = ref.watch(selectedIdStateProvider);
height: 60 + MediaQuery.paddingOf(context).bottom, return Padding(
width: MediaQuery.sizeOf(context).width, padding: MediaQuery.of(context).viewInsets,
padding: EdgeInsets.only( child: Container(
bottom: MediaQuery.paddingOf(context).bottom, height: 60 + MediaQuery.paddingOf(context).bottom,
left: 16, width: MediaQuery.sizeOf(context).width,
right: 16, padding: EdgeInsets.only(
), bottom: MediaQuery.paddingOf(context).bottom,
decoration: BoxDecoration( left: 16,
color: Theme.of(context).colorScheme.surface, right: 16,
border: Border( ),
top: BorderSide( decoration: BoxDecoration(
color: Theme.of(context).colorScheme.onInverseSurface, color: Theme.of(context).colorScheme.surface,
width: 1, border: Border(
top: BorderSide(
color: Theme.of(context).colorScheme.onInverseSurface,
width: 1,
),
), ),
), ),
), child: Row(
child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween,
mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [
children: [ IconButton.filledTonal(
IconButton.filledTonal( style: IconButton.styleFrom(
style: IconButton.styleFrom( shape: const RoundedRectangleBorder(
shape: const RoundedRectangleBorder( borderRadius: BorderRadius.all(Radius.circular(12)),
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,
), ),
); ),
}, onPressed: selecetdId == null
icon: const Icon(Icons.code_rounded), ? null
), : () {
SendButton( Navigator.of(context).push(
onTap: () { MaterialPageRoute(
if (requestResponseTabController.index != 1) { builder: (context) => const PageBase(
requestResponseTabController.animateTo(1); title: 'View Code',
} scaffoldBody: CodePane(),
}, addBottomPadding: false,
), ),
], fullscreenDialog: true,
),
);
},
icon: const Icon(Icons.code_rounded),
),
SendButton(
onTap: () {
if (requestResponseTabController.index != 1) {
requestResponseTabController.animateTo(1);
}
},
),
],
),
), ),
); );
} }

View File

@ -143,51 +143,53 @@ class TwoDrawerScaffold extends StatelessWidget {
return Container( return Container(
padding: (kIsWindows || kIsMacOS) ? kPt28 : EdgeInsets.zero, padding: (kIsWindows || kIsMacOS) ? kPt28 : EdgeInsets.zero,
color: Theme.of(context).colorScheme.surface, color: Theme.of(context).colorScheme.surface,
child: Scaffold( child: SafeArea(
key: scaffoldKey, child: Scaffold(
backgroundColor: Theme.of(context).colorScheme.surface, key: scaffoldKey,
onDrawerChanged: onDrawerChanged,
onEndDrawerChanged: onEndDrawerChanged,
drawerEdgeDragWidth: context.width,
appBar: AppBar(
backgroundColor: Theme.of(context).colorScheme.surface, backgroundColor: Theme.of(context).colorScheme.surface,
scrolledUnderElevation: 0, onDrawerChanged: onDrawerChanged,
shape: const ContinuousRectangleBorder(), onEndDrawerChanged: onEndDrawerChanged,
leading: IconButton( drawerEdgeDragWidth: context.width,
icon: const Icon(Icons.format_list_bulleted_rounded), appBar: AppBar(
onPressed: () { backgroundColor: Theme.of(context).colorScheme.surface,
scaffoldKey.currentState!.openDrawer(); scrolledUnderElevation: 0,
}, shape: const ContinuousRectangleBorder(),
), leading: IconButton(
title: title, icon: const Icon(Icons.format_list_bulleted_rounded),
titleSpacing: 0, onPressed: () {
actions: [ scaffoldKey.currentState!.openDrawer();
...actions ?? [], },
(rightDrawerContent != null ),
? Padding( title: title,
padding: const EdgeInsets.all(8.0), titleSpacing: 0,
child: IconButton( actions: [
icon: Icon( ...actions ?? [],
rightDrawerIcon ?? Icons.arrow_forward, (rightDrawerContent != null
color: Theme.of(context).colorScheme.onBackground, ? 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()),
}, ],
), ),
) drawer: Drawer(
: const SizedBox.shrink()), 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,
), ),
); );
} }