mirror of
https://github.com/KRTirtho/spotube.git
synced 2025-09-15 00:25:17 +00:00

Configuration File Removals: .vscode/c_cpp_properties.json: Removed the entire configuration for C/C++ properties. .vscode/launch.json: Removed the Dart launch configurations for different environments and modes. .vscode/settings.json: Removed settings related to CMake, spell checking, file nesting, and Dart Flutter SDK path. .vscode/snippets.code-snippets: Removed code snippets for Dart, including PaginatedState and PaginatedNotifier templates. .vscode/tasks.json: Removed the tasks configuration file. Documentation Updates: CONTRIBUTION.md: Removed heart emoji from the introductory text. README.md: Updated the logo image and made minor text adjustments, including removing emojis and updating section titles. [1] [2] [3] [4] [5] Asset Removals: lib/collections/assets.gen.dart: Removed multiple unused asset references, including images related to Spotube logos and banners. [1] [2] [3] Minor Code Cleanups: cli/commands/build/linux.dart, cli/commands/build/windows.dart, cli/commands/translated.dart, cli/commands/untranslated.dart: Adjusted import statements for consistency. [1] [2] [3] [4] integration_test/app_test.dart: Removed an unnecessary blank line. lib/collections/routes.dart: Commented out the TrackRoute configuration.
86 lines
2.8 KiB
Dart
86 lines
2.8 KiB
Dart
import 'dart:math';
|
|
|
|
import 'package:auto_route/auto_route.dart';
|
|
import 'package:flutter/material.dart' show Badge;
|
|
import 'package:flutter_hooks/flutter_hooks.dart';
|
|
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
|
import 'package:shadcn_flutter/shadcn_flutter.dart';
|
|
import 'package:shadcn_flutter/shadcn_flutter_extension.dart';
|
|
import 'package:spotube/collections/side_bar_tiles.dart';
|
|
import 'package:spotube/extensions/constrains.dart';
|
|
import 'package:spotube/extensions/context.dart';
|
|
import 'package:spotube/models/database/database.dart';
|
|
import 'package:spotube/provider/download_manager_provider.dart';
|
|
import 'package:spotube/provider/user_preferences/user_preferences_provider.dart';
|
|
|
|
final navigationPanelHeight = StateProvider<double>((ref) => 50);
|
|
|
|
class SpotubeNavigationBar extends HookConsumerWidget {
|
|
const SpotubeNavigationBar({
|
|
super.key,
|
|
});
|
|
|
|
@override
|
|
Widget build(BuildContext context, ref) {
|
|
final mediaQuery = MediaQuery.of(context);
|
|
|
|
final downloadCount = ref.watch(downloadManagerProvider).$downloadCount;
|
|
final layoutMode =
|
|
ref.watch(userPreferencesProvider.select((s) => s.layoutMode));
|
|
|
|
final navbarTileList = useMemoized(
|
|
() => getNavbarTileList(context.l10n),
|
|
[context.l10n],
|
|
);
|
|
|
|
final panelHeight = ref.watch(navigationPanelHeight);
|
|
|
|
final router = context.watchRouter;
|
|
final selectedIndex = max(
|
|
0,
|
|
navbarTileList.indexWhere(
|
|
(e) => router.currentPath.startsWith(e.pathPrefix),
|
|
),
|
|
);
|
|
|
|
// if (layoutMode == LayoutMode.extended ||
|
|
// (mediaQuery.mdAndUp && layoutMode == LayoutMode.adaptive) ||
|
|
// panelHeight < 10) {
|
|
// return const SizedBox();
|
|
// }
|
|
|
|
return AnimatedContainer(
|
|
duration: const Duration(milliseconds: 100),
|
|
height: panelHeight,
|
|
child: SingleChildScrollView(
|
|
child: Column(
|
|
children: [
|
|
const Divider(),
|
|
NavigationBar(
|
|
index: selectedIndex,
|
|
surfaceBlur: context.theme.surfaceBlur,
|
|
surfaceOpacity: context.theme.surfaceOpacity,
|
|
children: [
|
|
for (final tile in navbarTileList)
|
|
NavigationButton(
|
|
style: navbarTileList[selectedIndex] == tile
|
|
? const ButtonStyle.fixed(density: ButtonDensity.icon)
|
|
: const ButtonStyle.muted(density: ButtonDensity.icon),
|
|
child: Badge(
|
|
isLabelVisible: tile.id == "library" && downloadCount > 0,
|
|
label: Text(downloadCount.toString()),
|
|
child: Icon(tile.icon),
|
|
),
|
|
onPressed: () {
|
|
context.navigateTo(tile.route);
|
|
},
|
|
)
|
|
],
|
|
),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|