mirror of
https://github.com/gabehf/Fladder.git
synced 2026-03-08 23:18:16 -07:00
feature: Cleaned up app bar
This commit is contained in:
parent
79310c7bf4
commit
a9cdd5c506
7 changed files with 59 additions and 69 deletions
|
|
@ -107,15 +107,12 @@ class _DashboardScreenState extends ConsumerState<DashboardScreen> {
|
|||
),
|
||||
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),
|
||||
),
|
||||
),
|
||||
},
|
||||
|
|
|
|||
|
|
@ -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),
|
||||
)
|
||||
|
|
|
|||
|
|
@ -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),
|
||||
),
|
||||
);
|
||||
}
|
||||
})
|
||||
|
|
|
|||
|
|
@ -38,14 +38,13 @@ class _DefaultTitleBarState extends ConsumerState<DefaultTitleBar> 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()
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
|
|
|||
|
|
@ -47,7 +47,6 @@ class _SyncedScreenState extends ConsumerState<SyncedScreen> {
|
|||
slivers: [
|
||||
if (AdaptiveLayout.viewSizeOf(context) == ViewSize.phone)
|
||||
NestedSliverAppBar(
|
||||
searchTitle: "${context.localized.search} ...",
|
||||
parent: context,
|
||||
route: LibrarySearchRoute(),
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue