Complete the code to create a vertical ListView with three Text widgets.
ListView(
children: [
Text('Item 1'),
Text('Item 2'),
[1]('Item 3'),
],
)The ListView children must be widgets. To show text, use the Text widget.
Complete the code to create a ListView that scrolls horizontally.
ListView( scrollDirection: [1], children: [ Text('A'), Text('B'), Text('C'), ], )
To make a ListView scroll horizontally, set scrollDirection to Axis.horizontal.
Fix the error in the ListView builder code to correctly create 5 items.
ListView.builder( itemCount: [1], itemBuilder: (context, index) { return Text('Item $index'); }, )
The itemCount must be an integer number, not a string or null.
Fill both blanks to create a ListView with 3 colored Containers stacked vertically.
ListView(
children: [
Container(color: [1], height: 50),
Container(color: [2], height: 50),
Container(color: Colors.blue, height: 50),
],
)The first two Containers need colors red and green to show different colors in the list.
Fill all three blanks to create a ListView.builder that shows 4 items with text and index.
ListView.builder( itemCount: [1], itemBuilder: ([2], [3]) { return Text('Item $index'); }, )
The itemCount is 4 to show four items. The itemBuilder takes context and index as parameters.