App2 : 5K Quotes - Learning New Widgets

Table Of Content :

  1. FloatingActionButton
  2. Image(Asset)


  1. FloatingActionButton
  2. A floating action button is a circular icon button that hovers over content to promote a primary action in the application. Floating action buttons are most commonly used in the Scaffold.floatingActionButton field.

    Some properties of FloatingActionButton Class:

    1. child : Widget
    2. The widget below this widget in the tree.

    3. backgroundColor : Color
    4. The button's background color.

    5. foregroundColor : Color
    6. The default foreground color for icons and text within the button.

    7. onPressed : VoidCallback (that have no arguments and return no data )
    8. The callback that is called when the button is tapped or otherwise activated.

    We will see more properties in the next apps.

    Example :


          floatingActionButton: FloatingActionButton(

            child: Icon(Icons.update),

            onPressed: () {

              print("updated");

            },

            backgroundColor: Colors.redAccent,

            foregroundColor: Colors.yellow,

          ),



    FloatingActionButton example
  3. Image
  4. A widget that displays an image.

    Second Method : Image.asset( path )

    In the next lesson, you will learn how to include images in your app before using them.


    Example

    Image.asset("assets/images/heart.jpg"),



    Image asset Flutter Example