Browse Source

Merge branch '1.22.0_master' of http://192.168.0.138:3000/FnuoOS_ZhiYing/zhiying_base_widget into 1.22.0_master

tags/0.0.11+2
“yanghuaxuan” 3 years ago
parent
commit
68a2b8cdfa
10 changed files with 166 additions and 33 deletions
  1. +1
    -1
      lib/dialog/global_dialog/advertising_dialog/advertising_dialog.dart
  2. +4
    -4
      lib/dialog/global_dialog/intellect_search_goods_dialog/intellect_create.dart
  3. +5
    -3
      lib/dialog/global_dialog/intellect_search_goods_dialog/intellect_search_no_goods_dialog.dart
  4. +32
    -14
      lib/pages/custom_page/custom_page.dart
  5. +6
    -0
      lib/pages/home_page/home_page.dart
  6. +2
    -2
      lib/pages/team_page/team_page.dart
  7. +107
    -3
      lib/widgets/custom/search/custom_search_widget.dart
  8. +3
    -0
      lib/widgets/goods_details/appbar/goods_details_appbar_widget.dart
  9. +4
    -4
      lib/widgets/mine/mine_data/mine_data_widget.dart
  10. +2
    -2
      pubspec.yaml

+ 1
- 1
lib/dialog/global_dialog/advertising_dialog/advertising_dialog.dart View File

@@ -25,8 +25,8 @@ class AdvertisingDialog extends StatelessWidget {
if (!EmptyUtil.isEmpty(item)) { if (!EmptyUtil.isEmpty(item)) {
AdvertisingDialogModel model = AdvertisingDialogModel.fromJson(item); AdvertisingDialogModel model = AdvertisingDialogModel.fromJson(item);
if (!EmptyUtil.isEmpty(model)) { if (!EmptyUtil.isEmpty(model)) {
await Future.delayed(Duration(milliseconds: model?.interval*1000));
await showCupertinoDialog(context: context, builder: (_) => AdvertisingDialog(model)); await showCupertinoDialog(context: context, builder: (_) => AdvertisingDialog(model));
await Future.delayed(Duration(milliseconds: (model?.interval ?? 0) * 1000 * 60));
} }
} }
} }


+ 4
- 4
lib/dialog/global_dialog/intellect_search_goods_dialog/intellect_create.dart View File

@@ -1,9 +1,11 @@
import 'dart:async'; import 'dart:async';
import 'dart:convert'; import 'dart:convert';
import 'dart:io';


