feat(app): segmented glass top bar across the app
Extract the chat's segmented bar into lib/ui/adaptive (SegmentedBar, GlassPill, SegmentedBarOverlay) and use it for the shell bar, DetailPane and every page-level bar. Pieces are frosted glass over a fading scrim; only pills take taps. Actions keep their natural width so the title gives way before a model name. The chat transcript scrolls behind its header.
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import '../ui/adaptive/segmented_bar.dart';
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter/cupertino.dart';
|
||||
@@ -102,32 +103,37 @@ class _SchedulesDestinationState extends State<SchedulesDestination> {
|
||||
final body = _body(cupertino);
|
||||
if (cupertino) {
|
||||
return CupertinoPageScaffold(
|
||||
navigationBar: CupertinoNavigationBar(
|
||||
navigationBar: SegmentedBar(
|
||||
cupertino: true,
|
||||
leading: CupertinoButton(
|
||||
padding: EdgeInsets.zero,
|
||||
onPressed: widget.onBack,
|
||||
child: const Icon(CupertinoIcons.back, semanticLabel: 'Back'),
|
||||
),
|
||||
middle: const Text('Schedules'),
|
||||
title: 'Schedules',
|
||||
),
|
||||
child: SafeArea(child: body),
|
||||
);
|
||||
}
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
extendBodyBehindAppBar: true,
|
||||
appBar: SegmentedBar(
|
||||
cupertino: false,
|
||||
leading: IconButton(
|
||||
onPressed: widget.onBack,
|
||||
icon: const Icon(Icons.arrow_back, semanticLabel: 'Back'),
|
||||
),
|
||||
title: const Text('Schedules'),
|
||||
title: 'Schedules',
|
||||
),
|
||||
body: body,
|
||||
body: SafeArea(left: false, right: false, bottom: false, child: body),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _body(bool cupertino) {
|
||||
if (!widget.session.everConnected) {
|
||||
return const Center(child: Text('Connect to the server to see schedules.'));
|
||||
return const Center(
|
||||
child: Text('Connect to the server to see schedules.'),
|
||||
);
|
||||
}
|
||||
return SchedulesListView(
|
||||
controller: _controller,
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../ui/adaptive/segmented_bar.dart';
|
||||
import '../core/api_gateway.dart';
|
||||
import '../features/search/search_screen.dart';
|
||||
import '../ui/adaptive/host.dart';
|
||||
@@ -119,11 +120,12 @@ class _SearchPage extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) => cupertino
|
||||
? CupertinoPageScaffold(
|
||||
navigationBar: const CupertinoNavigationBar(middle: Text('Search')),
|
||||
navigationBar: const SegmentedBar(cupertino: true, title: 'Search'),
|
||||
child: SafeArea(child: child),
|
||||
)
|
||||
: Scaffold(
|
||||
appBar: AppBar(title: const Text('Search')),
|
||||
extendBodyBehindAppBar: true,
|
||||
appBar: const SegmentedBar(cupertino: false, title: 'Search'),
|
||||
body: SafeArea(child: child),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../ui/adaptive/segmented_bar.dart';
|
||||
import '../core/api_gateway.dart';
|
||||
import '../features/templates/screen.dart';
|
||||
import '../ui/adaptive/host.dart';
|
||||
@@ -96,7 +97,8 @@ class _TemplatesPage extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
if (cupertino) {
|
||||
return CupertinoPageScaffold(
|
||||
navigationBar: CupertinoNavigationBar(
|
||||
navigationBar: SegmentedBar(
|
||||
cupertino: true,
|
||||
leading: CupertinoButton(
|
||||
key: templatesPageBackKey,
|
||||
padding: EdgeInsets.zero,
|
||||
@@ -106,20 +108,22 @@ class _TemplatesPage extends StatelessWidget {
|
||||
semanticLabel: 'Back to Settings',
|
||||
),
|
||||
),
|
||||
middle: const Text('Templates'),
|
||||
title: 'Templates',
|
||||
),
|
||||
child: SafeArea(child: child),
|
||||
);
|
||||
}
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
extendBodyBehindAppBar: true,
|
||||
appBar: SegmentedBar(
|
||||
cupertino: false,
|
||||
leading: IconButton(
|
||||
key: templatesPageBackKey,
|
||||
tooltip: 'Back to Settings',
|
||||
onPressed: onBack,
|
||||
icon: const Icon(Icons.arrow_back),
|
||||
),
|
||||
title: const Text('Templates'),
|
||||
title: 'Templates',
|
||||
),
|
||||
body: SafeArea(child: child),
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user