Flutter Widget之FloatingActionButton

Widget:https://flutter.io/docs/development/ui/widgets
FloatingActionButton:https://docs.flutter.io/flutter/material/FloatingActionButton-class.html

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import 'package:flutter/material.dart';

class FloatingActionButtonDemoPage extends StatefulWidget {
@override
State<StatefulWidget> createState() => new _FloatingActionButtonDemoPagePageState();
}

class _FloatingActionButtonDemoPagePageState extends State<FloatingActionButtonDemoPage> {
@override
void initState() {
super.initState();
}

Widget build(BuildContext context) {
return Scaffold(
appBar: new AppBar(
title: new Text('FloatingActionButton Demo'),
),
body: new Center(
child: new FloatingActionButton(
child: new Icon(Icons.add), //子Widet, 可以是文本或者图片
tooltip: 'http://www.appblog.cn', //长按提示的文字
foregroundColor: Colors.white, //设置显示图标或者文本的颜色//前提是子child没有设置
backgroundColor: Colors.blueAccent, //设置按钮的背景色
//heroTag: , //类似于一个标识
elevation: 10.0, //设置阴影
highlightElevation: 50.0,
shape: const CircleBorder(),
//isExtended: true,
onPressed: () {
print('FloatingActionButton');
},
),
),
);
}
}

Flutter Widget FloatingActionButton

Powered by AppBlog.CN     浙ICP备14037229号

Copyright © 2012 - 2020 APP开发技术博客 All Rights Reserved.

访客数 : | 访问量 :