Skip to content

Commit

Permalink
feat: platform bottom navigation bar add
Browse files Browse the repository at this point in the history
  • Loading branch information
KRTirtho committed Nov 7, 2022
1 parent e795e23 commit ff14469
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 23 deletions.
2 changes: 1 addition & 1 deletion lib/components/Home/Sidebar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ class Sidebar extends HookConsumerWidget {

if (layoutMode == LayoutMode.compact ||
(breakpoints.isSm && layoutMode == LayoutMode.adaptive)) {
return child;
return PlatformScaffold(body: child);
}

void toggleExtended() =>
Expand Down
30 changes: 8 additions & 22 deletions lib/components/Home/SpotubeNavigationBar.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import 'package:badges/badges.dart';
import 'package:flutter/material.dart';
import 'package:flutter_hooks/flutter_hooks.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'package:platform_ui/platform_ui.dart';
import 'package:spotube/components/Home/Sidebar.dart';
import 'package:spotube/hooks/useBreakpoints.dart';
import 'package:spotube/models/sideBarTiles.dart';
Expand Down Expand Up @@ -37,37 +37,23 @@ class SpotubeNavigationBar extends HookConsumerWidget {
if (layoutMode == LayoutMode.extended ||
(breakpoint.isMoreThan(Breakpoints.sm) &&
layoutMode == LayoutMode.adaptive)) return const SizedBox();
return NavigationBar(
destinations: [
return PlatformBottomNavigationBar(
items: [
...sidebarTileList.map(
(e) {
final icon = Icon(e.icon);
return NavigationDestination(
icon: e.title == "Library" && downloadCount > 0
? Badge(
badgeColor: Colors.red[100]!,
badgeContent: Text(
downloadCount.toString(),
style: const TextStyle(
color: Colors.red,
fontWeight: FontWeight.bold,
),
),
animationType: BadgeAnimationType.fade,
child: icon,
)
: icon,
return PlatformBottomNavigationBarItem(
icon: e.icon,
label: e.title,
);
},
),
const NavigationDestination(
icon: Icon(Icons.settings_rounded),
const PlatformBottomNavigationBarItem(
icon: Icons.settings_rounded,
label: "Settings",
)
],
selectedIndex: insideSelectedIndex.value,
onDestinationSelected: (i) {
onSelectedIndexChanged: (i) {
if (i == 4) {
insideSelectedIndex.value = 4;
Sidebar.goToSettings(context);
Expand Down

0 comments on commit ff14469

Please sign in to comment.