Commit 2a816c6 1 parent 4646681 commit 2a816c6 Copy full SHA for 2a816c6
File tree 3 files changed +17
-4
lines changed
3 files changed +17
-4
lines changed Original file line number Diff line number Diff line change @@ -2,12 +2,20 @@ import 'package:flutter/services.dart';
2
2
import 'package:fluent_ui/fluent_ui.dart' ;
3
3
4
4
import '../utils/navigation/navigation_item.dart' ;
5
+ import '../providers/router_path.dart' ;
6
+ import '../utils/router/navigation.dart' ;
5
7
6
8
final List <NavigationItem > navigationItems = [
7
9
NavigationItem (
8
10
'Rune' ,
9
11
'/' ,
10
- tappable: false ,
12
+ onTap: (context) {
13
+ final path = $router.path;
14
+
15
+ if (path != '/library' ) {
16
+ $replace ('/library' );
17
+ }
18
+ },
11
19
children: [
12
20
NavigationItem (
13
21
'Library' ,
Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ class NavigationItem {
4
4
final String title;
5
5
final String path;
6
6
final bool hidden;
7
- final bool tappable ;
7
+ final void Function ( BuildContext ) ? onTap ;
8
8
final bool zuneOnly;
9
9
final List <NavigationItem >? children;
10
10
final List <SingleActivator >? shortcuts;
@@ -13,7 +13,7 @@ class NavigationItem {
13
13
this .title,
14
14
this .path, {
15
15
this .hidden = false ,
16
- this .tappable = true ,
16
+ this .onTap ,
17
17
this .children = const [],
18
18
this .zuneOnly = false ,
19
19
this .shortcuts,
Original file line number Diff line number Diff line change @@ -65,7 +65,12 @@ class NavigationBarState extends State<NavigationBar> {
65
65
}
66
66
67
67
void _onHeaderTap (BuildContext context, NavigationItem ? item) {
68
- if (item? .tappable == false ) return ;
68
+ final onTap = item? .onTap;
69
+
70
+ if (onTap != null ) {
71
+ onTap (context);
72
+ return ;
73
+ }
69
74
70
75
setState (() {
71
76
if (item != null ) {
You can’t perform that action at this time.
0 commit comments