import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.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_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/dialog/global_dialog/intellect_search_goods_dialog/model/intellect_dialog_data_model.dart';
import 'package:zhiying_base_widget/utils/contants.dart'; import 'package:zhiying_base_widget/utils/contants.dart';
@@ -30,8 +32,7 @@ class IntellectCreate {
await _requestSetData(context); await _requestSetData(context);
} catch (e, s) { } catch (e, s) {
isRequest = false; isRequest = false;
print(e);
print(s);
Logger.error(e, s);
} }
} }
// Timer(Duration(milliseconds: 500), () async { // Timer(Duration(milliseconds: 500), () async {
@@ -119,8 +120,7 @@ class IntellectCreate {
///检查字段是否被监听 ///检查字段是否被监听
static void validate(BuildContext context, IntellectSearchSetModel setModel) async { 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) { if (content == null || content.length == 0) {


+ 5
- 3
lib/dialog/global_dialog/intellect_search_goods_dialog/intellect_search_no_goods_dialog.dart View File

@@ -1,6 +1,7 @@
import 'dart:convert'; import 'dart:convert';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.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/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: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'; import 'package:cached_network_image/cached_network_image.dart';
@@ -34,9 +35,10 @@ class _IntellectSearchNoGoodsDialogState extends State<IntellectSearchNoGoodsDia


///获取粘贴板内容 ///获取粘贴板内容
_getClipBoardData() async { _getClipBoardData() async {
ClipboardData data = await Clipboard.getData(Clipboard.kTextPlain);
_textEditingController.text = data.text.trim();
searchText = data.text.trim();
// ClipboardData data = await Clipboard.getData(Clipboard.kTextPlain);
String result = await FlutterClipboardPlugin.getData;
_textEditingController.text = result;
searchText = result;
requestStyle(); requestStyle();
setState(() {}); setState(() {});
} }


+ 32
- 14
lib/pages/custom_page/custom_page.dart View File

@@ -2,14 +2,11 @@ import 'dart:convert';


import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart';
import 'package:tab_indicator_styler/tab_indicator_styler.dart'; import 'package:tab_indicator_styler/tab_indicator_styler.dart';
import 'package:zhiying_base_widget/pages/custom_page/custom_item_page.dart'; import 'package:zhiying_base_widget/pages/custom_page/custom_item_page.dart';
import 'package:zhiying_base_widget/pages/main_page/model/background_model.dart'; import 'package:zhiying_base_widget/pages/main_page/model/background_model.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_bg_notifier.dart';
import 'package:zhiying_base_widget/widgets/custom/search/custom_search_widget.dart';
import 'package:zhiying_base_widget/widgets/empty/empty_widget.dart'; import 'package:zhiying_base_widget/widgets/empty/empty_widget.dart';
import 'package:zhiying_base_widget/widgets/others/mine_header_bg_widget.dart';
import 'package:zhiying_comm/zhiying_comm.dart'; import 'package:zhiying_comm/zhiying_comm.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
@@ -19,8 +16,8 @@ import 'bloc/custom_page_bloc.dart';
import 'bloc/custom_page_state.dart'; import 'bloc/custom_page_state.dart';
import 'bloc/custom_page_event.dart'; import 'bloc/custom_page_event.dart';
import 'bloc/custom_page_repository.dart'; import 'bloc/custom_page_repository.dart';
import 'package:zhiying_base_widget/widgets/search/widget/my_tab.dart';
import 'dart:ui'; import 'dart:ui';
import 'package:fluttertoast/fluttertoast.dart';


/// ///
/// 通用模块页面 /// 通用模块页面
@@ -258,24 +255,24 @@ class __CommonPageContainerState extends State<_CommonPageContainer> with Single
String parentTitle = !EmptyUtil.isEmpty(widget?.data) ? widget?.data['title'] ?? '' : ''; String parentTitle = !EmptyUtil.isEmpty(widget?.data) ? widget?.data['title'] ?? '' : '';
_isHasAppbar = true; _isHasAppbar = true;
return AppBar( 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, brightness: Brightness.light,
leading: IconButton(
leading: Navigator.canPop(context) ? IconButton(
icon: Icon( icon: Icon(
Icons.arrow_back_ios, Icons.arrow_back_ios,
size: 22, size: 22,
color: HexColor.fromHex('#333333'),
color: HexColor.fromHex(!EmptyUtil.isEmpty(data) ? data['app_bar_name_color'] ?? '#333333' : '#333333'),
), ),
onPressed: () => Navigator.maybePop(context), onPressed: () => Navigator.maybePop(context),
),
) : null,
title: Text( 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'] ? data['app_bar_name']
: parentTitle
// : parentTitle
: parentTitle, : parentTitle,
style: TextStyle( 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, fontSize: 16,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
), ),
@@ -314,6 +311,15 @@ class __CommonPageContainerState extends State<_CommonPageContainer> with Single


// 2、导航栏开启的情况 // 2、导航栏开启的情况
if (listStyle.length > 0) { if (listStyle.length > 0) {

// 获取分类类型,如果第一位type等于imageAndText说明是带有小图标的
bool haveIcon = false;
try {
haveIcon = listStyle[0]['type']?.toString() == 'imageAndText';
} catch (e, s){
Logger.error(e, s);
}

// tabContorller 初始化 // tabContorller 初始化
if (null == _tabController || _tabController.length != listStyle.length) { if (null == _tabController || _tabController.length != listStyle.length) {
_tabController = new TabController(length: listStyle.length, vsync: this); _tabController = new TabController(length: listStyle.length, vsync: this);
@@ -321,6 +327,7 @@ class __CommonPageContainerState extends State<_CommonPageContainer> with Single


result.add(Container( result.add(Container(
height: 40, height: 40,
padding: const EdgeInsets.only(bottom: 5),
width: double.infinity, width: double.infinity,
color: HexColor.fromHex(data['bg_color']), color: HexColor.fromHex(data['bg_color']),
child: TabBar( child: TabBar(
@@ -340,7 +347,18 @@ class __CommonPageContainerState extends State<_CommonPageContainer> with Single
height: 2.5, height: 2.5,
horizontalPadding: 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; return result;
} }


/// 背景颜色
_buildBackground(BackgroundModel backgroundModel) { _buildBackground(BackgroundModel backgroundModel) {
if (backgroundModel != null) { if (backgroundModel != null) {
var headerBg = backgroundModel.headerBg; var headerBg = backgroundModel.headerBg;
@@ -422,7 +441,6 @@ class __CommonPageContainerState extends State<_CommonPageContainer> with Single
} }


@override @override
// TODO: implement wantKeepAlive
bool get wantKeepAlive => true; bool get wantKeepAlive => true;
} }




+ 6
- 0
lib/pages/home_page/home_page.dart View File

@@ -289,6 +289,11 @@ class _HomePageState extends State<HomePage> with WidgetsBindingObserver, Ticker
items: items); items: items);
} }


// Widget createBottomNavigationBarNew(List<Map<String, dynamic>> tabs) {
//
// return ConvexAppBar(items: null, initialActiveIndex: _currentIndex, style: TabStyle.titled,);
// }

Future<bool> _checkLimit(BaseTabModel model) async { Future<bool> _checkLimit(BaseTabModel model) async {
if (model.requiredLogin == '1') { if (model.requiredLogin == '1') {
UserInfoModel user = await Provider.of<UserInfoNotifier>(context, listen: false).getUserInfoModel(); UserInfoModel user = await Provider.of<UserInfoNotifier>(context, listen: false).getUserInfoModel();
@@ -319,6 +324,7 @@ class _HomePageState extends State<HomePage> with WidgetsBindingObserver, Ticker
// 活动弹窗 // 活动弹窗
await AdvertisingDialog.show(context); await AdvertisingDialog.show(context);


// 检查app更新
await AppUpdateUtil.updateApp(context); await AppUpdateUtil.updateApp(context);


IntellectCreate.checkAndCreateFirst(context); IntellectCreate.checkAndCreateFirst(context);


+ 2
- 2
lib/pages/team_page/team_page.dart View File

@@ -133,7 +133,7 @@ class _TeamPageContainerState extends State<_TeamPageContainer> {
SliverPersistentHeader( SliverPersistentHeader(
delegate: new _SliverTabBarDelegate( delegate: new _SliverTabBarDelegate(
tabBar: TabBar( tabBar: TabBar(
isScrollable: false,
isScrollable: (styleModel?.userLvTabs?.length ?? 0) <= 4 ? false : true,
labelStyle: TextStyle(fontWeight: FontWeight.bold, fontSize: 13), labelStyle: TextStyle(fontWeight: FontWeight.bold, fontSize: 13),
unselectedLabelStyle: TextStyle(fontSize: 13), unselectedLabelStyle: TextStyle(fontSize: 13),
indicator: MaterialIndicator( indicator: MaterialIndicator(
@@ -143,7 +143,7 @@ class _TeamPageContainerState extends State<_TeamPageContainer> {
bottomLeftRadius: 8, bottomLeftRadius: 8,
bottomRightRadius: 8, bottomRightRadius: 8,
color: HexColor.fromHex(styleModel?.userLvTabsLineColor ?? '#F94B47'), color: HexColor.fromHex(styleModel?.userLvTabsLineColor ?? '#F94B47'),
horizontalPadding: 30,
horizontalPadding: (styleModel?.userLvTabs?.length ?? 0) <= 4 ? 30 : 20,
), ),
controller: _controller, controller: _controller,
// tabs: tabTitle.map((f) => Tab(text: f)).toList(), // tabs: tabTitle.map((f) => Tab(text: f)).toList(),


+ 107
- 3
lib/widgets/custom/search/custom_search_widget.dart View File

@@ -70,7 +70,111 @@ class CustomSearchWidget extends StatelessWidget {


/// 左1右1图标 /// 左1右1图标
Widget _buildStyle3Widget(BuildContext context) { 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: <Widget>[
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: <Widget>[
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( child: Row(
children: <Widget>[ children: <Widget>[
CachedNetworkImage( CachedNetworkImage(
width: 13,
height: 13,
width: 15,
height: 15,
imageUrl: model?.listStyle?.searchCss?.image ?? '', imageUrl: model?.listStyle?.searchCss?.image ?? '',
), ),
SizedBox(width: 4), SizedBox(width: 4),


+ 3
- 0
lib/widgets/goods_details/appbar/goods_details_appbar_widget.dart View File

@@ -14,6 +14,7 @@ class GoodsDetailsAppBarWidget extends StatefulWidget {
GoodsDetailsAppBarWidget(this.data, {Key key}) : super(key: key){ GoodsDetailsAppBarWidget(this.data, {Key key}) : super(key: key){
try{ try{
model = GoodsDetailsAppBarModel.fromJson(jsonDecode(data['data'])); model = GoodsDetailsAppBarModel.fromJson(jsonDecode(data['data']));
Logger.log('商品详情页面数据 = ${model.toJson()}');
}catch(e, s){ }catch(e, s){
Logger.error(e, s); Logger.error(e, s);
} }
@@ -54,6 +55,8 @@ class _GoodsDetailsAppBarWidgetState extends State<GoodsDetailsAppBarWidget> {


@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
_endTextColor = HexColor.fromHex(widget?.model?.appBarNameColor ?? '#FFFFFF' );
_endBgColor = HexColor.fromHex(widget?.model?.appBarBgColor ?? '#FF4242');
// Logger.log('^-^'); // Logger.log('^-^');
return Container( return Container(
width: double.infinity, width: double.infinity,


+ 4
- 4
lib/widgets/mine/mine_data/mine_data_widget.dart View File

@@ -127,7 +127,7 @@ class _MineDataWidgetState extends State<MineDataWidget> {
), ),
), ),
Text( Text(
widget?.profile?.gridViews[0]?.value ?? "¥0",
EmptyUtil.isEmpty(widget?.profile?.gridViews) ? '¥0' : widget?.profile?.gridViews[0]?.value ?? "¥0",
style: TextStyle( style: TextStyle(
fontSize: 18, fontSize: 18,
fontWeight: FontWeight.w800, fontWeight: FontWeight.w800,
@@ -158,8 +158,8 @@ class _MineDataWidgetState extends State<MineDataWidget> {
), ),
Center( Center(
child: Text( 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<MineDataWidget> {
), ),
behavior: HitTestBehavior.opaque, behavior: HitTestBehavior.opaque,
onTap: () { onTap: () {
RouterUtil.route(_style.cashBtn, _style.cashBtn.toJson(), context);
RouterUtil.route(_style?.cashBtn, _style?.cashBtn?.toJson(), context);
}, },
) )
], ],


+ 2
- 2
pubspec.yaml View File

@@ -60,8 +60,8 @@ dependencies:
permission_handler_platform_interface: "2.0.1" permission_handler_platform_interface: "2.0.1"


flutter_user_agent: ^1.2.2 flutter_user_agent: ^1.2.2
# 特效底部
# convex_bottom_bar: ^2.7.1+2


dev_dependencies: dev_dependencies:
flutter_test: flutter_test:


Loading…
Cancel
Save