From a9cdd5c50620be8037b9e8033bed80bed2b6cb91 Mon Sep 17 00:00:00 2001 From: PartyDonut Date: Wed, 30 Jul 2025 18:54:54 +0200 Subject: [PATCH] feature: Cleaned up app bar --- lib/screens/dashboard/dashboard_screen.dart | 13 +-- lib/screens/favourites/favourites_screen.dart | 1 - lib/screens/home_screen.dart | 7 ++ lib/screens/shared/default_title_bar.dart | 5 +- lib/screens/shared/nested_sliver_appbar.dart | 95 ++++++++----------- lib/screens/syncing/synced_screen.dart | 1 - .../components/side_navigation_bar.dart | 6 +- 7 files changed, 59 insertions(+), 69 deletions(-) diff --git a/lib/screens/dashboard/dashboard_screen.dart b/lib/screens/dashboard/dashboard_screen.dart index af0ea5d..1329647 100644 --- a/lib/screens/dashboard/dashboard_screen.dart +++ b/lib/screens/dashboard/dashboard_screen.dart @@ -107,15 +107,12 @@ class _DashboardScreenState extends ConsumerState { ), if (homeBanner && homeCarouselItems.isNotEmpty) ...{ SliverToBoxAdapter( - child: Transform.translate( - offset: Offset(0, AdaptiveLayout.layoutOf(context) == ViewSize.phone ? -14 : 0), - child: Padding( - padding: AdaptiveLayout.adaptivePadding( - context, - horizontalPadding: 0, - ), - child: HomeBannerWidget(posters: homeCarouselItems), + child: Padding( + padding: AdaptiveLayout.adaptivePadding( + context, + horizontalPadding: 0, ), + child: HomeBannerWidget(posters: homeCarouselItems), ), ), }, diff --git a/lib/screens/favourites/favourites_screen.dart b/lib/screens/favourites/favourites_screen.dart index afee5db..bf3e94b 100644 --- a/lib/screens/favourites/favourites_screen.dart +++ b/lib/screens/favourites/favourites_screen.dart @@ -38,7 +38,6 @@ class FavouritesScreen extends ConsumerWidget { slivers: [ if (AdaptiveLayout.viewSizeOf(context) == ViewSize.phone) NestedSliverAppBar( - searchTitle: "${context.localized.search} ${context.localized.favorites.toLowerCase()}...", parent: context, route: LibrarySearchRoute(favourites: true), ) diff --git a/lib/screens/home_screen.dart b/lib/screens/home_screen.dart index faff11f..d632371 100644 --- a/lib/screens/home_screen.dart +++ b/lib/screens/home_screen.dart @@ -108,6 +108,13 @@ class HomeScreen extends ConsumerWidget { selectedIcon: Icon(e.selectedIcon), route: const LibraryRoute(), action: () => e.navigate(context), + floatingActionButton: AdaptiveFab( + context: context, + title: context.localized.search, + key: Key(e.name.capitalize()), + onPressed: () => context.router.navigate(LibrarySearchRoute()), + child: const Icon(IconsaxPlusLinear.search_status), + ), ); } }) diff --git a/lib/screens/shared/default_title_bar.dart b/lib/screens/shared/default_title_bar.dart index d12ff14..592cf36 100644 --- a/lib/screens/shared/default_title_bar.dart +++ b/lib/screens/shared/default_title_bar.dart @@ -38,14 +38,13 @@ class _DefaultTitleBarState extends ConsumerState with WindowLi if (ref.watch(argumentsStateProvider.select((value) => value.htpcMode))) return const SizedBox.shrink(); final brightness = widget.brightness ?? Theme.of(context).brightness; final iconColor = Theme.of(context).colorScheme.onSurface.withValues(alpha: 0.65); + final surfaceColor = Theme.of(context).colorScheme.surface; return MouseRegion( onEnter: (event) => setState(() => hovering = true), onExit: (event) => setState(() => hovering = false), child: AnimatedContainer( duration: const Duration(milliseconds: 250), - decoration: BoxDecoration( - color: hovering ? Colors.black.withValues(alpha: 0.15) : Colors.transparent, - ), + color: surfaceColor.withValues(alpha: hovering ? 0.15 : 0), height: widget.height, child: kIsWeb ? const SizedBox.shrink() diff --git a/lib/screens/shared/nested_sliver_appbar.dart b/lib/screens/shared/nested_sliver_appbar.dart index c2a212d..e080308 100644 --- a/lib/screens/shared/nested_sliver_appbar.dart +++ b/lib/screens/shared/nested_sliver_appbar.dart @@ -4,77 +4,62 @@ import 'package:auto_route/auto_route.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:iconsax_plus/iconsax_plus.dart'; -import 'package:fladder/util/localization_helper.dart'; import 'package:fladder/widgets/navigation_scaffold/components/settings_user_icon.dart'; -import 'package:fladder/widgets/shared/shapes.dart'; class NestedSliverAppBar extends ConsumerWidget { final BuildContext parent; - final String? searchTitle; final PageRouteInfo? route; - const NestedSliverAppBar({required this.parent, this.route, this.searchTitle, super.key}); + const NestedSliverAppBar({required this.parent, this.route, super.key}); @override Widget build(BuildContext context, WidgetRef ref) { + final surfaceColor = Theme.of(context).colorScheme.surface; + final buttonStyle = Theme.of(context).filledButtonTheme.style?.copyWith( + backgroundColor: WidgetStatePropertyAll( + surfaceColor.withValues(alpha: 0.8), + ), + ); return SliverAppBar( automaticallyImplyLeading: false, - elevation: 16, - forceElevated: true, + elevation: 0, + forceElevated: false, surfaceTintColor: Colors.transparent, shadowColor: Colors.transparent, - backgroundColor: Theme.of(context).colorScheme.surface, - shape: AppBarShape(), - title: SizedBox( - height: 65, + backgroundColor: Colors.transparent, + flexibleSpace: Container( + decoration: BoxDecoration( + gradient: LinearGradient( + colors: [ + surfaceColor.withValues(alpha: 0.7), + surfaceColor.withValues(alpha: 0), + ], + begin: Alignment.topCenter, + end: Alignment.bottomCenter, + )), child: Padding( - padding: const EdgeInsets.only(bottom: 24), - child: Row( - crossAxisAlignment: CrossAxisAlignment.stretch, - spacing: 10, - children: [ - SizedBox( - width: 30, - child: IconButton( - onPressed: () => Scaffold.of(parent).openDrawer(), - icon: const Icon(IconsaxPlusLinear.menu), - padding: EdgeInsets.zero, - ), - ), - Expanded( - child: Hero( - tag: "PrimarySearch", - child: Card( - elevation: 3, - shadowColor: Colors.transparent, - child: InkWell( - onTap: route != null - ? () { - route?.push(context); - } - : null, - child: Padding( - padding: const EdgeInsets.all(10), - child: Opacity( - opacity: 0.65, - child: Row( - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - const Icon(IconsaxPlusLinear.search_normal), - const SizedBox(width: 16), - Transform.translate( - offset: const Offset(0, 1.5), - child: Text(searchTitle ?? "${context.localized.search}..."), - ), - ], - ), - ), - ), + padding: MediaQuery.paddingOf(context).copyWith(bottom: 0), + child: Padding( + padding: const EdgeInsets.all(14), + child: SizedBox( + height: 50, + child: Row( + crossAxisAlignment: CrossAxisAlignment.stretch, + spacing: 12, + children: [ + AspectRatio( + aspectRatio: 1.0, + child: IconButton.filledTonal( + style: buttonStyle, + onPressed: () => Scaffold.of(parent).openDrawer(), + icon: const Icon(IconsaxPlusLinear.menu), + padding: EdgeInsets.zero, ), ), - ), + const Spacer(), + const SettingsUserIcon() + ], ), - const SettingsUserIcon() - ], + ), ), ), ), diff --git a/lib/screens/syncing/synced_screen.dart b/lib/screens/syncing/synced_screen.dart index c96257a..792fd95 100644 --- a/lib/screens/syncing/synced_screen.dart +++ b/lib/screens/syncing/synced_screen.dart @@ -47,7 +47,6 @@ class _SyncedScreenState extends ConsumerState { slivers: [ if (AdaptiveLayout.viewSizeOf(context) == ViewSize.phone) NestedSliverAppBar( - searchTitle: "${context.localized.search} ...", parent: context, route: LibrarySearchRoute(), ) diff --git a/lib/widgets/navigation_scaffold/components/side_navigation_bar.dart b/lib/widgets/navigation_scaffold/components/side_navigation_bar.dart index 44ba989..efb4e87 100644 --- a/lib/widgets/navigation_scaffold/components/side_navigation_bar.dart +++ b/lib/widgets/navigation_scaffold/components/side_navigation_bar.dart @@ -85,7 +85,11 @@ class _SideNavigationBarState extends ConsumerState { child: (context) => widget.child, ), Container( - color: Theme.of(context).colorScheme.surface.withValues(alpha: shouldExpand ? 0.95 : 0.85), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(12) + .copyWith(topLeft: const Radius.circular(0), bottomLeft: const Radius.circular(0)), + color: Theme.of(context).colorScheme.surface.withValues(alpha: shouldExpand ? 0.95 : 0.85), + ), width: shouldExpand ? expandedWidth : collapsedWidth, child: MouseRegion( onEnter: (value) => startTimer(),