How to remove default margin/spacing from Button Widget in Flutter

VEmpink
Jan 17, 2021

--

Sometimes it’s annoying when components (React) or widgets (Flutter) have some default spacing like margin and padding but for now, I wanna tell you how to remove the default margin/spacing from Button Widget in Flutter like this:

to remove that default margin/spacing Flutter has given us some options with a property called `tapTargetSize` aaand here the example:

ElevatedButton(  child: Text('CREATE'),  style: ButtonStyle(    tapTargetSize: MaterialTapTargetSize.shrinkWrap
),
onPressed: () {},)

that’s it! Done :)

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

--

--

VEmpink
VEmpink

Written by VEmpink

0 Followers

JavaScript Developer and a fan of React Framework

No responses yet

Write a response