Home Mobile Pengertian Appbar Leading Action

Pengertian Appbar Leading Action

0

Appbar Leading Action merupakan widget yang tampil dibagian sisi kiri menu sebelum title yang umumnya difungsikan untuk menambahkan tombol navigasi drawer atau navigasi lainnya. Leading berfungsi untuk menambahkan action/button/icon pada sudut kiri appbar.

import 'package:flutter/material.dart';

void main() {
  runApp( new MaterialApp(home: new Application()));
}

class Application extends StatefulWidget{
  @override
    _ApplicationState createState() => _ApplicationState();
}

class _ApplicationState extends State<Application> {
  String txt='';
  @override
  Widget build(BuildContext context) {
    return new Scaffold( appBar: new AppBar(backgroundColor: Colors.orange,
    title: new Text('AppBar Widget'),
    leading: new Icon(Icons.menu),
    actions: <Widget>[
      new IconButton(icon: new Icon(Icons.access_time), onPressed: (){
      txt ='This is Arrow Button';}),
      new IconButton(icon: new Icon(Icons.data_usage), onPressed: (){
        txt='This is Arrow Button';}),
    ],
  ),
  );
  }
}

Hasil Running :