mirror of
https://github.com/kuhyx/diet-guard.git
synced 2026-11-19 21:34:26 +01:00
Flutter 3.50 deprecates package:flutter/material.dart; 73 deprecation infos failed flutter analyze --fatal-infos, and four Dart pins were behind (crdt_sync_flutter 0.8.2, flutter_local_notifications 23.0.2, github_device_auth 0.5.0, sync_settings_ui 0.8.2). Those UI packages now sit on material_ui, so the app has to as well or their widgets lose MaterialLocalizations. Imports swap one-for-one and dart fix re-sorted the directives; no behaviour change. analyze is clean and all six test shards pass. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WzxdWWfb63jncj9Lca2jeX
48 lines
1.4 KiB
Dart
48 lines
1.4 KiB
Dart
import 'package:diet_guard_app/ui/theme.dart';
|
|
import 'package:material_ui/material_ui.dart';
|
|
import 'package:flutter_test/flutter_test.dart';
|
|
|
|
void main() {
|
|
test('durations follow the shared motion scale', () {
|
|
expect(AppDuration.instant, Duration.zero);
|
|
expect(AppDuration.fast, const Duration(milliseconds: 120));
|
|
expect(AppDuration.base, const Duration(milliseconds: 200));
|
|
expect(AppDuration.slow, const Duration(milliseconds: 320));
|
|
});
|
|
|
|
test('curves carry the shared control points', () {
|
|
expect(AppCurve.standard, const Cubic(0.2, 0, 0, 1));
|
|
expect(AppCurve.decelerate, const Cubic(0, 0, 0, 1));
|
|
expect(AppCurve.accelerate, const Cubic(0.3, 0, 1, 1));
|
|
});
|
|
|
|
Future<Duration> resolved(
|
|
WidgetTester tester, {
|
|
required bool reduced,
|
|
}) async {
|
|
late Duration out;
|
|
await tester.pumpWidget(
|
|
MediaQuery(
|
|
data: MediaQueryData(disableAnimations: reduced),
|
|
child: Builder(
|
|
builder: (context) {
|
|
out = AppDuration.resolve(context, AppDuration.slow);
|
|
return const SizedBox();
|
|
},
|
|
),
|
|
),
|
|
);
|
|
return out;
|
|
}
|
|
|
|
testWidgets('resolve collapses to zero under disableAnimations', (
|
|
tester,
|
|
) async {
|
|
expect(await resolved(tester, reduced: true), Duration.zero);
|
|
});
|
|
|
|
testWidgets('resolve returns the token otherwise', (tester) async {
|
|
expect(await resolved(tester, reduced: false), AppDuration.slow);
|
|
});
|
|
}
|