Last active
October 8, 2020 20:37
-
-
Save bastaware/ac436b786ae48383c107a64bb3db8070 to your computer and use it in GitHub Desktop.
ListView as main widget
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
import 'package:flutter/rendering.dart'; | |
void main() { | |
runApp(MyApp()); | |
} | |
class MyApp extends StatelessWidget { | |
MyApp({Key key}) : super(key: key); | |
@override | |
Widget build(BuildContext context) { | |
return MaterialApp( | |
home: ListView.builder( | |
scrollDirection: Axis.vertical, | |
shrinkWrap: true, | |
itemCount: 20, | |
itemBuilder: (context, index) { | |
var text = 'Card $index'; | |
print('Building card $text'); | |
return Card( | |
child: Container( | |
height: 130, | |
child: Center( | |
child: Text(text), | |
))); | |
})); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment