flutter floatingActionButton悬浮按钮控件


import 'package:flutter/material.dart';

void main() {
  runApp( MaterialApp(
    title: 'Flutter gesture',
    home: LearnFloatingActionButton(),
  ));
}

class LearnFloatingActionButton extends StatefulWidget{
  @override
  State<StatefulWidget> createState() {
    return _LearnFloatingActionButton();
  }
}
class _LearnFloatingActionButton extends State<LearnFloatingActionButton>{
  @override
  Widget build(BuildContext context) {
    return new Scaffold(
      body: new Center(
        child:new FloatingActionButton(
          child: new Icon(Icons.ac_unit),//子Widet 可以是文本或者图片
          tooltip: '长按之后提示的文字',//长按提示的文字
          foregroundColor: Colors.red,//设置显示图标或者文本的颜色//前提是子child没有设置
          backgroundColor: Colors.blueAccent,//设置按钮的背景色
//          heroTag: ,//类似于一个标识
          elevation: 10.0,//设置阴影
          highlightElevation: 50.0,
          shape: const CircleBorder(),
//          isExtended: true,
          onPressed: (){
            print('aaaaaaaaaaaaaa点击了悬浮按钮aaaaaaaaaaaaa');
          },
        ),
      ),
    );
  }
}

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM