Add Dock captions and subtle blue icon glow

This commit is contained in:
Codex
2026-10-14 09:22:24 +08:00
parent 499c6a905e
commit fe23c65fd9
8 changed files with 101 additions and 28 deletions
+9 -2
View File
@@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:hepan_everyday/widgets/glass_dock.dart';
import 'package:hepan_everyday/app/hepan_app.dart';
import 'package:hepan_everyday/features/timetable/timetable_page.dart';
import 'package:timezone/data/latest.dart' as tzdata;
import 'navigation_test.dart' show uiController;
@@ -16,7 +17,13 @@ void main() {
await c.showDemo();
await tester.pumpWidget(HepanApp(controller: c));
await tester.pumpAndSettle();
expect(find.text('课表'), findsOneWidget);
expect(
find.descendant(
of: find.byType(TimetablePage),
matching: find.text('课表'),
),
findsOneWidget,
);
expect(tester.getRect(find.text('周日')).right, lessThanOrEqualTo(800));
await tester.drag(find.text('周三'), const Offset(-250, 0));
await tester.pumpAndSettle();
@@ -36,7 +43,7 @@ void main() {
);
await tester.pumpAndSettle();
expect(find.text('示例课表'), findsOneWidget);
await tester.tap(find.bySemanticsLabel('个人设置'));
await tester.tap(find.text('我的'));
await tester.pumpAndSettle();
expect(find.text('登录学校账户'), findsOneWidget);
c.dispose();
+9 -8
View File
@@ -18,10 +18,11 @@ void main() {
backdropColor: Colors.white,
preview: true,
);
final selected = _channel(resting, 46, 52, 0);
// Sample beside the visible label, away from icon glow and glass rims.
final selected = _channel(resting, 22, 52, 0);
final base = _channel(resting, 160, 52, 0);
expect(base - selected, greaterThan(20));
expect((_channel(resting, 46, 52, 2) - selected).abs(), lessThan(12));
expect((_channel(resting, 22, 52, 2) - selected).abs(), lessThan(12));
final held = await _render(
tester,
GlassDock(selectedIndex: 0, onSelected: (_) {}),
@@ -29,7 +30,7 @@ void main() {
held: true,
preview: true,
);
expect(_channel(held, 46, 52, 0) - selected, greaterThan(18));
expect(_channel(held, 22, 52, 0) - selected, greaterThan(18));
});
testWidgets(
'glass softens fine background detail without whitening its colour',
@@ -60,9 +61,9 @@ void main() {
);
// Below the symbol and away from the rim, the selected lens should retain
// this saturated cyan backdrop while applying the new resting grey tint.
final red = _channel(pixels, 46, 52, 0);
final green = _channel(pixels, 46, 52, 1);
final blue = _channel(pixels, 46, 52, 2);
final red = _channel(pixels, 22, 52, 0);
final green = _channel(pixels, 22, 52, 1);
final blue = _channel(pixels, 22, 52, 2);
expect(red, lessThan(85));
expect(green - red, greaterThan(95));
expect(blue - red, greaterThan(140));
@@ -80,7 +81,7 @@ void main() {
);
for (final start in [32, 160]) {
final reds = [
for (var x = start; x < start + 20; x++) _channel(pixels, x, 52, 0),
for (var x = start; x < start + 20; x++) _channel(pixels, x, 60, 0),
];
final contrast =
reds.reduce((a, b) => a > b ? a : b) -
@@ -103,7 +104,7 @@ void main() {
);
for (final start in [24, 160]) {
final reds = [
for (var x = start; x < start + 40; x++) _channel(pixels, x, 52, 0),
for (var x = start; x < start + 40; x++) _channel(pixels, x, 60, 0),
];
final contrast =
reds.reduce((a, b) => a > b ? a : b) -
@@ -1,6 +1,7 @@
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:hepan_everyday/app/hepan_app.dart';
import 'package:hepan_everyday/features/timetable/timetable_page.dart';
import 'package:timezone/data/latest.dart' as tzdata;
import 'navigation_test.dart' show uiController;
@@ -19,7 +20,13 @@ void main() {
await c.showDemo();
await tester.pumpWidget(HepanApp(controller: c));
await tester.pumpAndSettle();
expect(find.text('课表'), findsOneWidget);
expect(
find.descendant(
of: find.byType(TimetablePage),
matching: find.text('课表'),
),
findsOneWidget,
);
expect(find.bySemanticsLabel('考试'), findsOneWidget);
await tester.drag(find.text('周三'), const Offset(0, -200));
await tester.pumpAndSettle();
+2 -1
View File
@@ -67,7 +67,8 @@ void main() {
await tester.pumpAndSettle();
await tester.tap(find.bySemanticsLabel('考试'));
await tester.pumpAndSettle();
expect(find.text('考试'), findsOneWidget);
// The page heading and Dock caption both show the active tab name.
expect(find.text('考试'), findsNWidgets(2));
expect(find.text('考试安排'), findsOneWidget);
await tester.tap(find.bySemanticsLabel('个人设置'));
await tester.pumpAndSettle();