121 lines
2.9 KiB
Dart
121 lines
2.9 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:gl_dao/main_color.dart';
|
|
import 'widget/shop_item.dart';
|
|
|
|
class CartPage extends StatefulWidget {
|
|
const CartPage({Key? key}) : super(key: key);
|
|
|
|
@override
|
|
State<CartPage> createState() => _CartPageState();
|
|
}
|
|
|
|
class _CartPageState extends State<CartPage> {
|
|
List<Map> cartList = [
|
|
{
|
|
'cartId': '1',
|
|
'title': '七度空间京东旗舰店',
|
|
'url': 'assets/images/detail.png',
|
|
'goodsList': [
|
|
{'goodsId': 001, 'qty': 1},
|
|
{'goodsId': 002, 'qty': 2},
|
|
{'goodsId': 003, 'qty': 3},
|
|
]
|
|
},
|
|
{
|
|
'cartId': '2',
|
|
'title': '苏菲京东旗舰店',
|
|
'url': 'assets/images/banner.png',
|
|
'goodsList': [
|
|
{'goodsId': 201, 'qty': 11},
|
|
{'goodsId': 202, 'qty': 12},
|
|
{'goodsId': 203, 'qty': 13},
|
|
{'goodsId': 204, 'qty': 14},
|
|
]
|
|
},
|
|
{
|
|
'cartId': '2',
|
|
'title': '透蜜京东旗舰店',
|
|
'url': 'assets/images/banner.png',
|
|
'goodsList': [
|
|
{'goodsId': 301, 'qty': 121},
|
|
{'goodsId': 302, 'qty': 122},
|
|
{'goodsId': 303, 'qty': 123},
|
|
{'goodsId': 304, 'qty': 124},
|
|
]
|
|
},
|
|
];
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Scaffold(
|
|
appBar: AppBar(
|
|
title: const Text(
|
|
'购物车',
|
|
style: TextStyle(
|
|
color: Colors.white,
|
|
),
|
|
),
|
|
backgroundColor: tMainRedColor,
|
|
shadowColor: Colors.transparent,
|
|
actions: [
|
|
IconButton(
|
|
onPressed: () {},
|
|
icon: const Icon(
|
|
Icons.more_horiz,
|
|
color: Colors.white,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
body: Padding(
|
|
padding: const EdgeInsets.symmetric(horizontal: 8.0),
|
|
child: ListView(
|
|
children: cartList.map((item) {
|
|
return ShopItem(item);
|
|
}).toList(),
|
|
),
|
|
),
|
|
bottomNavigationBar: _cartAction(),
|
|
);
|
|
}
|
|
|
|
Widget _cartAction() {
|
|
return Container(
|
|
padding: const EdgeInsets.only(
|
|
top: 4,
|
|
left: 4,
|
|
right: 8,
|
|
bottom: 4,
|
|
),
|
|
decoration: const BoxDecoration(
|
|
color: tMainBg,
|
|
border: Border(
|
|
top: BorderSide(color: Colors.black12),
|
|
),
|
|
),
|
|
child: Row(
|
|
children: [
|
|
Radio(
|
|
toggleable: true,
|
|
value: false,
|
|
groupValue: 'G',
|
|
onChanged: (e) {},
|
|
),
|
|
const Expanded(
|
|
child: Text('价格'),
|
|
),
|
|
ElevatedButton(
|
|
style: ButtonStyle(
|
|
backgroundColor: MaterialStateProperty.all(tMainRedColor),
|
|
),
|
|
onPressed: () {
|
|
// Get.toNamed(MallRoutes.transactionSure);
|
|
},
|
|
child: const Text('去结算'),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|