mirror of
https://github.com/flutter/samples.git
synced 2025-11-09 06:18:49 +00:00
Upgrading samples to flutter_lints, part 1 of n (#804)
This commit is contained in:
@@ -25,7 +25,7 @@ class _CurvedAnimationDemoState extends State<CurvedAnimationDemo>
|
||||
late final Animation<double> animationRotation;
|
||||
late final Animation<Offset> animationTranslation;
|
||||
static const _duration = Duration(seconds: 4);
|
||||
List<CurveChoice> curves = [
|
||||
List<CurveChoice> curves = const [
|
||||
CurveChoice(curve: Curves.bounceIn, name: 'Bounce In'),
|
||||
CurveChoice(curve: Curves.bounceOut, name: 'Bounce Out'),
|
||||
CurveChoice(curve: Curves.easeInCubic, name: 'Ease In Cubic'),
|
||||
@@ -69,8 +69,8 @@ class _CurvedAnimationDemoState extends State<CurvedAnimationDemo>
|
||||
}
|
||||
});
|
||||
animationTranslation = Tween<Offset>(
|
||||
begin: Offset(-1, 0),
|
||||
end: Offset(1, 0),
|
||||
begin: const Offset(-1, 0),
|
||||
end: const Offset(1, 0),
|
||||
).animate(curvedAnimation)
|
||||
..addListener(() {
|
||||
setState(() {});
|
||||
@@ -86,11 +86,11 @@ class _CurvedAnimationDemoState extends State<CurvedAnimationDemo>
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text('Curved Animation'),
|
||||
title: const Text('Curved Animation'),
|
||||
),
|
||||
body: Column(
|
||||
children: [
|
||||
SizedBox(height: 20.0),
|
||||
const SizedBox(height: 20.0),
|
||||
Text(
|
||||
'Select Curve for forward motion',
|
||||
style: Theme.of(context).textTheme.headline6,
|
||||
@@ -110,7 +110,7 @@ class _CurvedAnimationDemoState extends State<CurvedAnimationDemo>
|
||||
},
|
||||
value: selectedForwardCurve,
|
||||
),
|
||||
SizedBox(height: 15.0),
|
||||
const SizedBox(height: 15.0),
|
||||
Text(
|
||||
'Select Curve for reverse motion',
|
||||
style: Theme.of(context).textTheme.headline6,
|
||||
@@ -130,32 +130,28 @@ class _CurvedAnimationDemoState extends State<CurvedAnimationDemo>
|
||||
},
|
||||
value: selectedReverseCurve,
|
||||
),
|
||||
SizedBox(height: 35.0),
|
||||
const SizedBox(height: 35.0),
|
||||
Transform.rotate(
|
||||
angle: animationRotation.value,
|
||||
child: Center(
|
||||
child: Container(
|
||||
child: FlutterLogo(
|
||||
size: 100,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(height: 35.0),
|
||||
FractionalTranslation(
|
||||
translation: animationTranslation.value,
|
||||
child: Container(
|
||||
child: const Center(
|
||||
child: FlutterLogo(
|
||||
size: 100,
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(height: 25.0),
|
||||
const SizedBox(height: 35.0),
|
||||
FractionalTranslation(
|
||||
translation: animationTranslation.value,
|
||||
child: const FlutterLogo(
|
||||
size: 100,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 25.0),
|
||||
ElevatedButton(
|
||||
onPressed: () {
|
||||
controller.forward();
|
||||
},
|
||||
child: Text('Animate'),
|
||||
child: const Text('Animate'),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user