From f4ca239afbe79e56191e46f7dcd2873872c197f1 Mon Sep 17 00:00:00 2001 From: Alan Silva Date: Thu, 3 Dec 2026 22:54:51 +0000 Subject: [PATCH] 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 --- .../chat/conversation/chat_composer_bar.dart | 18 +++++++++---- app/lib/ui/theme/app_design_controller.dart | 27 +++++++------------ 2 files changed, 22 insertions(+), 23 deletions(-) diff --git a/app/lib/features/chat/conversation/chat_composer_bar.dart b/app/lib/features/chat/conversation/chat_composer_bar.dart index 748ffc96..52647aa1 100644 --- a/app/lib/features/chat/conversation/chat_composer_bar.dart +++ b/app/lib/features/chat/conversation/chat_composer_bar.dart @@ -1061,7 +1061,15 @@ class _ChatComposerBarState extends State { 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 { // 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, ), ), ); diff --git a/app/lib/ui/theme/app_design_controller.dart b/app/lib/ui/theme/app_design_controller.dart index 7825e6a6..f0b38892 100644 --- a/app/lib/ui/theme/app_design_controller.dart +++ b/app/lib/ui/theme/app_design_controller.dart @@ -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 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;