In the above code I used Sized Box Widget but it didn’t gives me anything?
How can I add space in it?
Android Emulator Images
Padding(padding: EdgeInsetsDirectional.fromSTEB(24, 4, 24, 0),
child:
Row(mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
'Discount',
style: AppTheme.of(context).subtitle2,
),
SizedBox(height: 20,),
Text(
'₹ ${Provider.of<Cart>(context,listen:false).discountPrice}',
style: AppTheme.of(context).subtitle1,
),
],
),
),
3
Answers
wrap with container/sizebox and add in row mainAxisAlignment: MainAxisAlignment.spaceAround
Using
TextSpan()
widget is better than instead ofRow()
. Like that.Edit: but I think in your question your code and your screen shoot is different. Please ask clearly. ** My answer is to space between horizontal text widget. **
That’s a quite good approach to use SizedBox in this case, but you need to set width instead of height.