[ad_1]
i’m operating this code and that i get error of
can’t learn properties of null (studying shade)
in line that starred in code
import 'package deal:flutter/materials.dart';
import 'package deal:untitled/constants.dart';
import 'package deal:untitled/fashions/product.dart';
import 'package deal:untitled/screens/residence/parts/classes.dart';
class Physique extends StatelessWidget {
const Physique({Key key}) : tremendous(key: key);
@override
Widget construct(BuildContext context) {
return Column(
crossAxisAlignment: CrossAxisAlignment.begin,
youngsters: <Widget>[
Padding(
padding: const EdgeInsets.all(15.0),
child: Text(
"Women",
textAlign: TextAlign.left,
style: Theme.of(context)
.textTheme
.headline5
.copyWith(fontWeight: FontWeight.bold),
),
),
Categories(),
Expanded(
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 20.0),
child: GridView.builder(
itemCount: products.length,
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 2,
childAspectRatio: 0.75,
),
itemBuilder: (Context, index) => ItemCard(),
),
),
),
],
);
}
}
class ItemCard extends StatelessWidget {
closing Product product;
closing Perform press;
const ItemCard({
Key key,
this.product,
this.press,
}) : tremendous(key: key);
@override
Widget construct(BuildContext context) {
return GestureDetector(
onTap: press,
youngster: Column(
crossAxisAlignment: CrossAxisAlignment.begin,
youngsters: <Widget>[
Expanded(
child: Container(
padding: EdgeInsets.all(20.0),
height: 100,
width: 100,
decoration: BoxDecoration(
* color: product.color, //error in that line
borderRadius: BorderRadius.circular(15),
),
child: Hero(
tag: "${product.id}",
child: Image.asset(product.image),
),
),
),
Padding(
padding: const EdgeInsets.symmetric(vertical: 5),
child: Text(
product.title,
style: TextStyle(
color: ktextlightcolor,
),
),
),
Text(
"$${product.price}",
style: TextStyle(fontWeight: FontWeight.bold),
)
],
),
);
}
}
that is product.dart
import 'package deal:flutter/materials.dart';
class Product {
closing String picture, title, description;
closing int value, measurement, id;
var shade;
Product({
this.id,
this.picture,
this.title,
this.value,
this.description,
this.measurement,
this.shade,
});
}
Listing<Product> merchandise = [
Product(
id: 1,
title: "office code",
price: 232,
size: 12,
description: dummyText,
image: "assets/images/bag_1.png",
color: const Color(0XFF3D82AE),
),
Product(
id: 2,
title: "belt bag",
price: 234,
size: 8,
description: dummyText,
image: "assets/images/bag_2.png",
color: const Color(0xffd3a084)),
Product(
id: 3,
title: "hang top",
price: 444,
size: 13,
description: dummyText.
image: "assets/images/bag_3.png",
color: const Color(0XFF989493)),
Product(
id: 4,
title: "old fashion",
price: 555,
size: 18,
description: dummyText,
image: "assets/images/bag_4.png",
color: const Color(0xffe6b398)),
Product(
id: 5,
title: "office code",
price: 999,
size: 33,
description: dummyText,
image: "assets/images/bag_5.png",
color: const Color(0xfffb7883)),
Product(
id: 6,
title: "siple bag",
price: 1299,
size: 6,
description: dummyText,
image: "assets/images/bag_6.png",
color: const Color(0xffaeaeae)),
];
String dummyText =
"Lorem Ipsum is just dummy textual content of the printing and typesetting business. Lorem Ipsum has been the business's commonplace dummy textual content ever because the 1500s, when an unknown printer took a galley of kind and scrambled it to make a kind specimen ebook. It has survived not solely 5 centuries, but additionally the leap into digital typesetting, remaining basically unchanged. It was popularised within the Sixties with the discharge of Letraset sheets containing Lorem Ipsum passages, and extra not too long ago with desktop publishing software program like Aldus PageMaker together with variations of Lorem Ipsum.";
[ad_2]
