mirror of
https://github.com/kuhyx/screen-locker.git
synced 2026-11-20 20:32:24 +01:00
Flutter 3.50 deprecates package:flutter/material.dart, which made flutter-analyze report 27 deprecated_member_use infos and blocked the gate. workout_app now imports material_ui 1.11.0, with crdt_sync_dart 0.14.1 and sync_settings_ui 0.8.2 (both on material_ui). material_ui's MaterialApp ships its own MaterialLocalizations, so a package that still calls the framework showDialog threw a null check. WorkoutApp now adds the framework delegate, and a widget test opens a material_ui and a framework dialog through the real app root. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WzxdWWfb63jncj9Lca2jeX
36 lines
1.1 KiB
Dart
36 lines
1.1 KiB
Dart
/// A whole number that counts to its true value instead of snapping to it.
|
|
library;
|
|
|
|
import 'package:material_ui/material_ui.dart';
|
|
import 'package:workout_app/ui/theme.dart';
|
|
|
|
/// Rebuilds [builder] with a number that eases from 0 to [value] on arrival,
|
|
/// and from the number on screen to a new [value] when it changes.
|
|
///
|
|
/// The animation only travels towards the real value and always ends on it;
|
|
/// nothing here can show a number the data does not hold. With the OS
|
|
/// animations setting off, the duration collapses and the real value shows at
|
|
/// once.
|
|
class AnimatedCounter extends StatelessWidget {
|
|
/// Creates an [AnimatedCounter].
|
|
const AnimatedCounter({
|
|
required this.value,
|
|
required this.builder,
|
|
super.key,
|
|
});
|
|
|
|
/// The true value to arrive at.
|
|
final int value;
|
|
|
|
/// Draws the number currently on its way to [value].
|
|
final Widget Function(int shown) builder;
|
|
|
|
@override
|
|
Widget build(BuildContext context) => TweenAnimationBuilder<int>(
|
|
tween: IntTween(begin: 0, end: value),
|
|
duration: motionDuration(context, AppDuration.slow),
|
|
curve: AppCurve.decelerate,
|
|
builder: (_, shown, _) => builder(shown),
|
|
);
|
|
}
|