said bendrioue
said bendrioue

Reputation: 383

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

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

Upvotes: 2

Views: 856

Answers (2)

said bendrioue
said bendrioue

Reputation: 383

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: () {}),
),

Upvotes: 1

Argel Bejarano
Argel Bejarano

Reputation: 622

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.

Upvotes: 1

Related Questions