feat(app): compose live Runs with deep links and reconnect retention
This commit is contained in:
@@ -8,20 +8,46 @@ class AdaptiveShell extends StatefulWidget {
|
||||
super.key,
|
||||
this.destinationBodies = const {},
|
||||
this.cupertino = false,
|
||||
this.destination,
|
||||
this.onDestinationSelected,
|
||||
});
|
||||
|
||||
final Map<AppDestination, WidgetBuilder> destinationBodies;
|
||||
final bool cupertino;
|
||||
|
||||
/// The destination a route owner selected. When null the shell keeps its own
|
||||
/// selection, which preserves the plain-shell tests and native composition.
|
||||
final AppDestination? destination;
|
||||
final ValueChanged<AppDestination>? onDestinationSelected;
|
||||
|
||||
@override
|
||||
State<AdaptiveShell> createState() => _AdaptiveShellState();
|
||||
}
|
||||
|
||||
class _AdaptiveShellState extends State<AdaptiveShell> {
|
||||
AppDestination _selected = AppDestination.pipelines;
|
||||
late AppDestination _selected;
|
||||
|
||||
void _select(AppDestination destination) =>
|
||||
setState(() => _selected = destination);
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_selected = widget.destination ?? AppDestination.pipelines;
|
||||
}
|
||||
|
||||
@override
|
||||
void didUpdateWidget(covariant AdaptiveShell oldWidget) {
|
||||
super.didUpdateWidget(oldWidget);
|
||||
final destination = widget.destination;
|
||||
if (destination != null) _selected = destination;
|
||||
}
|
||||
|
||||
void _select(AppDestination destination) {
|
||||
final callback = widget.onDestinationSelected;
|
||||
if (callback != null) {
|
||||
callback(destination);
|
||||
return;
|
||||
}
|
||||
setState(() => _selected = destination);
|
||||
}
|
||||
|
||||
List<T> _items<T>(T Function(AppDestination) build) =>
|
||||
AppDestination.values.map(build).toList();
|
||||
|
||||
Reference in New Issue
Block a user