From b0c4f7145b6c494022c7122fce85ada603e1b332 Mon Sep 17 00:00:00 2001 From: DenserMeerkat Date: Sun, 9 Jun 2024 18:51:13 +0530 Subject: [PATCH 01/12] wip: desktop responsiveness --- lib/app.dart | 34 ++- lib/consts.dart | 9 +- lib/extensions/context_extensions.dart | 16 +- lib/screens/home_page/collection_pane.dart | 4 +- .../home_page/editor_pane/editor_request.dart | 2 +- .../home_page/editor_pane/url_card.dart | 4 +- lib/screens/mobile/dashboard.dart | 13 +- lib/screens/mobile/navbar.dart | 130 +++++----- lib/screens/mobile/response_drawer.dart | 43 ++-- lib/screens/mobile/widgets/left_drawer.dart | 9 +- lib/screens/mobile/widgets/page_base.dart | 52 ++-- lib/screens/settings_page.dart | 2 +- lib/widgets/dropdowns.dart | 2 +- lib/widgets/intro_message.dart | 2 +- lib/widgets/request_widgets.dart | 2 +- lib/widgets/tabs.dart | 2 +- pubspec.lock | 230 +++++++++--------- 17 files changed, 299 insertions(+), 257 deletions(-) diff --git a/lib/app.dart b/lib/app.dart index 7a4116683..ec9af5302 100644 --- a/lib/app.dart +++ b/lib/app.dart @@ -6,7 +6,6 @@ import 'package:window_manager/window_manager.dart' hide WindowCaption; import 'widgets/widgets.dart' show WindowCaption; import 'providers/providers.dart'; import 'screens/screens.dart'; -import 'extensions/extensions.dart'; import 'consts.dart'; class App extends ConsumerStatefulWidget { @@ -125,24 +124,23 @@ class DashApp extends ConsumerWidget { visualDensity: VisualDensity.adaptivePlatformDensity, ), themeMode: isDarkMode ? ThemeMode.dark : ThemeMode.light, - home: kIsMobile - ? context.isLargeWidth - ? const Dashboard() - : const MobileDashboard() - : Stack( - children: [ - kIsLinux ? const Dashboard() : const App(), - if (kIsWindows) - SizedBox( - height: 29, - child: WindowCaption( - backgroundColor: Colors.transparent, - brightness: - isDarkMode ? Brightness.dark : Brightness.light, - ), - ), - ], + home: Stack( + children: [ + context.isMediumWindow + ? const MobileDashboard() + : !kIsLinux && !kIsMobile + ? const App() + : const Dashboard(), + if (kIsWindows) + SizedBox( + height: 29, + child: WindowCaption( + backgroundColor: Colors.transparent, + brightness: isDarkMode ? Brightness.dark : Brightness.light, + ), ), + ], + ), ); } } diff --git a/lib/consts.dart b/lib/consts.dart index 3b2f55294..063dbe284 100644 --- a/lib/consts.dart +++ b/lib/consts.dart @@ -35,11 +35,14 @@ final kColorLightDanger = Colors.red.withOpacity(0.9); const kColorDarkDanger = Color(0xffcf6679); const kWindowTitle = "API Dash"; -const kMinWindowSize = Size(900, 600); +const kMinWindowSize = Size(320, 640); const kMinInitialWindowWidth = 1200.0; const kMinInitialWindowHeight = 800.0; const kMinRequestEditorDetailsCardPaneSize = 300.0; -const kLargeMobileWidth = 600.0; +const kCompactWindowWidth = 600.0; +const kMediumWindowWidth = 840.0; +const kExpandedWindowWidth = 1200.0; +const kLargeWindowWidth = 1600.0; const kColorSchemeSeed = Colors.blue; final kFontFamily = GoogleFonts.openSans().fontFamily; @@ -106,6 +109,8 @@ const kP8CollectionPane = EdgeInsets.only( //right: 4.0, // bottom: 8.0, ); +const kPt28 = EdgeInsets.only(top: 28); +const kPt32 = EdgeInsets.only(top: 32); const kPb10 = EdgeInsets.only( bottom: 10, ); diff --git a/lib/extensions/context_extensions.dart b/lib/extensions/context_extensions.dart index c8ded965d..8d334df05 100644 --- a/lib/extensions/context_extensions.dart +++ b/lib/extensions/context_extensions.dart @@ -2,9 +2,17 @@ import 'package:apidash/consts.dart'; import 'package:flutter/material.dart'; extension MediaQueryExtension on BuildContext { - bool get isLargeWidth => - MediaQuery.of(this).size.width > kMinWindowSize.width; + bool get isCompactWindow => + MediaQuery.of(this).size.width < kCompactWindowWidth; - bool get isMobile => - kIsMobile && MediaQuery.of(this).size.width < kMinWindowSize.width; + bool get isMediumWindow => + MediaQuery.of(this).size.width < kMediumWindowWidth; + + bool get isExpandedWindow => + MediaQuery.of(this).size.width < kExpandedWindowWidth; + + bool get isLargeWindow => MediaQuery.of(this).size.width < kLargeWindowWidth; + + bool get isExtraLargeWindow => + MediaQuery.of(this).size.width > kLargeWindowWidth; } diff --git a/lib/screens/home_page/collection_pane.dart b/lib/screens/home_page/collection_pane.dart index a14916829..91a7ed93a 100644 --- a/lib/screens/home_page/collection_pane.dart +++ b/lib/screens/home_page/collection_pane.dart @@ -150,7 +150,7 @@ class _RequestListState extends ConsumerState { radius: const Radius.circular(12), child: filterQuery.isEmpty ? ReorderableListView.builder( - padding: context.isMobile + padding: context.isMediumWindow ? EdgeInsets.only( bottom: MediaQuery.paddingOf(context).bottom, right: 8, @@ -198,7 +198,7 @@ class _RequestListState extends ConsumerState { }, ) : ListView( - padding: kIsMobile + padding: context.isMediumWindow ? EdgeInsets.only( bottom: MediaQuery.paddingOf(context).bottom, right: 8, diff --git a/lib/screens/home_page/editor_pane/editor_request.dart b/lib/screens/home_page/editor_pane/editor_request.dart index 1d6211072..e035ab270 100644 --- a/lib/screens/home_page/editor_pane/editor_request.dart +++ b/lib/screens/home_page/editor_pane/editor_request.dart @@ -12,7 +12,7 @@ class RequestEditor extends StatelessWidget { @override Widget build(BuildContext context) { - return context.isMobile + return context.isMediumWindow ? const Padding( padding: kPb10, child: Column( diff --git a/lib/screens/home_page/editor_pane/url_card.dart b/lib/screens/home_page/editor_pane/url_card.dart index 012844e2d..749991d36 100644 --- a/lib/screens/home_page/editor_pane/url_card.dart +++ b/lib/screens/home_page/editor_pane/url_card.dart @@ -21,9 +21,9 @@ class EditorPaneRequestURLCard extends StatelessWidget { child: Padding( padding: EdgeInsets.symmetric( vertical: 5, - horizontal: !context.isMobile ? 20 : 6, + horizontal: !context.isMediumWindow ? 20 : 6, ), - child: context.isMobile + child: context.isMediumWindow ? const Row( children: [ DropdownButtonHTTPMethod(), diff --git a/lib/screens/mobile/dashboard.dart b/lib/screens/mobile/dashboard.dart index 901c5888e..acc4feecd 100644 --- a/lib/screens/mobile/dashboard.dart +++ b/lib/screens/mobile/dashboard.dart @@ -4,7 +4,8 @@ import 'package:flutter/services.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:inner_drawer/inner_drawer.dart'; import 'package:flex_color_scheme/flex_color_scheme.dart'; -import '../../providers/providers.dart'; +import 'package:apidash/extensions/extensions.dart'; +import 'package:apidash/providers/providers.dart'; import 'navbar.dart'; import 'widgets/left_drawer.dart'; import 'requests_page.dart'; @@ -44,7 +45,6 @@ class _MobileDashboardState extends ConsumerState { ) { final GlobalKey innerDrawerKey = ref.watch(mobileDrawerKeyProvider); - final isLargeMobile = MediaQuery.sizeOf(context).width > kLargeMobileWidth; return AnnotatedRegion( value: FlexColorScheme.themedSystemNavigationBar( context, @@ -59,7 +59,7 @@ class _MobileDashboardState extends ConsumerState { swipe: true, swipeChild: true, onTapClose: true, - offset: isLargeMobile + offset: !context.isCompactWindow ? const IDOffset.only(left: 0.1, right: 1) : const IDOffset.only(left: 0.7, right: 1), boxShadow: [ @@ -72,8 +72,8 @@ class _MobileDashboardState extends ConsumerState { colorTransitionChild: Colors.transparent, colorTransitionScaffold: Colors.transparent, rightAnimationType: InnerDrawerAnimation.linear, - backgroundDecoration: - BoxDecoration(color: Theme.of(context).colorScheme.surface), + backgroundDecoration: BoxDecoration( + color: Theme.of(context).colorScheme.onInverseSurface), onDragUpdate: (value, direction) { drawerDirection.value = direction; if (value > 0.98 && direction == InnerDrawerDirection.start) { @@ -105,6 +105,7 @@ class _MobileDashboardState extends ConsumerState { borderRadius: const BorderRadius.only(topLeft: Radius.circular(8)), child: SafeArea( + minimum: kIsWindows || kIsMacOS ? kPt28 : EdgeInsets.zero, bottom: false, child: RequestsPage( innerDrawerKey: innerDrawerKey, @@ -113,7 +114,7 @@ class _MobileDashboardState extends ConsumerState { ), ), ), - if (!isLargeMobile) + if (context.isCompactWindow) AnimatedPositioned( bottom: isLeftDrawerOpen ? 0 diff --git a/lib/screens/mobile/navbar.dart b/lib/screens/mobile/navbar.dart index 43b092aee..5509152d0 100644 --- a/lib/screens/mobile/navbar.dart +++ b/lib/screens/mobile/navbar.dart @@ -1,7 +1,8 @@ -import 'package:apidash/providers/ui_providers.dart'; -import 'package:apidash/screens/mobile/widgets/page_base.dart'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; +import 'package:apidash/extensions/context_extensions.dart'; +import 'package:apidash/providers/ui_providers.dart'; +import 'package:apidash/screens/mobile/widgets/page_base.dart'; import '../settings_page.dart'; import '../intro_page.dart'; @@ -183,67 +184,76 @@ Widget customNavigationDestination( Function()? onTap, }) { bool isSelected = railIdx == buttonIdx; - return Tooltip( - message: label, - triggerMode: TooltipTriggerMode.longPress, - verticalOffset: 42, - child: GestureDetector( - behavior: HitTestBehavior.translucent, - onTap: isSelected - ? null - : () { - if (!isNavigator) { - ref.read(navRailIndexStateProvider.notifier).state = buttonIdx; - } - onTap?.call(); - }, - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Ink( - width: 65, - height: 32, - decoration: BoxDecoration( - color: isSelected - ? Theme.of(context).colorScheme.secondaryContainer - : Colors.transparent, - borderRadius: BorderRadius.circular(30), - ), - child: InkWell( - borderRadius: BorderRadius.circular(30), - onTap: isSelected - ? null - : () { - if (!isNavigator) { - ref.read(navRailIndexStateProvider.notifier).state = - buttonIdx; - } - onTap?.call(); - }, - child: Icon( - isSelected ? selectedIcon : icon, + return TooltipVisibility( + visible: context.isCompactWindow, + child: Tooltip( + message: label, + triggerMode: TooltipTriggerMode.longPress, + verticalOffset: 42, + child: GestureDetector( + behavior: HitTestBehavior.translucent, + onTap: isSelected + ? null + : () { + if (!isNavigator) { + ref.read(navRailIndexStateProvider.notifier).state = + buttonIdx; + } + onTap?.call(); + }, + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Ink( + width: 65, + height: 32, + decoration: BoxDecoration( color: isSelected - ? Theme.of(context).colorScheme.onSecondaryContainer - : Theme.of(context).colorScheme.onSurface.withOpacity(0.65), + ? Theme.of(context).colorScheme.secondaryContainer + : Colors.transparent, + borderRadius: BorderRadius.circular(30), + ), + child: InkWell( + borderRadius: BorderRadius.circular(30), + onTap: isSelected + ? null + : () { + if (!isNavigator) { + ref.read(navRailIndexStateProvider.notifier).state = + buttonIdx; + } + onTap?.call(); + }, + child: Icon( + isSelected ? selectedIcon : icon, + color: isSelected + ? Theme.of(context).colorScheme.onSecondaryContainer + : Theme.of(context) + .colorScheme + .onSurface + .withOpacity(0.65), + ), ), ), - ), - showLabel ? const SizedBox(height: 4) : const SizedBox.shrink(), - showLabel - ? Text( - label, - style: Theme.of(context).textTheme.labelSmall!.copyWith( - fontWeight: FontWeight.w600, - color: isSelected - ? Theme.of(context).colorScheme.onSecondaryContainer - : Theme.of(context) - .colorScheme - .onSurface - .withOpacity(0.65), - ), - ) - : const SizedBox.shrink(), - ], + showLabel ? const SizedBox(height: 4) : const SizedBox.shrink(), + showLabel + ? Text( + label, + style: Theme.of(context).textTheme.labelSmall!.copyWith( + fontWeight: FontWeight.w600, + color: isSelected + ? Theme.of(context) + .colorScheme + .onSecondaryContainer + : Theme.of(context) + .colorScheme + .onSurface + .withOpacity(0.65), + ), + ) + : const SizedBox.shrink(), + ], + ), ), ), ); diff --git a/lib/screens/mobile/response_drawer.dart b/lib/screens/mobile/response_drawer.dart index e7295c278..40f0a9aa5 100644 --- a/lib/screens/mobile/response_drawer.dart +++ b/lib/screens/mobile/response_drawer.dart @@ -1,4 +1,5 @@ import 'package:flutter/material.dart'; +import 'package:apidash/consts.dart'; import '../home_page/editor_pane/details_card/response_pane.dart'; class ResponseDrawer extends StatelessWidget { @@ -6,27 +7,31 @@ class ResponseDrawer extends StatelessWidget { @override Widget build(BuildContext context) { - return Scaffold( - appBar: AppBar( - backgroundColor: Theme.of(context).colorScheme.surface, - shape: const RoundedRectangleBorder( - borderRadius: BorderRadius.vertical(top: Radius.circular(8)), + return Container( + padding: kIsWindows || kIsMacOS ? kPt28 : EdgeInsets.zero, + color: Theme.of(context).colorScheme.surface, + child: Scaffold( + appBar: AppBar( + backgroundColor: Theme.of(context).colorScheme.surface, + shape: const RoundedRectangleBorder( + borderRadius: BorderRadius.vertical(top: Radius.circular(8)), + ), + leading: IconButton( + icon: const Icon(Icons.arrow_back_rounded), + onPressed: () { + Navigator.of(context).pop(); + }, + ), + scrolledUnderElevation: 0, + centerTitle: true, + title: const Text("Response"), ), - leading: IconButton( - icon: const Icon(Icons.arrow_back_rounded), - onPressed: () { - Navigator.of(context).pop(); - }, + body: Padding( + padding: EdgeInsets.only( + bottom: MediaQuery.paddingOf(context).bottom, + ), + child: const ResponsePane(), ), - scrolledUnderElevation: 0, - centerTitle: true, - title: const Text("Response"), - ), - body: Padding( - padding: EdgeInsets.only( - bottom: MediaQuery.paddingOf(context).bottom, - ), - child: const ResponsePane(), ), ); } diff --git a/lib/screens/mobile/widgets/left_drawer.dart b/lib/screens/mobile/widgets/left_drawer.dart index 9a0f67c6a..d7f6973d3 100644 --- a/lib/screens/mobile/widgets/left_drawer.dart +++ b/lib/screens/mobile/widgets/left_drawer.dart @@ -1,4 +1,5 @@ import 'package:apidash/consts.dart'; +import 'package:apidash/extensions/extensions.dart'; import 'package:apidash/screens/mobile/navbar.dart'; import 'package:flutter/material.dart'; @@ -8,9 +9,9 @@ class LeftDrawer extends StatelessWidget { @override Widget build(BuildContext context) { - final isLargeMobile = MediaQuery.sizeOf(context).width > kLargeMobileWidth; return Container( - padding: EdgeInsets.only(top: MediaQuery.paddingOf(context).top), + padding: EdgeInsets.only(top: MediaQuery.paddingOf(context).top) + + (kIsWindows || kIsMacOS ? kPt28 : EdgeInsets.zero), color: Theme.of(context).colorScheme.onInverseSurface, child: Drawer( backgroundColor: Colors.transparent, @@ -20,7 +21,7 @@ class LeftDrawer extends StatelessWidget { child: Container( padding: EdgeInsets.only( left: MediaQuery.paddingOf(context).left, - bottom: isLargeMobile + bottom: !context.isCompactWindow ? MediaQuery.paddingOf(context).bottom : 70 + MediaQuery.paddingOf(context).bottom), clipBehavior: Clip.hardEdge, @@ -29,7 +30,7 @@ class LeftDrawer extends StatelessWidget { borderRadius: const BorderRadius.only(topRight: Radius.circular(8)), ), - child: isLargeMobile + child: !context.isCompactWindow ? Row( children: [ const NavRail(), diff --git a/lib/screens/mobile/widgets/page_base.dart b/lib/screens/mobile/widgets/page_base.dart index 96efeefeb..39cc71561 100644 --- a/lib/screens/mobile/widgets/page_base.dart +++ b/lib/screens/mobile/widgets/page_base.dart @@ -1,26 +1,48 @@ import 'package:flutter/material.dart'; +import 'package:flutter_riverpod/flutter_riverpod.dart'; +import 'package:apidash/consts.dart'; +import 'package:apidash/providers/providers.dart'; +import 'package:apidash/widgets/window_caption.dart'; -class PageBase extends StatelessWidget { +class PageBase extends ConsumerWidget { final String title; final Widget scaffoldBody; const PageBase({super.key, required this.title, required this.scaffoldBody}); @override - Widget build(BuildContext context) { - return Scaffold( - backgroundColor: Theme.of(context).colorScheme.background, - appBar: AppBar( - backgroundColor: Theme.of(context).colorScheme.background, - primary: true, - title: Text(title), - centerTitle: true, - ), - body: Padding( - padding: EdgeInsets.only( - bottom: MediaQuery.paddingOf(context).bottom, + Widget build(BuildContext context, WidgetRef ref) { + final isDarkMode = + ref.watch(settingsProvider.select((value) => value.isDark)); + return Stack( + children: [ + Container( + padding: kIsWindows || kIsMacOS ? kPt28 : EdgeInsets.zero, + color: Theme.of(context).colorScheme.surface, + child: Scaffold( + backgroundColor: Theme.of(context).colorScheme.background, + appBar: AppBar( + backgroundColor: Theme.of(context).colorScheme.background, + primary: true, + title: Text(title), + centerTitle: true, + ), + body: Padding( + padding: EdgeInsets.only( + bottom: MediaQuery.paddingOf(context).bottom, + ), + child: scaffoldBody, + ), + ), ), - child: scaffoldBody, - ), + if (kIsWindows) + SizedBox( + height: 29, + child: WindowCaption( + backgroundColor: Colors.transparent, + brightness: isDarkMode ? Brightness.dark : Brightness.light, + ), + ), + ], ); } } diff --git a/lib/screens/settings_page.dart b/lib/screens/settings_page.dart index a6735cab6..7b4a3bcbb 100644 --- a/lib/screens/settings_page.dart +++ b/lib/screens/settings_page.dart @@ -17,7 +17,7 @@ class SettingsPage extends ConsumerWidget { return Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - !context.isMobile + !context.isMediumWindow ? Padding( padding: kPh20t40, child: kIsDesktop diff --git a/lib/widgets/dropdowns.dart b/lib/widgets/dropdowns.dart index 5ca344707..2d8a059b1 100644 --- a/lib/widgets/dropdowns.dart +++ b/lib/widgets/dropdowns.dart @@ -30,7 +30,7 @@ class DropdownButtonHttpMethod extends StatelessWidget { return DropdownMenuItem( value: value, child: Padding( - padding: EdgeInsets.only(left: context.isMobile ? 8 : 16), + padding: EdgeInsets.only(left: context.isMediumWindow ? 8 : 16), child: Text( value.name.toUpperCase(), style: kCodeStyle.copyWith( diff --git a/lib/widgets/intro_message.dart b/lib/widgets/intro_message.dart index ca9964b64..21e209ae8 100644 --- a/lib/widgets/intro_message.dart +++ b/lib/widgets/intro_message.dart @@ -38,7 +38,7 @@ class IntroMessage extends StatelessWidget { return CustomMarkdown( data: text, - padding: !context.isMobile ? kPh60 : kPh20, + padding: !context.isMediumWindow ? kPh60 : kPh20, ); } return const Center(child: CircularProgressIndicator()); diff --git a/lib/widgets/request_widgets.dart b/lib/widgets/request_widgets.dart index 9555b84b9..368bba5f6 100644 --- a/lib/widgets/request_widgets.dart +++ b/lib/widgets/request_widgets.dart @@ -48,7 +48,7 @@ class _RequestPaneState extends State } return Column( children: [ - context.isMobile + context.isMediumWindow ? const SizedBox.shrink() : Padding( padding: kP8, diff --git a/lib/widgets/tabs.dart b/lib/widgets/tabs.dart index 8f97d22aa..ead365020 100644 --- a/lib/widgets/tabs.dart +++ b/lib/widgets/tabs.dart @@ -14,7 +14,7 @@ class TabLabel extends StatelessWidget { @override Widget build(BuildContext context) { return SizedBox( - height: context.isMobile ? kMobileTabHeight : kTabHeight, + height: context.isMediumWindow ? kMobileTabHeight : kTabHeight, child: Stack( children: [ Center( diff --git a/pubspec.lock b/pubspec.lock index 74cdcd438..0d8cedefe 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -5,34 +5,34 @@ packages: dependency: transitive description: name: _fe_analyzer_shared - sha256: eb376e9acf6938204f90eb3b1f00b578640d3188b4c8a8ec054f9f479af8d051 + sha256: "0b2f2bd91ba804e53a61d757b986f89f1f9eaed5b11e4b2f5a2468d86d6c9fc7" url: "https://pub.dev" source: hosted - version: "64.0.0" + version: "67.0.0" analyzer: dependency: transitive description: name: analyzer - sha256: "69f54f967773f6c26c7dcb13e93d7ccee8b17a641689da39e878d5cf13b06893" + sha256: "37577842a27e4338429a1cbc32679d508836510b056f1eedf0c8d20e39c1383d" url: "https://pub.dev" source: hosted - version: "6.2.0" + version: "6.4.1" archive: dependency: transitive description: name: archive - sha256: "7b875fd4a20b165a3084bd2d210439b22ebc653f21cea4842729c0c30c82596b" + sha256: cb6a278ef2dbb298455e1a713bda08524a175630ec643a242c399c932a0a1f7d url: "https://pub.dev" source: hosted - version: "3.4.9" + version: "3.6.1" args: dependency: transitive description: name: args - sha256: eef6c46b622e0494a36c5a12d10d77fb4e855501a91c1b9ef9339326e58f0596 + sha256: "7cf60b9f0cc88203c5a190b4cd62a99feea42759a7fa695010eb5de1c0b2252a" url: "https://pub.dev" source: hosted - version: "2.4.2" + version: "2.5.0" async: dependency: transitive description: @@ -45,18 +45,18 @@ packages: dependency: transitive description: name: audio_session - sha256: "6fdf255ed3af86535c96452c33ecff1245990bb25a605bfb1958661ccc3d467f" + sha256: a49af9981eec5d7cd73b37bacb6ee73f8143a6a9f9bd5b6021e6c346b9b6cf4e url: "https://pub.dev" source: hosted - version: "0.1.18" + version: "0.1.19" barcode: dependency: transitive description: name: barcode - sha256: "2a8b2ee065f419c2aeda141436cc556d91ae772d220fd80679f4d431d6c2ab43" + sha256: ab180ce22c6555d77d45f0178a523669db67f95856e3378259ef2ffeb43e6003 url: "https://pub.dev" source: hosted - version: "2.2.5" + version: "2.2.8" bidi: dependency: transitive description: @@ -109,18 +109,18 @@ packages: dependency: "direct dev" description: name: build_runner - sha256: "581bacf68f89ec8792f5e5a0b2c4decd1c948e97ce659dc783688c8a88fbec21" + sha256: "3ac61a79bfb6f6cc11f693591063a7f19a7af628dc52f141743edac5c16e8c22" url: "https://pub.dev" source: hosted - version: "2.4.8" + version: "2.4.9" build_runner_core: dependency: transitive description: name: build_runner_core - sha256: c9e32d21dd6626b5c163d48b037ce906bbe428bc23ab77bcd77bb21e593b6185 + sha256: "4ae8ffe5ac758da294ecf1802f2aff01558d8b1b00616aa7538ea9a8a5d50799" url: "https://pub.dev" source: hosted - version: "7.2.11" + version: "7.3.0" built_collection: dependency: transitive description: @@ -133,10 +133,10 @@ packages: dependency: transitive description: name: built_value - sha256: c9aabae0718ec394e5bc3c7272e6bb0dc0b32201a08fe185ec1d8401d3e39309 + sha256: c7913a9737ee4007efedaffc968c049fd0f3d0e49109e778edc10de9426005cb url: "https://pub.dev" source: hosted - version: "8.8.1" + version: "8.9.2" characters: dependency: transitive description: @@ -197,10 +197,10 @@ packages: dependency: transitive description: name: coverage - sha256: "8acabb8306b57a409bf4c83522065672ee13179297a6bb0cb9ead73948df7c76" + sha256: "3945034e86ea203af7a056d98e98e42a5518fff200d6e8e6647e1886b07e936e" url: "https://pub.dev" source: hosted - version: "1.7.2" + version: "1.8.0" cross_file: dependency: transitive description: @@ -245,10 +245,10 @@ packages: dependency: "direct main" description: name: data_table_2 - sha256: fdb0551f103f1daf837bddfde14619fd9e683408833a618c9afabeb533fce88c + sha256: e403de6d9a58dddf27700114b614ea8ea5aa8442d7fbdfbe8b3d11b0512e7a49 url: "https://pub.dev" source: hosted - version: "2.5.11" + version: "2.5.12" eventify: dependency: transitive description: @@ -261,10 +261,10 @@ packages: dependency: transitive description: name: extended_text_field - sha256: ed9655c70a47a54c7cc689cf7f89a2bde9ab7b530150b4d1808b7aa7eb8cdf90 + sha256: d064097c774eab3a7f2aad1db32533611a71ed52305b3afd3e0364642a1a61f7 url: "https://pub.dev" source: hosted - version: "13.0.0" + version: "13.1.0" extended_text_library: dependency: transitive description: @@ -285,10 +285,10 @@ packages: dependency: transitive description: name: ffi - sha256: "7bf0adc28a23d395f19f3f1eb21dd7cfd1dd9f8e1c50051c069122e6853bc878" + sha256: "493f37e7df1804778ff3a53bd691d8692ddf69702cf4c1c1096a2e41b4779e21" url: "https://pub.dev" source: hosted - version: "2.1.0" + version: "2.1.2" file: dependency: transitive description: @@ -309,18 +309,18 @@ packages: dependency: transitive description: name: file_selector_android - sha256: "1cd66575f063b689e041aec836905ba7be18d76c9f0634d0d75daec825f67095" + sha256: "8bcc3af859e9d47fab9c7dc315537406511a894ab578e198bd8f9ed745ea5a01" url: "https://pub.dev" source: hosted - version: "0.5.0+7" + version: "0.5.1+2" file_selector_ios: dependency: transitive description: name: file_selector_ios - sha256: b015154e6d9fddbc4d08916794df170b44531798c8dd709a026df162d07ad81d + sha256: "38ebf91ecbcfa89a9639a0854ccaed8ab370c75678938eebca7d34184296f0bb" url: "https://pub.dev" source: hosted - version: "0.5.1+8" + version: "0.5.3" file_selector_linux: dependency: transitive description: @@ -333,10 +333,10 @@ packages: dependency: transitive description: name: file_selector_macos - sha256: b15c3da8bd4908b9918111fa486903f5808e388b8d1c559949f584725a6594d6 + sha256: f42eacb83b318e183b1ae24eead1373ab1334084404c8c16e0354f9a3e55d385 url: "https://pub.dev" source: hosted - version: "0.9.3+3" + version: "0.9.4" file_selector_platform_interface: dependency: transitive description: @@ -381,10 +381,10 @@ packages: dependency: transitive description: name: flex_seed_scheme - sha256: "29c12aba221eb8a368a119685371381f8035011d18de5ba277ad11d7dfb8657f" + sha256: "4cee2f1d07259f77e8b36f4ec5f35499d19e74e17c7dce5b819554914082bc01" url: "https://pub.dev" source: hosted - version: "1.4.0" + version: "1.5.0" flutter: dependency: "direct main" description: flutter @@ -450,18 +450,18 @@ packages: dependency: "direct dev" description: name: flutter_lints - sha256: e2a421b7e59244faef694ba7b30562e489c2b489866e505074eb005cd7060db7 + sha256: "9e8c3858111da373efc5aa341de011d9bd23e2c5c5e0c62bccf32438e192d7b1" url: "https://pub.dev" source: hosted - version: "3.0.1" + version: "3.0.2" flutter_markdown: dependency: "direct main" description: name: flutter_markdown - sha256: cb44f7831b23a6bdd0f501718b0d2e8045cbc625a15f668af37ddb80314821db + sha256: "04c4722cc36ec5af38acc38ece70d22d3c2123c61305d555750a091517bbe504" url: "https://pub.dev" source: hosted - version: "0.6.21" + version: "0.6.23" flutter_riverpod: dependency: "direct main" description: @@ -500,10 +500,10 @@ packages: dependency: "direct dev" description: name: freezed - sha256: "57247f692f35f068cae297549a46a9a097100685c6780fe67177503eea5ed4e5" + sha256: a434911f643466d78462625df76fd9eb13e57348ff43fe1f77bbe909522c67a1 url: "https://pub.dev" source: hosted - version: "2.4.7" + version: "2.5.2" freezed_annotation: dependency: "direct main" description: @@ -620,10 +620,10 @@ packages: dependency: transitive description: name: image - sha256: "028f61960d56f26414eb616b48b04eb37d700cbe477b7fb09bf1d7ce57fd9271" + sha256: "2237616a36c0d69aef7549ab439b833fb7f9fb9fc861af2cc9ac3eedddd69ca8" url: "https://pub.dev" source: hosted - version: "4.1.3" + version: "4.2.0" inner_drawer: dependency: "direct main" description: @@ -660,10 +660,10 @@ packages: dependency: "direct main" description: name: json_annotation - sha256: b10a7b2ff83d83c777edba3c6a0f97045ddadd56c944e1a23a3fdf43a1bf4467 + sha256: "1ce844379ca14835a50d2f019a3099f419082cfdd231cd86a142af94dd5c6bb1" url: "https://pub.dev" source: hosted - version: "4.8.1" + version: "4.9.0" json_data_explorer: dependency: "direct main" description: @@ -677,10 +677,10 @@ packages: dependency: "direct dev" description: name: json_serializable - sha256: aa1f5a8912615733e0fdc7a02af03308933c93235bdc8d50d0b0c8a8ccb0b969 + sha256: ea1432d167339ea9b5bb153f0571d0039607a873d6e04e0117af043f14a1fd4b url: "https://pub.dev" source: hosted - version: "6.7.1" + version: "6.8.0" json_text_field: dependency: "direct main" description: @@ -693,10 +693,10 @@ packages: dependency: "direct main" description: name: just_audio - sha256: b607cd1a43bac03d85c3aaee00448ff4a589ef2a77104e3d409889ff079bf823 + sha256: "5abfab1d199e01ab5beffa61b3e782350df5dad036cb8c83b79fa45fc656614e" url: "https://pub.dev" source: hosted - version: "0.9.36" + version: "0.9.38" just_audio_mpv: dependency: "direct main" description: @@ -709,26 +709,26 @@ packages: dependency: transitive description: name: just_audio_platform_interface - sha256: c3dee0014248c97c91fe6299edb73dc4d6c6930a2f4f713579cd692d9e47f4a1 + sha256: "0243828cce503c8366cc2090cefb2b3c871aa8ed2f520670d76fd47aa1ab2790" url: "https://pub.dev" source: hosted - version: "4.2.2" + version: "4.3.0" just_audio_web: dependency: transitive description: name: just_audio_web - sha256: "134356b0fe3d898293102b33b5fd618831ffdc72bb7a1b726140abdf22772b70" + sha256: "0edb481ad4aa1ff38f8c40f1a3576013c3420bf6669b686fe661627d49bc606c" url: "https://pub.dev" source: hosted - version: "0.4.9" + version: "0.4.11" just_audio_windows: dependency: "direct main" description: name: just_audio_windows - sha256: "7b8801f3987e98a2002cd23b5600b2daf162248ff1413266fb44c84448c1c0d3" + sha256: "48ab2dec79cf6097550602fe07b1a644f341450e138dc8fdc23e42ce0ed2d928" url: "https://pub.dev" source: hosted - version: "0.2.0" + version: "0.2.1" leak_tracker: dependency: transitive description: @@ -773,10 +773,10 @@ packages: dependency: "direct main" description: name: lottie - sha256: ce2bb2605753915080e4ee47f036a64228c88dc7f56f7bc1dbe912d75b55b1e2 + sha256: "6a24ade5d3d918c306bb1c21a6b9a04aab0489d51a2582522eea820b4093b62b" url: "https://pub.dev" source: hosted - version: "3.1.0" + version: "3.1.2" markdown: dependency: "direct main" description: @@ -813,10 +813,10 @@ packages: dependency: transitive description: name: mime - sha256: e4ff8e8564c03f255408decd16e7899da1733852a9110a58fe6d1b817684a63e + sha256: "2e123074287cc9fd6c09de8336dae606d1ddb88d9ac47358826db698c176a1f2" url: "https://pub.dev" source: hosted - version: "1.0.4" + version: "1.0.5" mime_dart: dependency: "direct main" description: @@ -901,26 +901,26 @@ packages: dependency: "direct main" description: name: path_provider - sha256: b27217933eeeba8ff24845c34003b003b2b22151de3c908d0e679e8fe1aa078b + sha256: c9e7d3a4cd1410877472158bee69963a4579f78b68c65a2b7d40d1a7a88bb161 url: "https://pub.dev" source: hosted - version: "2.1.2" + version: "2.1.3" path_provider_android: dependency: transitive description: name: path_provider_android - sha256: e595b98692943b4881b219f0a9e3945118d3c16bd7e2813f98ec6e532d905f72 + sha256: a248d8146ee5983446bf03ed5ea8f6533129a12b11f12057ad1b4a67a2b3b41d url: "https://pub.dev" source: hosted - version: "2.2.1" + version: "2.2.4" path_provider_foundation: dependency: transitive description: name: path_provider_foundation - sha256: "19314d595120f82aca0ba62787d58dde2cc6b5df7d2f0daf72489e38d1b57f2d" + sha256: f234384a3fdd67f989b4d54a5d73ca2a6c422fa55ae694381ae0f4375cd1ea16 url: "https://pub.dev" source: hosted - version: "2.3.1" + version: "2.4.0" path_provider_linux: dependency: transitive description: @@ -933,10 +933,10 @@ packages: dependency: transitive description: name: path_provider_platform_interface - sha256: "94b1e0dd80970c1ce43d5d4e050a9918fce4f4a775e6142424c30a29a363265c" + sha256: "88f5779f72ba699763fa3a3b06aa4bf6de76c8e5de842cf6f29e2e06476c2334" url: "https://pub.dev" source: hosted - version: "2.1.1" + version: "2.1.2" path_provider_windows: dependency: transitive description: @@ -949,10 +949,10 @@ packages: dependency: transitive description: name: pdf - sha256: "93cbb2c06de9bab91844550f19896b2373e7a5ce25173995e7e5ec5e1741429d" + sha256: "243f05342fc0bdf140eba5b069398985cdbdd3dbb1d776cf43d5ea29cc570ba6" url: "https://pub.dev" source: hosted - version: "3.10.7" + version: "3.10.8" pdf_widget_wrapper: dependency: transitive description: @@ -973,34 +973,34 @@ packages: dependency: transitive description: name: platform - sha256: "0a279f0707af40c890e80b1e9df8bb761694c074ba7e1d4ab1bc4b728e200b59" + sha256: "12220bb4b65720483f8fa9450b4332347737cf8213dd2840d8b2c823e47243ec" url: "https://pub.dev" source: hosted - version: "3.1.3" + version: "3.1.4" plugin_platform_interface: dependency: transitive description: name: plugin_platform_interface - sha256: f4f88d4a900933e7267e2b353594774fc0d07fb072b47eedcd5b54e1ea3269f8 + sha256: "4820fbfdb9478b1ebae27888254d445073732dae3d6ea81f0b7e06d5dedc3f02" url: "https://pub.dev" source: hosted - version: "2.1.7" + version: "2.1.8" pointer_interceptor: dependency: transitive description: name: pointer_interceptor - sha256: bd18321519718678d5fa98ad3a3359cbc7a31f018554eab80b73d08a7f0c165a + sha256: d0a8e660d1204eaec5bd34b34cc92174690e076d2e4f893d9d68c486a13b07c4 url: "https://pub.dev" source: hosted - version: "0.10.1" + version: "0.10.1+1" pointer_interceptor_ios: dependency: transitive description: name: pointer_interceptor_ios - sha256: "2e73c39452830adc4695757130676a39412a3b7f3c34e3f752791b5384770877" + sha256: a6906772b3205b42c44614fcea28f818b1e5fdad73a4ca742a7bd49818d9c917 url: "https://pub.dev" source: hosted - version: "0.10.0+2" + version: "0.10.1" pointer_interceptor_platform_interface: dependency: transitive description: @@ -1013,18 +1013,10 @@ packages: dependency: transitive description: name: pointer_interceptor_web - sha256: "9386e064097fd16419e935c23f08f35b58e6aaec155dd39bd6a003b88f9c14b4" - url: "https://pub.dev" - source: hosted - version: "0.10.1+2" - pointycastle: - dependency: transitive - description: - name: pointycastle - sha256: "7c1e5f0d23c9016c5bbd8b1473d0d3fb3fc851b876046039509e18e0c7485f2c" + sha256: a6237528b46c411d8d55cdfad8fcb3269fc4cbb26060b14bff94879165887d1e url: "https://pub.dev" source: hosted - version: "3.7.3" + version: "0.10.2" pool: dependency: transitive description: @@ -1061,10 +1053,10 @@ packages: dependency: transitive description: name: pubspec_parse - sha256: c63b2876e58e194e4b0828fcb080ad0e06d051cb607a6be51a9e084f47cb9367 + sha256: c799b721d79eb6ee6fa56f00c04b472dcd44a30d258fac2174a6ec57302678f8 url: "https://pub.dev" source: hosted - version: "1.2.3" + version: "1.3.0" qr: dependency: transitive description: @@ -1290,26 +1282,26 @@ packages: dependency: "direct main" description: name: url_launcher - sha256: "0ecc004c62fd3ed36a2ffcbe0dd9700aee63bd7532d0b642a488b1ec310f492e" + sha256: "21b704ce5fa560ea9f3b525b43601c678728ba46725bab9b01187b4831377ed3" url: "https://pub.dev" source: hosted - version: "6.2.5" + version: "6.3.0" url_launcher_android: dependency: transitive description: name: url_launcher_android - sha256: "31222ffb0063171b526d3e569079cf1f8b294075ba323443fdc690842bfd4def" + sha256: "17cd5e205ea615e2c6ea7a77323a11712dffa0720a8a90540db57a01347f9ad9" url: "https://pub.dev" source: hosted - version: "6.2.0" + version: "6.3.2" url_launcher_ios: dependency: transitive description: name: url_launcher_ios - sha256: bba3373219b7abb6b5e0d071b0fe66dfbe005d07517a68e38d4fc3638f35c6d3 + sha256: "7068716403343f6ba4969b4173cbf3b84fc768042124bc2c011e5d782b24fe89" url: "https://pub.dev" source: hosted - version: "6.2.1" + version: "6.3.0" url_launcher_linux: dependency: transitive description: @@ -1322,26 +1314,26 @@ packages: dependency: transitive description: name: url_launcher_macos - sha256: b7244901ea3cf489c5335bdacda07264a6e960b1c1b1a9f91e4bc371d9e68234 + sha256: "9a1a42d5d2d95400c795b2914c36fdcb525870c752569438e4ebb09a2b5d90de" url: "https://pub.dev" source: hosted - version: "3.1.0" + version: "3.2.0" url_launcher_platform_interface: dependency: transitive description: name: url_launcher_platform_interface - sha256: "980e8d9af422f477be6948bdfb68df8433be71f5743a188968b0c1b887807e50" + sha256: "552f8a1e663569be95a8190206a38187b531910283c3e982193e4f2733f01029" url: "https://pub.dev" source: hosted - version: "2.2.0" + version: "2.3.2" url_launcher_web: dependency: transitive description: name: url_launcher_web - sha256: fff0932192afeedf63cdd50ecbb1bc825d31aed259f02bb8dba0f3b729a5e88b + sha256: "8d9e750d8c9338601e709cd0885f95825086bd8b642547f26bda435aade95d8a" url: "https://pub.dev" source: hosted - version: "2.2.3" + version: "2.3.1" url_launcher_windows: dependency: transitive description: @@ -1354,10 +1346,10 @@ packages: dependency: "direct main" description: name: uuid - sha256: cd210a09f7c18cbe5a02511718e0334de6559871052c90a90c0cca46a4aa81c8 + sha256: "814e9e88f21a176ae1359149021870e87f7cddaf633ab678a5d2b0bff7fd1ba8" url: "https://pub.dev" source: hosted - version: "4.3.3" + version: "4.4.0" vector_graphics: dependency: transitive description: @@ -1394,26 +1386,26 @@ packages: dependency: "direct main" description: name: video_player - sha256: afc65f4b8bcb2c188f64a591f84fb471f4f2e19fc607c65fd8d2f8fedb3dec23 + sha256: db6a72d8f4fd155d0189845678f55ad2fd54b02c10dcafd11c068dbb631286c0 url: "https://pub.dev" source: hosted - version: "2.8.3" + version: "2.8.6" video_player_android: dependency: transitive description: name: video_player_android - sha256: "4dd9b8b86d70d65eecf3dcabfcdfbb9c9115d244d022654aba49a00336d540c2" + sha256: "134e1ad410d67e18a19486ed9512c72dfc6d8ffb284d0e8f2e99e903d1ba8fa3" url: "https://pub.dev" source: hosted - version: "2.4.12" + version: "2.4.14" video_player_avfoundation: dependency: transitive description: name: video_player_avfoundation - sha256: "309e3962795e761be010869bae65c0b0e45b5230c5cee1bec72197ca7db040ed" + sha256: d1e9a824f2b324000dc8fb2dcb2a3285b6c1c7c487521c63306cc5b394f68a7c url: "https://pub.dev" source: hosted - version: "2.5.6" + version: "2.6.1" video_player_platform_interface: dependency: "direct main" description: @@ -1426,10 +1418,10 @@ packages: dependency: transitive description: name: video_player_web - sha256: "41245cef5ef29c4585dbabcbcbe9b209e34376642c7576cabf11b4ad9289d6e4" + sha256: ff4d69a6614b03f055397c27a71c9d3ddea2b2a23d71b2ba0164f59ca32b8fe2 url: "https://pub.dev" source: hosted - version: "2.3.0" + version: "2.3.1" vm_service: dependency: transitive description: @@ -1458,10 +1450,10 @@ packages: dependency: transitive description: name: web_socket_channel - sha256: d88238e5eac9a42bb43ca4e721edba3c08c6354d4a53063afaa568516217621b + sha256: "58c6666b342a38816b2e7e50ed0f1e261959630becd4c879c4f26bfa14aa5a42" url: "https://pub.dev" source: hosted - version: "2.4.0" + version: "2.4.5" webkit_inspection_protocol: dependency: transitive description: @@ -1474,24 +1466,24 @@ packages: dependency: transitive description: name: win32 - sha256: b0f37db61ba2f2e9b7a78a1caece0052564d1bc70668156cf3a29d676fe4e574 + sha256: "0eaf06e3446824099858367950a813472af675116bf63f008a4c2a75ae13e9cb" url: "https://pub.dev" source: hosted - version: "5.1.1" + version: "5.5.0" window_manager: dependency: "direct main" description: name: window_manager - sha256: b3c895bdf936c77b83c5254bec2e6b3f066710c1f89c38b20b8acc382b525494 + sha256: "8699323b30da4cdbe2aa2e7c9de567a6abd8a97d9a5c850a3c86dcd0b34bbfbf" url: "https://pub.dev" source: hosted - version: "0.3.8" + version: "0.3.9" window_size: dependency: "direct main" description: path: "plugins/window_size" ref: HEAD - resolved-ref: "6c66ad23ee79749f30a8eece542cf54eaf157ed8" + resolved-ref: eb3964990cf19629c89ff8cb4a37640c7b3d5601 url: "https://github.com/google/flutter-desktop-embedding.git" source: git version: "0.1.0" @@ -1499,10 +1491,10 @@ packages: dependency: transitive description: name: xdg_directories - sha256: "589ada45ba9e39405c198fe34eb0f607cddb2108527e658136120892beac46d2" + sha256: faea9dee56b520b55a566385b84f2e8de55e7496104adada9962e0bd11bcff1d url: "https://pub.dev" source: hosted - version: "1.0.3" + version: "1.0.4" xml: dependency: "direct main" description: From 0ae911cde73dde072c451c2a49c1e14118098a45 Mon Sep 17 00:00:00 2001 From: DenserMeerkat Date: Sun, 9 Jun 2024 19:03:00 +0530 Subject: [PATCH 02/12] fix: add missing import --- lib/app.dart | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/app.dart b/lib/app.dart index ec9af5302..76aa62b97 100644 --- a/lib/app.dart +++ b/lib/app.dart @@ -5,6 +5,7 @@ import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:window_manager/window_manager.dart' hide WindowCaption; import 'widgets/widgets.dart' show WindowCaption; import 'providers/providers.dart'; +import 'extensions/extensions.dart'; import 'screens/screens.dart'; import 'consts.dart'; From a1a5f4fa585aaab622463446a7ce62587ea5b9a2 Mon Sep 17 00:00:00 2001 From: DenserMeerkat Date: Sun, 9 Jun 2024 19:10:44 +0530 Subject: [PATCH 03/12] wip: update minWindowHeight --- lib/consts.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/consts.dart b/lib/consts.dart index 063dbe284..625eaafec 100644 --- a/lib/consts.dart +++ b/lib/consts.dart @@ -35,7 +35,7 @@ final kColorLightDanger = Colors.red.withOpacity(0.9); const kColorDarkDanger = Color(0xffcf6679); const kWindowTitle = "API Dash"; -const kMinWindowSize = Size(320, 640); +const kMinWindowSize = Size(320, 600); const kMinInitialWindowWidth = 1200.0; const kMinInitialWindowHeight = 800.0; const kMinRequestEditorDetailsCardPaneSize = 300.0; From f0175ff70adef6043c608b56f59bb1ec98189387 Mon Sep 17 00:00:00 2001 From: DenserMeerkat Date: Mon, 10 Jun 2024 21:50:58 +0530 Subject: [PATCH 04/12] fix: navrail index --- lib/screens/dashboard.dart | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/lib/screens/dashboard.dart b/lib/screens/dashboard.dart index 35189fd0c..1c6aef0a4 100644 --- a/lib/screens/dashboard.dart +++ b/lib/screens/dashboard.dart @@ -37,6 +37,19 @@ class Dashboard extends ConsumerWidget { 'Requests', style: Theme.of(context).textTheme.labelSmall, ), + kVSpacer10, + IconButton( + isSelected: railIdx == 1, + onPressed: () { + ref.read(navRailIndexStateProvider.notifier).state = 1; + }, + icon: const Icon(Icons.computer_outlined), + selectedIcon: const Icon(Icons.computer_rounded), + ), + Text( + 'Variables', + style: Theme.of(context).textTheme.labelSmall, + ), ], ), Expanded( @@ -45,12 +58,12 @@ class Dashboard extends ConsumerWidget { children: [ Padding( padding: const EdgeInsets.only(bottom: 16.0), - child: bottomButton(context, ref, railIdx, 1, + child: bottomButton(context, ref, railIdx, 2, Icons.help, Icons.help_outline), ), Padding( padding: const EdgeInsets.only(bottom: 16.0), - child: bottomButton(context, ref, railIdx, 2, + child: bottomButton(context, ref, railIdx, 3, Icons.settings, Icons.settings_outlined), ), ], @@ -81,6 +94,7 @@ class Dashboard extends ConsumerWidget { index: railIdx, children: const [ HomePage(), + SizedBox(), IntroPage(), SettingsPage(), ], From aa5fec6558e97dba8bd1079b8ee6719a68f5b9b1 Mon Sep 17 00:00:00 2001 From: DenserMeerkat Date: Tue, 11 Jun 2024 13:11:57 +0530 Subject: [PATCH 05/12] fix: page navigation --- lib/providers/ui_providers.dart | 4 +- lib/screens/dashboard.dart | 3 + lib/screens/envvar/environment_page.dart | 0 lib/screens/envvar/environments_pane.dart | 129 +++++++++++++++++++ lib/screens/home_page/collection_pane.dart | 4 +- lib/screens/mobile/dashboard.dart | 139 +++++++++------------ lib/screens/mobile/navbar.dart | 80 ++++-------- lib/screens/mobile/widgets/page_base.dart | 3 +- lib/widgets/cards.dart | 38 ++++++ lib/widgets/splitviews.dart | 87 +++++++++++++ pubspec.lock | 16 +++ pubspec.yaml | 2 + 12 files changed, 367 insertions(+), 138 deletions(-) create mode 100644 lib/screens/envvar/environment_page.dart create mode 100644 lib/screens/envvar/environments_pane.dart diff --git a/lib/providers/ui_providers.dart b/lib/providers/ui_providers.dart index 248170b95..0a6be4411 100644 --- a/lib/providers/ui_providers.dart +++ b/lib/providers/ui_providers.dart @@ -4,6 +4,7 @@ import 'package:inner_drawer/inner_drawer.dart'; final mobileDrawerKeyProvider = StateProvider>( (ref) => GlobalKey()); +final leftDrawerStateProvider = StateProvider((ref) => false); final navRailIndexStateProvider = StateProvider((ref) => 0); final selectedIdEditStateProvider = StateProvider((ref) => null); final codePaneVisibleStateProvider = StateProvider((ref) => false); @@ -29,4 +30,5 @@ final nameTextFieldFocusNodeProvider = return focusNode; }); -final searchQueryProvider = StateProvider((ref) => ''); +final collectionSearchQueryProvider = StateProvider((ref) => ''); +final environmentSearchQueryProvider = StateProvider((ref) => ''); diff --git a/lib/screens/dashboard.dart b/lib/screens/dashboard.dart index 1c6aef0a4..b5a9e0332 100644 --- a/lib/screens/dashboard.dart +++ b/lib/screens/dashboard.dart @@ -58,11 +58,13 @@ class Dashboard extends ConsumerWidget { children: [ Padding( padding: const EdgeInsets.only(bottom: 16.0), + child: bottomButton(context, ref, railIdx, 2, child: bottomButton(context, ref, railIdx, 2, Icons.help, Icons.help_outline), ), Padding( padding: const EdgeInsets.only(bottom: 16.0), + child: bottomButton(context, ref, railIdx, 3, child: bottomButton(context, ref, railIdx, 3, Icons.settings, Icons.settings_outlined), ), @@ -95,6 +97,7 @@ class Dashboard extends ConsumerWidget { children: const [ HomePage(), SizedBox(), + SizedBox(), IntroPage(), SettingsPage(), ], diff --git a/lib/screens/envvar/environment_page.dart b/lib/screens/envvar/environment_page.dart new file mode 100644 index 000000000..e69de29bb diff --git a/lib/screens/envvar/environments_pane.dart b/lib/screens/envvar/environments_pane.dart new file mode 100644 index 000000000..e5200889d --- /dev/null +++ b/lib/screens/envvar/environments_pane.dart @@ -0,0 +1,129 @@ +import 'package:apidash/consts.dart'; +import 'package:apidash/extensions/extensions.dart'; +import 'package:apidash/models/environment_model.dart'; +import 'package:apidash/providers/providers.dart'; +import 'package:flutter/material.dart'; +import 'package:hooks_riverpod/hooks_riverpod.dart'; +import 'package:flutter_hooks/flutter_hooks.dart'; + +class EnvironmentsPane extends ConsumerWidget { + const EnvironmentsPane({ + super.key, + }); + + @override + Widget build(BuildContext context, WidgetRef ref) { + return const SizedBox(); + } +} + +class EnvironmentsList extends HookConsumerWidget { + const EnvironmentsList({ + super.key, + }); + + @override + Widget build(BuildContext context, WidgetRef ref) { + final environmentSequence = ref.watch(environmentSequenceProvider); + final environmentItems = ref.watch(environmentsStateNotifierProvider)!; + final alwaysShowEnvironmentsPaneScrollbar = ref.watch(settingsProvider + .select((value) => value.alwaysShowCollectionPaneScrollbar)); + final filterQuery = ref.watch(environmentSearchQueryProvider).trim(); + + ScrollController scrollController = useScrollController(); + return Scrollbar( + controller: scrollController, + thumbVisibility: alwaysShowEnvironmentsPaneScrollbar, + radius: const Radius.circular(12), + child: filterQuery.isEmpty + ? ReorderableListView.builder( + padding: context.isMediumWindow + ? EdgeInsets.only( + bottom: MediaQuery.paddingOf(context).bottom, + right: 8, + ) + : kPe8, + scrollController: scrollController, + buildDefaultDragHandles: false, + itemCount: environmentSequence.length, + onReorder: (int oldIndex, int newIndex) { + if (oldIndex < newIndex) { + newIndex -= 1; + } + if (oldIndex != newIndex) { + ref + .read(collectionStateNotifierProvider.notifier) + .reorder(oldIndex, newIndex); + } + }, + itemBuilder: (context, index) { + var id = environmentSequence[index]; + if (kIsMobile) { + return ReorderableDelayedDragStartListener( + key: ValueKey(id), + index: index, + child: Padding( + padding: kP1, + child: EnvironmentItem( + id: id, + environmentModel: environmentItems[id]!, + ), + ), + ); + } + return ReorderableDragStartListener( + key: ValueKey(id), + index: index, + child: Padding( + padding: kP1, + child: EnvironmentItem( + id: id, + environmentModel: environmentItems[id]!, + ), + ), + ); + }, + ) + : ListView( + padding: context.isMediumWindow + ? EdgeInsets.only( + bottom: MediaQuery.paddingOf(context).bottom, + right: 8, + ) + : kPe8, + controller: scrollController, + children: environmentSequence.map((id) { + var item = environmentItems[id]!; + if (item.name.toLowerCase().contains(filterQuery)) { + return Padding( + padding: kP1, + child: EnvironmentItem( + id: id, + environmentModel: item, + ), + ); + } + return const SizedBox(); + }).toList(), + ), + ); + } +} + +class EnvironmentItem extends ConsumerWidget { + const EnvironmentItem({ + super.key, + required this.id, + required this.environmentModel, + }); + + final String id; + final EnvironmentModel environmentModel; + + @override + Widget build(BuildContext context, WidgetRef ref) { + final selectedId = ref.watch(selectedEnvironmentIdProvider); + + return Text(environmentModel.name); + } +} diff --git a/lib/screens/home_page/collection_pane.dart b/lib/screens/home_page/collection_pane.dart index 91a7ed93a..9d9b73403 100644 --- a/lib/screens/home_page/collection_pane.dart +++ b/lib/screens/home_page/collection_pane.dart @@ -94,7 +94,7 @@ class CollectionPane extends ConsumerWidget { style: Theme.of(context).textTheme.bodyMedium, hintText: "Filter by name or URL", onChanged: (value) { - ref.read(searchQueryProvider.notifier).state = + ref.read(collectionSearchQueryProvider.notifier).state = value.toLowerCase(); }, ), @@ -142,7 +142,7 @@ class _RequestListState extends ConsumerState { final requestItems = ref.watch(collectionStateNotifierProvider)!; final alwaysShowCollectionPaneScrollbar = ref.watch(settingsProvider .select((value) => value.alwaysShowCollectionPaneScrollbar)); - final filterQuery = ref.watch(searchQueryProvider).trim(); + final filterQuery = ref.watch(collectionSearchQueryProvider).trim(); return Scrollbar( controller: controller, diff --git a/lib/screens/mobile/dashboard.dart b/lib/screens/mobile/dashboard.dart index acc4feecd..123ccaeab 100644 --- a/lib/screens/mobile/dashboard.dart +++ b/lib/screens/mobile/dashboard.dart @@ -1,4 +1,4 @@ -import 'package:apidash/consts.dart'; +import 'package:apidash/widgets/splitviews.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; @@ -6,11 +6,13 @@ import 'package:inner_drawer/inner_drawer.dart'; import 'package:flex_color_scheme/flex_color_scheme.dart'; import 'package:apidash/extensions/extensions.dart'; import 'package:apidash/providers/providers.dart'; +import '../intro_page.dart'; +import '../settings_page.dart'; import 'navbar.dart'; -import 'widgets/left_drawer.dart'; import 'requests_page.dart'; import 'response_drawer.dart'; import '../home_page/collection_pane.dart'; +import 'widgets/page_base.dart'; class MobileDashboard extends ConsumerStatefulWidget { const MobileDashboard({super.key}); @@ -20,31 +22,14 @@ class MobileDashboard extends ConsumerStatefulWidget { } class _MobileDashboardState extends ConsumerState { - late Color backgroundColor; - bool isLeftDrawerOpen = false; - ValueNotifier dragPosition = ValueNotifier(0); - ValueNotifier drawerDirection = - ValueNotifier(InnerDrawerDirection.start); - - Color calculateBackgroundColor(double dragPosition) { - Color start = Theme.of(context).colorScheme.surface; - Color end = Theme.of(context).colorScheme.onInverseSurface; - return dragPosition == 0 ? start : end; - } - - @override - void dispose() { - super.dispose(); - dragPosition.dispose(); - drawerDirection.dispose(); - } - @override Widget build( BuildContext context, ) { + final railIdx = ref.watch(navRailIndexStateProvider); final GlobalKey innerDrawerKey = ref.watch(mobileDrawerKeyProvider); + final isLeftDrawerOpen = ref.watch(leftDrawerStateProvider); return AnnotatedRegion( value: FlexColorScheme.themedSystemNavigationBar( context, @@ -54,65 +39,9 @@ class _MobileDashboardState extends ConsumerState { child: Stack( alignment: AlignmentDirectional.bottomCenter, children: [ - InnerDrawer( - key: innerDrawerKey, - swipe: true, - swipeChild: true, - onTapClose: true, - offset: !context.isCompactWindow - ? const IDOffset.only(left: 0.1, right: 1) - : const IDOffset.only(left: 0.7, right: 1), - boxShadow: [ - BoxShadow( - offset: const Offset(1, 0), - color: Theme.of(context).colorScheme.onInverseSurface, - blurRadius: 0, - ), - ], - colorTransitionChild: Colors.transparent, - colorTransitionScaffold: Colors.transparent, - rightAnimationType: InnerDrawerAnimation.linear, - backgroundDecoration: BoxDecoration( - color: Theme.of(context).colorScheme.onInverseSurface), - onDragUpdate: (value, direction) { - drawerDirection.value = direction; - if (value > 0.98 && direction == InnerDrawerDirection.start) { - dragPosition.value = 1; - } else { - dragPosition.value = 0; - } - }, - innerDrawerCallback: (isOpened) { - if (drawerDirection.value == InnerDrawerDirection.start) { - setState(() { - isLeftDrawerOpen = isOpened; - }); - } - }, - leftChild: const LeftDrawer( - drawerContent: CollectionPane(), - ), - rightChild: const ResponseDrawer(), - scaffold: ValueListenableBuilder( - valueListenable: dragPosition, - builder: (context, value, child) { - return Container( - color: calculateBackgroundColor(value), - child: child, - ); - }, - child: ClipRRect( - borderRadius: - const BorderRadius.only(topLeft: Radius.circular(8)), - child: SafeArea( - minimum: kIsWindows || kIsMacOS ? kPt28 : EdgeInsets.zero, - bottom: false, - child: RequestsPage( - innerDrawerKey: innerDrawerKey, - ), - ), - ), - ), + PageBranch( + pageIndex: railIdx, + innerDrawerKey: innerDrawerKey, ), if (context.isCompactWindow) AnimatedPositioned( @@ -131,3 +60,53 @@ class _MobileDashboardState extends ConsumerState { ); } } + +class PageBranch extends StatelessWidget { + const PageBranch({ + super.key, + required this.pageIndex, + required this.innerDrawerKey, + }); + + final int pageIndex; + final GlobalKey innerDrawerKey; + + @override + Widget build(BuildContext context) { + switch (pageIndex) { + case 1: + return TwoDrawerSplitView( + key: const ValueKey('env'), + innerDrawerKey: innerDrawerKey, + offset: !context.isCompactWindow + ? const IDOffset.only(left: 0.1) + : const IDOffset.only(left: 0.7), + leftDrawerContent: const SizedBox(), + mainContent: const SizedBox(), + ); + case 2: + return const PageBase( + title: 'About', + scaffoldBody: IntroPage(), + ); + case 3: + return const PageBase( + title: 'Settings', + scaffoldBody: SettingsPage(), + ); + default: + return TwoDrawerSplitView( + key: const ValueKey('home'), + innerDrawerKey: innerDrawerKey, + offset: !context.isCompactWindow + ? const IDOffset.only(left: 0.1, right: 1) + : const IDOffset.only(left: 0.7, right: 1), + leftDrawerContent: const CollectionPane(), + rightDrawerContent: const ResponseDrawer(), + mainContent: RequestsPage( + innerDrawerKey: innerDrawerKey, + ), + ); + } + } +} diff --git a/lib/screens/mobile/navbar.dart b/lib/screens/mobile/navbar.dart index 5509152d0..ab516c5b4 100644 --- a/lib/screens/mobile/navbar.dart +++ b/lib/screens/mobile/navbar.dart @@ -2,9 +2,6 @@ import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:apidash/extensions/context_extensions.dart'; import 'package:apidash/providers/ui_providers.dart'; -import 'package:apidash/screens/mobile/widgets/page_base.dart'; -import '../settings_page.dart'; -import '../intro_page.dart'; class BottomNavBar extends ConsumerWidget { const BottomNavBar({super.key}); @@ -48,30 +45,26 @@ class BottomNavBar extends ConsumerWidget { 'Variables'), ), Expanded( - child: customNavigationDestination(context, ref, railIdx, 2, - Icons.help, Icons.help_outline, 'About', - isNavigator: true, onTap: () { - Navigator.of(context).push( - MaterialPageRoute( - builder: (context) => const PageBase( - title: 'About', - scaffoldBody: IntroPage(), - )), - ); - }), + child: customNavigationDestination( + context, + ref, + railIdx, + 2, + Icons.help, + Icons.help_outline, + 'About', + ), ), Expanded( - child: customNavigationDestination(context, ref, railIdx, 3, - Icons.settings, Icons.settings_outlined, 'Settings', - isNavigator: true, onTap: () { - Navigator.of(context).push( - MaterialPageRoute( - builder: (context) => const PageBase( - title: 'Settings', - scaffoldBody: SettingsPage(), - )), - ); - }), + child: customNavigationDestination( + context, + ref, + railIdx, + 3, + Icons.settings, + Icons.settings_outlined, + 'Settings', + ), ), ], ), @@ -131,17 +124,6 @@ class NavRail extends ConsumerWidget { Icons.help, Icons.help_outline, 'About', - isNavigator: true, - showLabel: false, - onTap: () { - Navigator.of(context).push( - MaterialPageRoute( - builder: (context) => const PageBase( - title: 'About', - scaffoldBody: IntroPage(), - )), - ); - }, ), const SizedBox(height: 24), customNavigationDestination( @@ -152,17 +134,6 @@ class NavRail extends ConsumerWidget { Icons.settings, Icons.settings_outlined, 'Settings', - isNavigator: true, - showLabel: false, - onTap: () { - Navigator.of(context).push( - MaterialPageRoute( - builder: (context) => const PageBase( - title: 'Settings', - scaffoldBody: SettingsPage(), - )), - ); - }, ), ], ), @@ -179,7 +150,6 @@ Widget customNavigationDestination( IconData selectedIcon, IconData icon, String label, { - bool isNavigator = false, bool showLabel = true, Function()? onTap, }) { @@ -195,9 +165,9 @@ Widget customNavigationDestination( onTap: isSelected ? null : () { - if (!isNavigator) { - ref.read(navRailIndexStateProvider.notifier).state = - buttonIdx; + ref.read(navRailIndexStateProvider.notifier).state = buttonIdx; + if (railIdx > 1 && buttonIdx <= 1) { + ref.read(leftDrawerStateProvider.notifier).state = false; } onTap?.call(); }, @@ -218,9 +188,11 @@ Widget customNavigationDestination( onTap: isSelected ? null : () { - if (!isNavigator) { - ref.read(navRailIndexStateProvider.notifier).state = - buttonIdx; + ref.read(navRailIndexStateProvider.notifier).state = + buttonIdx; + if (railIdx > 1 && buttonIdx <= 1) { + ref.read(leftDrawerStateProvider.notifier).state = + false; } onTap?.call(); }, diff --git a/lib/screens/mobile/widgets/page_base.dart b/lib/screens/mobile/widgets/page_base.dart index 39cc71561..424608311 100644 --- a/lib/screens/mobile/widgets/page_base.dart +++ b/lib/screens/mobile/widgets/page_base.dart @@ -16,7 +16,8 @@ class PageBase extends ConsumerWidget { return Stack( children: [ Container( - padding: kIsWindows || kIsMacOS ? kPt28 : EdgeInsets.zero, + padding: const EdgeInsets.only(bottom: 70) + + (kIsWindows || kIsMacOS ? kPt28 : EdgeInsets.zero), color: Theme.of(context).colorScheme.surface, child: Scaffold( backgroundColor: Theme.of(context).colorScheme.background, diff --git a/lib/widgets/cards.dart b/lib/widgets/cards.dart index fd99d4929..5983608df 100644 --- a/lib/widgets/cards.dart +++ b/lib/widgets/cards.dart @@ -152,3 +152,41 @@ class RequestDetailsCard extends StatelessWidget { ); } } + +class SidebarEnvironmentCard extends StatelessWidget { + const SidebarEnvironmentCard({ + super.key, + required this.id, + this.isGlobal = false, + this.isSelected = false, + this.isActive = false, + this.name, + this.editRequestId, + this.onTap, + this.onDoubleTap, + this.onSecondaryTap, + this.onChangedNameEditor, + this.focusNode, + this.onTapOutsideNameEditor, + this.onMenuSelected, + }); + + final String id; + final bool isGlobal; + final bool isSelected; + final bool isActive; + final String? name; + final String? editRequestId; + final void Function()? onTap; + final void Function()? onDoubleTap; + final void Function()? onSecondaryTap; + final Function(String)? onChangedNameEditor; + final FocusNode? focusNode; + final Function()? onTapOutsideNameEditor; + final Function(RequestItemMenuOption)? onMenuSelected; + + @override + Widget build(BuildContext context) { + return const SizedBox(); + } +} diff --git a/lib/widgets/splitviews.dart b/lib/widgets/splitviews.dart index 935bc6177..f4a30e32b 100644 --- a/lib/widgets/splitviews.dart +++ b/lib/widgets/splitviews.dart @@ -1,6 +1,11 @@ +import 'package:apidash/screens/mobile/widgets/left_drawer.dart'; import 'package:flutter/material.dart'; +import 'package:hooks_riverpod/hooks_riverpod.dart'; +import 'package:inner_drawer/inner_drawer.dart'; import 'package:multi_split_view/multi_split_view.dart'; import 'package:apidash/consts.dart'; +import 'package:apidash/providers/ui_providers.dart'; +import 'package:flutter_hooks/flutter_hooks.dart'; class DashboardSplitView extends StatefulWidget { const DashboardSplitView({ @@ -110,3 +115,85 @@ class _EqualSplitViewState extends State { super.dispose(); } } + +class TwoDrawerSplitView extends HookConsumerWidget { + const TwoDrawerSplitView({ + super.key, + required this.innerDrawerKey, + required this.offset, + required this.mainContent, + required this.leftDrawerContent, + this.rightDrawerContent, + }); + + final GlobalKey innerDrawerKey; + final IDOffset offset; + final Widget mainContent; + final Widget leftDrawerContent; + final Widget? rightDrawerContent; + + @override + Widget build(BuildContext context, WidgetRef ref) { + ValueNotifier dragPosition = useState(0.0); + ValueNotifier drawerDirection = + ValueNotifier(InnerDrawerDirection.start); + + Color calculateBackgroundColor(double dragPosition) { + Color start = Theme.of(context).colorScheme.surface; + Color end = Theme.of(context).colorScheme.onInverseSurface; + return dragPosition == 0 ? start : end; + } + + return InnerDrawer( + key: innerDrawerKey, + swipe: true, + swipeChild: true, + onTapClose: true, + offset: offset, + boxShadow: [ + BoxShadow( + offset: const Offset(1, 0), + color: Theme.of(context).colorScheme.onInverseSurface, + blurRadius: 0, + ), + ], + colorTransitionChild: Colors.transparent, + colorTransitionScaffold: Colors.transparent, + rightAnimationType: InnerDrawerAnimation.linear, + backgroundDecoration: + BoxDecoration(color: Theme.of(context).colorScheme.onInverseSurface), + onDragUpdate: (value, direction) { + drawerDirection.value = direction; + if (value > 0.98 && direction == InnerDrawerDirection.start) { + dragPosition.value = 1; + } else { + dragPosition.value = 0; + } + }, + innerDrawerCallback: (isOpened) { + if (drawerDirection.value == InnerDrawerDirection.start) { + ref.read(leftDrawerStateProvider.notifier).state = isOpened; + } + }, + leftChild: LeftDrawer(drawerContent: leftDrawerContent), + rightChild: rightDrawerContent, + scaffold: ValueListenableBuilder( + valueListenable: dragPosition, + builder: (context, value, child) { + return Container( + color: calculateBackgroundColor(value), + child: child, + ); + }, + child: ClipRRect( + borderRadius: const BorderRadius.only(topLeft: Radius.circular(8)), + child: SafeArea( + minimum: kIsWindows || kIsMacOS ? kPt28 : EdgeInsets.zero, + bottom: false, + child: mainContent, + ), + ), + ), + ); + } +} diff --git a/pubspec.lock b/pubspec.lock index 0d8cedefe..bd3a0f368 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -390,6 +390,14 @@ packages: description: flutter source: sdk version: "0.0.0" + flutter_hooks: + dependency: "direct main" + description: + name: flutter_hooks + sha256: cde36b12f7188c85286fba9b38cc5a902e7279f36dd676967106c041dc9dde70 + url: "https://pub.dev" + source: hosted + version: "0.20.5" flutter_keyboard_visibility: dependency: transitive description: @@ -576,6 +584,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.1.0" + hooks_riverpod: + dependency: "direct main" + description: + name: hooks_riverpod + sha256: "45b2030a18bcd6dbd680c2c91bc3b33e3fe7c323e3acb5ecec93a613e2fbaa8a" + url: "https://pub.dev" + source: hosted + version: "2.5.1" html: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index 88294a6e3..3d0923417 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -61,6 +61,8 @@ dependencies: flex_color_scheme: ^7.3.1 data_table_2: ^2.5.11 file_selector: ^1.0.3 + hooks_riverpod: ^2.5.1 + flutter_hooks: ^0.20.5 dependency_overrides: web: ^0.5.0 From a3381c9f38390a4ca066c765b85d0d791b7a6769 Mon Sep 17 00:00:00 2001 From: DenserMeerkat Date: Tue, 11 Jun 2024 13:22:17 +0530 Subject: [PATCH 06/12] fix: merge --- lib/screens/dashboard.dart | 3 - lib/screens/envvar/environment_page.dart | 0 lib/screens/envvar/environments_pane.dart | 129 ---------------------- 3 files changed, 132 deletions(-) delete mode 100644 lib/screens/envvar/environment_page.dart delete mode 100644 lib/screens/envvar/environments_pane.dart diff --git a/lib/screens/dashboard.dart b/lib/screens/dashboard.dart index b5a9e0332..1c6aef0a4 100644 --- a/lib/screens/dashboard.dart +++ b/lib/screens/dashboard.dart @@ -58,13 +58,11 @@ class Dashboard extends ConsumerWidget { children: [ Padding( padding: const EdgeInsets.only(bottom: 16.0), - child: bottomButton(context, ref, railIdx, 2, child: bottomButton(context, ref, railIdx, 2, Icons.help, Icons.help_outline), ), Padding( padding: const EdgeInsets.only(bottom: 16.0), - child: bottomButton(context, ref, railIdx, 3, child: bottomButton(context, ref, railIdx, 3, Icons.settings, Icons.settings_outlined), ), @@ -97,7 +95,6 @@ class Dashboard extends ConsumerWidget { children: const [ HomePage(), SizedBox(), - SizedBox(), IntroPage(), SettingsPage(), ], diff --git a/lib/screens/envvar/environment_page.dart b/lib/screens/envvar/environment_page.dart deleted file mode 100644 index e69de29bb..000000000 diff --git a/lib/screens/envvar/environments_pane.dart b/lib/screens/envvar/environments_pane.dart deleted file mode 100644 index e5200889d..000000000 --- a/lib/screens/envvar/environments_pane.dart +++ /dev/null @@ -1,129 +0,0 @@ -import 'package:apidash/consts.dart'; -import 'package:apidash/extensions/extensions.dart'; -import 'package:apidash/models/environment_model.dart'; -import 'package:apidash/providers/providers.dart'; -import 'package:flutter/material.dart'; -import 'package:hooks_riverpod/hooks_riverpod.dart'; -import 'package:flutter_hooks/flutter_hooks.dart'; - -class EnvironmentsPane extends ConsumerWidget { - const EnvironmentsPane({ - super.key, - }); - - @override - Widget build(BuildContext context, WidgetRef ref) { - return const SizedBox(); - } -} - -class EnvironmentsList extends HookConsumerWidget { - const EnvironmentsList({ - super.key, - }); - - @override - Widget build(BuildContext context, WidgetRef ref) { - final environmentSequence = ref.watch(environmentSequenceProvider); - final environmentItems = ref.watch(environmentsStateNotifierProvider)!; - final alwaysShowEnvironmentsPaneScrollbar = ref.watch(settingsProvider - .select((value) => value.alwaysShowCollectionPaneScrollbar)); - final filterQuery = ref.watch(environmentSearchQueryProvider).trim(); - - ScrollController scrollController = useScrollController(); - return Scrollbar( - controller: scrollController, - thumbVisibility: alwaysShowEnvironmentsPaneScrollbar, - radius: const Radius.circular(12), - child: filterQuery.isEmpty - ? ReorderableListView.builder( - padding: context.isMediumWindow - ? EdgeInsets.only( - bottom: MediaQuery.paddingOf(context).bottom, - right: 8, - ) - : kPe8, - scrollController: scrollController, - buildDefaultDragHandles: false, - itemCount: environmentSequence.length, - onReorder: (int oldIndex, int newIndex) { - if (oldIndex < newIndex) { - newIndex -= 1; - } - if (oldIndex != newIndex) { - ref - .read(collectionStateNotifierProvider.notifier) - .reorder(oldIndex, newIndex); - } - }, - itemBuilder: (context, index) { - var id = environmentSequence[index]; - if (kIsMobile) { - return ReorderableDelayedDragStartListener( - key: ValueKey(id), - index: index, - child: Padding( - padding: kP1, - child: EnvironmentItem( - id: id, - environmentModel: environmentItems[id]!, - ), - ), - ); - } - return ReorderableDragStartListener( - key: ValueKey(id), - index: index, - child: Padding( - padding: kP1, - child: EnvironmentItem( - id: id, - environmentModel: environmentItems[id]!, - ), - ), - ); - }, - ) - : ListView( - padding: context.isMediumWindow - ? EdgeInsets.only( - bottom: MediaQuery.paddingOf(context).bottom, - right: 8, - ) - : kPe8, - controller: scrollController, - children: environmentSequence.map((id) { - var item = environmentItems[id]!; - if (item.name.toLowerCase().contains(filterQuery)) { - return Padding( - padding: kP1, - child: EnvironmentItem( - id: id, - environmentModel: item, - ), - ); - } - return const SizedBox(); - }).toList(), - ), - ); - } -} - -class EnvironmentItem extends ConsumerWidget { - const EnvironmentItem({ - super.key, - required this.id, - required this.environmentModel, - }); - - final String id; - final EnvironmentModel environmentModel; - - @override - Widget build(BuildContext context, WidgetRef ref) { - final selectedId = ref.watch(selectedEnvironmentIdProvider); - - return Text(environmentModel.name); - } -} From 9c4b49267918e555564a6a46ad384bcb97b513ab Mon Sep 17 00:00:00 2001 From: DenserMeerkat Date: Tue, 11 Jun 2024 23:26:52 +0530 Subject: [PATCH 07/12] fix: navbar responsiveness --- lib/screens/mobile/navbar.dart | 2 + lib/screens/mobile/widgets/page_base.dart | 46 +++++++++++++++-------- 2 files changed, 32 insertions(+), 16 deletions(-) diff --git a/lib/screens/mobile/navbar.dart b/lib/screens/mobile/navbar.dart index ab516c5b4..e129f80b2 100644 --- a/lib/screens/mobile/navbar.dart +++ b/lib/screens/mobile/navbar.dart @@ -124,6 +124,7 @@ class NavRail extends ConsumerWidget { Icons.help, Icons.help_outline, 'About', + showLabel: false, ), const SizedBox(height: 24), customNavigationDestination( @@ -134,6 +135,7 @@ class NavRail extends ConsumerWidget { Icons.settings, Icons.settings_outlined, 'Settings', + showLabel: false, ), ], ), diff --git a/lib/screens/mobile/widgets/page_base.dart b/lib/screens/mobile/widgets/page_base.dart index 424608311..ab2f308c4 100644 --- a/lib/screens/mobile/widgets/page_base.dart +++ b/lib/screens/mobile/widgets/page_base.dart @@ -1,8 +1,10 @@ import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:apidash/consts.dart'; +import 'package:apidash/extensions/extensions.dart'; import 'package:apidash/providers/providers.dart'; import 'package:apidash/widgets/window_caption.dart'; +import '../navbar.dart'; class PageBase extends ConsumerWidget { final String title; @@ -13,27 +15,39 @@ class PageBase extends ConsumerWidget { Widget build(BuildContext context, WidgetRef ref) { final isDarkMode = ref.watch(settingsProvider.select((value) => value.isDark)); + final scaffold = Scaffold( + backgroundColor: Theme.of(context).colorScheme.background, + appBar: AppBar( + backgroundColor: Theme.of(context).colorScheme.background, + primary: true, + title: Text(title), + centerTitle: true, + ), + body: Padding( + padding: EdgeInsets.only( + bottom: MediaQuery.paddingOf(context).bottom, + ), + child: scaffoldBody, + ), + ); return Stack( children: [ Container( - padding: const EdgeInsets.only(bottom: 70) + + padding: (context.isCompactWindow + ? const EdgeInsets.only(bottom: 70) + : EdgeInsets.zero) + (kIsWindows || kIsMacOS ? kPt28 : EdgeInsets.zero), color: Theme.of(context).colorScheme.surface, - child: Scaffold( - backgroundColor: Theme.of(context).colorScheme.background, - appBar: AppBar( - backgroundColor: Theme.of(context).colorScheme.background, - primary: true, - title: Text(title), - centerTitle: true, - ), - body: Padding( - padding: EdgeInsets.only( - bottom: MediaQuery.paddingOf(context).bottom, - ), - child: scaffoldBody, - ), - ), + child: !context.isCompactWindow + ? Row( + children: [ + const NavRail(), + Expanded( + child: scaffold, + ), + ], + ) + : scaffold, ), if (kIsWindows) SizedBox( From 605196197337d0a5d545ab81f5cfc6df2b7384f6 Mon Sep 17 00:00:00 2001 From: DenserMeerkat Date: Thu, 13 Jun 2024 00:46:22 +0530 Subject: [PATCH 08/12] fix: migrate to native drawer --- lib/extensions/context_extensions.dart | 4 + lib/providers/ui_providers.dart | 7 +- lib/screens/home_page/collection_pane.dart | 165 ++++++++++---------- lib/screens/mobile/dashboard.dart | 54 +++---- lib/screens/mobile/navbar.dart | 69 -------- lib/screens/mobile/requests_page.dart | 71 +++------ lib/screens/mobile/response_drawer.dart | 43 +++-- lib/screens/mobile/widgets/left_drawer.dart | 46 ------ lib/screens/mobile/widgets/page_base.dart | 15 +- lib/widgets/splitviews.dart | 132 ++++++++-------- pubspec.lock | 8 - pubspec.yaml | 1 - 12 files changed, 222 insertions(+), 393 deletions(-) delete mode 100644 lib/screens/mobile/widgets/left_drawer.dart diff --git a/lib/extensions/context_extensions.dart b/lib/extensions/context_extensions.dart index 8d334df05..69f978933 100644 --- a/lib/extensions/context_extensions.dart +++ b/lib/extensions/context_extensions.dart @@ -15,4 +15,8 @@ extension MediaQueryExtension on BuildContext { bool get isExtraLargeWindow => MediaQuery.of(this).size.width > kLargeWindowWidth; + + double get width => MediaQuery.of(this).size.width; + + double get height => MediaQuery.of(this).size.height; } diff --git a/lib/providers/ui_providers.dart b/lib/providers/ui_providers.dart index 0a6be4411..e7d670386 100644 --- a/lib/providers/ui_providers.dart +++ b/lib/providers/ui_providers.dart @@ -1,9 +1,8 @@ -import 'package:flutter/widgets.dart'; +import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; -import 'package:inner_drawer/inner_drawer.dart'; -final mobileDrawerKeyProvider = StateProvider>( - (ref) => GlobalKey()); +final mobileScaffoldKeyStateProvider = StateProvider>( + (ref) => GlobalKey()); final leftDrawerStateProvider = StateProvider((ref) => false); final navRailIndexStateProvider = StateProvider((ref) => 0); final selectedIdEditStateProvider = StateProvider((ref) => null); diff --git a/lib/screens/home_page/collection_pane.dart b/lib/screens/home_page/collection_pane.dart index 9d9b73403..e1edd9787 100644 --- a/lib/screens/home_page/collection_pane.dart +++ b/lib/screens/home_page/collection_pane.dart @@ -22,91 +22,99 @@ class CollectionPane extends ConsumerWidget { child: CircularProgressIndicator(), ); } - return Padding( - padding: kIsMacOS ? kP24CollectionPane : kP8CollectionPane, - child: Column( - crossAxisAlignment: CrossAxisAlignment.stretch, - children: [ - Padding( - padding: kPe8, - child: Wrap( - alignment: WrapAlignment.spaceBetween, - children: [ - TextButton.icon( - onPressed: (savingData || !hasUnsavedChanges) - ? null - : () async { - overlayWidget.show( - widget: - const SavingOverlay(saveCompleted: false)); + return Drawer( + shape: const ContinuousRectangleBorder(), + backgroundColor: Theme.of(context).colorScheme.surface, + surfaceTintColor: kColorTransparent, + child: Padding( + padding: !context.isMediumWindow && kIsMacOS + ? kP24CollectionPane + : kP8CollectionPane, + child: Column( + crossAxisAlignment: CrossAxisAlignment.stretch, + children: [ + Padding( + padding: kPe8, + child: Wrap( + alignment: WrapAlignment.spaceBetween, + children: [ + TextButton.icon( + onPressed: (savingData || !hasUnsavedChanges) + ? null + : () async { + overlayWidget.show( + widget: + const SavingOverlay(saveCompleted: false)); - await ref - .read(collectionStateNotifierProvider.notifier) - .saveData(); - overlayWidget.hide(); - overlayWidget.show( - widget: const SavingOverlay(saveCompleted: true)); - await Future.delayed(const Duration(seconds: 1)); - overlayWidget.hide(); - }, - icon: const Icon( - Icons.save, - size: 20, - ), - label: const Text( - kLabelSave, - style: kTextStyleButton, + await ref + .read(collectionStateNotifierProvider.notifier) + .saveData(); + overlayWidget.hide(); + overlayWidget.show( + widget: + const SavingOverlay(saveCompleted: true)); + await Future.delayed(const Duration(seconds: 1)); + overlayWidget.hide(); + }, + icon: const Icon( + Icons.save, + size: 20, + ), + label: const Text( + kLabelSave, + style: kTextStyleButton, + ), ), - ), - //const Spacer(), - ElevatedButton( - onPressed: () { - ref.read(collectionStateNotifierProvider.notifier).add(); - }, - child: const Text( - kLabelPlusNew, - style: kTextStyleButton, + //const Spacer(), + ElevatedButton( + onPressed: () { + ref.read(collectionStateNotifierProvider.notifier).add(); + }, + child: const Text( + kLabelPlusNew, + style: kTextStyleButton, + ), ), - ), - ], - ), - ), - kVSpacer10, - Container( - margin: const EdgeInsets.only(right: 8), - decoration: BoxDecoration( - borderRadius: kBorderRadius8, - border: Border.all( - color: Theme.of(context).colorScheme.surfaceVariant, + ], ), ), - child: Row( - children: [ - kHSpacer5, - Icon( - Icons.filter_alt, - size: 18, - color: Theme.of(context).colorScheme.secondary, + kVSpacer10, + Container( + margin: const EdgeInsets.only(right: 8), + decoration: BoxDecoration( + borderRadius: kBorderRadius8, + border: Border.all( + color: Theme.of(context).colorScheme.surfaceVariant, ), - kHSpacer5, - Expanded( - child: RawTextField( - style: Theme.of(context).textTheme.bodyMedium, - hintText: "Filter by name or URL", - onChanged: (value) { - ref.read(collectionSearchQueryProvider.notifier).state = - value.toLowerCase(); - }, + ), + child: Row( + children: [ + kHSpacer5, + Icon( + Icons.filter_alt, + size: 18, + color: Theme.of(context).colorScheme.secondary, ), - ), - ], + kHSpacer5, + Expanded( + child: RawTextField( + style: Theme.of(context).textTheme.bodyMedium, + hintText: "Filter by name or URL", + onChanged: (value) { + ref.read(collectionSearchQueryProvider.notifier).state = + value.toLowerCase(); + }, + ), + ), + ], + ), + ), + kVSpacer10, + const Expanded( + child: RequestList(), ), - ), - kVSpacer10, - const Expanded( - child: RequestList(), - ), - ], + ], + ), ), ); } @@ -240,7 +248,6 @@ class RequestItem extends ConsumerWidget { Widget build(BuildContext context, WidgetRef ref) { final selectedId = ref.watch(selectedIdStateProvider); final editRequestId = ref.watch(selectedIdEditStateProvider); - final mobileDrawerKey = ref.watch(mobileDrawerKeyProvider); return SidebarRequestCard( id: id, @@ -250,7 +257,7 @@ class RequestItem extends ConsumerWidget { selectedId: selectedId, editRequestId: editRequestId, onTap: () { - mobileDrawerKey.currentState?.close(); + ref.read(mobileScaffoldKeyStateProvider).currentState?.closeDrawer(); ref.read(selectedIdStateProvider.notifier).state = id; }, // onDoubleTap: () { diff --git a/lib/screens/mobile/dashboard.dart b/lib/screens/mobile/dashboard.dart index 123ccaeab..805c37b97 100644 --- a/lib/screens/mobile/dashboard.dart +++ b/lib/screens/mobile/dashboard.dart @@ -1,8 +1,7 @@ -import 'package:apidash/widgets/splitviews.dart'; +import 'package:apidash/consts.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; -import 'package:inner_drawer/inner_drawer.dart'; import 'package:flex_color_scheme/flex_color_scheme.dart'; import 'package:apidash/extensions/extensions.dart'; import 'package:apidash/providers/providers.dart'; @@ -10,8 +9,6 @@ import '../intro_page.dart'; import '../settings_page.dart'; import 'navbar.dart'; import 'requests_page.dart'; -import 'response_drawer.dart'; -import '../home_page/collection_pane.dart'; import 'widgets/page_base.dart'; class MobileDashboard extends ConsumerStatefulWidget { @@ -27,9 +24,8 @@ class _MobileDashboardState extends ConsumerState { BuildContext context, ) { final railIdx = ref.watch(navRailIndexStateProvider); - final GlobalKey innerDrawerKey = - ref.watch(mobileDrawerKeyProvider); final isLeftDrawerOpen = ref.watch(leftDrawerStateProvider); + return AnnotatedRegion( value: FlexColorScheme.themedSystemNavigationBar( context, @@ -41,9 +37,8 @@ class _MobileDashboardState extends ConsumerState { children: [ PageBranch( pageIndex: railIdx, - innerDrawerKey: innerDrawerKey, ), - if (context.isCompactWindow) + if (context.isMediumWindow) AnimatedPositioned( bottom: isLeftDrawerOpen ? 0 @@ -61,28 +56,32 @@ class _MobileDashboardState extends ConsumerState { } } -class PageBranch extends StatelessWidget { +class PageBranch extends ConsumerWidget { const PageBranch({ super.key, required this.pageIndex, - required this.innerDrawerKey, }); final int pageIndex; - final GlobalKey innerDrawerKey; - @override - Widget build(BuildContext context) { + Widget build(BuildContext context, WidgetRef ref) { + final scaffoldKey = ref.watch(mobileScaffoldKeyStateProvider); switch (pageIndex) { case 1: - return TwoDrawerSplitView( - key: const ValueKey('env'), - innerDrawerKey: innerDrawerKey, - offset: !context.isCompactWindow - ? const IDOffset.only(left: 0.1) - : const IDOffset.only(left: 0.7), - leftDrawerContent: const SizedBox(), - mainContent: const SizedBox(), + // Temporary Environment Page + return Scaffold( + key: scaffoldKey, + appBar: AppBar( + title: const Text('Environments'), + ), + onDrawerChanged: (isOpened) { + ref.read(leftDrawerStateProvider.notifier).state = isOpened; + }, + drawer: const Drawer( + surfaceTintColor: kColorTransparent, + shape: ContinuousRectangleBorder(), + ), + body: const SizedBox(), ); case 2: return const PageBase( @@ -95,17 +94,8 @@ class PageBranch extends StatelessWidget { scaffoldBody: SettingsPage(), ); default: - return TwoDrawerSplitView( - key: const ValueKey('home'), - innerDrawerKey: innerDrawerKey, - offset: !context.isCompactWindow - ? const IDOffset.only(left: 0.1, right: 1) - : const IDOffset.only(left: 0.7, right: 1), - leftDrawerContent: const CollectionPane(), - rightDrawerContent: const ResponseDrawer(), - mainContent: RequestsPage( - innerDrawerKey: innerDrawerKey, - ), + return RequestsPage( + scaffoldKey: scaffoldKey, ); } } diff --git a/lib/screens/mobile/navbar.dart b/lib/screens/mobile/navbar.dart index e129f80b2..81ec1abb2 100644 --- a/lib/screens/mobile/navbar.dart +++ b/lib/screens/mobile/navbar.dart @@ -75,75 +75,6 @@ class BottomNavBar extends ConsumerWidget { } } -class NavRail extends ConsumerWidget { - const NavRail({super.key}); - - @override - Widget build(BuildContext context, WidgetRef ref) { - final railIdx = ref.watch(navRailIndexStateProvider); - return Material( - type: MaterialType.transparency, - child: Container( - width: 70, - padding: const EdgeInsets.symmetric(vertical: 16, horizontal: 8), - decoration: BoxDecoration( - border: Border( - right: BorderSide( - color: Theme.of(context).colorScheme.onInverseSurface, - width: 1, - ), - ), - ), - child: Column( - children: [ - customNavigationDestination( - context, - ref, - railIdx, - 0, - Icons.dashboard, - Icons.dashboard_outlined, - 'Requests', - ), - const SizedBox(height: 16), - customNavigationDestination( - context, - ref, - railIdx, - 1, - Icons.laptop_windows, - Icons.laptop_windows_outlined, - 'Variables', - ), - const Expanded(child: SizedBox()), - customNavigationDestination( - context, - ref, - railIdx, - 2, - Icons.help, - Icons.help_outline, - 'About', - showLabel: false, - ), - const SizedBox(height: 24), - customNavigationDestination( - context, - ref, - railIdx, - 3, - Icons.settings, - Icons.settings_outlined, - 'Settings', - showLabel: false, - ), - ], - ), - ), - ); - } -} - Widget customNavigationDestination( BuildContext context, WidgetRef ref, diff --git a/lib/screens/mobile/requests_page.dart b/lib/screens/mobile/requests_page.dart index fb41b14dd..6f36c1448 100644 --- a/lib/screens/mobile/requests_page.dart +++ b/lib/screens/mobile/requests_page.dart @@ -1,58 +1,36 @@ import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; -import 'package:inner_drawer/inner_drawer.dart'; import 'package:apidash/providers/providers.dart'; import 'package:apidash/utils/http_utils.dart'; import 'package:apidash/consts.dart'; import 'package:apidash/widgets/widgets.dart'; +import '../home_page/collection_pane.dart'; import '../home_page/editor_pane/editor_request.dart'; import '../home_page/editor_pane/editor_pane.dart'; import '../home_page/editor_pane/url_card.dart'; import '../home_page/editor_pane/details_card/code_pane.dart'; +import 'response_drawer.dart'; import 'widgets/page_base.dart'; -class RequestsPage extends StatelessWidget { - final GlobalKey innerDrawerKey; +class RequestsPage extends ConsumerWidget { + const RequestsPage({ + super.key, + required this.scaffoldKey, + }); - const RequestsPage({super.key, required this.innerDrawerKey}); + final GlobalKey scaffoldKey; @override - Widget build(BuildContext context) { - return Scaffold( - backgroundColor: Colors.transparent, - appBar: AppBar( - backgroundColor: Theme.of(context).colorScheme.surface, - scrolledUnderElevation: 0, - shape: const RoundedRectangleBorder( - borderRadius: BorderRadius.only(topLeft: Radius.circular(8)), - ), - leading: IconButton( - icon: const Icon(Icons.format_list_bulleted_rounded), - onPressed: () { - innerDrawerKey.currentState! - .open(direction: InnerDrawerDirection.start); - }, - ), - title: const RequestTitle(), - titleSpacing: 0, - actions: [ - IconButton( - icon: Icon( - Icons.quickreply_outlined, - color: Theme.of(context).colorScheme.onBackground, - ), - onPressed: () { - innerDrawerKey.currentState! - .open(direction: InnerDrawerDirection.end); - }, - ), - ], - ), - body: Container( - color: Theme.of(context).colorScheme.surface, - child: const RequestEditorPane(), - ), - bottomNavigationBar: RequestPageBottombar(innerDrawerKey: innerDrawerKey), + Widget build(BuildContext context, WidgetRef ref) { + return TwoDrawerScaffold( + scaffoldKey: scaffoldKey, + title: const RequestTitle(), + leftDrawerContent: const CollectionPane(), + rightDrawerContent: const ResponseDrawer(), + mainContent: const RequestEditorPane(), + bottomNavigationBar: const RequestPageBottombar(), + onDrawerChanged: (value) => + ref.read(leftDrawerStateProvider.notifier).state = value, ); } } @@ -118,16 +96,13 @@ class RequestTitle extends ConsumerWidget { } } -class RequestPageBottombar extends StatelessWidget { +class RequestPageBottombar extends ConsumerWidget { const RequestPageBottombar({ super.key, - required this.innerDrawerKey, }); - final GlobalKey innerDrawerKey; - @override - Widget build(BuildContext context) { + Widget build(BuildContext context, WidgetRef ref) { return Container( height: 60 + MediaQuery.paddingOf(context).bottom, width: MediaQuery.sizeOf(context).width, @@ -168,8 +143,10 @@ class RequestPageBottombar extends StatelessWidget { ), SendButton( onTap: () { - innerDrawerKey.currentState! - .open(direction: InnerDrawerDirection.end); + ref + .read(mobileScaffoldKeyStateProvider) + .currentState! + .openEndDrawer(); }, ), ], diff --git a/lib/screens/mobile/response_drawer.dart b/lib/screens/mobile/response_drawer.dart index 40f0a9aa5..e7295c278 100644 --- a/lib/screens/mobile/response_drawer.dart +++ b/lib/screens/mobile/response_drawer.dart @@ -1,5 +1,4 @@ import 'package:flutter/material.dart'; -import 'package:apidash/consts.dart'; import '../home_page/editor_pane/details_card/response_pane.dart'; class ResponseDrawer extends StatelessWidget { @@ -7,31 +6,27 @@ class ResponseDrawer extends StatelessWidget { @override Widget build(BuildContext context) { - return Container( - padding: kIsWindows || kIsMacOS ? kPt28 : EdgeInsets.zero, - color: Theme.of(context).colorScheme.surface, - child: Scaffold( - appBar: AppBar( - backgroundColor: Theme.of(context).colorScheme.surface, - shape: const RoundedRectangleBorder( - borderRadius: BorderRadius.vertical(top: Radius.circular(8)), - ), - leading: IconButton( - icon: const Icon(Icons.arrow_back_rounded), - onPressed: () { - Navigator.of(context).pop(); - }, - ), - scrolledUnderElevation: 0, - centerTitle: true, - title: const Text("Response"), + return Scaffold( + appBar: AppBar( + backgroundColor: Theme.of(context).colorScheme.surface, + shape: const RoundedRectangleBorder( + borderRadius: BorderRadius.vertical(top: Radius.circular(8)), ), - body: Padding( - padding: EdgeInsets.only( - bottom: MediaQuery.paddingOf(context).bottom, - ), - child: const ResponsePane(), + leading: IconButton( + icon: const Icon(Icons.arrow_back_rounded), + onPressed: () { + Navigator.of(context).pop(); + }, ), + scrolledUnderElevation: 0, + centerTitle: true, + title: const Text("Response"), + ), + body: Padding( + padding: EdgeInsets.only( + bottom: MediaQuery.paddingOf(context).bottom, + ), + child: const ResponsePane(), ), ); } diff --git a/lib/screens/mobile/widgets/left_drawer.dart b/lib/screens/mobile/widgets/left_drawer.dart deleted file mode 100644 index d7f6973d3..000000000 --- a/lib/screens/mobile/widgets/left_drawer.dart +++ /dev/null @@ -1,46 +0,0 @@ -import 'package:apidash/consts.dart'; -import 'package:apidash/extensions/extensions.dart'; -import 'package:apidash/screens/mobile/navbar.dart'; -import 'package:flutter/material.dart'; - -class LeftDrawer extends StatelessWidget { - final Widget drawerContent; - const LeftDrawer({super.key, required this.drawerContent}); - - @override - Widget build(BuildContext context) { - return Container( - padding: EdgeInsets.only(top: MediaQuery.paddingOf(context).top) + - (kIsWindows || kIsMacOS ? kPt28 : EdgeInsets.zero), - color: Theme.of(context).colorScheme.onInverseSurface, - child: Drawer( - backgroundColor: Colors.transparent, - surfaceTintColor: Colors.transparent, - child: Padding( - padding: const EdgeInsets.only(right: 16), - child: Container( - padding: EdgeInsets.only( - left: MediaQuery.paddingOf(context).left, - bottom: !context.isCompactWindow - ? MediaQuery.paddingOf(context).bottom - : 70 + MediaQuery.paddingOf(context).bottom), - clipBehavior: Clip.hardEdge, - decoration: BoxDecoration( - color: Theme.of(context).colorScheme.surface, - borderRadius: - const BorderRadius.only(topRight: Radius.circular(8)), - ), - child: !context.isCompactWindow - ? Row( - children: [ - const NavRail(), - Expanded(child: drawerContent), - ], - ) - : drawerContent, - ), - ), - ), - ); - } -} diff --git a/lib/screens/mobile/widgets/page_base.dart b/lib/screens/mobile/widgets/page_base.dart index ab2f308c4..b1bbb247e 100644 --- a/lib/screens/mobile/widgets/page_base.dart +++ b/lib/screens/mobile/widgets/page_base.dart @@ -4,7 +4,6 @@ import 'package:apidash/consts.dart'; import 'package:apidash/extensions/extensions.dart'; import 'package:apidash/providers/providers.dart'; import 'package:apidash/widgets/window_caption.dart'; -import '../navbar.dart'; class PageBase extends ConsumerWidget { final String title; @@ -22,6 +21,7 @@ class PageBase extends ConsumerWidget { primary: true, title: Text(title), centerTitle: true, + scrolledUnderElevation: 0, ), body: Padding( padding: EdgeInsets.only( @@ -33,21 +33,12 @@ class PageBase extends ConsumerWidget { return Stack( children: [ Container( - padding: (context.isCompactWindow + padding: (context.isMediumWindow ? const EdgeInsets.only(bottom: 70) : EdgeInsets.zero) + (kIsWindows || kIsMacOS ? kPt28 : EdgeInsets.zero), color: Theme.of(context).colorScheme.surface, - child: !context.isCompactWindow - ? Row( - children: [ - const NavRail(), - Expanded( - child: scaffold, - ), - ], - ) - : scaffold, + child: scaffold, ), if (kIsWindows) SizedBox( diff --git a/lib/widgets/splitviews.dart b/lib/widgets/splitviews.dart index f4a30e32b..8145e6b70 100644 --- a/lib/widgets/splitviews.dart +++ b/lib/widgets/splitviews.dart @@ -1,11 +1,7 @@ -import 'package:apidash/screens/mobile/widgets/left_drawer.dart'; import 'package:flutter/material.dart'; -import 'package:hooks_riverpod/hooks_riverpod.dart'; -import 'package:inner_drawer/inner_drawer.dart'; import 'package:multi_split_view/multi_split_view.dart'; +import 'package:apidash/extensions/extensions.dart'; import 'package:apidash/consts.dart'; -import 'package:apidash/providers/ui_providers.dart'; -import 'package:flutter_hooks/flutter_hooks.dart'; class DashboardSplitView extends StatefulWidget { const DashboardSplitView({ @@ -116,83 +112,77 @@ class _EqualSplitViewState extends State { } } -class TwoDrawerSplitView extends HookConsumerWidget { - const TwoDrawerSplitView({ +class TwoDrawerScaffold extends StatelessWidget { + const TwoDrawerScaffold({ super.key, - required this.innerDrawerKey, - required this.offset, + required this.scaffoldKey, required this.mainContent, - required this.leftDrawerContent, + required this.title, + this.actions, + this.leftDrawerContent, this.rightDrawerContent, + this.rightDrawerIcon, + this.bottomNavigationBar, + this.onDrawerChanged, + this.onEndDrawerChanged, }); - final GlobalKey innerDrawerKey; - final IDOffset offset; + final GlobalKey scaffoldKey; final Widget mainContent; - final Widget leftDrawerContent; + final Widget title; + final List? actions; + final Widget? leftDrawerContent; final Widget? rightDrawerContent; + final IconData? rightDrawerIcon; + final Widget? bottomNavigationBar; + final ValueChanged? onDrawerChanged; + final ValueChanged? onEndDrawerChanged; @override - Widget build(BuildContext context, WidgetRef ref) { - ValueNotifier dragPosition = useState(0.0); - ValueNotifier drawerDirection = - ValueNotifier(InnerDrawerDirection.start); - - Color calculateBackgroundColor(double dragPosition) { - Color start = Theme.of(context).colorScheme.surface; - Color end = Theme.of(context).colorScheme.onInverseSurface; - return dragPosition == 0 ? start : end; - } - - return InnerDrawer( - key: innerDrawerKey, - swipe: true, - swipeChild: true, - onTapClose: true, - offset: offset, - boxShadow: [ - BoxShadow( - offset: const Offset(1, 0), - color: Theme.of(context).colorScheme.onInverseSurface, - blurRadius: 0, - ), - ], - colorTransitionChild: Colors.transparent, - colorTransitionScaffold: Colors.transparent, - rightAnimationType: InnerDrawerAnimation.linear, - backgroundDecoration: - BoxDecoration(color: Theme.of(context).colorScheme.onInverseSurface), - onDragUpdate: (value, direction) { - drawerDirection.value = direction; - if (value > 0.98 && direction == InnerDrawerDirection.start) { - dragPosition.value = 1; - } else { - dragPosition.value = 0; - } - }, - innerDrawerCallback: (isOpened) { - if (drawerDirection.value == InnerDrawerDirection.start) { - ref.read(leftDrawerStateProvider.notifier).state = isOpened; - } - }, - leftChild: LeftDrawer(drawerContent: leftDrawerContent), - rightChild: rightDrawerContent, - scaffold: ValueListenableBuilder( - valueListenable: dragPosition, - builder: (context, value, child) { - return Container( - color: calculateBackgroundColor(value), - child: child, - ); - }, - child: ClipRRect( - borderRadius: const BorderRadius.only(topLeft: Radius.circular(8)), - child: SafeArea( - minimum: kIsWindows || kIsMacOS ? kPt28 : EdgeInsets.zero, - bottom: false, - child: mainContent, + Widget build(BuildContext context) { + 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( + 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(); + }, + ), + ) + : const SizedBox.shrink()), + ], ), + drawer: leftDrawerContent, + endDrawer: rightDrawerContent, + body: mainContent, + bottomNavigationBar: bottomNavigationBar, ), ); } diff --git a/pubspec.lock b/pubspec.lock index bd3a0f368..4e4b5ddb7 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -640,14 +640,6 @@ packages: url: "https://pub.dev" source: hosted version: "4.2.0" - inner_drawer: - dependency: "direct main" - description: - name: inner_drawer - sha256: "19df8813ccb6aa1b6db76f2f976c93befbbae67452d019f5267209b15deb0772" - url: "https://pub.dev" - source: hosted - version: "1.0.0+1" io: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index 3d0923417..922f98dfb 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -57,7 +57,6 @@ dependencies: dart_style: ^2.3.6 json_text_field: ^1.1.0 csv: ^6.0.0 - inner_drawer: ^1.0.0+1 flex_color_scheme: ^7.3.1 data_table_2: ^2.5.11 file_selector: ^1.0.3 From 2eebe33d3b783b71bdab811888a86dc566d54971 Mon Sep 17 00:00:00 2001 From: DenserMeerkat Date: Thu, 13 Jun 2024 00:56:17 +0530 Subject: [PATCH 09/12] fix: collection pane scroll padding --- lib/consts.dart | 11 +++++++++-- lib/screens/home_page/collection_pane.dart | 8 +++++--- lib/screens/mobile/widgets/page_base.dart | 4 +--- 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/lib/consts.dart b/lib/consts.dart index 625eaafec..1333cc86d 100644 --- a/lib/consts.dart +++ b/lib/consts.dart @@ -109,14 +109,21 @@ const kP8CollectionPane = EdgeInsets.only( //right: 4.0, // bottom: 8.0, ); -const kPt28 = EdgeInsets.only(top: 28); -const kPt32 = EdgeInsets.only(top: 32); +const kPt28 = EdgeInsets.only( + top: 28, +); +const kPt32 = EdgeInsets.only( + top: 32, +); const kPb10 = EdgeInsets.only( bottom: 10, ); const kPb15 = EdgeInsets.only( bottom: 15, ); +const kPb70 = EdgeInsets.only( + bottom: 70, +); const kHSpacer4 = SizedBox(width: 4); const kHSpacer5 = SizedBox(width: 5); const kHSpacer10 = SizedBox(width: 10); diff --git a/lib/screens/home_page/collection_pane.dart b/lib/screens/home_page/collection_pane.dart index e1edd9787..66a3d93a4 100644 --- a/lib/screens/home_page/collection_pane.dart +++ b/lib/screens/home_page/collection_pane.dart @@ -27,9 +27,10 @@ class CollectionPane extends ConsumerWidget { backgroundColor: Theme.of(context).colorScheme.surface, surfaceTintColor: kColorTransparent, child: Padding( - padding: !context.isMediumWindow && kIsMacOS - ? kP24CollectionPane - : kP8CollectionPane, + padding: (!context.isMediumWindow && kIsMacOS + ? kP24CollectionPane + : kP8CollectionPane) + + (context.isMediumWindow ? kPb70 : EdgeInsets.zero), child: Column( crossAxisAlignment: CrossAxisAlignment.stretch, children: [ @@ -113,6 +114,7 @@ class CollectionPane extends ConsumerWidget { const Expanded( child: RequestList(), ), + kVSpacer5 ], ), ), diff --git a/lib/screens/mobile/widgets/page_base.dart b/lib/screens/mobile/widgets/page_base.dart index b1bbb247e..38fbbd7f7 100644 --- a/lib/screens/mobile/widgets/page_base.dart +++ b/lib/screens/mobile/widgets/page_base.dart @@ -33,9 +33,7 @@ class PageBase extends ConsumerWidget { return Stack( children: [ Container( - padding: (context.isMediumWindow - ? const EdgeInsets.only(bottom: 70) - : EdgeInsets.zero) + + padding: (context.isMediumWindow ? kPb70 : EdgeInsets.zero) + (kIsWindows || kIsMacOS ? kPt28 : EdgeInsets.zero), color: Theme.of(context).colorScheme.surface, child: scaffold, From c200fbb56e459d9f8f81b0985633368b617097a5 Mon Sep 17 00:00:00 2001 From: DenserMeerkat Date: Thu, 13 Jun 2024 01:07:53 +0530 Subject: [PATCH 10/12] fix: click cursor on hover & cleanup --- lib/providers/ui_providers.dart | 3 +- lib/screens/home_page/collection_pane.dart | 4 +- lib/screens/mobile/navbar.dart | 132 ++++++++++----------- lib/widgets/cards.dart | 38 ------ 4 files changed, 64 insertions(+), 113 deletions(-) diff --git a/lib/providers/ui_providers.dart b/lib/providers/ui_providers.dart index e7d670386..2db494b24 100644 --- a/lib/providers/ui_providers.dart +++ b/lib/providers/ui_providers.dart @@ -29,5 +29,4 @@ final nameTextFieldFocusNodeProvider = return focusNode; }); -final collectionSearchQueryProvider = StateProvider((ref) => ''); -final environmentSearchQueryProvider = StateProvider((ref) => ''); +final searchQueryProvider = StateProvider((ref) => ''); diff --git a/lib/screens/home_page/collection_pane.dart b/lib/screens/home_page/collection_pane.dart index 66a3d93a4..f1d121b18 100644 --- a/lib/screens/home_page/collection_pane.dart +++ b/lib/screens/home_page/collection_pane.dart @@ -102,7 +102,7 @@ class CollectionPane extends ConsumerWidget { style: Theme.of(context).textTheme.bodyMedium, hintText: "Filter by name or URL", onChanged: (value) { - ref.read(collectionSearchQueryProvider.notifier).state = + ref.read(searchQueryProvider.notifier).state = value.toLowerCase(); }, ), @@ -152,7 +152,7 @@ class _RequestListState extends ConsumerState { final requestItems = ref.watch(collectionStateNotifierProvider)!; final alwaysShowCollectionPaneScrollbar = ref.watch(settingsProvider .select((value) => value.alwaysShowCollectionPaneScrollbar)); - final filterQuery = ref.watch(collectionSearchQueryProvider).trim(); + final filterQuery = ref.watch(searchQueryProvider).trim(); return Scrollbar( controller: controller, diff --git a/lib/screens/mobile/navbar.dart b/lib/screens/mobile/navbar.dart index 81ec1abb2..47c16adc9 100644 --- a/lib/screens/mobile/navbar.dart +++ b/lib/screens/mobile/navbar.dart @@ -1,7 +1,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; -import 'package:apidash/extensions/context_extensions.dart'; -import 'package:apidash/providers/ui_providers.dart'; +import 'package:apidash/extensions/extensions.dart'; +import 'package:apidash/providers/providers.dart'; class BottomNavBar extends ConsumerWidget { const BottomNavBar({super.key}); @@ -87,78 +87,68 @@ Widget customNavigationDestination( Function()? onTap, }) { bool isSelected = railIdx == buttonIdx; - return TooltipVisibility( - visible: context.isCompactWindow, - child: Tooltip( - message: label, - triggerMode: TooltipTriggerMode.longPress, - verticalOffset: 42, - child: GestureDetector( - behavior: HitTestBehavior.translucent, - onTap: isSelected - ? null - : () { - ref.read(navRailIndexStateProvider.notifier).state = buttonIdx; - if (railIdx > 1 && buttonIdx <= 1) { - ref.read(leftDrawerStateProvider.notifier).state = false; - } - onTap?.call(); - }, - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Ink( - width: 65, - height: 32, - decoration: BoxDecoration( + return MouseRegion( + cursor: SystemMouseCursors.click, + child: GestureDetector( + behavior: HitTestBehavior.translucent, + onTap: isSelected + ? null + : () { + ref.read(navRailIndexStateProvider.notifier).state = buttonIdx; + if (railIdx > 1 && buttonIdx <= 1) { + ref.read(leftDrawerStateProvider.notifier).state = false; + } + onTap?.call(); + }, + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Ink( + width: 65, + height: 32, + decoration: BoxDecoration( + color: isSelected + ? Theme.of(context).colorScheme.secondaryContainer + : Colors.transparent, + borderRadius: BorderRadius.circular(30), + ), + child: InkWell( + borderRadius: BorderRadius.circular(30), + onTap: isSelected + ? null + : () { + ref.read(navRailIndexStateProvider.notifier).state = + buttonIdx; + if (railIdx > 1 && buttonIdx <= 1) { + ref.read(leftDrawerStateProvider.notifier).state = + false; + } + onTap?.call(); + }, + child: Icon( + isSelected ? selectedIcon : icon, color: isSelected - ? Theme.of(context).colorScheme.secondaryContainer - : Colors.transparent, - borderRadius: BorderRadius.circular(30), - ), - child: InkWell( - borderRadius: BorderRadius.circular(30), - onTap: isSelected - ? null - : () { - ref.read(navRailIndexStateProvider.notifier).state = - buttonIdx; - if (railIdx > 1 && buttonIdx <= 1) { - ref.read(leftDrawerStateProvider.notifier).state = - false; - } - onTap?.call(); - }, - child: Icon( - isSelected ? selectedIcon : icon, - color: isSelected - ? Theme.of(context).colorScheme.onSecondaryContainer - : Theme.of(context) - .colorScheme - .onSurface - .withOpacity(0.65), - ), + ? Theme.of(context).colorScheme.onSecondaryContainer + : Theme.of(context).colorScheme.onSurface.withOpacity(0.65), ), ), - showLabel ? const SizedBox(height: 4) : const SizedBox.shrink(), - showLabel - ? Text( - label, - style: Theme.of(context).textTheme.labelSmall!.copyWith( - fontWeight: FontWeight.w600, - color: isSelected - ? Theme.of(context) - .colorScheme - .onSecondaryContainer - : Theme.of(context) - .colorScheme - .onSurface - .withOpacity(0.65), - ), - ) - : const SizedBox.shrink(), - ], - ), + ), + showLabel ? const SizedBox(height: 4) : const SizedBox.shrink(), + showLabel + ? Text( + label, + style: Theme.of(context).textTheme.labelSmall!.copyWith( + fontWeight: FontWeight.w600, + color: isSelected + ? Theme.of(context).colorScheme.onSecondaryContainer + : Theme.of(context) + .colorScheme + .onSurface + .withOpacity(0.65), + ), + ) + : const SizedBox.shrink(), + ], ), ), ); diff --git a/lib/widgets/cards.dart b/lib/widgets/cards.dart index 5983608df..fd99d4929 100644 --- a/lib/widgets/cards.dart +++ b/lib/widgets/cards.dart @@ -152,41 +152,3 @@ class RequestDetailsCard extends StatelessWidget { ); } } - -class SidebarEnvironmentCard extends StatelessWidget { - const SidebarEnvironmentCard({ - super.key, - required this.id, - this.isGlobal = false, - this.isSelected = false, - this.isActive = false, - this.name, - this.editRequestId, - this.onTap, - this.onDoubleTap, - this.onSecondaryTap, - this.onChangedNameEditor, - this.focusNode, - this.onTapOutsideNameEditor, - this.onMenuSelected, - }); - - final String id; - final bool isGlobal; - final bool isSelected; - final bool isActive; - final String? name; - final String? editRequestId; - final void Function()? onTap; - final void Function()? onDoubleTap; - final void Function()? onSecondaryTap; - final Function(String)? onChangedNameEditor; - final FocusNode? focusNode; - final Function()? onTapOutsideNameEditor; - final Function(RequestItemMenuOption)? onMenuSelected; - - @override - Widget build(BuildContext context) { - return const SizedBox(); - } -} From d084fb45da13d56472680c0bad6b74272a011b1d Mon Sep 17 00:00:00 2001 From: DenserMeerkat Date: Thu, 13 Jun 2024 18:39:11 +0530 Subject: [PATCH 11/12] fix: compact window close --- lib/app.dart | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/app.dart b/lib/app.dart index 76aa62b97..a29b124b3 100644 --- a/lib/app.dart +++ b/lib/app.dart @@ -95,7 +95,7 @@ class _AppState extends ConsumerState with WindowListener { @override Widget build(BuildContext context) { - return const Dashboard(); + return context.isMediumWindow ? const MobileDashboard() : const Dashboard(); } } @@ -127,10 +127,10 @@ class DashApp extends ConsumerWidget { themeMode: isDarkMode ? ThemeMode.dark : ThemeMode.light, home: Stack( children: [ - context.isMediumWindow - ? const MobileDashboard() - : !kIsLinux && !kIsMobile - ? const App() + !kIsLinux && !kIsMobile + ? const App() + : context.isMediumWindow + ? const MobileDashboard() : const Dashboard(), if (kIsWindows) SizedBox( From 126de74ca373168886432049bb9e87a5c540105b Mon Sep 17 00:00:00 2001 From: DenserMeerkat Date: Sat, 15 Jun 2024 16:06:13 +0530 Subject: [PATCH 12/12] fix: bottom navbar --- lib/screens/mobile/dashboard.dart | 6 ++++-- lib/screens/mobile/navbar.dart | 1 - lib/screens/mobile/requests_page.dart | 2 ++ lib/screens/mobile/widgets/page_base.dart | 12 ++++++++++-- 4 files changed, 16 insertions(+), 5 deletions(-) diff --git a/lib/screens/mobile/dashboard.dart b/lib/screens/mobile/dashboard.dart index 805c37b97..4e6f51ca8 100644 --- a/lib/screens/mobile/dashboard.dart +++ b/lib/screens/mobile/dashboard.dart @@ -40,9 +40,11 @@ class _MobileDashboardState extends ConsumerState { ), if (context.isMediumWindow) AnimatedPositioned( - bottom: isLeftDrawerOpen + bottom: railIdx > 1 ? 0 - : -(72 + MediaQuery.paddingOf(context).bottom), + : isLeftDrawerOpen + ? 0 + : -(72 + MediaQuery.paddingOf(context).bottom), left: 0, right: 0, height: 70 + MediaQuery.paddingOf(context).bottom, diff --git a/lib/screens/mobile/navbar.dart b/lib/screens/mobile/navbar.dart index 47c16adc9..99ad861d0 100644 --- a/lib/screens/mobile/navbar.dart +++ b/lib/screens/mobile/navbar.dart @@ -1,6 +1,5 @@ import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; -import 'package:apidash/extensions/extensions.dart'; import 'package:apidash/providers/providers.dart'; class BottomNavBar extends ConsumerWidget { diff --git a/lib/screens/mobile/requests_page.dart b/lib/screens/mobile/requests_page.dart index 6f36c1448..89e7a0895 100644 --- a/lib/screens/mobile/requests_page.dart +++ b/lib/screens/mobile/requests_page.dart @@ -135,7 +135,9 @@ class RequestPageBottombar extends ConsumerWidget { builder: (context) => const PageBase( title: 'View Code', scaffoldBody: CodePane(), + addBottomPadding: false, ), + fullscreenDialog: true, ), ); }, diff --git a/lib/screens/mobile/widgets/page_base.dart b/lib/screens/mobile/widgets/page_base.dart index 38fbbd7f7..d1ee4e416 100644 --- a/lib/screens/mobile/widgets/page_base.dart +++ b/lib/screens/mobile/widgets/page_base.dart @@ -6,9 +6,15 @@ import 'package:apidash/providers/providers.dart'; import 'package:apidash/widgets/window_caption.dart'; class PageBase extends ConsumerWidget { + const PageBase({ + super.key, + required this.title, + required this.scaffoldBody, + this.addBottomPadding = true, + }); final String title; final Widget scaffoldBody; - const PageBase({super.key, required this.title, required this.scaffoldBody}); + final bool addBottomPadding; @override Widget build(BuildContext context, WidgetRef ref) { @@ -33,7 +39,9 @@ class PageBase extends ConsumerWidget { return Stack( children: [ Container( - padding: (context.isMediumWindow ? kPb70 : EdgeInsets.zero) + + padding: (addBottomPadding && context.isMediumWindow + ? kPb70 + : EdgeInsets.zero) + (kIsWindows || kIsMacOS ? kPt28 : EdgeInsets.zero), color: Theme.of(context).colorScheme.surface, child: scaffold,