【问题标题】:SpeedDial with BottomAppBar带BottomAppBar 的快速拨号
【发布时间】:2021-06-08 14:29:55
【问题描述】:

你好朋友,我正在开发一个应用程序,这个应用程序有bottomAppBar和嵌入在bottomAppBar中的FloatingAction。当我将位置 SpeedDial Widget 设置为 centerDocker 然后我按下按钮时,它开始到默认位置,这是首先创建的 注意:我正在为 FAB 使用 SpeedDial 小部件

Here , there is a video to explain everything

floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked,
  floatingActionButton: mySpeedDial(),


      SpeedDial mySpeedDial() {
return SpeedDial(
  curve: Curves.bounceIn,
  elevation: 20,
  icon: Icons.add,
  buttonSize: 75,
  backgroundColor: Colors.white,
  closeManually: false,
  visible: true,
  overlayOpacity: 0,
  iconTheme: IconThemeData(
    color: Colors.black,
  ),
  children: [
    SpeedDialChild(
        child: Icon(
          Icons.camera_alt_sharp,
          color: Colors.black,
        ),
        backgroundColor: Colors.white,
        onTap: () {
          print("tapped");
          kameradanFotograf().then((value) {
            if (dosya != null) {
              Navigator.push(
                  context,
                  MaterialPageRoute(
                      builder: (context) => yuklemeSayfasi(
                            kullanici: anlikKullanici,
                            dosya: dosya,
                          )));
            } else {
              sayfaKontrol.jumpToPage(0);
            }
          });
          //displayUploadScreen();
        }),
    SpeedDialChild(
        child: Icon(
          Icons.add_photo_alternate,
          color: Colors.black,
        ),
        backgroundColor: Colors.white,
        onTap: () {
          print("tapped");
          galeridenFotograf().then((value) {
            if (dosya != null) {
              Navigator.push(
                  context,
                  MaterialPageRoute(
                      builder: (context) => yuklemeSayfasi(
                            kullanici: anlikKullanici,
                            dosya: dosya,
                          )));
            } else {
              sayfaKontrol.jumpToPage(0);
            }
          });
          //displayUploadScreen();
        }),
  ],
);

}

【问题讨论】:

    标签: flutter floating-action-button


    【解决方案1】:

    我已将 SpeedDialChild 更改为 FloatingActionButton,因为 SpeedChiald 不支持我想要的多个按钮集成,这是下面的代码

    Widget butonKamera() {
    return Container(
      decoration: BoxDecoration(
        boxShadow: [
          BoxShadow(
            color: Color(0x540000000),
            spreadRadius: 2,
            blurRadius: 65,
          ),
        ],
      ),
      child: FloatingActionButton(
        heroTag: "1",
        backgroundColor: Colors.white,
        mini: true,
        onPressed: () {
          print("tapped");
          kameradanFotograf().then((value) {
            // ignore: unnecessary_null_comparison
            if (dosya != null) {
              Navigator.push(
                  context,
                  MaterialPageRoute(
                      builder: (context) => yuklemeSayfasi(
                            kullanici: anlikKullanici,
                            dosya: dosya,
                          )));
            } else {
              sayfaKontrol!.jumpToPage(0);
            }
          });
        },
        tooltip: "kamera",
        child: Icon(Icons.camera_alt_sharp),
        ),
       );
       }
    
     Widget butonGaleri() {
        return Container(
         decoration: BoxDecoration(
          boxShadow: [
          BoxShadow(
            color: Color(0x540000000),
            spreadRadius: 2,
            blurRadius: 65,
            ),
          ],
        ),
        child: FloatingActionButton(
           heroTag: "2",
          mini: true,
          backgroundColor: Colors.white,
        onPressed: () {
          print("tapped");
          galeridenFotograf().then((value) {
            // ignore: unnecessary_null_comparison
            if (dosya != null) {
              Navigator.pushReplacement(
                  context,
                  MaterialPageRoute(
                      builder: (context) => yuklemeSayfasi(
                            kullanici: anlikKullanici,
                            dosya: dosya,
                          )));
            } else {
              sayfaKontrol!.jumpToPage(0);
            }
          });
        },
        tooltip: "galeri",
        child: Icon(Icons.add_photo_alternate_rounded),
         ),
       );
      }
    
      Widget butonEkleme() {
        return Container(
        width: 70,
        height: 70,
          child: FloatingActionButton(
         //BeveledRectangleBorder(borderRadius: 
        BorderRadius.all(Radius.circular(45.0))),
          heroTag: "3",
           backgroundColor: Colors.white,
          onPressed: animate,
          tooltip: "ekleme",
           child: Container(
            padding: EdgeInsets.zero,
            decoration: BoxDecoration(
            borderRadius: BorderRadius.circular(50),
               image: DecorationImage(image: AssetImage("assets/images/sscard.png"), 
             fit: BoxFit.fill),
           ),
         ),
       ),
      );
    }
    

    【讨论】:

      猜你喜欢
      • 2012-05-30
      • 1970-01-01
      • 1970-01-01
      • 2015-01-31
      • 2020-12-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-08-07
      相关资源
      最近更新 更多