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';
|
||||
@@ -205,28 +206,28 @@ class _ChatSessionsScreenState extends State<ChatSessionsScreen> {
|
||||
children: [
|
||||
ContentWidth(
|
||||
child: ChatSessionsBody(
|
||||
sessions: _controller.sessions,
|
||||
activeSessionId: widget.activeSessionId,
|
||||
query: _search.text,
|
||||
loading: _controller.loading,
|
||||
error: _controller.error,
|
||||
onOpen: _open,
|
||||
onRename: _rename,
|
||||
onClose: _close,
|
||||
onReopen: (session) =>
|
||||
_controller.reopen(_sessionId(session)),
|
||||
onStar: (session) => _controller.star(
|
||||
_sessionId(session),
|
||||
session['starred'] != true,
|
||||
),
|
||||
onHide: _hide,
|
||||
onClearSearch: () {
|
||||
_search.clear();
|
||||
setState(() {});
|
||||
},
|
||||
isUnseen: _controller.isUnseen,
|
||||
errorFor: _controller.errorFor,
|
||||
onDismissError: _controller.dismissError,
|
||||
sessions: _controller.sessions,
|
||||
activeSessionId: widget.activeSessionId,
|
||||
query: _search.text,
|
||||
loading: _controller.loading,
|
||||
error: _controller.error,
|
||||
onOpen: _open,
|
||||
onRename: _rename,
|
||||
onClose: _close,
|
||||
onReopen: (session) =>
|
||||
_controller.reopen(_sessionId(session)),
|
||||
onStar: (session) => _controller.star(
|
||||
_sessionId(session),
|
||||
session['starred'] != true,
|
||||
),
|
||||
onHide: _hide,
|
||||
onClearSearch: () {
|
||||
_search.clear();
|
||||
setState(() {});
|
||||
},
|
||||
isUnseen: _controller.isUnseen,
|
||||
errorFor: _controller.errorFor,
|
||||
onDismissError: _controller.dismissError,
|
||||
),
|
||||
),
|
||||
// The web's hide report is a fixed overlay: replacing or
|
||||
@@ -285,19 +286,22 @@ class _ChatSessionsScreenState extends State<ChatSessionsScreen> {
|
||||
|
||||
if (chatControlsStyleOf(context) == ChatControlsStyle.cupertino) {
|
||||
return CupertinoPageScaffold(
|
||||
navigationBar: CupertinoNavigationBar(
|
||||
middle: const Text('Chats'),
|
||||
trailing: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: _actions(),
|
||||
),
|
||||
navigationBar: SegmentedBar(
|
||||
cupertino: true,
|
||||
title: 'Chats',
|
||||
actions: _actions(),
|
||||
),
|
||||
child: SafeArea(child: body),
|
||||
);
|
||||
}
|
||||
return Scaffold(
|
||||
appBar: AppBar(title: const Text('Chats'), actions: _actions()),
|
||||
body: body,
|
||||
extendBodyBehindAppBar: true,
|
||||
appBar: SegmentedBar(
|
||||
cupertino: false,
|
||||
title: 'Chats',
|
||||
actions: _actions(),
|
||||
),
|
||||
body: SafeArea(left: false, right: false, bottom: false, child: body),
|
||||
floatingActionButton: FloatingActionButton.extended(
|
||||
key: const Key('chat-new-chat-fab'),
|
||||
onPressed: _newChat,
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import '../../../../ui/adaptive/segmented_bar.dart';
|
||||
import 'dart:typed_data';
|
||||
|
||||
import 'package:flutter/cupertino.dart';
|
||||
@@ -46,12 +47,13 @@ class ChatImageViewer extends StatelessWidget {
|
||||
void close() => Navigator.of(context).maybePop();
|
||||
if (cupertino) {
|
||||
return CupertinoPageScaffold(
|
||||
navigationBar: CupertinoNavigationBar(
|
||||
navigationBar: SegmentedBar(
|
||||
cupertino: true,
|
||||
automaticallyImplyLeading: false,
|
||||
middle: Text(name, overflow: TextOverflow.ellipsis),
|
||||
title: name,
|
||||
leading: CupertinoButton(
|
||||
key: const Key('chat-image-viewer-close'),
|
||||
padding: EdgeInsets.zero,
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16),
|
||||
onPressed: close,
|
||||
child: const Text(chatImageViewerClose),
|
||||
),
|
||||
@@ -60,7 +62,9 @@ class ChatImageViewer extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
extendBodyBehindAppBar: true,
|
||||
appBar: SegmentedBar(
|
||||
cupertino: false,
|
||||
automaticallyImplyLeading: false,
|
||||
leading: IconButton(
|
||||
key: const Key('chat-image-viewer-close'),
|
||||
@@ -68,7 +72,7 @@ class ChatImageViewer extends StatelessWidget {
|
||||
onPressed: close,
|
||||
icon: const Icon(Icons.close),
|
||||
),
|
||||
title: Text(name, overflow: TextOverflow.ellipsis),
|
||||
title: name,
|
||||
),
|
||||
body: body,
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user