App1 : Elon Musk’s Resume - Learning New Widgets



  1. Scaffold
  2. Scaffold is a class in flutter which provides many widgets or we can say APIs like Drawer, FloatingActionButton, AppBar etc. Scaffold will expand or occupy the whole device screen. It will occupy the available space. Scaffold will provide a framework to implement the basic material design layout of the application.

    Some properties of Scaffold Class:

    1. appBar : PreferredSizeWidget (AppBar)
    2. It displays a horizontal bar which mainly placed at the top of the Scaffold. appBar uses the widget AppBar which has its own properties like elevation, title, brightness, etc.

    3. body : Widget
    4. It will display the main or primary content in the Scaffold. It is below the appBar and under the floatingActionButton. The widgets inside the body are at the left-corner by default.

    5. backgroundColor : Color
    6. Used to set the color of the whole Scaffold widget.

    We will see more properties in the next apps.

    Example :

    Scaffold(

          appBar: AppBar(

            title: Text("AppBar"),

          ),

          body: Center(child: Text('Content'),),

        );



    Scaffold Example

    Without Scaffold :

    Without Scaffold Image
  3. AppBar
  4. AppBar is usually the topmost component of the app (or sometimes the bottom-most), it contains the toolbar and some other common action buttons. As all the components in a flutter application is a widget or a combination of widgets. So AppBar is also a built-in class or widget in flutter which gives the functionality of the AppBar out of the box.

    Some properties of AppBar Class:

    1. title : Widget
    2. This property usually takes in the main widget as a parameter to be displayed in the AppBar.

    3. backgroundColor : Color
    4. This property is used to add colors to the background of the Appbar.

    We will see more properties in the next apps.


  5. Container
  6. A convenience widget that combines common painting, positioning, and sizing widgets. A Container class can be used to store one or more widgets and position it on the screen according to our convenience. Basically a container is like a box to store contents.



    Some properties of Container Class:

    1. child : Widget
    2. The child Widget contained by the container.

    3. height / width / margin / padding :
    4. Check Box Model .

    5. alignment : Alignment
    6. Align the child within the container. We can align in different ways: bottom, bottom center, left, right, etc.

    7. decoration : Decoration (BoxDecoration)
    8. The decoration property is used to decorate the box(e.g. give a border). This paints behind the child. Whereas foregroundDecoration paints in front of a child. Let us give a border to the container. But, both color and border color cannot be given.

    9. color : Color
    10. The color to paint behind the child.

    We will see more properties in the next apps.


    Example :

     Container(

            child: Text("Content"),

            height: 250,

            width: 150,

            margin: EdgeInsets.all(25),

            padding: EdgeInsets.only(top: 20),

            alignment: Alignment.center,

            decoration: BoxDecoration(

              border: Border.all(color: Colors.blueAccent, width: 3),

              color: Colors.yellow,

            ),

          ),


    Flutter Container Example
  7. Text
  8. The Text widget displays a string of text with single style. The string might break across multiple lines or might all be displayed on the same line depending on the layout constraints.

    Some properties of Text Class:

    1. data : String
    2. The text to display.

    3. textAlign : TextAlign
    4. How the text should be aligned horizontally.

    5. style : TextStyle
    6. The style to use for this text.

    We will see more properties in the next apps.

    Example :

             Text(

                "Text Content",

                textAlign: TextAlign.center,

                style: TextStyle(

                    color: Color.fromRGBO(1001002150.9),

                    fontSize: 25,

                    fontStyle: FontStyle.italic,

                    fontWeight: FontWeight.bold,

                    letterSpacing: 10),

              ),


    Flutter Text Example
  9. Image
  10. A widget that displays an image.

    First Method : Image.network( address )

    With the image address, the image can be added to the code.

    Some properties of Image Class:

    1. alignment : Alignment
    2. How to align the image within its bounds.

    3. height / width

    4. fit : BoxFit
    5. How to inscribe the image into the space allocated during layout. (contain / cover / fill ... check BoxFit)

    We will see more methods and properties in the next apps.


    Example

                Image.network(

                  "https://downloadwap.com/thumbs2/wallpapers/p2/2019/fcelebs/48/34caf5ef13647831.jpg",

                  width: 300,

                  height: 200,

                  fit: BoxFit.contain,

                )



    Flutter Network Image Example
  11. Icon
  12. Icon class in Flutter is used to show specific icons in our app. Instead of creating an image for our icon, we can simply use the Icon class for inserting an icon in our app.

    Some properties of Icon Class:

    1. icon : IconData (Icons)
    2. The icon to display.

    3. color : Color
    4. The color to use when drawing the icon.

    5. size : Double
    6. The size of the icon in logical pixels.

    Example

                Icon(

                  Icons.email,

                  color: Colors.red,

                  size: 250,

                )



    Flutter Icon Example
  13. Column
  14. A widget that displays its children in a vertical array.
    The Column widget does not scroll (and in general it is considered an error to have more children in a Column than will fit in the available room).


    Some Properties of Column Class:

    1. children : List<Widget>
    2. The list of widgets to display inside the the Column widget.

    3. crossAxisAlignment CrossAxisAlignment
    4. How the children should be placed along the cross axis.

    5. mainAxisAlignment MainAxisAlignment
    6. How the children should be placed along the main axis.

    We will see more properties in the next apps.


    Example :

            Column(

              children: [

                Container(

                  height: 200,

                  color: Colors.red,

                  margin: EdgeInsets.all(10),

                ),

                Container(

                  height: 100,

                  color: Colors.orange,

                  margin: EdgeInsets.all(10),

                ),

                Container(

                  height: 50,

                  color: Colors.blue,

                  margin: EdgeInsets.all(10),

                ),

                Container(

                  height: 200,

                  color: Colors.pink,

                  margin: EdgeInsets.all(10),

                ),

              ],

            )



    Fluttter Column Example
  15. Row
  16. A widget that displays its children in a horizontal array.
    The Row widget does not scroll (and in general it is considered an error to have more children in a Row than will fit in the available room).


    Some Properties of Column Class:

    1. children : List<Widget>
    2. The list of widgets to display inside the the row widget.

    3. crossAxisAlignment CrossAxisAlignment
    4. How the children should be placed along the cross axis.

    5. mainAxisAlignment MainAxisAlignment
    6. How the children should be placed along the main axis.

    We will see more properties in the next apps.


    Example :

            Row(

              children: [

                Container(

                  width: 80,

                  color: Colors.red,

                  margin: EdgeInsets.all(10),

                ),

                Container(

                  width: 40,

                  color: Colors.orange,

                  margin: EdgeInsets.all(10),

                ),

                Container(

                  width: 20,

                  color: Colors.blue,

                  margin: EdgeInsets.all(10),

                ),

                Container(

                  width: 60,

                  color: Colors.pink,

                  margin: EdgeInsets.all(10),

                ),

              ],

            )



    Fluttter Row Example
  17. SizedBox
  18. A box with a specified size. If not given a child, SizedBox will try to size itself as close to the specified height and width as possible given the parent's constraints. If height or width is null or unspecified, it will be treated as zero.


    Properties of SizedBox Class:

    1. child : Widget
    2. The child Widget contained by the SizedBox.

    3. height / width

    Example :

                SizedBox(

                  width: 200.0,

                  height: 300.0,

                )



  19. SingleChildScrollView
  20. A box in which a single widget can be scrolled.
    This widget is useful when you have a single box that will normally be entirely visible, for example a clock face in a time picker, but you need to make sure it can be scrolled if the container gets too small in one axis (the scroll direction).

    Some Properties of SingleChildScrollView Class:

    1. child : Widget
    2. The child Widget contained by the SingleChildScrollView.

    We will see more properties in the next apps.


    Example :

                SingleChildScrollView(

                  child: Column(children: [

                    Icon(...)

                    Text(....),

                    Image(...),

                    Icon(...),

                    Text(....),

                    Image(...),

                    Icon(...),

                    Text(....),

                    Image(...),

                  ],),

                )