iT邦幫忙

0

Flutter 06

  • Button And Icons
    In Flutter we can add Button and Icon Widget as well.

Icons

  body: Center( //LOCATED IN THE MIDDLE
    child: Icon(
      Icons.add_circle_outline
    ),
    ),

In body, we insert a widget called Icon with the shapeadd_circle_outline.
(Different Icon Shape can be checked here.)


We can add different properties as well. (colors, size, etc.)

   child: Icon(
      Icons.add_circle_outline,
      color: Colors.red,
      size: 50.0,

  • Buttons
    Button are like icons with functionality.
body: Center( //LOCATED IN THE MIDDLE
child: RaisedButton(
  onPressed: (){},
  child: Text('click me'),
    color: Colors.lightBlue,
),
),

It’s important to include onPressed: (){} even it doesn’t have any function, or else an error will occur.

We can insert some action in the parenthesis{} in onPressed: to add some functionality. In this example, we print a string ‘You clicked me!’ whenever the button was clicked.

body: Center( //LOCATED IN THE MIDDLE
child: RaisedButton(
  onPressed: (){
    print('you clicked me!');
  },
  child: Text('click me'),
    color: Colors.lightBlue,
),
),


圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

尚未有邦友留言

立即登入留言