From e81a3506a7847aee01219c95e9052095978c0406 Mon Sep 17 00:00:00 2001 From: Weller <1812208341@qq.com> Date: Fri, 16 Oct 2020 17:25:11 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E8=AE=A2=E5=8D=95=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../orders_page/bloc/order_content_bloc.dart | 10 +++++++++ lib/pages/orders_page/order_content_page.dart | 4 ++-- .../orders_page/views/order_item_widget.dart | 22 ++++++++++++++----- 3 files changed, 29 insertions(+), 7 deletions(-) diff --git a/lib/pages/orders_page/bloc/order_content_bloc.dart b/lib/pages/orders_page/bloc/order_content_bloc.dart index 95a183b..4ebb1a7 100644 --- a/lib/pages/orders_page/bloc/order_content_bloc.dart +++ b/lib/pages/orders_page/bloc/order_content_bloc.dart @@ -33,6 +33,16 @@ class OrderContentBloc extends BlocBase { void _loadData(dynamic data) { List list = data ?? []; + OrderModel model = OrderModel(); + model.itemId = '6918577752399759376'; + model.imgUrl = + 'https://t7.baidu.com/it/u=3616242789,1098670747&fm=79&app=86&size=h300&n=0&g=4n&f=jpeg?sec=1603444938&t=04aeb23595ac79d419be19ab92bea668'; + model.title = '乐町百褶半身裙秋冬女2019新款复古麻花半身裙甜美百褶半身裙'; + model.price = '108'; + model.commission = '0'; + model.commissionRate = '9.2'; + _orders.add(model); + _orders = list.map((item) { return OrderModel.fromJson(Map.from(item)); }).toList(); diff --git a/lib/pages/orders_page/order_content_page.dart b/lib/pages/orders_page/order_content_page.dart index 8bd38aa..de1671f 100644 --- a/lib/pages/orders_page/order_content_page.dart +++ b/lib/pages/orders_page/order_content_page.dart @@ -63,9 +63,9 @@ class _OrderContentContainerState extends State { ); } return ListView.builder( - itemCount: 20, + itemCount: orders.length, itemBuilder: (context, index) { - return OrderItemWidget(); + return OrderItemWidget(orders[index]); }); }); } diff --git a/lib/pages/orders_page/views/order_item_widget.dart b/lib/pages/orders_page/views/order_item_widget.dart index c134fa3..0221a8c 100644 --- a/lib/pages/orders_page/views/order_item_widget.dart +++ b/lib/pages/orders_page/views/order_item_widget.dart @@ -1,6 +1,12 @@ import 'package:flutter/material.dart'; +import 'package:zhiying_base_widget/pages/orders_page/models/order_model.dart'; +import 'package:zhiying_comm/zhiying_comm.dart'; class OrderItemWidget extends StatelessWidget { + final OrderModel model; + + const OrderItemWidget(this.model, {Key key}) : super(key: key); + @override Widget build(BuildContext context) { return Container( @@ -56,7 +62,13 @@ class OrderItemWidget extends StatelessWidget { margin: EdgeInsets.only(right: 10), width: 96, height: 96, - color: Colors.black12, + child: ClipRRect( + borderRadius: BorderRadius.circular(8), + child: CachedNetworkImage( + imageUrl: model.imgUrl ?? '', + fit: BoxFit.cover, + ), + ), ), Expanded( child: Column( @@ -80,20 +92,20 @@ class OrderItemWidget extends StatelessWidget { padding: EdgeInsets.only(left: 2, right: 2, top: 3, bottom: 3), margin: EdgeInsets.only(right: 4), child: Text( - '类型', + '淘宝', style: TextStyle( fontSize: 9, height: 1, - color: Colors.purpleAccent, + color: Colors.white, ), ), decoration: BoxDecoration( - color: Colors.amber, borderRadius: BorderRadius.circular(2.5)), + color: Colors.redAccent, borderRadius: BorderRadius.circular(2.5)), ), )); list.add( TextSpan( - text: '桶装水抽水器饮水机泵器动桶装水抽水器饮水机泵器动', + text: model.title, style: TextStyle( fontSize: 15, color: Color(0xff333333),