align widgets to the left and right of the screen in flutter - flutter

i am having problems trying to align my widgets. the left side is aligning correctly but the right side is off a little bit.
here is my code
this is the code for the card view
ListView itemList(List<IncomeData> items, AppDatabase database, BuildContext context) {
return ListView(
children: items.map((IncomeData income) {
return Container(
child: Padding(
padding: const EdgeInsets.fromLTRB(15.0, 5.0, 15.0,5.0),
child: new Card( //listView(income),
child: Padding(
padding: const EdgeInsets.fromLTRB(20.0, 0.0, 20.0,0.0),
child: new Column(
children: <Widget>[
listView(income),
new ButtonBar(
children: <Widget>[
new RaisedButton.icon(
label: const Text('Edit'),
icon: Icon(Icons.edit,),
color: colorPrimary,
onPressed: () {
_navigateAndDisplaySelection(context, income);
/* Navigator.push(context,
MaterialPageRoute(builder: (context) => AddEditIncomeForm(incomeData: income)));*/
},
),
new RaisedButton.icon(
label: const Text('Delete'),
icon: Icon(Icons.delete),
color: colorPrimary,
onPressed: () {
//database.deleteEntry(income);
//deleteConfirmation(income, database);
showDialog(
context: context,
builder: (context) {
return CheckBoxAlertDialog(transactionType: delete, data: income, database: database,);
}
);
},
),
],
),
],
),
),
)
)
);
}).toList(),
);
}
this is the code for the content of the card view
return Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: <Widget>[
SizedBox(height: 8),
Row(
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
Text(common_functions(incomeList.dateReceived.toString()),
style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold )),
Spacer(),
//Expanded(child: SizedBox()),
Text("Not Received"),
Switch(
value: isSwitched,
onChanged: (value) {
setState(() {
isSwitched = value;
print(isSwitched);
});
},
activeTrackColor: Colors.lightGreenAccent,
activeColor: Colors.green,
),
]
),
Row(
children: <Widget>[
CircleAvatar(
backgroundColor: green,
child: Icon(Icons.attach_money, color: white,),
),
Expanded(
child: Padding(
padding: const EdgeInsets.all(15.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text(incomeList.category,
style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold )),
Text(incomeList.frequency + " | " + incomeList.depositAcct, style: TextStyle(color: grey, fontSize: 15)),
],
),
),
),
Column(
crossAxisAlignment: CrossAxisAlignment.end,
children: <Widget>[
Text("\$" + incomeList.expectedAmount.toStringAsFixed(2),
style: TextStyle(fontSize: 18, color: green , fontWeight: FontWeight.bold ) ),
Text(incomeList.status, style: TextStyle(color: grey, fontSize: 15)),
],
),
],
),
],
);
if you take a look at the pic attached, the buttons and the top switch is not align properly to the number $68.00. see the red line i drawed. the switch on top is off to the left by a few spaces and also the buttons are the bottom are not align exactly to $68.00
am i doing something wrong that the widgets are not aligning to the red line as $68.00 is? how can i change my code to properly align all the widgets on the right side? thanks in advance

For ButtonBar it's buttonPadding parameter. Just be sure not to use any horizontal padding with it (right or left), since it will split it between the buttons. You will have to add a left padding for the buttons inside the ButtonBar.
I've attached an example for it and for the Switch widget, which doesn't have any properties to modify this behavior, but you can always use Transform.translate to overcome this.
Row(
mainAxisAlignment: MainAxisAlignment.end,
children: <Widget>[
Transform.translate(
offset: Offset(10.0, 0.0),
child: Switch(
value: true,
onChanged: (value) {},
activeTrackColor: Colors.lightGreenAccent,
activeColor: Colors.green,
),
),
],
),
ButtonBar(
buttonPadding: EdgeInsets.zero,
children: <Widget>[
RaisedButton.icon(
label: const Text('Edit'),
icon: Icon(
Icons.edit,
),
color: Colors.blue,
onPressed: () {},
),
Padding(
padding: const EdgeInsets.only(left: 10.0),
child: RaisedButton.icon(
label: const Text('Delete'),
icon: Icon(Icons.delete),
color: Colors.blue,
onPressed: () {},
),
),
],
),

Related

How to align iconbuttons in card widget flutter?

I am having trouble issues aligning my icon buttons to the middle of the card. As you can see in the picture, the icon buttons are on top attached to the top of the card.
How do I make it meet at the half size of the card? Any suggestions? (I want the buttons to be located at the middle of the card)
Tried: I tried putting padding or wrap my Row widget with a center, but it doesn't work.
child: new Container(
height: 150.0,
width: MediaQuery.of(context).size.width,
child: new Card(
color: Colors.white,
elevation: 8.0,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Column(
children: [
IconButton(
onPressed: () {},
icon: Icon(Icons.sticky_note_2),
iconSize: 35,
color: Colors.lightBlue),
Text(
"Notes",
style: TextStyle(
color: Colors.black,
fontSize: 15,
),
),
],
),
Column(
children: [
IconButton(
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => QuizRoute()),
);
},
icon: Icon(Icons.quiz),
iconSize: 35,
),
Text(
"Quizzes",
style: TextStyle(
color: Colors.black,
fontSize: 15,
),
),
],
),
Column(
children: [
IconButton(
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => EbooksRoute()),
);
},
icon: Icon(Icons.auto_stories),
iconSize: 35,
),
Text(
"Ebooks",
style: TextStyle(
color: Colors.black,
fontSize: 15,
),
),
],
),
]),
),
),
),
],
),
Try below code and set mainAxisAlignment: MainAxisAlignment.center, to every Column widget. Refer layout and Align
Container(
height: 150.0,
width: MediaQuery.of(context).size.width,
child: Card(
color: Colors.white,
elevation: 8.0,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
IconButton(
onPressed: () {},
icon: Icon(Icons.sticky_note_2),
iconSize: 35,
color: Colors.lightBlue),
Text(
"Notes",
style: TextStyle(
color: Colors.black,
fontSize: 15,
),
),
],
),
Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
IconButton(
onPressed: () {},
icon: Icon(Icons.quiz),
iconSize: 35,
),
Text(
"Quizzes",
style: TextStyle(
color: Colors.black,
fontSize: 15,
),
),
],
),
Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
IconButton(
onPressed: () {},
icon: Icon(Icons.auto_stories),
iconSize: 35,
),
Text(
"Ebooks",
style: TextStyle(
color: Colors.black,
fontSize: 15,
),
),
],
),
],
),
),
),
Result Screen->
What is the issue?
You are using center alignment in the row but not inside the column. Now column is taking the height of entire row but the children of the column is not aligned center.
Solution:
Try adding mainAxisAlignment: MainAxisAlignment.center in each of your column
Present Code:
Row
mainAxisAlignment:MainAxisAlignment.center
|_Column
|_Column
|_Column
Required Code:
Row
mainAxisAlignment:MainAxisAlignment.center
|_Column
mainAxisAlignment:MainAxisAlignment.center 👈 Add these to every column
|_Column
mainAxisAlignment:MainAxisAlignment.center
|_Column
mainAxisAlignment:MainAxisAlignment.center
For the complete code refer : #Ravindra's answer
Replace your "Row" widget with the following code, this will solve your issue.
Solution : Give your Column center alignment
mainAxisAlignment: MainAxisAlignment.center
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
IconButton(
onPressed: () {},
icon: const Icon(Icons.sticky_note_2),
iconSize: 35,
color: Colors.lightBlue),
const Text(
"Notes",
style: TextStyle(
color: Colors.black,
fontSize: 15,
),
),
],
),
Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
IconButton(
onPressed: () {
// Navigator.push(
// context,
// MaterialPageRoute(
// builder: (context) => QuizRoute()),
// );
},
icon: const Icon(Icons.quiz),
iconSize: 35,
),
const Text(
"Quizzes",
style: TextStyle(
color: Colors.black,
fontSize: 15,
),
),
],
),
Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
IconButton(
onPressed: () {
// Navigator.push(
// context,
// MaterialPageRoute(
// builder: (context) => EbooksRoute()),
// );
},
icon: const Icon(Icons.auto_stories),
iconSize: 35,
),
const Text(
"Ebooks",
style: TextStyle(
color: Colors.black,
fontSize: 15,
),
),
],
),
]),

