mirror of
https://github.com/gabehf/Fladder.git
synced 2026-03-15 10:15:58 -07:00
feat: UI 2.0 and other Improvements (#357)
Co-authored-by: PartyDonut <PartyDonut@users.noreply.github.com>
This commit is contained in:
parent
9ca06eaa37
commit
e7b5bb40ff
169 changed files with 4584 additions and 3626 deletions
|
|
@ -1,8 +1,8 @@
|
|||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:auto_route/auto_route.dart';
|
||||
import 'package:iconsax_plus/iconsax_plus.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:iconsax_plus/iconsax_plus.dart';
|
||||
|
||||
import 'package:fladder/providers/user_provider.dart';
|
||||
import 'package:fladder/routes/auto_router.gr.dart';
|
||||
|
|
@ -14,8 +14,40 @@ import 'package:fladder/widgets/navigation_scaffold/navigation_scaffold.dart';
|
|||
|
||||
enum HomeTabs {
|
||||
dashboard,
|
||||
library,
|
||||
favorites,
|
||||
sync;
|
||||
sync,
|
||||
;
|
||||
|
||||
const HomeTabs();
|
||||
|
||||
IconData get icon => switch (this) {
|
||||
HomeTabs.dashboard => IconsaxPlusLinear.home_1,
|
||||
HomeTabs.library => IconsaxPlusLinear.book,
|
||||
HomeTabs.favorites => IconsaxPlusLinear.heart,
|
||||
HomeTabs.sync => IconsaxPlusLinear.cloud,
|
||||
};
|
||||
|
||||
IconData get selectedIcon => switch (this) {
|
||||
HomeTabs.dashboard => IconsaxPlusBold.home_1,
|
||||
HomeTabs.library => IconsaxPlusBold.book,
|
||||
HomeTabs.favorites => IconsaxPlusBold.heart,
|
||||
HomeTabs.sync => IconsaxPlusBold.cloud,
|
||||
};
|
||||
|
||||
Future navigate(BuildContext context) => switch (this) {
|
||||
HomeTabs.dashboard => context.router.navigate(const DashboardRoute()),
|
||||
HomeTabs.library => context.router.navigate(const LibraryRoute()),
|
||||
HomeTabs.favorites => context.router.navigate(const FavouritesRoute()),
|
||||
HomeTabs.sync => context.router.navigate(SyncedRoute()),
|
||||
};
|
||||
|
||||
String label(BuildContext context) => switch (this) {
|
||||
HomeTabs.dashboard => context.localized.dashboard,
|
||||
HomeTabs.library => context.localized.library(0),
|
||||
HomeTabs.favorites => context.localized.favorites,
|
||||
HomeTabs.sync => context.localized.sync,
|
||||
};
|
||||
}
|
||||
|
||||
@RoutePage()
|
||||
|
|
@ -31,10 +63,10 @@ class HomeScreen extends ConsumerWidget {
|
|||
case HomeTabs.dashboard:
|
||||
return DestinationModel(
|
||||
label: context.localized.navigationDashboard,
|
||||
icon: const Icon(IconsaxPlusLinear.home),
|
||||
selectedIcon: const Icon(IconsaxPlusBold.home),
|
||||
icon: Icon(e.icon),
|
||||
selectedIcon: Icon(e.selectedIcon),
|
||||
route: const DashboardRoute(),
|
||||
action: () => context.router.navigate(const DashboardRoute()),
|
||||
action: () => e.navigate(context),
|
||||
floatingActionButton: AdaptiveFab(
|
||||
context: context,
|
||||
title: context.localized.search,
|
||||
|
|
@ -46,8 +78,8 @@ class HomeScreen extends ConsumerWidget {
|
|||
case HomeTabs.favorites:
|
||||
return DestinationModel(
|
||||
label: context.localized.navigationFavorites,
|
||||
icon: const Icon(IconsaxPlusLinear.heart),
|
||||
selectedIcon: const Icon(IconsaxPlusBold.heart),
|
||||
icon: Icon(e.icon),
|
||||
selectedIcon: Icon(e.selectedIcon),
|
||||
route: const FavouritesRoute(),
|
||||
floatingActionButton: AdaptiveFab(
|
||||
context: context,
|
||||
|
|
@ -56,19 +88,26 @@ class HomeScreen extends ConsumerWidget {
|
|||
onPressed: () => context.router.navigate(LibrarySearchRoute(favourites: true)),
|
||||
child: const Icon(IconsaxPlusLinear.heart_search),
|
||||
),
|
||||
action: () => context.router.navigate(const FavouritesRoute()),
|
||||
action: () => e.navigate(context),
|
||||
);
|
||||
case HomeTabs.sync:
|
||||
if (canDownload) {
|
||||
return DestinationModel(
|
||||
label: context.localized.navigationSync,
|
||||
icon: const Icon(IconsaxPlusLinear.cloud),
|
||||
selectedIcon: const Icon(IconsaxPlusBold.cloud),
|
||||
icon: Icon(e.icon),
|
||||
selectedIcon: Icon(e.selectedIcon),
|
||||
route: SyncedRoute(),
|
||||
action: () => context.router.navigate(SyncedRoute()),
|
||||
action: () => e.navigate(context),
|
||||
);
|
||||
}
|
||||
return null;
|
||||
case HomeTabs.library:
|
||||
return DestinationModel(
|
||||
label: context.localized.library(0),
|
||||
icon: Icon(e.icon),
|
||||
selectedIcon: Icon(e.selectedIcon),
|
||||
route: const LibraryRoute(),
|
||||
action: () => e.navigate(context),
|
||||
);
|
||||
}
|
||||
})
|
||||
.nonNulls
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue