Can anyone explain?
When should use which one?
Specialy, I need to use paddings for lingual text and some languages are rtl.
Can anyone explain?
When should use which one?
Specialy, I need to use paddings for lingual text and some languages are rtl.
2
Answers
EdgeInsets.symmetric
is used to define symmetric padding around all 4 sides of a widget. It takes a single value for the vertical and horizontal padding.On the other hand,
EdgeInsetsDirectional.symmetric
is also used to define symmetric padding around all 4 sides but it takes separate values for the start/end and top/bottom directions. This is useful when dealing with text or widgets in right-to-left or somehow bottom-to-top layout.Example reference: https://www.youtube.com/watch?v=bq37eFbRMc0
The
EdgeInsetsDirectional
andEdgeInsets
are same for symmetric. source Official Flutter Documentation.It will only differ if you specify different values for either start/left or end/right.
left
insert it in left side of the text wherestart
at beginning of the text (It would right in rtl language),right
insert it in right side of the text whereend
at the end of the text (means It would left in rtl language)