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/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<RequestResponsePage>
),
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);
}
},
),
],
),
),
);
}

View File

@ -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,
),
);
}