Skip to content

Commit 9371ac1

Browse files
author
罗国雄
committed
Peroluo
1 parent d5c6ebd commit 9371ac1

File tree

1 file changed

+120
-3
lines changed

1 file changed

+120
-3
lines changed

lib/router/goodsDetail/index.dart

Lines changed: 120 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ class _GoodsDetail extends State<GoodsDetail> {
2828

2929
int goodsCount = 0;
3030

31+
Map goodsMsgs;
32+
3133
@override
3234
void didChangeDependencies() {
3335
super.didChangeDependencies();
@@ -46,6 +48,7 @@ class _GoodsDetail extends State<GoodsDetail> {
4648
var cartData = data[1].data;
4749
setState(() {
4850
imgList = goodsMsg['gallery'];
51+
goodsMsgs = goodsMsg;
4952
initLoading = false;
5053
goodsCount = cartData['cartTotal']['goodsCount'];
5154
});
@@ -56,6 +59,7 @@ class _GoodsDetail extends State<GoodsDetail> {
5659
var goodsMsg = data[0].data;
5760
setState(() {
5861
imgList = goodsMsg['gallery'];
62+
goodsMsgs = goodsMsg;
5963
initLoading = false;
6064
});
6165
}
@@ -64,13 +68,12 @@ class _GoodsDetail extends State<GoodsDetail> {
6468
@override
6569
Widget build(BuildContext context) {
6670
return new Scaffold(
67-
backgroundColor: Color.fromARGB(1, 200, 200, 200),
6871
appBar: buildAppBar('母亲节礼物-舒适安睡组合'),
6972
body: Column(
7073
children: <Widget>[
7174
Expanded(
7275
child: Container(
73-
color: Colors.white,
76+
color: Color.fromARGB(1, 200, 200, 200),
7477
child: buildContent(context),
7578
),
7679
),
@@ -178,6 +181,7 @@ class _GoodsDetail extends State<GoodsDetail> {
178181
top: 0,
179182
right: 0,
180183
child: Container(
184+
color: Colors.white,
181185
child: Text(
182186
'$goodsCount',
183187
style: TextStyle(
@@ -288,7 +292,15 @@ class _GoodsDetail extends State<GoodsDetail> {
288292
} else {
289293
return CustomScrollView(
290294
slivers: <Widget>[
291-
buildOneWidget(buildSwiper(context, imgList)),
295+
buildOneWidget(
296+
buildSwiper(context, imgList),
297+
),
298+
buildOneWidget(
299+
buildGoodsLa(context),
300+
),
301+
buildOneWidget(
302+
buildGoodsMsg(context),
303+
),
292304
],
293305
);
294306
}
@@ -333,4 +345,109 @@ class _GoodsDetail extends State<GoodsDetail> {
333345
),
334346
);
335347
}
348+
349+
// 商品活动栏
350+
Widget buildGoodsLa(BuildContext context) {
351+
return Container(
352+
color: Color.fromARGB(255, 244, 244, 244),
353+
padding: EdgeInsets.all(5),
354+
child: Column(
355+
children: <Widget>[
356+
Row(
357+
children: <Widget>[
358+
Expanded(
359+
child: Row(
360+
mainAxisAlignment: MainAxisAlignment.center,
361+
children: <Widget>[
362+
Icon(
363+
Icons.star,
364+
color: Colors.red,
365+
size: Rem.getPxToRem(26),
366+
),
367+
Container(
368+
child: Text(
369+
'30天无忧退货',
370+
style: TextStyle(fontSize: Rem.getPxToRem(26)),
371+
),
372+
)
373+
],
374+
),
375+
),
376+
Expanded(
377+
child: Row(
378+
mainAxisAlignment: MainAxisAlignment.center,
379+
children: <Widget>[
380+
Icon(
381+
Icons.star,
382+
color: Colors.red,
383+
size: Rem.getPxToRem(26),
384+
),
385+
Text(
386+
'满88元免邮费',
387+
style: TextStyle(fontSize: Rem.getPxToRem(26)),
388+
),
389+
],
390+
),
391+
),
392+
Expanded(
393+
child: Row(
394+
mainAxisAlignment: MainAxisAlignment.center,
395+
children: <Widget>[
396+
Icon(
397+
Icons.star,
398+
color: Colors.red,
399+
size: Rem.getPxToRem(26),
400+
),
401+
Text(
402+
'48小时快速退款',
403+
style: TextStyle(fontSize: Rem.getPxToRem(26)),
404+
)
405+
],
406+
),
407+
)
408+
],
409+
)
410+
],
411+
),
412+
);
413+
}
414+
415+
// 商品信息
416+
Widget buildGoodsMsg(BuildContext context) {
417+
print(goodsMsgs['info']);
418+
return Container(
419+
color: Colors.white,
420+
padding: EdgeInsets.all(10),
421+
child: Column(
422+
children: <Widget>[
423+
Padding(
424+
padding: EdgeInsets.only(bottom: 5),
425+
child: Text(
426+
goodsMsgs["info"]['name'],
427+
style: TextStyle(
428+
fontSize: Rem.getPxToRem(40),
429+
),
430+
),
431+
),
432+
Padding(
433+
padding: EdgeInsets.only(bottom: 5),
434+
child: Text(
435+
goodsMsgs["info"]['goods_brief'],
436+
style: TextStyle(
437+
color: Colors.grey,
438+
fontSize: Rem.getPxToRem(30),
439+
),
440+
),
441+
),
442+
Text(
443+
'¥499',
444+
style: TextStyle(
445+
color: Colors.red,
446+
fontSize: Rem.getPxToRem(40),
447+
),
448+
),
449+
],
450+
),
451+
);
452+
}
336453
}

0 commit comments

Comments
 (0)