From adbcf0024bbf5a925c4c8648eaed51e3a208937f Mon Sep 17 00:00:00 2001 From: "23028876916@qq.com" Date: Thu, 31 Dec 2020 17:15:32 +0800 Subject: [PATCH] =?UTF-8?q?1231=20=20=E5=BA=95=E9=83=A8=E5=AF=BC=E8=88=AA?= =?UTF-8?q?=E6=A0=8F=E9=9A=90=E8=97=8F=E6=8E=A7=E5=88=B6=E5=AD=97=E6=AE=B5?= =?UTF-8?q?=E5=AF=B9=E6=8E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../goods_details_page.dart | 2 +- lib/pages/home_page/home_page.dart | 63 +++++++-------- .../goods_details/store/store_widget.dart | 76 ++++++++++++------- 3 files changed, 76 insertions(+), 65 deletions(-) diff --git a/lib/pages/goods_details_page/goods_details_page.dart b/lib/pages/goods_details_page/goods_details_page.dart index 50d4b53..4891084 100644 --- a/lib/pages/goods_details_page/goods_details_page.dart +++ b/lib/pages/goods_details_page/goods_details_page.dart @@ -164,7 +164,7 @@ class _GoodsDetailsContainerState extends State { for (int i = 1; i < datas.length - 1; i++) { WidgetModel item = WidgetModel.fromJson(Map.from(datas[i])); - print('item.modName ${item.modName}'); + print('我的item.modName ${item.modName}'); list.addAll(WidgetFactory.create( item.modName, isSliver: true, diff --git a/lib/pages/home_page/home_page.dart b/lib/pages/home_page/home_page.dart index 369f917..9faca02 100644 --- a/lib/pages/home_page/home_page.dart +++ b/lib/pages/home_page/home_page.dart @@ -31,8 +31,7 @@ class HomePage extends StatefulWidget { class _HomePageState extends State with WidgetsBindingObserver { int _currentIndex = 0; List> _data = List(); - static const EventChannel _eventChannel = - const EventChannel('JAVA_TO_FLUTTER'); + static const EventChannel _eventChannel = const EventChannel('JAVA_TO_FLUTTER'); @override void initState() { @@ -55,7 +54,7 @@ class _HomePageState extends State with WidgetsBindingObserver { _showPolicy(); Moblink.uploadPrivacyPermissionStatus(1, (bool success) {}); - SharesdkPlugin.uploadPrivacyPermissionStatus( 1 , (bool success) {}); + SharesdkPlugin.uploadPrivacyPermissionStatus(1, (bool success) {}); // 是安卓系统,Android场景还原的实现 /*if (defaultTargetPlatform == TargetPlatform.android) { @@ -121,23 +120,22 @@ class _HomePageState extends State with WidgetsBindingObserver { String textColor = model.fontColor; String chooseColor = model.chooseColor ?? textColor; - items.add(BottomNavigationBarItem( - icon: Container( - width: 24, - height: 24, - margin: EdgeInsets.only(bottom: 4), - child: CachedNetworkImage( - imageUrl: _currentIndex == i ? selectedIcon : icon, - fit: BoxFit.fitWidth, + if (model.isShow == "1") { + items.add(BottomNavigationBarItem( + icon: Container( + width: 24, + height: 24, + margin: EdgeInsets.only(bottom: 4), + child: CachedNetworkImage( + imageUrl: _currentIndex == i ? selectedIcon : icon, + fit: BoxFit.fitWidth, + ), ), - ), - title: Text( - model.name, - style: TextStyle( - fontSize: 11, - color: HexColor.fromHex( - _currentIndex == i ? chooseColor : textColor)), - ))); + title: Text( + model.name, + style: TextStyle(fontSize: 11, color: HexColor.fromHex(_currentIndex == i ? chooseColor : textColor)), + ))); + } } if (items.length < 2) { @@ -169,9 +167,7 @@ class _HomePageState extends State with WidgetsBindingObserver { Future _checkLimit(BaseTabModel model) async { if (model.requiredLogin == '1') { - UserInfoModel user = - await Provider.of(context, listen: false) - .getUserInfoModel(); + UserInfoModel user = await Provider.of(context, listen: false).getUserInfoModel(); print(user.toString()); if (user?.token == null || user.token == '') { print('need login...'); @@ -201,8 +197,7 @@ class _HomePageState extends State with WidgetsBindingObserver { } // 通知弹窗 - String isShowNotiPermission = await SharedPreferencesUtil.getStringValue( - Constants.isShowNotiPermission); + String isShowNotiPermission = await SharedPreferencesUtil.getStringValue(Constants.isShowNotiPermission); if (isShowNotiPermission == null || isShowNotiPermission != '1') { await NotificationSettingDialog.show(context); await SharedPreferencesUtil.setStringValue(Constants.isShowNotiPermission, "1"); @@ -264,16 +259,14 @@ class _HomePageState extends State with WidgetsBindingObserver { void showAlert(String text, BuildContext context) { showDialog( context: context, - builder: (BuildContext context) => CupertinoAlertDialog( - title: new Text("提示"), - content: new Text(text), - actions: [ - new FlatButton( - child: new Text("OK"), - onPressed: () { - Navigator.of(context).pop(); - }, - ) - ])); + builder: (BuildContext context) => + CupertinoAlertDialog(title: new Text("提示"), content: new Text(text), actions: [ + new FlatButton( + child: new Text("OK"), + onPressed: () { + Navigator.of(context).pop(); + }, + ) + ])); } } diff --git a/lib/widgets/goods_details/store/store_widget.dart b/lib/widgets/goods_details/store/store_widget.dart index 9d3f301..b0b1214 100644 --- a/lib/widgets/goods_details/store/store_widget.dart +++ b/lib/widgets/goods_details/store/store_widget.dart @@ -49,7 +49,11 @@ class _StoreContainerState extends State { void _onMoreClick() {} /// 点击商家 - void _onStoreClick() {} + void _onStoreClick() { + print("点击了_onStoreClick"); + Logger.log(widget.model['data']); + // RouterUtil.openWebview(url, context); + } @override Widget build(BuildContext context) { @@ -72,30 +76,35 @@ class _StoreContainerState extends State { /// 主视图 Widget _getMianWidget(StoreModel model) { - return Container( - color: Colors.white, - width: double.infinity, - height: 50 + 20.0 + 18, - padding: const EdgeInsets.only(left: 12.5, right: 12.5, top: 20, bottom: 18), - child: Row( - children: [ - /// 商家图片 - _getStoreImgWidget(model), - const SizedBox(width: 7.5), - Expanded( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - /// 商店名称与更多 - _getStoreNameWidget(model), - - /// 评分描述 - _getEvaluateWidget(model), - ], + return GestureDetector( + onTap: () { + _onStoreClick(); + }, + child: Container( + color: Colors.white, + width: double.infinity, + height: 50 + 20.0 + 18, + padding: const EdgeInsets.only(left: 12.5, right: 12.5, top: 20, bottom: 18), + child: Row( + children: [ + /// 商家图片 + _getStoreImgWidget(model), + const SizedBox(width: 7.5), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + /// 商店名称与更多 + _getStoreNameWidget(model), + + /// 评分描述 + _getEvaluateWidget(model), + ], + ), ), - ), - ], + ], + ), ), ); } @@ -120,10 +129,16 @@ class _StoreContainerState extends State { mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ /// 商店名称 - Text(model?.shop_name ?? '品胜京东自营旗舰店', style: TextStyle(color: HexColor.fromHex(model?.shop_name_color ?? '#333333'), fontSize: 13, fontWeight: FontWeight.bold)), + Text(model?.shop_name ?? '品胜京东自营旗舰店', + style: TextStyle( + color: HexColor.fromHex(model?.shop_name_color ?? '#333333'), + fontSize: 13, + fontWeight: FontWeight.bold)), /// 更多 TODO 暂时隐藏,等后台有数据后再打开 - Visibility(visible: false, child: Text(model?.more ?? '更多店铺优惠 >', style: TextStyle(color: HexColor.fromHex('#FF4242'), fontSize: 11))), + Visibility( + visible: false, + child: Text(model?.more ?? '更多店铺优惠 >', style: TextStyle(color: HexColor.fromHex('#FF4242'), fontSize: 11))), ], ); } @@ -134,13 +149,16 @@ class _StoreContainerState extends State { mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ /// 宝贝描述 5.0 - _getCoustomWidet(model?.description ?? '宝贝描述 5.0', model?.description_color ?? '#999999', model?.description_leve_icon ?? ''), + _getCoustomWidet(model?.description ?? '宝贝描述 5.0', model?.description_color ?? '#999999', + model?.description_leve_icon ?? ''), /// 物流服务 5.0 - _getCoustomWidet(model?.logistics ?? '宝贝描述 5.0', model?.logistics_color ?? '#999999', model?.logistics_leve_icon ?? ''), + _getCoustomWidet( + model?.logistics ?? '宝贝描述 5.0', model?.logistics_color ?? '#999999', model?.logistics_leve_icon ?? ''), /// 服务态度 1.0 - _getCoustomWidet(model?.service ?? '宝贝描述 5.0', model?.service_color ?? '#999999', model?.service_leve_icon ?? ''), + _getCoustomWidet( + model?.service ?? '宝贝描述 5.0', model?.service_color ?? '#999999', model?.service_leve_icon ?? ''), ], ); }