i want to set text right ( width * 0.08 ) and icon left ( width * 0.08) but when i run it . itsw not work . and when i've set padding right for text and left for icon , in other size not work . image about web and about phone . width = 1080 .
and this is part of my code :
Container(
child: Row(
children: [
Container(
alignment: Alignment.centerRight,
child: Padding(
padding: EdgeInsets.only(
top: pageWidth * 0.08,
right: pageWidth * 0.09,
bottom: pageWidth * 0.03),
child: Text(
"سلام",
style: TextStyle(
fontSize: 20),
),
),
),
Container(
child: Padding(
padding: EdgeInsets.only(
top: pageWidth * 0.08,
left: pageWidth * 0.06,
bottom: pageWidth * 0.04),
child: IconButton(
alignment: Alignment.topLeft,
onPressed: () {},
icon: Container(
child: SvgPicture.asset(
homeSettings,
width: pageWidth * 0.062,
height:pageWidth * 0.062,
),
),
),
)),
],
)),
You just need to add a Spacer
widget between the 2 containers, like this:
Container(
child: Row(
children: [
Container(
alignment: Alignment.centerRight,
child: Padding(
padding: EdgeInsets.only(
top: pageWidth * 0.08,
right: pageWidth * 0.09,
bottom: pageWidth * 0.03),
child: Text(
"سلام",
style: TextStyle(
fontSize: 20),
),
),
),
Spacer(), //Add here
Container(
child: Padding(
padding: EdgeInsets.only(
top: pageWidth * 0.08,
left: pageWidth * 0.06,
bottom: pageWidth * 0.04),
child: IconButton(
alignment: Alignment.topLeft,
onPressed: () {},
icon: Container(
child: SvgPicture.asset(
homeSettings,
width: pageWidth * 0.062,
height:pageWidth * 0.062,
),
),
),
)),
],
)),