How to add Multiple Floating button in Stack Widget in Flutter

后端 未结 7 1306
终归单人心
终归单人心 2021-02-04 03:09

In flutter one view over another view using Stack Widget. It\'s work fine. Now I need to added two floating button left and right side of bottom of screen. I added one button ri

7条回答
  •  广开言路
    2021-02-04 03:35

    if this tree happen There are multiple heroes that share the same tag within a subtree.

    floatingActionButton: Stack(
      children: [
       Padding(
        padding: EdgeInsets.only(right: 70),
          child: Align(
            alignment: Alignment.bottomRight,
               child: FloatingActionButton.extended(
                      heroTag: "btn1",
                      // backgroundColor: Color(0XFF0D325E),
                      backgroundColor: Colors.red,
                      // child: Icon(Icons.refresh),
                      label: Text('Clear All Wifi'),
                      onPressed: () {
                        _sendMessage(all: 'Clear Wifi');
                      }),
                ),
              ),
              Align(
                alignment: Alignment.bottomRight,
                child: FloatingActionButton(
                    heroTag: "btn2",
                    backgroundColor: Color(0XFF0D325E),
                    child: Icon(Icons.refresh),
                    onPressed: () {
                      _sendMessage(all: 'GETALLWIFI');
                    }),
              ),
            ],
          ),
    

提交回复
热议问题