diff --git a/lib/dialog/global_dialog/advertising_dialog/advertising_dialog.dart b/lib/dialog/global_dialog/advertising_dialog/advertising_dialog.dart index ceb8609..89ee9e4 100644 --- a/lib/dialog/global_dialog/advertising_dialog/advertising_dialog.dart +++ b/lib/dialog/global_dialog/advertising_dialog/advertising_dialog.dart @@ -25,8 +25,8 @@ class AdvertisingDialog extends StatelessWidget { if (!EmptyUtil.isEmpty(item)) { AdvertisingDialogModel model = AdvertisingDialogModel.fromJson(item); if (!EmptyUtil.isEmpty(model)) { - await Future.delayed(Duration(milliseconds: model?.interval*1000)); await showCupertinoDialog(context: context, builder: (_) => AdvertisingDialog(model)); + await Future.delayed(Duration(milliseconds: (model?.interval ?? 0) * 1000 * 60)); } } } diff --git a/lib/dialog/global_dialog/intellect_search_goods_dialog/intellect_create.dart b/lib/dialog/global_dialog/intellect_search_goods_dialog/intellect_create.dart index 7f10c80..a604198 100644 --- a/lib/dialog/global_dialog/intellect_search_goods_dialog/intellect_create.dart +++ b/lib/dialog/global_dialog/intellect_search_goods_dialog/intellect_create.dart @@ -1,9 +1,11 @@ import 'dart:async'; import 'dart:convert'; +import 'dart:io'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; +import 'package:flutter_clipboard_plugin/flutter_clipboard_plugin.dart'; import 'package:zhiying_base_widget/dialog/global_dialog/intellect_search_goods_dialog/model/Intellect_search_set_model.dart'; import 'package:zhiying_base_widget/dialog/global_dialog/intellect_search_goods_dialog/model/intellect_dialog_data_model.dart'; import 'package:zhiying_base_widget/utils/contants.dart'; @@ -30,8 +32,7 @@ class IntellectCreate { await _requestSetData(context); } catch (e, s) { isRequest = false; - print(e); - print(s); + Logger.error(e, s); } } // Timer(Duration(milliseconds: 500), () async { @@ -119,8 +120,7 @@ class IntellectCreate { ///检查字段是否被监听 static void validate(BuildContext context, IntellectSearchSetModel setModel) async { //获取粘贴板的文字 - ClipboardData data = await Clipboard.getData(Clipboard.kTextPlain); - String content = data?.text?.trim() ?? ""; + String content = await FlutterClipboardPlugin.getData; ///粘贴版的文字如果是空直接跳出不检索 if (content == null || content.length == 0) { diff --git a/lib/dialog/global_dialog/intellect_search_goods_dialog/intellect_search_no_goods_dialog.dart b/lib/dialog/global_dialog/intellect_search_goods_dialog/intellect_search_no_goods_dialog.dart index 48f04ef..18a8c17 100644 --- a/lib/dialog/global_dialog/intellect_search_goods_dialog/intellect_search_no_goods_dialog.dart +++ b/lib/dialog/global_dialog/intellect_search_goods_dialog/intellect_search_no_goods_dialog.dart @@ -1,6 +1,7 @@ import 'dart:convert'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; +import 'package:flutter_clipboard_plugin/flutter_clipboard_plugin.dart'; import 'package:zhiying_base_widget/dialog/global_dialog/intellect_search_goods_dialog/model/intellect_dialog_data_model.dart'; import 'package:zhiying_base_widget/dialog/global_dialog/intellect_search_goods_dialog/model/no_goods_dialog_style_model.dart'; import 'package:cached_network_image/cached_network_image.dart'; @@ -34,9 +35,10 @@ class _IntellectSearchNoGoodsDialogState extends State with Single String parentTitle = !EmptyUtil.isEmpty(widget?.data) ? widget?.data['title'] ?? '' : ''; _isHasAppbar = true; return AppBar( - backgroundColor: HexColor.fromHex(null != data ? data['app_bar_bg_color'] ?? '#FFFFFF' : '#FFFFFF'), + backgroundColor: HexColor.fromHex(!EmptyUtil.isEmpty(data) ? data['app_bar_bg_color'] ?? '#FFFFFF' : '#FFFFFF'), brightness: Brightness.light, - leading: IconButton( + leading: Navigator.canPop(context) ? IconButton( icon: Icon( Icons.arrow_back_ios, size: 22, - color: HexColor.fromHex('#333333'), + color: HexColor.fromHex(!EmptyUtil.isEmpty(data) ? data['app_bar_name_color'] ?? '#333333' : '#333333'), ), onPressed: () => Navigator.maybePop(context), - ), + ) : null, title: Text( - null != data && data.containsKey('app_bar_name') - ? data['app_bar_name'] != '自定义页面' + !EmptyUtil.isEmpty(data) && data.containsKey('app_bar_name') + // ? data['app_bar_name'] != '自定义页面' ? data['app_bar_name'] - : parentTitle + // : parentTitle : parentTitle, style: TextStyle( - color: HexColor.fromHex(null != data ? data['app_bar_name_color'] ?? '#333333' : '#333333'), + color: HexColor.fromHex(!EmptyUtil.isEmpty(data) ? data['app_bar_name_color'] ?? '#333333' : '#333333'), fontSize: 16, fontWeight: FontWeight.bold, ), @@ -314,6 +311,15 @@ class __CommonPageContainerState extends State<_CommonPageContainer> with Single // 2、导航栏开启的情况 if (listStyle.length > 0) { + + // 获取分类类型,如果第一位type等于imageAndText说明是带有小图标的 + bool haveIcon = false; + try { + haveIcon = listStyle[0]['type']?.toString() == 'imageAndText'; + } catch (e, s){ + Logger.error(e, s); + } + // tabContorller 初始化 if (null == _tabController || _tabController.length != listStyle.length) { _tabController = new TabController(length: listStyle.length, vsync: this); @@ -321,6 +327,7 @@ class __CommonPageContainerState extends State<_CommonPageContainer> with Single result.add(Container( height: 40, + padding: const EdgeInsets.only(bottom: 5), width: double.infinity, color: HexColor.fromHex(data['bg_color']), child: TabBar( @@ -340,7 +347,18 @@ class __CommonPageContainerState extends State<_CommonPageContainer> with Single height: 2.5, horizontalPadding: 5, ), - tabs: listStyle.map((e) => Text(e['name'])).toList(), + // 不带图标 + tabs: !haveIcon ? listStyle.map((e) => Text(e['name'])).toList() : + // 带图标 + listStyle.map((item) { + return MyTab( + icon: CachedNetworkImage( + imageUrl: item['choose_image_url'] ?? '', + width: 14, + ), + text: item['name'], + ); + }).toList() ), )); @@ -372,6 +390,7 @@ class __CommonPageContainerState extends State<_CommonPageContainer> with Single return result; } + /// 背景颜色 _buildBackground(BackgroundModel backgroundModel) { if (backgroundModel != null) { var headerBg = backgroundModel.headerBg; @@ -422,7 +441,6 @@ class __CommonPageContainerState extends State<_CommonPageContainer> with Single } @override - // TODO: implement wantKeepAlive bool get wantKeepAlive => true; } diff --git a/lib/pages/home_page/home_page.dart b/lib/pages/home_page/home_page.dart index b897b76..06d3fc7 100644 --- a/lib/pages/home_page/home_page.dart +++ b/lib/pages/home_page/home_page.dart @@ -4,6 +4,8 @@ import 'dart:convert'; import 'dart:io'; import 'package:cached_network_image/cached_network_image.dart'; +import 'package:connectivity/connectivity.dart'; +import 'package:convex_bottom_bar/convex_bottom_bar.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; @@ -289,6 +291,11 @@ class _HomePageState extends State with WidgetsBindingObserver, Ticker items: items); } + Widget createBottomNavigationBarNew(List> tabs) { + + return ConvexAppBar(items: null, initialActiveIndex: _currentIndex, style: TabStyle.titled,); + } + Future _checkLimit(BaseTabModel model) async { if (model.requiredLogin == '1') { UserInfoModel user = await Provider.of(context, listen: false).getUserInfoModel(); @@ -319,6 +326,7 @@ class _HomePageState extends State with WidgetsBindingObserver, Ticker // 活动弹窗 await AdvertisingDialog.show(context); + // 检查app更新 await AppUpdateUtil.updateApp(context); IntellectCreate.checkAndCreateFirst(context); diff --git a/lib/pages/team_page/team_page.dart b/lib/pages/team_page/team_page.dart index c8566d6..7d707c3 100644 --- a/lib/pages/team_page/team_page.dart +++ b/lib/pages/team_page/team_page.dart @@ -133,7 +133,7 @@ class _TeamPageContainerState extends State<_TeamPageContainer> { SliverPersistentHeader( delegate: new _SliverTabBarDelegate( tabBar: TabBar( - isScrollable: false, + isScrollable: (styleModel?.userLvTabs?.length ?? 0) <= 4 ? false : true, labelStyle: TextStyle(fontWeight: FontWeight.bold, fontSize: 13), unselectedLabelStyle: TextStyle(fontSize: 13), indicator: MaterialIndicator( @@ -143,7 +143,7 @@ class _TeamPageContainerState extends State<_TeamPageContainer> { bottomLeftRadius: 8, bottomRightRadius: 8, color: HexColor.fromHex(styleModel?.userLvTabsLineColor ?? '#F94B47'), - horizontalPadding: 30, + horizontalPadding: (styleModel?.userLvTabs?.length ?? 0) <= 4 ? 30 : 20, ), controller: _controller, // tabs: tabTitle.map((f) => Tab(text: f)).toList(), diff --git a/lib/widgets/custom/search/custom_search_widget.dart b/lib/widgets/custom/search/custom_search_widget.dart index 48c827d..48c669a 100644 --- a/lib/widgets/custom/search/custom_search_widget.dart +++ b/lib/widgets/custom/search/custom_search_widget.dart @@ -70,7 +70,111 @@ class CustomSearchWidget extends StatelessWidget { /// 左1右1图标 Widget _buildStyle3Widget(BuildContext context) { - return Container(); + return Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + GestureDetector( + onTap: () => _onClickListener(context, model?.listStyle?.rightCss), + child: CachedNetworkImage( + width: 30, + height: 30, + imageUrl: model?.listStyle?.rightCss?.image ?? '', + )), + // 图标1 + SizedBox(width: 10), + // 中间 + Expanded( + child: GestureDetector( + onTap: () => _onClickListener(context, model?.listStyle?.searchCss), + behavior: HitTestBehavior.opaque, + child: Container( + // height: 30, + width: double.infinity, + padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 9), + decoration: BoxDecoration(borderRadius: BorderRadius.circular(60 / 2), color: HexColor.fromHex(model?.listStyle?.searchCss?.bgColor)), + child: Row( + children: [ + CachedNetworkImage( + width: 15, + height: 15, + imageUrl: model?.listStyle?.searchCss?.image ?? '', + ), + SizedBox(width: 4), + Text(model?.listStyle?.searchCss?.text ?? '输入搜索内容,领券省钱', style: TextStyle(fontSize: 13, color: HexColor.fromHex(model?.listStyle?.searchCss?.textColor??"#FFFFFF"))) + ], + ), + ), + )), + SizedBox(width: 10), + // 图标2 + GestureDetector( + onTap: () => _onClickListener(context, model?.listStyle?.rightCss), + child: CachedNetworkImage( + width: 30, + height: 30, + imageUrl: model?.listStyle?.rightCss?.image ?? '', + )), + ], + ); + } + + /// 左1右2图标 + Widget _buildStyle5Widget(BuildContext context) { + return Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + GestureDetector( + onTap: () => _onClickListener(context, model?.listStyle?.rightCss), + child: CachedNetworkImage( + width: 30, + height: 30, + imageUrl: model?.listStyle?.rightCss?.image ?? '', + )), + // 图标1 + SizedBox(width: 10), + // 中间 + Expanded( + child: GestureDetector( + onTap: () => _onClickListener(context, model?.listStyle?.searchCss), + behavior: HitTestBehavior.opaque, + child: Container( + // height: 30, + width: double.infinity, + padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 9), + decoration: BoxDecoration(borderRadius: BorderRadius.circular(60 / 2), color: HexColor.fromHex(model?.listStyle?.searchCss?.bgColor)), + child: Row( + children: [ + CachedNetworkImage( + width: 15, + height: 15, + imageUrl: model?.listStyle?.searchCss?.image ?? '', + ), + SizedBox(width: 4), + Text(model?.listStyle?.searchCss?.text ?? '输入搜索内容,领券省钱', style: TextStyle(fontSize: 13, color: HexColor.fromHex(model?.listStyle?.searchCss?.textColor??"#FFFFFF"))) + ], + ), + ), + )), + SizedBox(width: 10), + // 图标2 + GestureDetector( + onTap: () => _onClickListener(context, model?.listStyle?.rightCss), + child: CachedNetworkImage( + width: 30, + height: 30, + imageUrl: model?.listStyle?.rightCss?.image ?? '', + )), + SizedBox(width: 10), + // 图标2 + GestureDetector( + onTap: () => _onClickListener(context, model?.listStyle?.rightCss), + child: CachedNetworkImage( + width: 30, + height: 30, + imageUrl: model?.listStyle?.rightCss?.image ?? '', + )), + ], + ); } /// 右按钮 @@ -94,8 +198,8 @@ class CustomSearchWidget extends StatelessWidget { child: Row( children: [ CachedNetworkImage( - width: 13, - height: 13, + width: 15, + height: 15, imageUrl: model?.listStyle?.searchCss?.image ?? '', ), SizedBox(width: 4), diff --git a/lib/widgets/goods_details/appbar/goods_details_appbar_widget.dart b/lib/widgets/goods_details/appbar/goods_details_appbar_widget.dart index 7c1ee74..e7cc54e 100644 --- a/lib/widgets/goods_details/appbar/goods_details_appbar_widget.dart +++ b/lib/widgets/goods_details/appbar/goods_details_appbar_widget.dart @@ -14,6 +14,7 @@ class GoodsDetailsAppBarWidget extends StatefulWidget { GoodsDetailsAppBarWidget(this.data, {Key key}) : super(key: key){ try{ model = GoodsDetailsAppBarModel.fromJson(jsonDecode(data['data'])); + Logger.log('商品详情页面数据 = ${model.toJson()}'); }catch(e, s){ Logger.error(e, s); } @@ -54,6 +55,8 @@ class _GoodsDetailsAppBarWidgetState extends State { @override Widget build(BuildContext context) { + _endTextColor = HexColor.fromHex(widget?.model?.appBarNameColor ?? '#FFFFFF' ); + _endBgColor = HexColor.fromHex(widget?.model?.appBarBgColor ?? '#FF4242'); // Logger.log('^-^'); return Container( width: double.infinity, diff --git a/lib/widgets/mine/mine_data/mine_data_widget.dart b/lib/widgets/mine/mine_data/mine_data_widget.dart index 5a31626..1103018 100644 --- a/lib/widgets/mine/mine_data/mine_data_widget.dart +++ b/lib/widgets/mine/mine_data/mine_data_widget.dart @@ -127,7 +127,7 @@ class _MineDataWidgetState extends State { ), ), Text( - widget?.profile?.gridViews[0]?.value ?? "¥0", + EmptyUtil.isEmpty(widget?.profile?.gridViews) ? '¥0' : widget?.profile?.gridViews[0]?.value ?? "¥0", style: TextStyle( fontSize: 18, fontWeight: FontWeight.w800, @@ -158,8 +158,8 @@ class _MineDataWidgetState extends State { ), Center( child: Text( - _style.cashBtn.btnText, - style: TextStyle(fontSize: 12, color: HexColor.fromHex(_style.cashBtn.btnTextColor)), + _style?.cashBtn?.btnText ?? '', + style: TextStyle(fontSize: 12, color: HexColor.fromHex(_style?.cashBtn?.btnTextColor)), ), ) ], @@ -167,7 +167,7 @@ class _MineDataWidgetState extends State { ), behavior: HitTestBehavior.opaque, onTap: () { - RouterUtil.route(_style.cashBtn, _style.cashBtn.toJson(), context); + RouterUtil.route(_style?.cashBtn, _style?.cashBtn?.toJson(), context); }, ) ], diff --git a/pubspec.yaml b/pubspec.yaml index 414e29b..ff623fe 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -60,8 +60,8 @@ dependencies: permission_handler_platform_interface: "2.0.1" flutter_user_agent: ^1.2.2 - - + # 特效底部 + convex_bottom_bar: ^2.7.1+2 dev_dependencies: flutter_test: