Progress bars: one shared 4px top bar in the theme colour
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>
This commit is contained in:
1 parent
fe957c2765
commit
0aa867e40e
7 files changed
+112
-48
No files matched your search
@@ -0,0 +1,35 @@
|
||||
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);
|
||||
});
|
||||
}
|
||||
Reference in new issue
Block a user