FeatureRoute constructor
FeatureRoute({
- required String description,
- Map<
String, dynamic> parameters = const {}, - required String path,
- required Widget builder(
- BuildContext,
- GoRouterState
- required String? name,
- bool includeChat = true,
- GoRouterPageBuilder? pageBuilder,
- GoRouterRedirect? redirect,
- List<
RouteBase> routes = const <RouteBase>[], - Map<
String, Map< extras = const {},String, dynamic> >
Implementation
FeatureRoute({
required this.description,
this.parameters = const {},
required super.path,
required Widget Function(BuildContext, GoRouterState) builder,
required super.name,
this.includeChat = true,
super.pageBuilder,
super.redirect,
super.routes = const <RouteBase>[],
this.extras = const {},
}) : super(
builder: (context, state) {
final child = builder(context, state);
final settings = FeatureSettings();
if (includeChat && settings.aiApiKey != null) {
return Stack(
children: [
child,
Positioned(
right: 24.0,
bottom: 40.0,
child: FloatingActionButton(
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => const ChatPage()),
);
},
child: const Icon(Icons.chat),
),
),
],
);
}
return child;
},
) {
// Add this route to the global list of all routes
_allRoutes.add(this);
}