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)
pull/1353/head
diffwireauto 3 days ago
parent 074d186c09
commit 202b14e59b

@ -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<ChannelChatScreen> {
),
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(

@ -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<ChatScreen> {
) {
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<ChatScreen> {
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: [

@ -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),
),
],
);

@ -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);
}
});
}
Loading…
Cancel
Save

Powered by TurnKey Linux.