import 'package:flutter/material.dart';
void main() => runApp(Myapp());
class Myapp extends StatelessWidget {
@override
Widget build(BuildContext context) {
// TODO: implement build
return MaterialApp(
title: 'MaterialApp',
home: HomePage(),
);
}
}
class HomePage extends StatelessWidget {
@override
Widget build(BuildContext context) {
// TODO: implement build
return Scaffold(
appBar: AppBar(
title: Text('MaterialApp'),
//左侧图标
leading: Icon(Icons.home),
//右侧图标按钮
actions: <Widget>[
IconButton(
icon: Icon(Icons.add),
tooltip: '添加',
onPressed: () {
print("添加");
},
),
IconButton(
icon: Icon(Icons.search),
tooltip: '搜索',
onPressed: () {
print("搜索");
},
),
],
),
body: Center(
child: Text('MaterialApp'),
),
bottomNavigationBar: BottomAppBar(
child: Container(
height: 50,
),
),
floatingActionButton: FloatingActionButton(
onPressed: () {},
tooltip: '增加',
child: Icon(Icons.add),
),
floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked,
);
}
}
效果图
网友评论