• 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');
              },
            ),
          ),
        );
      }
    }

  • 相关阅读:
    MAVEN[08]
    MAVEN[04]
    hdu 1757【A Simple Math Problem】
    hdu 1507【Uncle Tom's Inherited Land*】
    hdu 2768【Cat vs. Dog】
    hdu 1392【Surround the Trees】
    hdu 1348【wall】
    hdu 2824【The Euler function】
    hdu 1147【Pickup sticks】
    hdu 1528【Card Game Cheater】
  • 原文地址:https://www.cnblogs.com/gaozhang12345/p/11958069.html
Copyright © 2020-2023  润新知