chore: 优化进度条显示

This commit is contained in:
rang 2026-01-13 11:56:49 +08:00
parent 03cec3f4b6
commit d96995a863
27 changed files with 1229 additions and 1311 deletions

View file

@ -21,6 +21,11 @@ class Routes {
pathParamName: 'itemId',
name: 'libraryItem',
);
static const libraryStatistics = _SimpleRoute(
pathName: 'statistics',
// pathParamName: 'statistics',
name: 'libraryStatistics',
);
// Local settings
static const settings = _SimpleRoute(

View file

@ -15,6 +15,7 @@ import 'package:vaani/features/settings/view/notification_settings_page.dart';
import 'package:vaani/features/settings/view/player_settings_page.dart';
import 'package:vaani/features/settings/view/shake_detector_settings_page.dart';
import 'package:vaani/features/settings/view/theme_settings_page.dart';
import 'package:vaani/features/statistics/abs_statistics.dart';
import 'package:vaani/features/you/view/server_manager.dart';
import 'package:vaani/features/you/view/you_page.dart';
import 'package:vaani/globals.dart';
@ -125,10 +126,18 @@ class MyAppRouter {
// pageBuilder: defaultPageBuilder(const LibraryBrowserPage()),
// ),
GoRoute(
path: Routes.library.localPath,
name: Routes.library.name,
pageBuilder: defaultPageBuilder(LibraryPage()),
),
path: Routes.library.localPath,
name: Routes.library.name,
pageBuilder: defaultPageBuilder(LibraryPage()),
routes: [
GoRoute(
path: Routes.libraryStatistics.pathName,
name: Routes.libraryStatistics.name,
pageBuilder: defaultPageBuilder(
const LibraryStatisticsPage(),
),
),
]),
],
),
// search/explore page

View file

@ -35,12 +35,18 @@ class ScaffoldWithNavBar extends HookConsumerWidget {
final size = MediaQuery.of(context).size;
//
final isVertical = size.height > size.width;
final currentBook = ref.watch(currentBookProvider);
return Scaffold(
body: Stack(
alignment: Alignment.bottomCenter,
children: [
isVertical ? navigationShell : buildNavLeft(context, ref),
Padding(
padding: EdgeInsets.only(
bottom: currentBook != null ? playerMinHeight : 0,
),
child: isVertical ? navigationShell : buildNavLeft(context, ref),
),
const PlayerMinimized(),
],
),
@ -49,67 +55,62 @@ class ScaffoldWithNavBar extends HookConsumerWidget {
}
Widget buildNavLeft(BuildContext context, WidgetRef ref) {
final currentBook = ref.watch(currentBookProvider);
return Padding(
padding:
EdgeInsets.only(bottom: currentBook != null ? playerMinHeight : 0),
child: Row(
children: [
SafeArea(
child: NavigationRail(
minWidth: 60,
minExtendedWidth: 180,
extended: MediaQuery.of(context).size.width > 640,
// extended: false,
destinations: _navigationItems(context).map((item) {
final isDestinationLibrary = item.name == S.of(context).library;
var currentLibrary =
ref.watch(currentLibraryProvider).valueOrNull;
final libraryIcon = AbsIcons.getIconByName(
currentLibrary?.icon,
);
final destinationWidget = NavigationRailDestination(
icon: Icon(
isDestinationLibrary ? libraryIcon ?? item.icon : item.icon,
),
selectedIcon: Icon(
isDestinationLibrary
? libraryIcon ?? item.activeIcon
: item.activeIcon,
),
label: Text(
isDestinationLibrary
? currentLibrary?.name ?? item.name
: item.name,
),
// tooltip: item.tooltip,
);
// if (isDestinationLibrary) {
// return GestureDetector(
// onSecondaryTap: () => showLibrarySwitcher(context, ref),
// onDoubleTap: () => showLibrarySwitcher(context, ref),
// child:
// destinationWidget, // Wrap the actual NavigationDestination
// );
// } else {
// // Return the unwrapped destination for other items
// return destinationWidget;
// }
return destinationWidget;
// return NavigationRailDestination(icon: Icon(nav.icon), label: Text(nav.name));
}).toList(),
selectedIndex: navigationShell.currentIndex,
onDestinationSelected: (int index) {
_onTap(context, index, ref);
},
),
return Row(
children: [
SafeArea(
child: NavigationRail(
minWidth: 60,
minExtendedWidth: 180,
extended: MediaQuery.of(context).size.width > 640,
// extended: false,
destinations: _navigationItems(context).map((item) {
final isDestinationLibrary = item.name == S.of(context).library;
var currentLibrary =
ref.watch(currentLibraryProvider).valueOrNull;
final libraryIcon = AbsIcons.getIconByName(
currentLibrary?.icon,
);
final destinationWidget = NavigationRailDestination(
icon: Icon(
isDestinationLibrary ? libraryIcon ?? item.icon : item.icon,
),
selectedIcon: Icon(
isDestinationLibrary
? libraryIcon ?? item.activeIcon
: item.activeIcon,
),
label: Text(
isDestinationLibrary
? currentLibrary?.name ?? item.name
: item.name,
),
// tooltip: item.tooltip,
);
// if (isDestinationLibrary) {
// return GestureDetector(
// onSecondaryTap: () => showLibrarySwitcher(context, ref),
// onDoubleTap: () => showLibrarySwitcher(context, ref),
// child:
// destinationWidget, // Wrap the actual NavigationDestination
// );
// } else {
// // Return the unwrapped destination for other items
// return destinationWidget;
// }
return destinationWidget;
// return NavigationRailDestination(icon: Icon(nav.icon), label: Text(nav.name));
}).toList(),
selectedIndex: navigationShell.currentIndex,
onDestinationSelected: (int index) {
_onTap(context, index, ref);
},
),
VerticalDivider(width: 0.5, thickness: 0.5),
Expanded(
child: navigationShell,
),
],
),
),
VerticalDivider(width: 0.5, thickness: 0.5),
Expanded(
child: navigationShell,
),
],
);
}