购物商品列表的实现
购物商品列表的实现
class ProductListPage extends StatefulWidget {
late Map _arguments;
ProductListPage({Key? key, arguments}) : super(key: key) {
_arguments = arguments;
}
@override
State<ProductListPage> createState() => _ProductListPageState();
}
class _ProductListPageState extends State<ProductListPage> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('商品列表'),
),
body: Padding(
padding: EdgeInsets.all(10),
child: ListView.builder(
itemBuilder: (context, index) {
return Column(
children: [
Row(
children: [
SizedBox(
width: ScreenAdapter.width(180),
height: ScreenAdapter.width(180),
child: Image.network(
"https://www.itying.com/images/flutter/list2.jpg",
fit: BoxFit.cover,
),
),
Expanded(
flex: 1,
child: Container(
height: ScreenAdapter.higth(180),
padding: EdgeInsets.all(10),
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
"戴尔(DELL)灵越3670 英特尔酷睿i5 高性能 台式电脑整机(九代)",
maxLines: 2,
overflow: TextOverflow.ellipsis,
),
Row(
children: [
Container(
height: ScreenAdapter.higth(36),
margin: EdgeInsets.only(right: 10),
alignment: Alignment(0, 0),
padding: EdgeInsets.fromLTRB(10, 0, 10, 0),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10),
color: Color.fromRGBO(230, 230, 230, 0.9),
),
child: Text('4G'),
),
Container(
height: ScreenAdapter.higth(36),
alignment: Alignment(0, 0),
margin: EdgeInsets.only(right: 10),
padding: EdgeInsets.fromLTRB(10, 0, 10, 0),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10),
color: Color.fromRGBO(230, 230, 230, 0.9),
),
child: Text('4G'),
),
],
),
Text(
"¥990",
style: TextStyle(color: Colors.red, fontSize: 16),
)
],
),
),
)
],
),
Divider(
height: 20,
)
],
);
},
itemCount: 10,
),
),
);
}
}
|