Why the size of the FAB in my flutter app is big?

653

Solution 1

I didn't know the reason but i managed to resize the button like so :

Transform.scale(
  scale : 0.5,
  child : FloatingActionButton(child: Icon(Icons.add), onPressed: () {}),
),

Solution 2

If you want o use a smaller FAB you can set the mini property to true and its gonna change it.

Here some information

Hope it helps.

Share:
653
said bendrioue
Author by

said bendrioue

Updated on December 10, 2022

Comments

  • said bendrioue
    said bendrioue over 1 year

    click to see the screenshot of the problem

    I tried to add some markers in my PhotoViewer (plan) as a floating buttons to use them later ! but IDK why is the button is showing up so big that it must be !

    class _MyHomePageState extends State<MyHomePage> {[enter image description here][1]
          @override
          Widget build(BuildContext context) {
            return Scaffold(
              appBar: AppBar(),
              body: plan(),
              floatingActionButton: FloatingActionButton(child: Icon(Icons.add), onPressed: () {}),
            );
          }
        
          Widget plan() {
            return PhotoView.customChild(
              child: Stack(
                children: widgets(),
              ),
              childSize: const Size(250.0, 220.0),
              minScale: PhotoViewComputedScale.contained,
              maxScale: PhotoViewComputedScale.covered * 1.8,
              initialScale: PhotoViewComputedScale.contained * 0.5,
            );
          }
        
          List<Widget> widgets() {
            return [
              Container(
                decoration: new BoxDecoration(
                  image: new DecorationImage(
                    image: new AssetImage("data_repo/img/bg1.jpg"),
                    fit: BoxFit.cover,
                  ),
                ),
              ),
              Center(
                child: FloatingActionButton(child: Icon(Icons.add), onPressed: () {}),
              ),
            ];
          }
        }