From 016bca01f4fa8a235a8f97dcb3b542680cfb0c38 Mon Sep 17 00:00:00 2001 From: Godwin Asuquo Date: Thu, 23 Feb 2023 18:18:40 +0200 Subject: [PATCH] remove unused code --- lib/src/screens/base_page.dart | 4 +--- .../desktop_dashboard_navbar.dart} | 8 +++++-- .../desktop_sidebar_wrapper.dart | 22 +++---------------- lib/src/widgets/nav_bar.dart | 4 ++-- 4 files changed, 12 insertions(+), 26 deletions(-) rename lib/src/{widgets/desktop_nav_bar.dart => screens/dashboard/desktop_widgets/desktop_dashboard_navbar.dart} (81%) diff --git a/lib/src/screens/base_page.dart b/lib/src/screens/base_page.dart index a82314b48..123eef65c 100644 --- a/lib/src/screens/base_page.dart +++ b/lib/src/screens/base_page.dart @@ -35,8 +35,6 @@ abstract class BasePage extends StatelessWidget { Widget? get endDrawer => null; - PreferredSizeWidget? desktopAppBar(BuildContext context) => null; - AppBarStyle get appBarStyle => AppBarStyle.regular; Widget Function(BuildContext, Widget)? get rootWrapper => null; @@ -152,7 +150,7 @@ abstract class BasePage extends StatelessWidget { resizeToAvoidBottomInset: resizeToAvoidBottomInset, extendBodyBehindAppBar: extendBodyBehindAppBar, endDrawer: endDrawer, - appBar: desktopAppBar(context) ?? appBar(context), + appBar: appBar(context), body: body(context), floatingActionButton: floatingActionButton(context)); diff --git a/lib/src/widgets/desktop_nav_bar.dart b/lib/src/screens/dashboard/desktop_widgets/desktop_dashboard_navbar.dart similarity index 81% rename from lib/src/widgets/desktop_nav_bar.dart rename to lib/src/screens/dashboard/desktop_widgets/desktop_dashboard_navbar.dart index ae12726e4..b97def132 100644 --- a/lib/src/widgets/desktop_nav_bar.dart +++ b/lib/src/screens/dashboard/desktop_widgets/desktop_dashboard_navbar.dart @@ -1,14 +1,15 @@ import 'package:cake_wallet/di.dart'; import 'package:cake_wallet/store/settings_store.dart'; import 'package:cake_wallet/themes/theme_base.dart'; +import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -class DesktopNavbar extends StatelessWidget implements PreferredSizeWidget { +class DesktopDashboardNavbar extends StatelessWidget implements ObstructingPreferredSizeWidget { final Widget leading; final Widget middle; final Widget trailing; - DesktopNavbar({ + DesktopDashboardNavbar({ super.key, required this.leading, required this.middle, @@ -41,4 +42,7 @@ class DesktopNavbar extends StatelessWidget implements PreferredSizeWidget { @override Size get preferredSize => Size.fromHeight(60); + + @override + bool shouldFullyObstruct(BuildContext context) => false; } diff --git a/lib/src/screens/dashboard/desktop_widgets/desktop_sidebar_wrapper.dart b/lib/src/screens/dashboard/desktop_widgets/desktop_sidebar_wrapper.dart index 9f8687643..53a1eeef0 100644 --- a/lib/src/screens/dashboard/desktop_widgets/desktop_sidebar_wrapper.dart +++ b/lib/src/screens/dashboard/desktop_widgets/desktop_sidebar_wrapper.dart @@ -2,13 +2,14 @@ import 'package:cake_wallet/di.dart'; import 'package:cake_wallet/routes.dart'; import 'package:cake_wallet/src/screens/dashboard/desktop_dashboard_page.dart'; import 'package:cake_wallet/src/screens/base_page.dart'; +import 'package:cake_wallet/src/screens/dashboard/desktop_widgets/desktop_dashboard_navbar.dart'; import 'package:cake_wallet/src/screens/dashboard/desktop_widgets/desktop_sidebar/side_menu.dart'; import 'package:cake_wallet/src/screens/dashboard/desktop_widgets/desktop_sidebar/side_menu_item.dart'; import 'package:cake_wallet/src/screens/dashboard/desktop_widgets/desktop_wallet_selection_dropdown.dart'; import 'package:cake_wallet/src/screens/dashboard/widgets/sync_indicator.dart'; -import 'package:cake_wallet/src/widgets/desktop_nav_bar.dart'; import 'package:cake_wallet/view_model/dashboard/dashboard_view_model.dart'; import 'package:cake_wallet/view_model/dashboard/desktop_sidebar_view_model.dart'; +import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_mobx/flutter_mobx.dart'; import 'package:cake_wallet/router.dart' as Router; @@ -28,7 +29,7 @@ class DesktopSidebarWrapper extends BasePage { static Key _pageViewKey = GlobalKey(); @override - PreferredSizeWidget desktopAppBar(BuildContext context) => DesktopNavbar( + ObstructingPreferredSizeWidget appBar(BuildContext context) => DesktopDashboardNavbar( leading: Padding( padding: EdgeInsets.only(left: sideMenuWidth), child: getIt(), @@ -80,23 +81,6 @@ class DesktopSidebarWrapper extends BasePage { double get sideMenuWidth => 76.0; - @override - Widget Function(BuildContext, Widget) get rootWrapper => - (BuildContext context, Widget scaffold) => Container( - decoration: BoxDecoration( - gradient: LinearGradient( - colors: [ - Theme.of(context).accentColor, - Theme.of(context).scaffoldBackgroundColor, - Theme.of(context).primaryColor, - ], - begin: Alignment.topRight, - end: Alignment.bottomLeft, - ), - ), - child: scaffold, - ); - @override Widget body(BuildContext context) { _setEffects(); diff --git a/lib/src/widgets/nav_bar.dart b/lib/src/widgets/nav_bar.dart index f16bf8801..aabe8d9c8 100644 --- a/lib/src/widgets/nav_bar.dart +++ b/lib/src/widgets/nav_bar.dart @@ -1,7 +1,7 @@ import 'package:flutter/cupertino.dart'; class NavBar extends StatelessWidget implements ObstructingPreferredSizeWidget { - factory NavBar({Widget? leading, Widget? middle, Widget? trailing, bool useDesktopAppbar = false, Color? backgroundColor,}) { + factory NavBar({Widget? leading, Widget? middle, Widget? trailing, Color? backgroundColor}) { return NavBar._internal( leading: leading, middle: middle, @@ -11,7 +11,7 @@ class NavBar extends StatelessWidget implements ObstructingPreferredSizeWidget { } factory NavBar.withShadow( - {Widget? leading, Widget? middle, Widget? trailing, Color? backgroundColor, bool useDesktopAppbar = false,}) { + {Widget? leading, Widget? middle, Widget? trailing, Color? backgroundColor}) { return NavBar._internal( leading: leading, middle: middle,