title widget to be centered and icon widgets at the right side in one row

the question is exactly same as this post
but I did not find an answer from the post.
my goal is to set the title widget in the center
and other two buttons on the right side.
the solutions in the link all put the title widget slightly on the left side.
does anyone know how to do this without using Stack? I'm afraid of the title widget being over the button widgets when the title gets too long.
the code:
SizedBox(
height: 40,
width: MediaQuery.of(context).size.width,
child: Row(
children: [
const SizedBox(width: 17),
Text(
'TITLE',
style: const TextStyle(
color: Colors.white, fontSize: 30, fontWeight: FontWeight.w500),
),
Spacer(),
Row(
children: [
GestureDetector(
onTap: (){null;},
child: SizedBox(
child: Icon(Icons.wallet_membership, color: Colors.white),
),
),
const SizedBox(width: 17),
GestureDetector(
onTap: (){Get.toNamed('/wallet_setting');},
child: const SizedBox(
child: Icon(Icons.settings, color: Colors.white),
),
),
]
)
]
),
)
Try this One
Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
Expanded(
child: Container(
child: Center(
child: Text(
'TITLE',
style: const TextStyle(color: Colors.white, fontSize: 30, fontWeight: FontWeight.w500),
),
)
)
),
Align(
alignment: Alignment.centerRight,
child: Row(
children: [
GestureDetector(
onTap: (){null;},
child: SizedBox(
child: Icon(Icons.wallet_membership, color: Colors.white),
),
),
const SizedBox(width: 17),
GestureDetector(
onTap: (){Get.toNamed('/wallet_setting');},
child: const SizedBox(
child: Icon(Icons.settings, color: Colors.white),
),
),
]
)
)
],
)
OutPut:
i think you should wrap it with centre
Try this approach:
first make widget from your right widgets:
Widget _rightIcons() {
return Row(children: [
GestureDetector(
onTap: () {
null;
},
child: SizedBox(
child: Icon(Icons.wallet_membership, color: Colors.white),
),
),
const SizedBox(width: 17),
GestureDetector(
onTap: () {
Get.toNamed('/wallet_setting');
},
child: const SizedBox(
child: Icon(Icons.settings, color: Colors.white),
),
),
]);
}
then build your header like this:
Row(
children: [
_rightIcons(),
Expanded(
child: Center(
child: Text(
'TITLE',
style: const TextStyle(
color: Colors.white,
fontSize: 30,
fontWeight: FontWeight.w500),
),
),
),
Opacity(
opacity: 0,
child: _rightIcons(),
)
],
),
You can use centerTitle:true on Appbar
appBar: AppBar(
centerTitle: true,
title: Text("title"),
actions: [
Another way
Container(
color: Colors.purple,
height: 40 * 2,
width: MediaQuery.of(context).size.width,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
IconButton(onPressed: () {}, icon: Icon(Icons.navigate_before)),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Expanded(
flex: 1,
child: SizedBox(),
),
Expanded(
flex: 4,
child: Text(
'TITLE',
textAlign: TextAlign.center,
style: const TextStyle(
color: Colors.white,
fontSize: 30,
fontWeight: FontWeight.w500),
),
),
Expanded(
flex: 1,
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
GestureDetector(
child: Icon(Icons.wallet_membership,
color: Colors.white),
),
const SizedBox(width: 17),
GestureDetector(
onTap: () {},
child: const SizedBox(
child:
Icon(Icons.settings, color: Colors.white),
),
),
]),
),
)
],
),
],
),
)
Preferable solution:
You can implements PreferredSizeWidget to create custom Appbar. Play with color and other decoration.
class MyAppBar extends StatelessWidget implements PreferredSizeWidget {
const MyAppBar({super.key});
#override
Widget build(BuildContext context) {
return Stack(
children: [
Align(
alignment: Alignment.bottomCenter,
child: Text("title"),
),
Align(
alignment: Alignment.bottomRight,
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
IconButton(
//you can use callback method to get onpressed
onPressed: () {},
icon: Icon(Icons.settings),
),
IconButton(
onPressed: () {},
icon: Icon(Icons.settings),
),
],
),
)
],
);
}
#override
Size get preferredSize => const Size.fromHeight(kToolbarHeight * 2);
}
And use like appBar: MyAppBar(),

Slidable widget not wrapping around container

I am trying to make the slidable widget wrap around the child container like this:
but it comes like this:
The slidable widget comes from the edge of the screen rather than the child widget also there seems to be no animation, it just disappears ontap.
Slidable(
key: UniqueKey(),
actionPane: SlidableDrawerActionPane(),
actions: [
IconSlideAction(
color: Colors.redAccent,
icon: Icons.delete,
onTap: () {
todoController.todos.removeAt(index);
},
)
],
child: Container(
decoration: BoxDecoration(
color: Color(0xFF414141),
boxShadow: const [
BoxShadow(
color: Color(0xFF414141),
offset: Offset(2.5, 2.5),
blurRadius: 5.0,
spreadRadius: 1.0,
), //B
],
borderRadius: BorderRadius.circular(14.0)),
padding: const EdgeInsets.symmetric(
horizontal: 24.0, vertical: 15.0),
child: Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
Text(
todoController.todos[index].title,
style: GoogleFonts.notoSans(
color: Color(0xFFA8A8A8),
fontSize: 20.0),
),
],
),
Divider(
color: Color(0xFF707070),
),
Text(
todoController.todos[index].details,
style: GoogleFonts.notoSans(
color: Color(0xFFA8A8A8), fontSize: 20.0),
),
],
),
),
),
),
u can use custom container in action widget like this:-
Widget slideBackground(BuildContext context, Function onTap, String text) {
return Container(
height: 80.h,
width: 120,
// color: Colors.white,
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Expanded(
child: Padding(
padding: const EdgeInsets.only(left: 20),
child: ClipRRect(
borderRadius: BorderRadius.circular(12),
child: IconSlideAction(
caption: '',
color: Colors.red,
closeOnTap: true,
icon: Icons.delete,
// icon: Icons.delete,
onTap: () {
showDialog(
context: context,
builder: (BuildContext context) {
return AlertDialog(
content: Text(text),
actions: <Widget>[
CupertinoButton(
child: const Text(
"Cancel",
style: TextStyle(color: Colors.black),
),
onPressed: () {
Navigator.of(context).pop();
},
),
CupertinoButton(
child: const Text(
"Delete",
style: TextStyle(color: Colors.red),
),
onPressed: () {
onTap();
Navigator.of(context).pop();
},
),
],
);
});
},
),
),
),
)
],
),
);
}```

How can i add expansion tile widgets inside GridView.builder() in flutter?

I was working on grid views and got stuck when trying to insert expansion tiles inside the grid view.The problem that i am facing is, when tring to expand the tile, i am getting an overflow error. Is there any way to use expansion tile inside grid view in such a way that when one of the tiles is expanded, the other tiles moves down without causing any overflow error ?
Here's my code snippet :
Expanded(
child: GridView.builder(
itemCount: 21,
physics: BouncingScrollPhysics(),
gridDelegate:
SliverGridDelegateWithFixedCrossAxisCount(
crossAxisSpacing: 10,
mainAxisSpacing: 10,
childAspectRatio: (1 / 0.46),
crossAxisCount:
(MediaQuery.of(context).orientation ==
Orientation.landscape)
? 4
: 1,
),
itemBuilder:
(BuildContext context, int index) => Card(
elevation: 6.0,
child: ClipRRect(
borderRadius: BorderRadius.circular(10.0),
child: ExpansionTile(
// collapsedBackgroundColor: Colors.white,
// backgroundColor: Colors.white,
trailing: FadeInImage.memoryNetwork(
image:
'https://picsum.photos/250?image=123',
placeholder: kTransparentImage,
),
title: Container(
child: Text(
'Pencil Pen Test Long String Again Test Long String',
),
),
subtitle: Padding(
padding:
const EdgeInsets.only(top: 8.0),
child: Text(
'\u{20B9} $myAmount',
style: TextStyle(
fontWeight: FontWeight.bold,
),
),
),
children: <Widget>[
Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
crossAxisAlignment:
CrossAxisAlignment.start,
children: <Widget>[
Align(
alignment: Alignment.topLeft,
child: Text('Price 1 :' +
' \u{20B9} $myAmount'),
),
Align(
alignment: Alignment.topLeft,
child: Text('Price 2 :' +
' \u{20B9} $myAmount'),
),
Align(
alignment: Alignment.topLeft,
child: Text('Price 3 :' +
' \u{20B9} $myAmount'),
),
SizedBox(
height: 6.0,
),
Column(
children: [
Container(
padding:
EdgeInsets.all(20.0),
child: Align(
alignment:
Alignment.centerLeft,
child: Text(
'TAGS',
style: TextStyle(
color: Colors.white,
decoration:
TextDecoration
.underline,
),
),
),
),
Row(
children: [
Expanded(
child: InputChip(
onDeleted: () {},
onPressed: () {},
label: Text('Chip a'),
avatar: Icon(
Icons.ac_unit),
),
),
Expanded(
child: InputChip(
onDeleted: () {},
onPressed: () {},
label: Text('Chip b'),
avatar: Icon(Icons
.e_mobiledata),
),
),
Expanded(
child: InputChip(
onDeleted: () {},
onPressed: () {},
label: Text('Chip c'),
avatar: Icon(Icons
.format_align_justify_outlined),
),
),
],
),
],
),
Divider(),
Row(
mainAxisAlignment:
MainAxisAlignment
.spaceBetween,
children: <Widget>[
Row(
children: [
Text(
'In Hand : ',
style: TextStyle(
fontWeight:
FontWeight.bold,
color:
Theme.of(context)
.colorScheme
.secondary,
),
),
],
),
Row(
children: [
IconButton(
onPressed: () {
displayBottomSheetAddInventory(
context);
},
icon: Icon(
Icons.add_circle),
),
IconButton(
onPressed: () {
displayBottomSheetSubtractInventory(
context);
},
icon: Icon(Icons
.remove_circle),
),
IconButton(
onPressed: () {
displayBottomSheetEditInventory(
context);
},
icon: Icon(
Icons.edit,
),
),
],
),
],
)
],
),
)
],
),
),
),
),
),
This is what i'm getting:
And this is want i want : (The other tiles should be below this tile and readjust when collapsed.)
Can anyone help ?

Place Widgets at the edge of their parent widget

EDIT: Added a screenshot of the desired output
Goal: Placing a group of widgets (RoundButtons and Text widgets) at the edge of their parent widget
Problem: The widgets that need to move are still close to their nearby widgets
Here is a screenshot showing the problem:
Here's the desired output:
The following code snippet shows the widgets that I need to move to the end of the parent:
Widgets to be moved: inner Row and its widgets.
Row(//parent widget
children: <Widget>[
Row(//To be moved to the end of the parent
children: <Widget>[
RoundIconButton(
icon: FontAwesomeIcons.minus, onPressed: () {}),
Text('$_counter'),
RoundIconButton(
icon: FontAwesomeIcons.plus, onPressed: () {}),
],
),
Text('10000', style: GoogleFonts.cairo(fontSize: 15)),
],
),
Here is the current implementation that corresponds to the screenshot above:
Container(
width: deviceWidth,
child: Row(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.end,
children: <Widget>[
Padding(
padding: EdgeInsets.only(right: 10),
child: Column(
textDirection: TextDirection.rtl,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Text(
'Product',
style: GoogleFonts.cairo(
fontSize: 15,
),
),
Text(
'subtitle',
style: GoogleFonts.cairo(
fontSize: 15,
fontWeight: FontWeight.w200,
),
),
StrikeThroughWidget(
child: Text(
'5000',
style: GoogleFonts.cairo(
fontSize: 10,
fontWeight: FontWeight.w200,
),
),
),
Row(
children: <Widget>[
Row(
children: <Widget>[
RoundIconButton(
icon: FontAwesomeIcons.minus, onPressed: () {}),
Text('$_counter'),
RoundIconButton(
icon: FontAwesomeIcons.plus, onPressed: () {}),
],
),
Text('10000', style: GoogleFonts.cairo(fontSize: 15)),
],
),
],
),
),
Container(
padding: const EdgeInsets.all(3.0),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10),
border: Border.all(color: Colors.grey[350])),
width: 90,
height: 90,
child: FlutterLogo(),
),
],
),
),
Already-tried Solutions:
Changing mainAxisAlignment of the Row with multiple values but didn't get the desired output
Placing the Row inside of a Flex Widget
You can separate the Widgets in multiple layers using Stack and use Position to place the layers exactly where you want.
#override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
debugShowCheckedModeBanner: false,
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: Material(
child: Center(
child: Stack(
children: <Widget>[
Container(
width: 500,
child: Row(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.end,
children: <Widget>[
Padding(
padding: EdgeInsets.only(right: 10),
child: Column(
textDirection: TextDirection.rtl,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Text('Product'),
Text('subtitle'),
Text('5000'),
Text('10000'),
],
),
),
Container(
padding: const EdgeInsets.all(3.0),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10),
border: Border.all(color: Colors.grey[350])),
width: 90,
height: 90,
child: FlutterLogo(),
),
],
),
),
Positioned(
bottom: 0,
left: 0,
child: Row(
children: <Widget>[
CircleAvatar(
backgroundColor: Colors.blue,
radius: 20,
child: IconButton(
padding: EdgeInsets.zero,
icon: Icon(Icons.add),
color: Colors.white,
onPressed: () {},
),
),
Text('1'),
CircleAvatar(
backgroundColor: Colors.blue,
radius: 20,
child: IconButton(
padding: EdgeInsets.zero,
icon: Icon(Icons.remove),
color: Colors.white,
onPressed: () {},
),
),
],
),
)
],
),
),
),
);
}
Hope this helps.
You could use a Stack and Positioned:
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
#override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
debugShowCheckedModeBanner: false,
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: Material(child: Center(
child:
Container(
color: Colors.grey,
width: 400,
height: 100,
child: Stack(children: <Widget>[
Row(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.end,
children: <Widget>[
Padding(
padding: EdgeInsets.only(right: 10),
child: Column(
textDirection: TextDirection.rtl,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Text(
'Product',
style: TextStyle(
fontSize: 15,
),
),
Text(
'subtitle',
style: TextStyle(
fontSize: 15,
fontWeight: FontWeight.w200,
),
),
Text(
'5000',
style: TextStyle(
fontSize: 10,
fontWeight: FontWeight.w200,
),
),
],
),
),
Container(
padding: const EdgeInsets.all(3.0),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10),
border: Border.all(color: Colors.grey[350])),
width: 90,
height: 90,
child: FlutterLogo(),
),
],
),
Positioned(
bottom: 0,
left: 0,
child: Row(
children: <Widget>[
Row(
children: <Widget>[
RawMaterialButton(
child: Text("-"), onPressed: () {}),
Text('6'),
RawMaterialButton(
child: Text("+"), onPressed: () {}),
],
),
Text('10000', style: TextStyle(fontSize: 15)),
],
),),
]
),),),),
);
}
}
Try adding a Spacer
Row(//parent widget
children: <Widget>[
Row(//To be moved to the end of the parent
children: <Widget>[
RoundIconButton(
icon: FontAwesomeIcons.minus, onPressed: () {}),
Text('$_counter'),
RoundIconButton(
icon: FontAwesomeIcons.plus, onPressed: () {}),
],
),
Spacer(),//Where I added the spacer
Text('10000', style: GoogleFonts.cairo(fontSize: 15)),
],
),