Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Floating Action Button: Is there a straightforward way to make a button smaller than default mini?

This is a screenshot of Button default sizes (http://www.material-ui.com/#/components/floating-action-button)

enter image description here

The size of mini button is 40x40px. Is there an easy way to reduce size to 30x30 or any other custom size? Say, by providing a prop={{size: '30:30'}} or somehow by styling.

like image 948
Green Avatar asked May 27 '16 10:05

Green


People also ask

How do I make my floating action button smaller?

By default, the floating action button in flutter is 56 logical pixels height and width. This is the normal size or non-mini size. If you add this property mini with a value true, it will create a smaller floating action button.

How do you size a floating action button?

Use a Container where you can specify width and height, then use a RawMaterialButton, like this: myFabButton = Container( width: 200.0, height: 200.0, child: new RawMaterialButton( shape: new CircleBorder(), elevation: 0.0, child: Icon( Icons.

What are the Floating Action buttons sizes?

Floating action buttons come in two sizes: Mini size: Only used to create visual continuity with other screen elements The button size should change from the default (56dp) to the mini size (40dp) when the screen width is 460dp or less.

What is the difference between normal/regular/mini Floating Action Button and Fab?

In this article let’s discuss the Normal/Regular Floating Action Button and Mini Floating Action Button with a sample example in Android. Regular FABs are FABs that are not expanded and are regular size. The following example shows a regular FAB with a plus icon.

What is floatingactionbutton in flutter?

FloatingActionButton in Flutter. A floating action button is a circular icon button that hovers over content to promote a primary action in the application. Floating action buttons are most commonly used in the Scaffold.floatingActionButton field.

How to set icon size for Floating Action Button in Android?

This will set 36dp size for all icons for floating action button. If you want to set icon size to particular Floating Action Button just go with Floating action button attributes like app:fabSize="normal" and android:scaleType="center".


1 Answers

For those still looking for a solution, I had to apply the style via the 'iconStyle' prop.

const myStyle = {
    height: 20,
    width: 20,
};

<FloatingActionButton iconStyle={ myStyle } />

For me, however, this caused an issue with my icon being off center. So myStyle then became:

const myStyle = {
    height: 20,
    lineHeight: '20px',
    verticalAlign: 'middle',
    width: 20,
};
like image 99
James Avatar answered Oct 24 '22 18:10

James