-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathint-list-view.dart
More file actions
61 lines (50 loc) · 1.28 KB
/
int-list-view.dart
File metadata and controls
61 lines (50 loc) · 1.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
// Copyright 2018 The Flutter team. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'package:flutter/material.dart';
import 'package:english_words/english_words.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Welcome to Flutter',
home: Stuff(),
);
}
}
class StuffState extends State<Stuff> {
@override
final _suggestions = <int> [];
final _biggerFont = const TextStyle(fontSize: 18.0);
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Display Integers'),
),
body: _buildSuggestions(),
);
}
Widget _buildRow(int number) {
return ListTile(
title: Text(
number.toString(),
style: _biggerFont,
),
);
}
Widget _buildSuggestions() {
return ListView.builder(
padding: const EdgeInsets.all(16.0),
itemBuilder: /*1*/ (context, i) {
if (i >= _suggestions.length) {
_suggestions.add(i);
}
return _buildRow(_suggestions[i]);
});
}
}
class Stuff extends StatefulWidget {
@override
StuffState createState() => StuffState();
}