-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: new sidebar widget and translucent bottom player
- Loading branch information
Showing
5 changed files
with
230 additions
and
95 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:flutter_hooks/flutter_hooks.dart'; | ||
import 'package:sidebarx/sidebarx.dart'; | ||
|
||
/// Creates [SidebarXController] that will be disposed automatically. | ||
/// | ||
/// See also: | ||
/// - [SidebarXController] | ||
SidebarXController useSidebarXController({ | ||
required int selectedIndex, | ||
bool? extended, | ||
List<Object?>? keys, | ||
}) { | ||
return use( | ||
_SidebarXControllerHook( | ||
selectedIndex: selectedIndex, | ||
extended: extended, | ||
keys: keys, | ||
), | ||
); | ||
} | ||
|
||
class _SidebarXControllerHook extends Hook<SidebarXController> { | ||
const _SidebarXControllerHook({ | ||
required this.selectedIndex, | ||
this.extended, | ||
List<Object?>? keys, | ||
}) : super(keys: keys); | ||
|
||
final int selectedIndex; | ||
final bool? extended; | ||
|
||
@override | ||
HookState<SidebarXController, Hook<SidebarXController>> createState() => | ||
_SidebarXControllerHookState(); | ||
} | ||
|
||
class _SidebarXControllerHookState | ||
extends HookState<SidebarXController, _SidebarXControllerHook> { | ||
late final SidebarXController controller; | ||
|
||
@override | ||
void initHook() { | ||
super.initHook(); | ||
controller = SidebarXController( | ||
selectedIndex: hook.selectedIndex, | ||
extended: hook.extended, | ||
); | ||
} | ||
|
||
@override | ||
SidebarXController build(BuildContext context) => controller; | ||
|
||
@override | ||
void dispose() => controller.dispose(); | ||
|
||
@override | ||
String get debugLabel => 'useSidebarXController'; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters