From e72d0c45039a954a42fe66d6c99b75ae58e2aa9e Mon Sep 17 00:00:00 2001 From: Weller <1812208341@qq.com> Date: Fri, 23 Oct 2020 14:17:26 +0800 Subject: [PATCH] =?UTF-8?q?=E6=90=9C=E7=B4=A2=E5=BC=B9=E7=AA=97=E9=80=82?= =?UTF-8?q?=E9=85=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../intellect_search_goods_dialog.dart | 28 ++++++++++--------- lib/pages/main_page/main_page.dart | 28 +++++++++---------- 2 files changed, 29 insertions(+), 27 deletions(-) diff --git a/lib/dialog/global_dialog/intellect_search_goods_dialog/intellect_search_goods_dialog.dart b/lib/dialog/global_dialog/intellect_search_goods_dialog/intellect_search_goods_dialog.dart index 85c969d..1057aa5 100644 --- a/lib/dialog/global_dialog/intellect_search_goods_dialog/intellect_search_goods_dialog.dart +++ b/lib/dialog/global_dialog/intellect_search_goods_dialog/intellect_search_goods_dialog.dart @@ -8,7 +8,6 @@ import 'package:flutter_alibc/alibc_const_key.dart'; import 'package:flutter_alibc/alibc_model.dart'; import 'package:flutter_alibc/flutter_alibc.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; -import 'package:provider/provider.dart'; import 'package:zhiying_base_widget/dialog/global_dialog/intellect_search_goods_dialog/model/has_goods_dialog_style_model.dart'; import 'package:zhiying_base_widget/dialog/global_dialog/intellect_search_goods_dialog/model/intellect_dialog_data_model.dart'; import 'package:zhiying_comm/zhiying_comm.dart'; @@ -26,7 +25,6 @@ class IntellectSearchGoodsDialog extends StatefulWidget { class _IntellectSearchGoodsDialogState extends State { HasGoodsDialogStyleModel _styleModel; - UserInfoModel _userInfo; @override void initState() { @@ -36,7 +34,6 @@ class _IntellectSearchGoodsDialogState @override Widget build(BuildContext context) { - _userInfo = Provider.of(context).userInfo; return Scaffold( backgroundColor: Colors.transparent, body: InkWell( @@ -240,15 +237,19 @@ class _IntellectSearchGoodsDialogState "")), ), ), - Text( - (num.tryParse(widget?.model?.price ?? "0") - - num.tryParse(widget?.model?.couponPrice ?? "0")) - .toString() ?? - "", - style: TextStyle( - fontSize: 32.sp, - color: HexColor.fromHex( - _styleModel?.moduleList?.couponAfterPrice?.fontColor), + Expanded( + child: Text( + (num.tryParse(widget?.model?.price ?? "0") - + num.tryParse( + widget?.model?.couponPrice ?? "0")) + .toStringAsFixed(2) ?? + "", + maxLines: 1, + style: TextStyle( + fontSize: 32.sp, + color: HexColor.fromHex(_styleModel + ?.moduleList?.couponAfterPrice?.fontColor), + ), ), ) ], @@ -346,7 +347,8 @@ class _IntellectSearchGoodsDialogState void openUrl() async { ///跳转购买 - if (_userInfo?.token == null || _userInfo.token == '') { + UserInfoModel userInfo = UserInfoNotifier.staitcUserInfo; + if (userInfo?.token == null || userInfo.token == '') { print('need login...'); RouterUtil.goLogin(context); return; diff --git a/lib/pages/main_page/main_page.dart b/lib/pages/main_page/main_page.dart index 5223be8..a35ce9d 100644 --- a/lib/pages/main_page/main_page.dart +++ b/lib/pages/main_page/main_page.dart @@ -5,12 +5,9 @@ import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; import 'package:pull_to_refresh/pull_to_refresh.dart'; import 'package:zhiying_base_widget/dialog/global_dialog/intellect_search_goods_dialog/intellect_create.dart'; -import 'package:zhiying_base_widget/dialog/global_dialog/intellect_search_goods_dialog/intellect_search_goods_dialog.dart'; -import 'package:zhiying_base_widget/dialog/global_dialog/intellect_search_goods_dialog/intellect_search_no_goods_dialog.dart'; import 'package:zhiying_base_widget/pages/main_page/main_page_bloc.dart'; import 'package:zhiying_base_widget/pages/main_page/notifier/main_page_bg_notifier.dart'; import 'package:zhiying_base_widget/pages/main_page/notifier/main_page_notifier.dart'; -import 'package:zhiying_base_widget/utils/contants.dart'; import 'package:zhiying_base_widget/widgets/home/home_auth/home_auth.dart'; import 'package:zhiying_base_widget/widgets/others/mine_header_bg_widget.dart'; import 'package:zhiying_base_widget/widgets/refresh/refresh_header/refresh_header.dart'; @@ -20,7 +17,8 @@ import 'package:zhiying_comm/zhiying_comm.dart'; class MainPage extends StatefulWidget { final Map data; - MainPage(this.data, { + MainPage( + this.data, { Key key, }) : super(key: key); @@ -59,7 +57,7 @@ class _MainPageContainerState extends State<_MainPageContainer> ScrollController _controller = ScrollController(); MainPageBloc _bloc; RefreshController _refreshController = - RefreshController(initialRefresh: false); + RefreshController(initialRefresh: false); Widget _floatWidget; @@ -81,7 +79,12 @@ class _MainPageContainerState extends State<_MainPageContainer> @override void didChangeAppLifecycleState(AppLifecycleState state) async { ///智能粘贴板 - IntellectCreate.checkAndCreate(state, context); + String indentifier = widget.data['skip_identifier']; + if (indentifier == 'pub.flutter.index') { + // 只在首页弹窗 + IntellectCreate.checkAndCreate(state, context); + } + super.didChangeAppLifecycleState(state); } @@ -122,10 +125,7 @@ class _MainPageContainerState extends State<_MainPageContainer> @override Widget build(BuildContext context) { - double top = MediaQueryData - .fromWindow(window) - .padding - .top; + double top = MediaQueryData.fromWindow(window).padding.top; return StreamBuilder>>( stream: _bloc.outData, builder: (BuildContext context, AsyncSnapshot snapshot) { @@ -135,7 +135,7 @@ class _MainPageContainerState extends State<_MainPageContainer> backgroundColor: Color(0xfff9f9f9), floatingActionButton: _floatWidget, floatingActionButtonLocation: - FloatingActionButtonLocation.centerDocked, + FloatingActionButtonLocation.centerDocked, body: MediaQuery.removePadding( removeTop: true, context: context, @@ -169,12 +169,12 @@ class _MainPageContainerState extends State<_MainPageContainer> }); } - List _createContent(BuildContext context, - List> datas) { + List _createContent( + BuildContext context, List> datas) { List list = List(); for (int i = 0; i < datas.length; i++) { WidgetModel item = - WidgetModel.fromJson(Map.from(datas[i])); + WidgetModel.fromJson(Map.from(datas[i])); print('item.modName ${item.modName}'); if (item.modName == 'index_taobao_auth_tip') {