feat(app): an open run takes over the app bar (Back, run, more menu); Search is the fifth tab; tabs keep their last screen
This commit is contained in:
@@ -19,6 +19,7 @@ class SearchScreen extends StatefulWidget {
|
||||
required this.gateway,
|
||||
required this.onOpen,
|
||||
this.cupertino,
|
||||
this.embedded = false,
|
||||
});
|
||||
|
||||
final ApiGateway gateway;
|
||||
@@ -28,6 +29,9 @@ class SearchScreen extends StatefulWidget {
|
||||
/// Cupertino controls and every other platform uses Material.
|
||||
final bool? cupertino;
|
||||
|
||||
/// True as the Search tab: the shell's bar names it, so no page bar.
|
||||
final bool embedded;
|
||||
|
||||
@override
|
||||
State<SearchScreen> createState() => _SearchScreenState();
|
||||
}
|
||||
@@ -112,17 +116,21 @@ class _SearchScreenState extends State<SearchScreen> {
|
||||
return cupertino ? _cupertinoScreen() : _materialScreen();
|
||||
}
|
||||
|
||||
Widget _materialScreen() => Scaffold(
|
||||
appBar: AppBar(title: const Text('Search')),
|
||||
body: SafeArea(
|
||||
Widget _materialScreen() {
|
||||
final body = SafeArea(
|
||||
child: MaterialSearchBody(
|
||||
controller: _controller,
|
||||
query: _controller.parsed.query,
|
||||
onOpen: widget.onOpen,
|
||||
header: _materialHeader(),
|
||||
),
|
||||
),
|
||||
);
|
||||
);
|
||||
if (widget.embedded) return body;
|
||||
return Scaffold(
|
||||
appBar: AppBar(title: const Text('Search')),
|
||||
body: body,
|
||||
);
|
||||
}
|
||||
|
||||
Widget _materialHeader() => Padding(
|
||||
padding: const EdgeInsets.fromLTRB(16, 12, 16, 8),
|
||||
@@ -175,17 +183,21 @@ class _SearchScreenState extends State<SearchScreen> {
|
||||
),
|
||||
);
|
||||
|
||||
Widget _cupertinoScreen() => CupertinoPageScaffold(
|
||||
navigationBar: const CupertinoNavigationBar(middle: Text('Search')),
|
||||
child: SafeArea(
|
||||
Widget _cupertinoScreen() {
|
||||
final body = SafeArea(
|
||||
child: CupertinoSearchBody(
|
||||
controller: _controller,
|
||||
query: _controller.parsed.query,
|
||||
onOpen: widget.onOpen,
|
||||
header: _cupertinoHeader(context),
|
||||
),
|
||||
),
|
||||
);
|
||||
);
|
||||
if (widget.embedded) return body;
|
||||
return CupertinoPageScaffold(
|
||||
navigationBar: const CupertinoNavigationBar(middle: Text('Search')),
|
||||
child: body,
|
||||
);
|
||||
}
|
||||
|
||||
Widget _cupertinoHeader(BuildContext context) => Padding(
|
||||
padding: const EdgeInsets.fromLTRB(16, 12, 16, 8),
|
||||
|
||||
Reference in New Issue
Block a user