App8 : Movie Time - Learning New Widgets

Table Of Content :

  1. GridView
  2. Table


  1. GridView
  2. A scrollable, 2D array of widgets.

    The main axis direction of a grid is the direction in which it scrolls (the scrollDirection).

    The most commonly used grid layouts are GridView.count, which creates a layout with a fixed number of tiles in the cross axis, and GridView.extent, which creates a layout with tiles that have a maximum cross-axis extent.

    To create a grid with a large (or infinite) number of children, use the GridView.builder. .

    Example :


     

    class MainPage extends StatelessWidget {

      MainPage({Keykey}) : super(keykey);

     

      final colors = [

        Colors.red,

        Colors.pink,

        Colors.purple,

        Colors.deepPurple,

        Colors.indigo,

        Colors.blue,

        Colors.lightBlue,

        Colors.cyan,

        Colors.teal,

        Colors.green,

      ];

     

      @override

      Widget build(BuildContext context) {

        return Scaffold(

          appBarAppBar(

            titleconst Text('Flutter GridView'),

          ),

          bodyGridView.count(

            crossAxisCount3,

            childAspectRatio1,

            childrenList.generate(colors.length, (index) {

              return Container(

                colorcolors[index],

                marginEdgeInsets.all(20),

                childCenter(childText(index.toString())),

              );

            }),

          ),

        );

      }

    }


     GridView Flutter

  3. Table
  4. A widget that uses the table layout algorithm for its children.

    Some properties of Table Class:

    1. border : TableBorder?
    2. The style to use when painting the boundary and interior divisions of the table.

    3. children : List<TableRow>
    4. The rows of the table.

    5. columnWidths : Map<int, TableColumnWidth>?
    6. How the horizontal extents of the columns of this table should be determined.

    7. defaultColumnWidth : TableColumnWidth
    8. How to determine with widths of columns that don't have an explicit sizing algorithm.

    9. defaultVerticalAlignment : TableCellVerticalAlignment
    10. How cells that do not explicitly specify a vertical alignment are aligned vertically.



    Example :


              Table(

                borderTableBorder.all(colorColors.deepOrangewidth2),

                columnWidthsconst {

                  0FractionColumnWidth(0.6),

                  1FractionColumnWidth(0.4)

                },

                defaultVerticalAlignmentTableCellVerticalAlignment.middle,

                childrenconst [

                  TableRow(children: [Text("Netherlands"), Text("Amsterdam")]),

                  TableRow(children: [Text("Greece"), Text("Athens")]),

                  TableRow(children: [Text("Germany"), Text("Berlin")]),

                  TableRow(children: [Text("Denmark"), Text("Copenhagen ")]),

                  TableRow(children: [Text("Norway"), Text("Oslo")]),

                ],

              ),



    Table Flutter