Search code examples
flutterfloating-action-button

SpeedDial with BottomAppBar


Hello friends, ı am developing an app , this app has bottomAppBar and FloatingAction which is embeded in bottomAppBar. When I set location SpeedDial Widget as centerDocker then ı press the button , it start to default location which is created as first Note : I am using SpeedDial Widget for FAB

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();
        }),
  ],
);

}


Solution

  • I've change SpeedDialChild to FloatingActionButton cause SpeedChiald doesent support multiple buttons integration as much as ı want , here is the code follow from below

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