Add tests for tween_animation_builder.0.dart API example. (#148902)
This PR contributes to https://github.com/flutter/flutter/issues/130459 ### Description - Adds tests for `examples/api/lib/widgets/tween_animation_builder/tween_animation_builder.0.dart`
This commit is contained in:
committed by
GitHub
parent
5933e99c6c
commit
488fb09582
@@ -15,7 +15,9 @@ class TweenAnimationBuilderExampleApp extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
return MaterialApp(
|
||||
home: Scaffold(
|
||||
appBar: AppBar(title: const Text('TweenAnimationBuilder Sample')),
|
||||
appBar: AppBar(
|
||||
title: const Text('TweenAnimationBuilder Sample'),
|
||||
),
|
||||
body: const Center(
|
||||
child: TweenAnimationBuilderExample(),
|
||||
),
|
||||
@@ -28,16 +30,18 @@ class TweenAnimationBuilderExample extends StatefulWidget {
|
||||
const TweenAnimationBuilderExample({super.key});
|
||||
|
||||
@override
|
||||
State<TweenAnimationBuilderExample> createState() => _TweenAnimationBuilderExampleState();
|
||||
State<TweenAnimationBuilderExample> createState() =>
|
||||
_TweenAnimationBuilderExampleState();
|
||||
}
|
||||
|
||||
class _TweenAnimationBuilderExampleState extends State<TweenAnimationBuilderExample> {
|
||||
double targetValue = 24.0;
|
||||
class _TweenAnimationBuilderExampleState
|
||||
extends State<TweenAnimationBuilderExample> {
|
||||
double _targetValue = 24.0;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return TweenAnimationBuilder<double>(
|
||||
tween: Tween<double>(begin: 0, end: targetValue),
|
||||
tween: Tween<double>(begin: 0, end: _targetValue),
|
||||
duration: const Duration(seconds: 1),
|
||||
builder: (BuildContext context, double size, Widget? child) {
|
||||
return IconButton(
|
||||
@@ -46,7 +50,7 @@ class _TweenAnimationBuilderExampleState extends State<TweenAnimationBuilderExam
|
||||
icon: child!,
|
||||
onPressed: () {
|
||||
setState(() {
|
||||
targetValue = targetValue == 24.0 ? 48.0 : 24.0;
|
||||
_targetValue = _targetValue == 24.0 ? 48.0 : 24.0;
|
||||
});
|
||||
},
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user