mirror of
https://github.com/flutter/flutter.git
synced 2025-06-03 00:51:18 +00:00
[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 ".
This commit is contained in:
parent
bbe6ed2dce
commit
e11a2213e2
@ -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 {
|
|||||||
|
|
||||||
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 {
|
|||||||
@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 {
|
|||||||
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:',
|
||||||
),
|
),
|
||||||
|
Loading…
Reference in New Issue
Block a user