Reputation: 1
Card(
child: Container(
height: 250,
width: 180,
//color: Colors.pink,
child: Column(
children: <Widget>[
Container(
height: 190,
width: 160,
decoration: BoxDecoration(
// color:Colors.white,
image: DecorationImage(
image:AssetImage("assets/images/hamlogo.png"),),
),
),
Text("\AED 30.00",style: TextStyle(fontWeight: FontWeight.bold, fontSize: 18),),
],
),
),),
pubspec
flutter:
uses-material-design: true
assets:
Upvotes: 0
Views: 838
Reputation: 17890
I think you are not setting asset correctly, follow this:
first you need create a asset folder in your project root folder, like this:
then in your pubspec.yaml
, under flutter:
define it like this:
assets:
- assets/images/
then run flutter pub get
now if you call image, you can see it:
Card(
child: Container(
height: 250,
width: 180,
//color: Colors.pink,
child: Column(
children: <Widget>[
Container(
height: 190,
width: 160,
decoration: BoxDecoration(
// color:Colors.white,
image: DecorationImage(
image: AssetImage('assets/images/test.jpeg'),
),
),
),
Text(
"\AED 30.00",
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 18),
),
],
),
),
),
Note: if you still not getting image, please stop project and close ide, then open it again run flutter pub get then run then project.
Upvotes: 0