App shell
An app shell holds the current page and its main navigation together. Use the look’s scaffold to give related pages a consistent place to live.
Choose Search, then switch between phone and desktop. Observe where the look places navigation and whether the current page stays selected.
components/app-shell/appliance/navigate_workspace.dart
import 'package:flutter/widgets.dart';
import 'package:material_ui/material_ui.dart' show Icons;
import 'package:appliance_ui/appliance_ui.dart';
class NavigateWorkspace extends StatefulWidget {
const NavigateWorkspace({super.key});
@override
State<NavigateWorkspace> createState() => _NavigateWorkspaceState();
}
class _NavigateWorkspaceState extends State<NavigateWorkspace> {
int selected = 0;
static const destinations = [
ApplianceDestination(icon: Icons.home_outlined, label: 'Home'),
ApplianceDestination(icon: Icons.search, label: 'Search'),
];
@override
Widget build(BuildContext context) => ApplianceScaffold(
destinations: destinations,
selectedIndex: selected,
onSelected: (next) => setState(() => selected = next),
body: Center(child: Text(selected == 0 ? 'Home page' : 'Search page')),
);
}
destinations- Main pages available in this shell.
selectedIndex- Index of the current page.
onSelected- Selects another destination.
body- Content for the selected page.
Shared behaviour
- Keyboard and focus. Tab to a destination and activate it. The current page stays in the same shell while the content changes.
- Screen readers. Read the destinations and their selected state, then locate the content of the current page.
- Direction and type. Compare where navigation sits at phone and desktop widths. Try larger text and RTL while Search is selected.
Read the ui_core contract ↗