回答編集履歴

1

コメントを受けてコードを訂正

2020/07/12 03:16

投稿

satokei
satokei

スコア1217

test CHANGED
@@ -4,7 +4,23 @@
4
4
 
5
5
 
6
6
 
7
+ (コード修正しました)
8
+
9
+
10
+
11
+ **_Searchクラス**
12
+
7
13
  ```dart
14
+
15
+ @override
16
+
17
+ Widget build(BuildContext context) {
18
+
19
+ return StreamProvider<List<VerbsData>>.value(
20
+
21
+ value: DatabaseService().verbs,
22
+
23
+ child: Scaffold(
8
24
 
9
25
  appBar: AppBar(
10
26
 
@@ -60,4 +76,76 @@
60
76
 
61
77
  ),
62
78
 
79
+ body: SingleChildScrollView(
80
+
81
+ child: Column(
82
+
83
+ crossAxisAlignment: CrossAxisAlignment.start,
84
+
85
+ children: <Widget>[DropdownForSorts(), WordsList(verbs: items)],
86
+
87
+ ),
88
+
89
+ ),
90
+
91
+ ),
92
+
93
+ );
94
+
95
+ }
96
+
63
97
  ```
98
+
99
+
100
+
101
+ **WordsListクラス**
102
+
103
+ ```dart
104
+
105
+ class WordsList extends StatefulWidget {
106
+
107
+ final List<VerbsData> verbs;
108
+
109
+
110
+
111
+ const WordsList({Key key, this.verbs}) : super(key: key);
112
+
113
+
114
+
115
+ @override
116
+
117
+ _WordsListState createState() => _WordsListState();
118
+
119
+ }
120
+
121
+
122
+
123
+ class _WordsListState extends State<WordsList> {
124
+
125
+ @override
126
+
127
+ Widget build(BuildContext context) {
128
+
129
+ final verbs = widget.verbs;
130
+
131
+
132
+
133
+ return ListView.builder(
134
+
135
+ shrinkWrap: true,
136
+
137
+ itemCount: verbs?.length ?? 0,
138
+
139
+ itemBuilder: (context, index) {
140
+
141
+ return WordsTile(verbsData: verbs[index]);
142
+
143
+ },
144
+
145
+ );
146
+
147
+ }
148
+
149
+ }
150
+
151
+ ```