Set Raised Button Height Width in Flutter Android iOS Example

Raised button widget by default dose not support custom width and height. We have to wrap the Raised button component in Container Widget to achieve custom height and width. Container widget supports width and height properties and raised button automatically expand itself to its given parent dimensions. So in this tutorial we would Set Raised Button Height Width in Flutter Android iOS Example.

Contents in this project Set Raised Button Height Width in Flutter Android iOS Example:

1. Import material.dart package in your app’s main.dart file.

2. Call our main MyApp class using void main runApp() method.

3. Create our main class named as MyApp extends with State less widget.

4. Creating a function named as sampleFunction(). We would call this function on button onPress event. We would simply printing a message on terminal screen in this function using print dart method.

5. Creating Scaffold widget -> Safe Area widget -> Center widget in widget build area.

6. Creating a Container widget in Center widget with Height and Width properties and Put the Raised button widget as child widget in Container widget.

7. Complete source code for main.dart file:

Screenshot:

Set Raised Button Height Width in Flutter Android iOS Example

3 Comments

  1. Useful for me

  2. I need a size that will adopt according to the size of the screen and not a fix size.

Leave a Reply

Your email address will not be published. Required fields are marked *