From 202b14e59b993a7432561e94d2b8bf2cf05e7381 Mon Sep 17 00:00:00 2001 From: diffwireauto <330573775+diffwireauto@users.noreply.github.com> Date: Sun, 29 Nov 2026 05:02:22 -0500 Subject: [PATCH] fix(#1276): same separator above the input in DM and channel chat The DM composer drew a hard top border in the divider colour; the channel composer drew a soft shadow. All three composer bars (DM text, DM GIF-only, channel) now take composerDecoration: the surface colour with the channel chat's soft shadow. Regression test composer_decoration_test.dart: the decoration has no border, and both chats build their composer bars from it. The source check fails against dev. Epic: #1272 Agent: StormyElk (session 088ce922) --- lib/screens/channel_chat_screen.dart | 12 ++----- lib/screens/chat_screen.dart | 11 ++---- lib/widgets/composer_decoration.dart | 14 ++++++++ test/widgets/composer_decoration_test.dart | 42 ++++++++++++++++++++++ 4 files changed, 61 insertions(+), 18 deletions(-) create mode 100644 lib/widgets/composer_decoration.dart create mode 100644 test/widgets/composer_decoration_test.dart diff --git a/lib/screens/channel_chat_screen.dart b/lib/screens/channel_chat_screen.dart index 1e8d5384..88194c9e 100644 --- a/lib/screens/channel_chat_screen.dart +++ b/lib/screens/channel_chat_screen.dart @@ -49,6 +49,7 @@ import '../widgets/app_bar_title.dart'; import '../widgets/app_shell.dart'; import '../widgets/channel_drawer_list.dart'; import '../widgets/composer_budget_notice.dart'; +import '../widgets/composer_decoration.dart'; import '../widgets/mention_autocomplete.dart'; import '../helpers/emoji_shortcodes.dart'; import '../widgets/chat_zoom_wrapper.dart'; @@ -1603,16 +1604,7 @@ class _ChannelChatScreenState extends State { ), Container( padding: const EdgeInsets.all(8), - decoration: BoxDecoration( - color: Theme.of(context).colorScheme.surface, - boxShadow: [ - BoxShadow( - color: Colors.black.withValues(alpha: 0.1), - blurRadius: 4, - offset: const Offset(0, -2), - ), - ], - ), + decoration: composerDecoration(context), child: Row( children: [ IconButton( diff --git a/lib/screens/chat_screen.dart b/lib/screens/chat_screen.dart index aa83574d..8e4ecdaf 100644 --- a/lib/screens/chat_screen.dart +++ b/lib/screens/chat_screen.dart @@ -34,6 +34,7 @@ import '../services/translation_service.dart'; import '../widgets/app_bar_title.dart'; import '../widgets/chat_zoom_wrapper.dart'; import '../widgets/composer_budget_notice.dart'; +import '../widgets/composer_decoration.dart'; import '../widgets/contact_settings_dialog.dart'; import '../widgets/elements_ui.dart'; import '../widgets/mention_autocomplete.dart'; @@ -624,10 +625,7 @@ class _ChatScreenState extends State { ) { return Container( padding: const EdgeInsets.all(8), - decoration: BoxDecoration( - color: colorScheme.surface, - border: Border(top: BorderSide(color: Theme.of(context).dividerColor)), - ), + decoration: composerDecoration(context), child: SafeArea( child: Row( children: [ @@ -764,10 +762,7 @@ class _ChatScreenState extends State { final colorScheme = Theme.of(context).colorScheme; return Container( padding: const EdgeInsets.all(8), - decoration: BoxDecoration( - color: colorScheme.surface, - border: Border(top: BorderSide(color: Theme.of(context).dividerColor)), - ), + decoration: composerDecoration(context), child: SafeArea( child: Row( children: [ diff --git a/lib/widgets/composer_decoration.dart b/lib/widgets/composer_decoration.dart new file mode 100644 index 00000000..0050a1f7 --- /dev/null +++ b/lib/widgets/composer_decoration.dart @@ -0,0 +1,14 @@ +import 'package:flutter/material.dart'; + +/// The bar behind every chat composer: the surface colour with a soft shadow +/// above it, the same in direct and channel chat. (#1276) +BoxDecoration composerDecoration(BuildContext context) => BoxDecoration( + color: Theme.of(context).colorScheme.surface, + boxShadow: [ + BoxShadow( + color: Colors.black.withValues(alpha: 0.1), + blurRadius: 4, + offset: const Offset(0, -2), + ), + ], +); diff --git a/test/widgets/composer_decoration_test.dart b/test/widgets/composer_decoration_test.dart new file mode 100644 index 00000000..01a42bbd --- /dev/null +++ b/test/widgets/composer_decoration_test.dart @@ -0,0 +1,42 @@ +import 'dart:io'; + +import 'package:flutter/material.dart'; +import 'package:flutter_test/flutter_test.dart'; +import 'package:meshcore_open/widgets/composer_decoration.dart'; + +// #1276: the DM composer drew a hard top border, the channel composer a soft +// shadow, so the line above the input looked different in the two chats. +void main() { + testWidgets('the composer bar has a soft shadow and no border', ( + tester, + ) async { + late BoxDecoration decoration; + await tester.pumpWidget( + MaterialApp( + home: Builder( + builder: (context) { + decoration = composerDecoration(context); + return const SizedBox(); + }, + ), + ), + ); + expect(decoration.border, isNull); + expect(decoration.boxShadow, isNotEmpty); + }); + + test('both chats build their composer bar from composerDecoration', () { + for (final (path, count) in [ + ('lib/screens/chat_screen.dart', 2), + ('lib/screens/channel_chat_screen.dart', 1), + ]) { + final src = File(path).readAsStringSync(); + expect( + 'composerDecoration(context)'.allMatches(src).length, + count, + reason: path, + ); + expect(src.contains('Border(top: BorderSide('), isFalse, reason: path); + } + }); +}