Unverified Commit e11a2213 authored by Yu's avatar Yu Committed by GitHub

[Refactor] Fix style in example (#126191)

Replaces #125616

I just fixed "IMAGES" to "images" in examples/image_list.
Currently, "PREFER uses the lower case of the constant name ".
parent bbe6ed2d
...@@ -119,7 +119,7 @@ Future<void> main() async { ...@@ -119,7 +119,7 @@ Future<void> main() async {
runApp(MyApp(port)); runApp(MyApp(port));
} }
const int IMAGES = 50; const int images = 50;
@immutable @immutable
class MyApp extends StatelessWidget { class MyApp extends StatelessWidget {
...@@ -159,7 +159,7 @@ class _MyHomePageState extends State<MyHomePage> with TickerProviderStateMixin { ...@@ -159,7 +159,7 @@ class _MyHomePageState extends State<MyHomePage> with TickerProviderStateMixin {
Widget createImage(final int index, final Completer<bool> completer) { Widget createImage(final int index, final Completer<bool> completer) {
return Image.network( return Image.network(
'https://localhost:${widget.port}/${_counter * IMAGES + index}', 'https://localhost:${widget.port}/${_counter * images + index}',
frameBuilder: ( frameBuilder: (
BuildContext context, BuildContext context,
Widget child, Widget child,
...@@ -177,14 +177,14 @@ class _MyHomePageState extends State<MyHomePage> with TickerProviderStateMixin { ...@@ -177,14 +177,14 @@ class _MyHomePageState extends State<MyHomePage> with TickerProviderStateMixin {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final List<AnimationController> controllers = <AnimationController>[ final List<AnimationController> controllers = <AnimationController>[
for (int i = 0; i < IMAGES; i++) for (int i = 0; i < images; i++)
AnimationController( AnimationController(
duration: const Duration(milliseconds: 3600), duration: const Duration(milliseconds: 3600),
vsync: this, vsync: this,
)..repeat(), )..repeat(),
]; ];
final List<Completer<bool>> completers = <Completer<bool>>[ final List<Completer<bool>> completers = <Completer<bool>>[
for (int i = 0; i < IMAGES; i++) for (int i = 0; i < images; i++)
Completer<bool>(), Completer<bool>(),
]; ];
final List<Future<bool>> futures = completers.map( final List<Future<bool>> futures = completers.map(
...@@ -204,7 +204,7 @@ class _MyHomePageState extends State<MyHomePage> with TickerProviderStateMixin { ...@@ -204,7 +204,7 @@ class _MyHomePageState extends State<MyHomePage> with TickerProviderStateMixin {
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[ children: <Widget>[
Row(children: createImageList(IMAGES, completers, controllers)), Row(children: createImageList(images, completers, controllers)),
const Text( const Text(
'You have pushed the button this many times:', 'You have pushed the button this many times:',
), ),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment