i am continuously being wrong with this data overflow - flutter

I want to display the text under the images. I am able to see the Images and text, but My text is overflowing. I want to display it on each text under each image. Below is my code.
What should I do to solve this situation.
Widget firstStyleRow(String ImgPath1, String ImgPath2, String avatarImg) {
return Container(
height: 250.0,
padding: EdgeInsets.only(left: 10.0, right: 10.0),
child: Row(
children: [
Container(
height: 250.0,
width: (MediaQuery.of(context).size.width - 30.0) / 2,
child: Column(
children: [
Container(
height: 125.0,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10.0),
image: DecorationImage(
image: AssetImage(ImgPath1),
fit: BoxFit.cover,
),
),
),
SizedBox(
height: 15.0,
),
Text(
'i like the wy to show more item',
style: TextStyle(
fontSize: 20,
fontWeight: FontWeight.bold,
),
),
SizedBox(
height: 15.0,
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
Container(
height: 30.0,
width: 30.0,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(20.0),
image: DecorationImage(
image: AssetImage('assets/chris.jpg'),
),
),
),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'mon hll',
textAlign: TextAlign.left,
style: TextStyle(
fontSize: 15.0,
fontWeight: FontWeight.bold,
),
),
Text(
'10:28 pm',
textAlign: TextAlign.left,
style: TextStyle(
fontSize: 15.0,
fontWeight: FontWeight.bold,
),
),
],
),
],
),
],
),
),
SizedBox(
width: 10.0,
),
Container(
height: 350,
width: (MediaQuery.of(context).size.width - 30.0) / 2,
child: Container(
height: 250,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10.0),
image: DecorationImage(
image: AssetImage('assets/letter.jpeg'),
fit: BoxFit.cover,
),
),
),
),
SizedBox(
height: 5,
),
Padding(
padding: const EdgeInsets.all(9.0),
child: Text(
'i hvxxxx',
style: TextStyle(
fontSize: 50,
),
),
),
],
),
);
}

Try below code hope its help to you.add your inside row widget wrap it with Expanded or Flexible, just change my images with your images
Container(
height: 250.0,
padding: EdgeInsets.only(left: 10.0, right: 10.0),
child: Row(
children: [
Expanded(
child: Container(
height: 250.0,
width: (MediaQuery.of(context).size.width - 30.0) / 2,
child: SingleChildScrollView(
child: Column(
children: [
Container(
height: 125.0,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10.0),
image: DecorationImage(
image: NetworkImage(
'https://tech.pelmorex.com/wp-content/uploads/2020/10/flutter.png'),
fit: BoxFit.cover,
),
),
),
SizedBox(
height: 15.0,
),
Text(
'i like the wy to show more item',
style: TextStyle(
fontSize: 20,
fontWeight: FontWeight.bold,
),
),
SizedBox(
height: 15.0,
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
Expanded(
child: Container(
height: 30.0,
width: 30.0,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(20.0),
image: DecorationImage(
image: NetworkImage(
'https://tech.pelmorex.com/wp-content/uploads/2020/10/flutter.png'),
),
),
),
),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'mon hll',
textAlign: TextAlign.left,
style: TextStyle(
fontSize: 15.0,
fontWeight: FontWeight.bold,
),
),
Text(
'10:28 pm',
textAlign: TextAlign.left,
style: TextStyle(
fontSize: 15.0,
fontWeight: FontWeight.bold,
),
),
],
),
),
],
),
],
),
),
),
),
SizedBox(
width: 10.0,
),
Container(
height: 350,
width: (MediaQuery.of(context).size.width - 30.0) / 2,
child: Container(
height: 250,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10.0),
image: DecorationImage(
image: NetworkImage(
'https://tech.pelmorex.com/wp-content/uploads/2020/10/flutter.png'),
fit: BoxFit.cover,
),
),
),
),
SizedBox(
height: 5,
),
Expanded(
child: Padding(
padding: const EdgeInsets.all(9.0),
child: Text(
'i hvxxxx',
style: TextStyle(
fontSize: 50,
),
),
),
),
],
),
),
Your result screen->

Related

How to add overlapping and horizontally positioned image in fllutter?

I am trying to Position an Image horizontally in a way that it would cover/overlap on the left side of a container , but can't seem to figure out the right way to do it
Here is what I am trying to achieve:
Image is covering the Left edge of the Container.
This is what I got:
There is a gap between the image and container
Here is my code :
Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisSize: MainAxisSize.max,
children: [
Image(
image: AssetImage("assets/images/btc.png"),
height: 47,
width: 43,
fit: BoxFit.contain,
),
Container(
alignment: Alignment.center,
margin: EdgeInsets.zero,
padding: EdgeInsets.zero,
width: MediaQuery.of(context).size.width * 0.4,
height: MediaQuery.of(context).size.height * 0.045,
decoration: BoxDecoration(
color: Color(0xff2e325c),
shape: BoxShape.rectangle,
borderRadius: BorderRadius.circular(6.0),
),
child: Text(
"1 Token",
textAlign: TextAlign.start,
overflow: TextOverflow.clip,
style: TextStyle(
fontWeight: FontWeight.w600,
fontStyle: FontStyle.normal,
fontSize: 16,
color: Color(0xffffffff),
),
),
),
],
),
UPDATE:
This is what it looks like when I add it into the stack
Positioning is a little bit off how can I align it with the container like above image
Row(
children: [
Stack(
children: [
Align(
alignment: Alignment.centerLeft,
child: Container(
alignment: Alignment.center,
margin: EdgeInsets.fromLTRB(30, 8, 0, 0),
padding: EdgeInsets.zero,
width: MediaQuery.of(context).size.width * 0.4,
height: MediaQuery.of(context).size.height * 0.055,
decoration: BoxDecoration(
color: Color(0xff2e325c),
shape: BoxShape.rectangle,
borderRadius: BorderRadius.circular(6.0),
),
child: Text(
"1 Token",
textAlign: TextAlign.start,
overflow: TextOverflow.clip,
style: TextStyle(
fontWeight: FontWeight.w600,
fontStyle: FontStyle.normal,
fontSize: 16,
color: Color(0xffffffff),
),
),
),
),
Icon(
Icons.monetization_on,
size: 60,
color: Colors.amber,
)
],
),
],
),
You can use stack to overlap coin with container.
Stack(
children: [
Container(
alignment: Alignment.center,
margin: EdgeInsets.zero,
padding: EdgeInsets.zero,
width: MediaQuery.of(context).size.width * 0.4,
height: MediaQuery.of(context).size.height * 0.045,
decoration: BoxDecoration(
color: Color(0xff2e325c),
shape: BoxShape.rectangle,
borderRadius: BorderRadius.circular(6.0),
),
child: Text(
"1 Token",
textAlign: TextAlign.start,
overflow: TextOverflow.clip,
style: TextStyle(
fontWeight: FontWeight.w600,
fontStyle: FontStyle.normal,
fontSize: 16,
color: Color(0xffffffff),
),
),
),
Image(
image: AssetImage("assets/images/btc.png"),
height: 47,
width: 43,
fit: BoxFit.contain,
),
],
),
SizedBox(
width: MediaQuery.of(context).size.width * 0.4,
height: MediaQuery.of(context).size.height * 0.070,
child: Stack(
children: [
Align(
alignment: Alignment.center,
child: Container(
alignment: Alignment.center,
margin: EdgeInsets.only(left: 20),
width: MediaQuery.of(context).size.width * 0.4,
height: MediaQuery.of(context).size.height * 0.045,
decoration: BoxDecoration(
color: Color(0xff2e325c),
shape: BoxShape.rectangle,
borderRadius: BorderRadius.circular(6.0),
),
child: Text(
"1 Token",
textAlign: TextAlign.start,
overflow: TextOverflow.clip,
style: TextStyle(
fontWeight: FontWeight.w600,
fontStyle: FontStyle.normal,
fontSize: 16,
color: Color(0xffffffff),
),
),
),
),
Align(
alignment: Alignment.centerLeft,
child: Image(
image: AssetImage("assets/images/btc.png"),
height: 55,
width: 55,
fit: BoxFit.contain,
),
),
],
),
),

Flutter with Firebase Realtime Database, how to displaying the name of the user who made a post

I am creating an application with flutter and Firebase Realtime where I have the functionality that a user can publish an article. What I would like is to list all these articles with the name of the user who published it. But how to display his name knowing that at the database level it is just the ID of the person who made the post that is recorded?.
Thanks
Here is the structure of the relative database :
my code from my request with Firebase Realtime :
ref = FirebaseDatabase.instance.reference().child("post").orderByKey();
FirebaseAnimatedList(
scrollDirection: Axis.vertical,
shrinkWrap: true,
query: ref,
itemBuilder: (BuildContext context, DataSnapshot snapshot,
Animation<double> animation, int index) {
return Container(
padding: EdgeInsets.all(10),
margin: EdgeInsets.only(bottom: 20),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Row(
children: <Widget>[
Container(
width: 50,
height: 50,
decoration: BoxDecoration(
shape: BoxShape.circle,
image: DecorationImage(
image: NetworkImage(snapshot
.value["imagePost"]
.toString()),
fit: BoxFit.cover)),
),
SizedBox(
width: 10,
),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
RichText(
text: TextSpan(
//text: snapshot.value["user_id"].toString(),
text: "" +
FirebaseDatabase.instance
.reference()
.child('users')
.child(
"${snapshot.value["user_id"].toString()}")
.child('nom')
.toString(),
style: TextStyle(
color: Colors.grey[900],
fontSize: 14,
fontWeight: FontWeight.bold,
letterSpacing: 1),
),
),
SizedBox(
height: 3,
),
Text(
"${timeago.format(DateTime.parse("${DateTime.fromMillisecondsSinceEpoch(snapshot.value['createAt'])}"), locale: 'fr_short')}",
style: TextStyle(
fontSize: 12, color: Colors.grey),
),
],
)
],
),
],
),
SizedBox(
height: 20,
),
RichText(
text: TextSpan(
text: snapshot.value["description"].toString(),
style: TextStyle(
fontSize: 12,
color: Colors.grey[800],
height: 1.5,
letterSpacing: .7),
),
),
SizedBox(
height: 20,
),
snapshot.value["imagePost"].toString() != ''
? Container(
height: 200,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10),
image: DecorationImage(
image: NetworkImage(
snapshot.value["imagePost"].toString()),
fit: BoxFit.cover),
),
)
: Container(
height: 200,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10),
color: kPrimaryColor,
),
),
SizedBox(
height: 20,
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
makeLikeButton(isActive: false),
Padding(
padding: EdgeInsets.only(
right: 10,
),
),
Row(
children: <Widget>[
makeLike(),
SizedBox(
width: 5,
),
Text(
"2.5K",
style: TextStyle(
fontSize: 10, color: Colors.grey[800]),
)
],
),
],
),
],
),
);
},
),

flutter Problem : How to make upgrade section in bottom left in card

I want to make upgrade section in bottom left but I am not understatig how to do it.
I want to make upgrade section in bottom left but I am not understatig how to do it.
I want to make upgrade section in bottom left but I am not understatig how to do it.
this is my code.
import 'package:cwc/constants/constants.dart';
import 'package:flutter/material.dart';
class UpgradeMemberPackages extends StatefulWidget {
const UpgradeMemberPackages({Key? key}) : super(key: key);
#override
_UpgradeMemberPackagesState createState() => _UpgradeMemberPackagesState();
}
class _UpgradeMemberPackagesState extends State<UpgradeMemberPackages> {
#override
Widget build(BuildContext context) {
return Scaffold(
body: SingleChildScrollView(
child: Column(
children: [
Container(
width: double.infinity,
height: 160,
decoration: const BoxDecoration(
color: Color(0xffCCEAEF),
image: DecorationImage(
image: AssetImage('assets/ump.png'),
fit: BoxFit.cover,
),
),
),
Container(
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 12.0),
child: Column(
children: [
SizedBox(
height: 13,
),
Text(
"Your Membership Package",
style: TextStyle(
fontSize: tSize18,
fontWeight: FontWeight.w500),
),
Container(
padding: EdgeInsets.only(right: 15, left: 15),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10),
image: DecorationImage(
image: AssetImage("assets/green_card.png"),
fit: BoxFit.fill,
),
),
height: 147,
width: MediaQuery.of(context).size.width,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Padding(
padding: const EdgeInsets.only(top: 16.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
"Starter Package",
style: TextStyle(
fontSize: tSize18,
fontWeight: FontWeight.w500),
),
SizedBox(
height: 6,
),
Text(
"Package for new members",
style: TextStyle(
fontSize: tSize14,
),
),
SizedBox(
height: 16,
),
Text(
"Free",
style: TextStyle(
fontSize: tSize27,
fontWeight: FontWeight.w500),
),
SizedBox(
height: 3,
),
Text(
"Valid Til: NONE",
style: TextStyle(
fontSize: tSize14,
),
),
],
),
),
Padding(
padding: EdgeInsets.only(bottom: 8),
child: Image.asset(
'assets/onaa.png',
height: 114,
width: 114,
),
),
],
)),
SizedBox(
height: 13,
),Text(
"Other Packages",
style: TextStyle(
fontSize: tSize18,
fontWeight: FontWeight.w500),
), SizedBox(
height: 13,
),
Container(
padding: EdgeInsets.only(right: 15, left: 15),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10),
image: DecorationImage(
image: AssetImage("assets/orange_card.png"),
fit: BoxFit.fill,
),
),
height: 147,
width: MediaQuery.of(context).size.width,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Padding(
padding: const EdgeInsets.only(top: 16.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
"Explorer Package",
style: TextStyle(
fontSize: tSize18,
fontWeight: FontWeight.w500),
),
SizedBox(
height: 6,
),
Text(
"Best package for price",
style: TextStyle(
fontSize: tSize14,
),
),
SizedBox(
height: 16,
),
Text(
"\$99 USD",
style: TextStyle(
fontSize: tSize27,
fontWeight: FontWeight.w500),
),
],
),
),
Padding(
padding: EdgeInsets.only(bottom: 8),
child: Image.asset(
'assets/onbb.png',
height: 114,
width: 114,
),
),
],
)),
SizedBox(
height: 10,
),
Container(
padding: EdgeInsets.only(right: 15, left: 15),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10),
image: DecorationImage(
image: AssetImage("assets/purple_card.png"),
fit: BoxFit.fill,
),
),
height: 147,
width: MediaQuery.of(context).size.width,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Padding(
padding: const EdgeInsets.only(top: 16.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
"Champion Package",
style: TextStyle(
fontSize: tSize18,
fontWeight: FontWeight.w500),
),
SizedBox(
height: 6,
),
Text(
"VIP Package",
style: TextStyle(
fontSize: tSize14,
),
),
SizedBox(
height: 16,
),
Text(
"\$199 USD",
style: TextStyle(
fontSize: tSize27,
fontWeight: FontWeight.w500),
),
],
),
),
Padding(
padding: const EdgeInsets.only(bottom: 8.0),
child: Image.asset(
'assets/oncc.png',
height: 114,
width: 114,
),
),
],
))
],
),
),
),
],
),
),
);
}
}
In Actuall I want to make like this.
But It becoming like this. I want upgrade section which is in bottom left.
Try below code hope its help to you. You used Stack widget for that
Refer Stack here
Refer Positioned here
Stack(
children: [
Container(
padding: EdgeInsets.only(right: 15, left: 15),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10),
image: DecorationImage(
image: NetworkImage(
"https://miro.medium.com/max/1400/1*-6WdIcd88w3pfphHOYln3Q.png"),
fit: BoxFit.fill,
),
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Padding(
padding: const EdgeInsets.only(top: 16.0),
child: Column(
children: [
Text(
"Explorer Package",
style: TextStyle(
color: Colors.white,
fontSize: 18,
fontWeight: FontWeight.w500),
),
SizedBox(
height: 6,
),
Text(
"Best package for price",
style: TextStyle(
fontSize: 14,
),
),
SizedBox(
height: 16,
),
Text(
"\$99 USD",
style: TextStyle(
color: Colors.white,
fontSize: 27,
fontWeight: FontWeight.w500),
),
],
),
),
Padding(
padding: EdgeInsets.only(bottom: 8),
child: Image.network(
'https://miro.medium.com/max/1400/1*-6WdIcd88w3pfphHOYln3Q.png',
height: 114,
width: 114,
),
),
],
),
),
Positioned(
bottom: 0,
child: Container(
decoration: BoxDecoration(
color: Colors.green,
borderRadius: BorderRadius.only(
bottomLeft: Radius.circular(8),
topRight: Radius.circular(20),
),
),
width: 200,
height: 38,
child: Center(
child: Text(
'Upgrade Now',
style: TextStyle(
color: Colors.white,
fontSize: 20,
),
),
),
),
),
],
),
Your result screen->
By using Stack widget, I implemented what you want to.
Because there is no image resource, screenshot is not same as you uploaded.
Wrap Row Widget with Stack widget in Container
Moved padding property because of 'upgrade now' widget location
Added 'upgrade now' widget
Container(
decoration: BoxDecoration(
color: Colors.orange,
borderRadius: BorderRadius.circular(10),
image: DecorationImage(
image: AssetImage("assets/orange_card.png"),
fit: BoxFit.fill,
),
),
height: 147,
width: MediaQuery.of(context).size.width,
child: Stack(
children: [
Padding(
padding: EdgeInsets.only(right: 15, left: 15),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Padding(
padding: const EdgeInsets.only(top: 16.0),
child: Column(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Text(
"Explorer Package",
style: TextStyle(
fontSize: 14,
fontWeight: FontWeight.w500),
),
SizedBox(
height: 6,
),
Text(
"Best package for price",
style: TextStyle(
fontSize: 10,
),
),
SizedBox(
height: 16,
),
Text(
"\$99 USD",
style: TextStyle(
fontSize: 23,
fontWeight: FontWeight.w500),
),
],
),
),
Padding(
padding: EdgeInsets.only(bottom: 8),
child: Image.asset(
'assets/onbb.png',
height: 114,
width: 114,
),
),
],
),
),
Align(
alignment: Alignment.bottomLeft,
child: Container(
decoration: BoxDecoration(
color: Colors.green,
borderRadius: BorderRadius.only(
topRight: Radius.circular(10),
bottomLeft: Radius.circular(10),
),
),
height: 25,
width: 150,
child: Center(
child: Text(
'Upgrade Now',
style: TextStyle(
color: Colors.white,
fontSize: 9,
),
),
),
),
),
],
),
),

how to insert backround image in one row (whole row)

I want to insert background image in one row in flutter
when I insert background image does not take up the entire row, only is displayed in one container
you can see this issue below image (I insert black background image for to be seen better):
Widget getBody() {
var size = MediaQuery.of(context).size;
return Container(
width: size.width,
height: size.height,
decoration: BoxDecoration(
borderRadius: BorderRadius.only(
bottomLeft: Radius.circular(10),
bottomRight: Radius.circular(10)),
color: Colors.red),
child: SingleChildScrollView(
child: Column(
children: [
SizedBox(
height: 10,
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Flexible(
child: Container(
height: 1,
decoration:
BoxDecoration(color: Colors.grey.withOpacity(0.2)),
),
),
SizedBox(
width: 10,
),
Text(
"درصد تخفیف برای 30 عدد",
style: TextStyle(color: Colors.black54),
),
SizedBox(
width: 10,
),
Flexible(
child: Container(
height: 1,
decoration:
BoxDecoration(color: Colors.grey.withOpacity(0.2)),
),
),
],
),
SizedBox(
height: 15,
),
Column(
children: List.generate(nardeban_data.length, (index) {
return Column(
children: [
Padding(
padding: const EdgeInsets.only(right: 20, left: 20),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Container(
decoration: new BoxDecoration(
image: new DecorationImage(
image: new AssetImage("assets/images/bg.png"),
fit: BoxFit.cover,
),
),
width: (size.width - 40) * 0.68,
child: Row(
children: [
Container(
width: 40,
decoration: BoxDecoration(
color: Colors.blue,
border: Border.all(color: Colors.blue),
borderRadius:
BorderRadius.circular(40.0)),
child: Padding(
padding: EdgeInsets.all(10.0),
child: Text("14",
style: TextStyle(
fontSize: 13.0,
fontWeight: FontWeight.bold,
color: Colors.white)))),
SizedBox(
width: 10,
),
Container(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
nardeban_data[index]['name'],
style: TextStyle(
fontSize: 14,
color: Colors.black54,
fontWeight: FontWeight.w400),
overflow: TextOverflow.ellipsis,
),
Text(
nardeban_data[index]['takhfif'],
style: TextStyle(
fontSize: 12,
color: Colors.blue,
),
overflow: TextOverflow.ellipsis,
),
],
),
)
],
),
),
Container(
width: (size.width - 90) * 0.32,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10),
border: Border.all(color: Colors.green)),
child: Padding(
padding: const EdgeInsets.only(
right: 10, bottom: 4, left: 10, top: 4),
child: Row(
children: [
SizedBox(
width: 25,
height: 25,
child: TextField(
textAlign: TextAlign.center,
keyboardType: TextInputType.number,
decoration: InputDecoration(
hintText: '4%',
border: InputBorder.none,
contentPadding: EdgeInsets.only(
bottom: 8,
top: 3,
),
),
),
)
],
),
),
),
Icon(
Icons.notifications,
size: 22,
color: Colors.blue.withOpacity(0.7),
)
],
),
)
],
),
),
SizedBox(
height: 5,
),
Divider()
],
);
})),
],
),
),
);
}
wrap Row with Container and add decoration in container
like this:
Container(
decoration: new BoxDecoration(
image: new DecorationImage(
image: new AssetImage("assets/images/bg.png"),
fit: BoxFit.cover,
),),
child: Row(
........
)
Full code:
Widget getBody() {
var size = MediaQuery.of(context).size;
return Container(
width: size.width,
height: size.height,
decoration: BoxDecoration(
borderRadius: BorderRadius.only(
bottomLeft: Radius.circular(10),
bottomRight: Radius.circular(10)),
color: Colors.red),
child: SingleChildScrollView(
child: Column(
children: [
SizedBox(
height: 10,
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Flexible(
child: Container(
height: 1,
decoration:
BoxDecoration(color: Colors.grey.withOpacity(0.2)),
),
),
SizedBox(
width: 10,
),
Text(
"درصد تخفیف برای 30 عدد",
style: TextStyle(color: Colors.black54),
),
SizedBox(
width: 10,
),
Flexible(
child: Container(
height: 1,
decoration:
BoxDecoration(color: Colors.grey.withOpacity(0.2)),
),
),
],
),
SizedBox(
height: 15,
),
Column(
children: List.generate(5, (index) {
return Column(
children: [
Padding(
padding: const EdgeInsets.only(right: 20, left: 20),
child: Container(
decoration: new BoxDecoration(
image: new DecorationImage(
image: new AssetImage("assets/images/bg.png"),
fit: BoxFit.cover,
),
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Container(
width: (size.width - 40) * 0.68,
child: Row(
children: [
Container(
width: 40,
decoration: BoxDecoration(
color: Colors.blue,
border: Border.all(color: Colors.blue),
borderRadius:
BorderRadius.circular(40.0)),
child: Padding(
padding: EdgeInsets.all(10.0),
child: Text("14",
style: TextStyle(
fontSize: 13.0,
fontWeight: FontWeight.bold,
color: Colors.white)))),
SizedBox(
width: 10,
),
Container(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
"Name",
style: TextStyle(
fontSize: 14,
color: Colors.black54,
fontWeight: FontWeight.w400),
overflow: TextOverflow.ellipsis,
),
Text(
' nardeban_data',
style: TextStyle(
fontSize: 12,
color: Colors.blue,
),
overflow: TextOverflow.ellipsis,
),
],
),
)
],
),
),
Container(
width: (size.width - 90) * 0.32,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10),
border: Border.all(color: Colors.green)),
child: Padding(
padding: const EdgeInsets.only(
right: 10, bottom: 4, left: 10, top: 4),
child: Row(
children: [
SizedBox(
width: 25,
height: 25,
child: TextField(
textAlign: TextAlign.center,
keyboardType: TextInputType.number,
decoration: InputDecoration(
hintText: '4%',
border: InputBorder.none,
contentPadding: EdgeInsets.only(
bottom: 8,
top: 3,
),
),
),
)
],
),
),
),
Icon(
Icons.notifications,
size: 22,
color: Colors.blue.withOpacity(0.7),
)
],
),
)
],
),)
),
SizedBox(
height: 5,
),
Divider()
],
);
})),
],
),
),
);
}
Add this code
decoration: new BoxDecoration(
image: new DecorationImage(
image: new AssetImage("filename")// or networkImage() or anything,
),),
to the row's container

FittedBox not allowing to set specific font size

I have used a FittedBox() for Text widget and the issue is I could not set font size of my choice. I have tried some specific font sizes but the font remains same. Here is the screenshot of UI I am talking about Image1, highlighted with blue color.
This is the code snippet.
Container(
color: Colors.black,
width: double.infinity,
constraints: BoxConstraints(minHeight: 30),
padding: EdgeInsets.symmetric(horizontal: 5),
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Expanded(
child: Container(
color: Colors.blue,
child: FittedBox(
fit: BoxFit.contain,
child: Text(
'Qty',
textAlign: TextAlign.left,
style: TextStyle(
color: Colors.white,
),
),
),
),
),
Container(
width: 10,
child: VerticalDivider(
color: Colors.white,
),
),
Expanded(
flex: 2,
child: Container(
alignment: Alignment.center,
// color: Colors.blue[200],
child: FittedBox(
fit: BoxFit.contain,
child: Text(
'Description',
style: TextStyle(
color: Colors.white,
// fontSize: textSize,
),
),
),
),
),
Container(
width: 10,
child: VerticalDivider(
color: Colors.white,
),
),
Expanded(
child: Container(
//width: MediaQuery.of(context).size.width * 0.07,
alignment: Alignment.center,
child: FittedBox(
fit: BoxFit.contain,
child: Text(
'Price',
style: TextStyle(
color: Colors.white,
fontSize: 12,
),
),
),
),
),
Container(
width: 10,
child: VerticalDivider(
color: Colors.white,
),
),
Expanded(
child: Container(
// width: MediaQuery.of(context).size.width * 0.07,
alignment: Alignment.center,
child: FittedBox(
fit: BoxFit.contain,
child: Text(
'Extend',
style: TextStyle(
color: Colors.white,
fontSize: 12,
),
),
),
),
),
],
),
),
I have also tried to reduce the widget height using BoxConstraints property but it is also not working. Anyone help me please to solve this issue.