Compact: snap previews too, pin the composer to the 40px send button

The design switcher's live preview decides the hosts' blend like a choice
does. Compact's field matches the now fixed 40px send button and its
32px attach centres on that line.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-12-03 22:54:51 +00:00
parent 048ecc651e
commit f4ca239afb
2 changed files with 22 additions and 23 deletions
@@ -1061,7 +1061,15 @@ class _ChatComposerBarState extends State<ChatComposerBar> {
builder: (context, constraints) => Row(
crossAxisAlignment: CrossAxisAlignment.end,
children: [
_attach(context),
// A dense design's 32px attach centres
// on the 40px send button's line.
if (AppDesignTokens.of(context).density.dense)
Padding(
padding: const EdgeInsets.only(bottom: 4),
child: _attach(context),
)
else
_attach(context),
Expanded(
child: Focus(
canRequestFocus: false,
@@ -1329,11 +1337,11 @@ class _ChatComposerBarState extends State<ChatComposerBar> {
// The pill draws the field's surface; the field adds no border.
border: InputBorder.none,
isDense: true,
// A dense design's slim composer: one line in a 40px pill, as tall
// as its 32px controls (its compact density takes 4px off each of
// these 10).
// A dense design's slim composer: one line as tall as the 40px send
// button (every design pins it), so the pill is 48px. Its compact
// density takes 4px off each of these 14.
contentPadding: EdgeInsets.symmetric(
vertical: AppDesignTokens.of(context).density.dense ? 10 : 12,
vertical: AppDesignTokens.of(context).density.dense ? 14 : 12,
),
),
);
+9 -18
View File
@@ -88,7 +88,7 @@ class AppDesignController extends ChangeNotifier {
void preview(AppDesign? design) {
final shown = this.design;
_preview = design;
if (this.design != shown) notifyListeners();
if (this.design != shown) _shown(shown);
}
/// How long the theme hosts blend into the current design (their
@@ -101,9 +101,11 @@ class AppDesignController extends ChangeNotifier {
_snapTheme ? Duration.zero : kThemeAnimationDuration;
bool _snapTheme = false;
void _apply(AppDesign design) {
_snapTheme = _design.dense || design.dense;
_design = design;
/// The shown design changed from [before]: decide the hosts' blend and
/// tell them.
void _shown(AppDesign before) {
_snapTheme = before.dense || design.dense;
notifyListeners();
}
/// The last choice could not be stored on this device.
@@ -116,30 +118,19 @@ class AppDesignController extends ChangeNotifier {
if (revision != _revision || id == null) return;
final design = AppDesign.fromId(id);
if (design == _design) return;
<<<<<<< HEAD
_apply(design);
notifyListeners();
=======
final shown = this.design;
_design = design;
if (_preview == null) notifyListeners();
>>>>>>> main
if (_preview == null) _shown(shown);
}
/// Applies [design] now and stores it.
Future<void> select(AppDesign design) async {
_revision++;
final revision = _revision;
<<<<<<< HEAD
if (design != _design) {
_apply(design);
notifyListeners();
}
=======
final shown = this.design;
_preview = null;
_design = design;
if (design != shown) notifyListeners();
>>>>>>> main
if (design != shown) _shown(shown);
final saved = await _store.save(design.id);
if (revision != _revision || saved != _saveFailed) return;
_saveFailed = !saved;