Flutter & Scaffold & multiple floatingActionButton

demo


import 'package:flutter/material.dart'; void main() => runApp(App()); class App extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
// home: StateApp(),
home: Scaffold(
appBar: AppBar(
title: Text("appbar"),
backgroundColor: Colors.blueAccent[700],
),
body: Center(
child: StateApp(),
),
),
);
}
} class StateApp extends StatefulWidget {
StateApp();
@override
createState() => _StateAppState();
} class _StateAppState extends State<StateApp> {
int _counter = 0;
// String _randomColor = "#ff00ff";
Color _randomColor = Colors.lightGreen;
void _clearCounter() => setState(() {
// clear
_counter = 0;
_randomColor = Colors.lightGreen;
});
void _updateCounter() => setState(() {
_counter++;
_randomColor = (_counter % 2 == 0) ? Colors.redAccent : Colors.purple;
// random color
});
// _updateCounter() {
// setState(() {
// _counter++;
// });
// } @override
Widget build(BuildContext context) {
return Scaffold(
// backgroundColor: Colors.lightGreen,
backgroundColor: _randomColor,
body: Center(
child: Column(
children: <Widget>[
Padding(
padding: const EdgeInsets.all(23.0),
child: Text(
'You have pushed the button this many times:',
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 18.0,
),
),
),
Center(
child: Text(
'$_counter',
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 23.0,
),
),
),
],
),
),
floatingActionButton: Padding(
// padding: const EdgeInsets.all(8.0),
padding: const EdgeInsets.only(
top: 300.0,
),
child: Column(
children: <Widget>[
// SpeedDial
FloatingActionButton(
onPressed: () async {
// _counter++;
print("clicked = $_counter");
// setState(() {
// _counter++;
// });
_updateCounter();
},
child: Icon(Icons.add),
),
FloatingActionButton(
onPressed: () async {
print("clear = $_counter");
_clearCounter();
},
child: Icon(Icons.remove),
),
],
),
),
);
}
}

refs

https://gist.github.com/duhamelstuff/39a9c24ad1cd1ad376c34bc3aea2ef57#gistcomment-3348355

https://www.youtube.com/watch?v=1FmATI4rOBc

   cupertino_icons: ^0.1.3
flutter_speed_dial: ^1.2.1

https://www.youtube.com/watch?v=p2xKPvNZeEA

https://medium.com/@RotBolt/test-cef30fcb5c54

https://stackoverflow.com/questions/50839282/how-to-add-multiple-floating-button-in-stack-widget-in-flutter



xgqfrms 2012-2020

www.cnblogs.com 发布文章使用:只允许注册用户才可以访问!


Flutter & Scaffold & multiple floatingActionButton的更多相关文章

  1. flutter系列之:flutter中可以建索引的栈布局IndexedStack

    目录 简介 IndexedStack简介 IndexedStack的使用 总结 简介 之前我们介绍了一个flutter的栈结构的layout组件叫做Stack,通过Stack我们可以将一些widget ...

  2. Flutter学习(一)之MaterialApp和Scaffold组件使用详解

    一,前言: MaterialApp和Scaffold是Flutter提供的两个Widget,其中: MaterialApp是一个方便的Widget,它封装了应用程序实现Material Design所 ...

  3. Flutter常用组件(Widget)解析-Scaffold

    实现一个应用基本的布局结构. 举个栗子: import 'package:flutter/material.dart'; void main() => runApp(MyApp()); clas ...

  4. Flutter学习笔记(16)--Scaffold脚手架、AppBar组件、BottomNavigationBar组件

    如需转载,请注明出处:Flutter学习笔记(15)--MaterialApp应用组件及routes路由详解 今天的内容是Scaffold脚手架.AppBar组件.BottomNavigationBa ...

  5. Flutter学习笔记(20)--FloatingActionButton、PopupMenuButton、SimpleDialog、AlertDialog、SnackBar

    如需转载,请注明出处:Flutter学习笔记(20)--FloatingActionButton.PopupMenuButton.SimpleDialog.AlertDialog.SnackBar F ...

  6. flutter FloatingActionButton组件

    import 'package:flutter/material.dart'; class FloatingActionButtonDemo extends StatelessWidget { @ov ...

  7. Flutter——FloatingActionButton组件(浮动按钮组件)

    FloatingActionButton 简称 FAB ,可以实现浮动按钮,也可以实现类似闲鱼 app 的地步凸起导航.     属性名称 属性值 child 子视图,一般为 Icon,不推荐使用文字 ...

  8. Flutter中的浮动按钮FloatingActionButton 及融合底部工具栏

    FloatingActionButton 简称 FAB,从字面理解可以看出,它是“可交互的浮动按钮”,其实在Flutter默认生成的代码中就有这家伙,只是我们没有正式的接触. 一般来说,它是一个圆形, ...

  9. Flutter中的浮动按钮 FloatingActionButton

    FloatingActionButton 简称 FAB ,可以实现浮动按钮,也可以实现类似闲鱼 app 的底部凸起导航 . 常用属性 FloatingActionButton的常用属性,同flutte ...

随机推荐

  1. Jenkins部署web项目到Tomcat(shell脚本)

    一.首先配置Publish Over SSH插件 配置地址:系统管理-->系统设置-->Publish over SSH(需要安装Publish over SSH插件) 二.jenkins ...

  2. 在nodejs中创建cluster

    目录 简介 cluster集群 cluster详解 cluster中的event cluster中的方法 cluster中的属性 cluster中的worker 总结 在nodejs中创建cluste ...

  3. 将Oracle数据,以及表结构如何传输至MySQL

    最近研究数据库,将Oracle数据库中的表结构以及数据传输给MySQL数据库,自己通过学习采用两种方式,效率较高. 方式一:Navicat 自从下载了Navicat,真的发现这是一款操作数据库十分优秀 ...

  4. DOS windows 使用bat脚本获取 IP MAC 系统信息

    @echo select disk 0 >dpjs.txt @echo detail disk >>dpjs.txt diskpart /s dpjs.txt@echo ------ ...

  5. (转)pip和easy_install使用方式

    easy_install 跟 pip 都是 Python 的套件管理程式,有了它們,在使用 Python 開發程式的時候會帶來不少方便. easy_install 和 pip 有什麼不一樣?據 pip ...

  6. CentOS 安装TFTP

    1.当然是使用yum安装最直接,一共会安装3个东东tftp.i386tftp-server.i386xinetd.i386[root@localhost CentOS]# yum -y install ...

  7. Cisco交换机管理员配置

    conf tservice timestamps debug datetime msec localtime yearservice timestamps log datetime msec loca ...

  8. 整理我的Git常见问题和命令

    整理我的Git常见问题和命令 目录 整理我的Git常见问题和命令 提交注释规范 合并分支 clone & 切换分支 支持中文路径显示 账户及密码 基于远程分支创建本地分支 提交注释规范 举例: ...

  9. netty写Echo Server & Client完整步骤教程(图文)

    1.创建Maven工程 1.1 父节点的pom.xml代码(root pom文件) 1 <?xml version="1.0" encoding="UTF-8&qu ...

  10. 原生js拖拽功能制作滑动条实例教程

    拖拽属于前端常见的功能,很多效果都会用到js的拖拽功能.滑动条的核心功能也就是使用js拖拽滑块来修改位置.一个完整的滑动条包括 滑动条.滑动痕迹.滑块.文本 等元素,先把html代码写出来,如下所示: ...