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
parent
074d186c09
commit
202b14e59b
@ -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…
Reference in new issue