From 8b9fd0d03d3aadc5f4c01b820fe4c4ec0a026280 Mon Sep 17 00:00:00 2001 From: nyne Date: Wed, 18 Dec 2024 17:19:34 +0800 Subject: [PATCH] improve pop_up_widget and side_bar in dark mode --- lib/components/pop_up_widget.dart | 17 ++++++++++++----- lib/components/side_bar.dart | 16 ++++++++++++---- 2 files changed, 24 insertions(+), 9 deletions(-) diff --git a/lib/components/pop_up_widget.dart b/lib/components/pop_up_widget.dart index 727b7bb..3436af5 100644 --- a/lib/components/pop_up_widget.dart +++ b/lib/components/pop_up_widget.dart @@ -22,8 +22,15 @@ class PopUpWidget extends PopupRoute { Widget body = PopupIndicatorWidget( child: Container( decoration: showPopUp - ? const BoxDecoration( + ? BoxDecoration( borderRadius: BorderRadius.all(Radius.circular(12)), + boxShadow: context.brightness == ui.Brightness.dark ? [ + BoxShadow( + color: Colors.white.withAlpha(50), + blurRadius: 10, + offset: Offset(0, 2), + ), + ] : null, ) : null, clipBehavior: showPopUp ? Clip.antiAlias : Clip.none, @@ -86,7 +93,8 @@ class PopupIndicatorWidget extends InheritedWidget { } Future showPopUpWidget(BuildContext context, Widget widget) async { - return await Navigator.of(context, rootNavigator: true).push(PopUpWidget(widget)); + return await Navigator.of(context, rootNavigator: true) + .push(PopUpWidget(widget)); } class PopUpWidgetScaffold extends StatefulWidget { @@ -127,9 +135,8 @@ class _PopUpWidgetScaffoldState extends State { message: "Back".tl, child: IconButton( icon: const Icon(Icons.arrow_back_sharp), - onPressed: () => context.canPop() - ? context.pop() - : App.pop(), + onPressed: () => + context.canPop() ? context.pop() : App.pop(), ), ), const SizedBox( diff --git a/lib/components/side_bar.dart b/lib/components/side_bar.dart index 1afb208..752cae4 100644 --- a/lib/components/side_bar.dart +++ b/lib/components/side_bar.dart @@ -57,10 +57,18 @@ class SideBarRoute extends PopupRoute { body = Container( decoration: BoxDecoration( - borderRadius: showSideBar - ? const BorderRadius.horizontal(left: Radius.circular(16)) - : null, - color: Theme.of(context).colorScheme.surfaceTint), + borderRadius: showSideBar + ? const BorderRadius.horizontal(left: Radius.circular(16)) + : null, + color: Theme.of(context).colorScheme.surfaceTint, + boxShadow: context.brightness == ui.Brightness.dark ? [ + BoxShadow( + color: Colors.white.withAlpha(50), + blurRadius: 10, + offset: Offset(0, 2), + ), + ] : null, + ), clipBehavior: Clip.antiAlias, constraints: BoxConstraints(maxWidth: sideBarWidth), height: MediaQuery.of(context).size.height,