Add test for animated_fractionally_sized_box.0.dart API example. (#146721)
This PR contributes to https://github.com/flutter/flutter/issues/130459 ### Description - Adds `examples/api/test/widgets/implicit_animations/animated_fractionally_sized_box.0_test.dart` test
This commit is contained in:
committed by
GitHub
parent
a1cb040511
commit
32ea4b3c46
@@ -11,25 +11,43 @@ void main() => runApp(const AnimatedFractionallySizedBoxExampleApp());
|
||||
class AnimatedFractionallySizedBoxExampleApp extends StatelessWidget {
|
||||
const AnimatedFractionallySizedBoxExampleApp({super.key});
|
||||
|
||||
static const Duration duration = Duration(seconds: 1);
|
||||
static const Curve curve = Curves.fastOutSlowIn;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return MaterialApp(
|
||||
home: Scaffold(
|
||||
appBar: AppBar(title: const Text('AnimatedFractionallySizedBox Sample')),
|
||||
body: const AnimatedFractionallySizedBoxExample(),
|
||||
appBar: AppBar(
|
||||
title: const Text('AnimatedFractionallySizedBox Sample'),
|
||||
),
|
||||
body: const AnimatedFractionallySizedBoxExample(
|
||||
duration: duration,
|
||||
curve: curve,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class AnimatedFractionallySizedBoxExample extends StatefulWidget {
|
||||
const AnimatedFractionallySizedBoxExample({super.key});
|
||||
const AnimatedFractionallySizedBoxExample({
|
||||
required this.duration,
|
||||
required this.curve,
|
||||
super.key,
|
||||
});
|
||||
|
||||
final Duration duration;
|
||||
|
||||
final Curve curve;
|
||||
|
||||
@override
|
||||
State<AnimatedFractionallySizedBoxExample> createState() => _AnimatedFractionallySizedBoxExampleState();
|
||||
State<AnimatedFractionallySizedBoxExample> createState() =>
|
||||
_AnimatedFractionallySizedBoxExampleState();
|
||||
}
|
||||
|
||||
class _AnimatedFractionallySizedBoxExampleState extends State<AnimatedFractionallySizedBoxExample> {
|
||||
class _AnimatedFractionallySizedBoxExampleState
|
||||
extends State<AnimatedFractionallySizedBoxExample> {
|
||||
bool selected = false;
|
||||
|
||||
@override
|
||||
@@ -50,8 +68,8 @@ class _AnimatedFractionallySizedBoxExampleState extends State<AnimatedFractional
|
||||
widthFactor: selected ? 0.25 : 0.75,
|
||||
heightFactor: selected ? 0.75 : 0.25,
|
||||
alignment: selected ? Alignment.topLeft : Alignment.bottomRight,
|
||||
duration: const Duration(seconds: 1),
|
||||
curve: Curves.fastOutSlowIn,
|
||||
duration: widget.duration,
|
||||
curve: widget.curve,
|
||||
child: const ColoredBox(
|
||||
color: Colors.blue,
|
||||
child: FlutterLogo(size: 75),
|
||||
|
||||
Reference in New Issue
Block a user