1. What every programme starts with void main() => runApp( new MyApp()); "=>" is an operator and it denotes { return expr ; } . () denotes method runApp will run MyApp() which is a widget. Besides running MyApp(), you can also play with runApp() function by doing the following: new Text(). Do remember to include the TextDirection. Text will appear on the top left hand corner of the screen. void main() { runApp( new Text( 'Hello World' ,textDirection: TextDirection. ltr ,)); } Make it centralised in the center through the following. void main() => runApp( new Center( child: new Text( 'Hello World' ,textDirection: TextDirection. ltr ,) ) ); 2.Declaring App/Widget to be run in runApp() void main() => runApp(MyApp()); class MyApp extends StatelessWidget{ @override Widget build(BuildContext context) { // TODO: implement build return null ; } } extends is the inheriting of...
1. List For type of list : Function (Why?) Small List: ListView (Create all at once) Large List: ListView.itembuilder (Create item as they are scrolled onto screen) What is ListView.itembuilder : Way to make list of Widgets/Children on demand. Widget are not static, can be called multiple times based on itemCount and return different widget at each call. Made up of ItemCount and ItemBuilder. ItemCo unt: decide how many times callback function of ItemBuilder is called Based on code below, itemBuilder would be called back 4 times (itemCount is equivalent to length of list) Why? to estimate maximum scroll extent ItemBuilder : Consist of Context and Index Abstract of IndexedWidgetBuilder, signature for function that create Widget for a given index. Index can be used to indicate location. Link to solution to position of list lost after bottom navigation. Index issue List<String> litems = ["1","2","Third","4"];...
Comments
Post a Comment