Adds MeshProgressBar and MeshProgressAppBarBottom: 4px, theme progress colour and track, filling when progress is known, keeping their height when idle. The sync bar uses them (no more red/blue/green), as do Repeater "Refresh all", the chess game, chat search and the line-of-sight map. design.md gets the progress bar rules. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
36 lines
1.2 KiB
Dart
36 lines
1.2 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter_test/flutter_test.dart';
|
|
|
|
import 'package:meshcore_open/widgets/sync_progress_overlay.dart';
|
|
|
|
// The shared top progress bar: 4px, theme colours, keeps its height idle.
|
|
void main() {
|
|
Widget host(Widget child) => MaterialApp(
|
|
home: Scaffold(body: Column(children: [child])),
|
|
);
|
|
|
|
testWidgets('idle bar keeps its 4px height and draws nothing', (
|
|
tester,
|
|
) async {
|
|
await tester.pumpWidget(host(const MeshProgressBar(active: false)));
|
|
expect(tester.getSize(find.byType(MeshProgressBar)).height, 4);
|
|
expect(find.byType(LinearProgressIndicator), findsNothing);
|
|
});
|
|
|
|
testWidgets('active bar fills with the theme colour', (tester) async {
|
|
await tester.pumpWidget(host(const MeshProgressBar(value: 0.5)));
|
|
final bar = tester.widget<LinearProgressIndicator>(
|
|
find.byType(LinearProgressIndicator),
|
|
);
|
|
expect(bar.value, 0.5);
|
|
expect(bar.minHeight, 4);
|
|
expect(bar.color, isNull);
|
|
expect(bar.backgroundColor, isNull);
|
|
});
|
|
|
|
test('app bar versions are 4px tall', () {
|
|
expect(const MeshProgressAppBarBottom().preferredSize.height, 4);
|
|
expect(const SyncProgressAppBarBottom().preferredSize.height, 4);
|
|
});
|
|
}
|