|
import 'package:flutter/foundation.dart'; |
|
import 'package:flutter/material.dart'; |
|
import 'package:flutter_hooks/flutter_hooks.dart'; |
|
import 'package:go_router/go_router.dart'; |
|
|
|
import 'package:userinterface/core/custom_hooks/use_create_state_notifier.dart'; |
|
import 'package:userinterface/core/custom_hooks/use_state_notifier.dart'; |
|
import 'package:userinterface/core/navigation/model_views/app_navigation_state.dart'; |
|
import 'package:userinterface/core/navigation/models/current_route.dart'; |
|
|
|
const bool _debug = kDebugMode && true; |
|
|
|
/// For interacting with [Go Router] one writes |
|
/// a navigation shell. Since Flex Scaffold makes |
|
/// use of state via State Notifier we do not have |
|
/// to use StatefulShellRoute which translates to |
|
/// an easier time implementing screen transitions. |
|
/// |
|
/// If we are using provider style DI than its a |
|
/// Consumer like widget, if using service locator |
|
/// DI its a HookWWidget as watch_it has noting to |
|
/// hook up state notifiers. |
|
class NavigationShell extends HookWidget { |
|
const NavigationShell({super.key, required this.body}); |
|
|
|
final Widget body; |
|
|
|
@override |
|
Widget build(BuildContext context) { |
|
// non-widget-di way using hooks |
|
final notifier = useCreateStateNotifier(() => CurrentRouteStateNotifier()); |
|
final state = useStateNotifier(notifier); |
|
|
|
final CurrentRoute route = state; |
|
|
|
final String goRouterPath = GoRouterState.of(context).uri.toString(); |
|
if (_debug) debugPrint('LayoutShell: goRouterPath = $goRouterPath'); |
|
|
|
return Container(); |
|
} |
|
} |