diff --git a/lib/pages/search_result_page/item/bloc/search_result_item_repository.dart b/lib/pages/search_result_page/item/bloc/search_result_item_repository.dart index 81156bb..327d258 100644 --- a/lib/pages/search_result_page/item/bloc/search_result_item_repository.dart +++ b/lib/pages/search_result_page/item/bloc/search_result_item_repository.dart @@ -3,7 +3,7 @@ import 'dart:convert'; import 'package:zhiying_comm/zhiying_comm.dart'; class SearchResultItemRepository { - List> _pageData; + List> _pageData = []; /// 初始化 Future>> fetchInitData(final Map model) async { @@ -14,17 +14,15 @@ class SearchResultItemRepository { if (NetUtil.isSuccess(result) && !EmptyUtil.isEmpty(result)) { try { List> modList = List.from(result[GlobalConfig.HTTP_RESPONSE_KEY_DATA]['mod_list']); - modList.forEach((Map item) { var data = jsonDecode(item['data']); data['keywords'] = keywords; item['data'] = jsonEncode(data); _pageData.add(item); }); - return _pageData; - } catch (e) { - Logger.error(e.toString()); + } catch (e, s) { + Logger.error('${e?.toString()} , s = ${s?.toString()}'); } } return null; @@ -49,7 +47,9 @@ class SearchResultItemRepository { }); return _pageData; } - } catch (e) {} + } catch (e, s) { + Logger.error('${e?.toString()} , s = ${s?.toString()}'); + } return null; } } diff --git a/lib/register.dart b/lib/register.dart index ec1df37..c850738 100644 --- a/lib/register.dart +++ b/lib/register.dart @@ -2,6 +2,7 @@ import 'package:sharesdk_plugin/sharesdk_interface.dart'; import 'package:sharesdk_plugin/sharesdk_register.dart'; import 'package:zhiying_base_widget/pages/favorite_page/favorite_page.dart'; import 'package:zhiying_base_widget/pages/goods_details_page/goods_details_page.dart'; +import 'package:zhiying_base_widget/pages/home_page/home_page.dart'; import 'package:zhiying_base_widget/pages/invited_friends/invited_friends.dart'; import 'package:zhiying_base_widget/pages/launch_page/launch_page.dart'; import 'package:zhiying_base_widget/pages/main_page/main_page.dart'; @@ -57,6 +58,7 @@ import 'widgets/search/history_tag/search_history_tag.dart'; import 'widgets/search/hot_tag/search_hot_tag_widget.dart'; import 'widgets/search/input/search_input_widget.dart'; import 'widgets/search/tabbar/search_tab_creater.dart'; +import 'widgets/search_result/goods_list/search_result_goods_list_creater.dart'; import 'widgets/search_result/goods_list/search_result_goods_list_widget.dart'; import 'widgets/search_result/search_input/search_result_input.dart'; @@ -92,7 +94,8 @@ class BaseWidgetRegister { // 注册页面 static void registPage() { - PageFactory.regist('homePage', (model) => LaunchPage()); + PageFactory.regist('LaunchPage', (model) => LaunchPage()); + PageFactory.regist('homePage', (model) => HomePage()); PageFactory.regist('pub.flutter.index', (model) => MainPage(model)); PageFactory.regist('pub.flutter.profile', (model) => MainPage(model)); PageFactory.regist( @@ -193,42 +196,42 @@ class BaseWidgetRegister { DefaultWidgetCreater((model) => SearchResultSortWidget(model))); // 搜索结果的商品列表 淘宝 WidgetFactory.regist('search_result_taobao_item', - DefaultWidgetCreater((model) => SearchResultGoodsListWidget(model))); + SearchResultGoodsListCreater()); // 搜索结果页筛选widget 京东 WidgetFactory.regist('search_result_jd_sort', DefaultWidgetCreater((model) => SearchResultSortWidget(model))); // 搜索结果的商品列表 京东 WidgetFactory.regist('search_result_jd_item', - DefaultWidgetCreater((model) => SearchResultGoodsListWidget(model))); + SearchResultGoodsListCreater()); // 搜索结果页筛选widget 苏宁 WidgetFactory.regist('search_result_suning_sort', DefaultWidgetCreater((model) => SearchResultSortWidget(model))); // 搜索结果的商品列表 苏宁 WidgetFactory.regist('search_result_suning_item', - DefaultWidgetCreater((model) => SearchResultGoodsListWidget(model))); + SearchResultGoodsListCreater()); // 搜索结果页筛选widget 拼多多 WidgetFactory.regist('search_result_pdd_sort', DefaultWidgetCreater((model) => SearchResultSortWidget(model))); // 搜索结果的商品列表 拼多多 WidgetFactory.regist('search_result_pdd_item', - DefaultWidgetCreater((model) => SearchResultGoodsListWidget(model))); + SearchResultGoodsListCreater()); // 搜索结果页筛选widget 唯品会 - WidgetFactory.regist('search_result_vip', + WidgetFactory.regist('search_result_vip_sort', DefaultWidgetCreater((model) => SearchResultSortWidget(model))); // 搜索结果的商品列表 唯品会 WidgetFactory.regist('search_result_vip_item', - DefaultWidgetCreater((model) => SearchResultGoodsListWidget(model))); + SearchResultGoodsListCreater()); // 搜索结果页筛选widget 考拉 - WidgetFactory.regist('search_result_kaola', + WidgetFactory.regist('search_result_kaola_sort', DefaultWidgetCreater((model) => SearchResultSortWidget(model))); // 搜索结果的商品列表 考拉 WidgetFactory.regist('search_result_kaola_item', - DefaultWidgetCreater((model) => SearchResultGoodsListWidget(model))); + SearchResultGoodsListCreater()); /// ==================== 商品详情 ==================== /// // 商品详情轮播图 diff --git a/lib/widgets/home/home_goods/home_goods_item.dart b/lib/widgets/home/home_goods/home_goods_item.dart index c44e18d..4088bd2 100644 --- a/lib/widgets/home/home_goods/home_goods_item.dart +++ b/lib/widgets/home/home_goods/home_goods_item.dart @@ -1,6 +1,7 @@ import 'dart:convert'; import 'package:cached_network_image/cached_network_image.dart'; +import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:zhiying_base_widget/pages/goods_details_page/goods_details_page.dart'; import 'package:zhiying_base_widget/widgets/home/home_goods/models/home_goods_model.dart'; @@ -24,8 +25,7 @@ class HomeGoodsItem extends StatelessWidget { /// 跳到商品详情 void _onJumpGoodsDetails(BuildContext context, HomeGoodsModel goods) { - Navigator.push(context, - MaterialPageRoute(builder: (_) => GoodsDetailsPage(goods.toJson()))); + Navigator.push(context, CupertinoPageRoute(builder: (_) => GoodsDetailsPage(goods.toJson()))); } @override diff --git a/lib/widgets/home/home_goods/home_goods_item_single.dart b/lib/widgets/home/home_goods/home_goods_item_single.dart index 9d128a6..5b64225 100644 --- a/lib/widgets/home/home_goods/home_goods_item_single.dart +++ b/lib/widgets/home/home_goods/home_goods_item_single.dart @@ -1,6 +1,7 @@ import 'dart:convert'; import 'package:cached_network_image/cached_network_image.dart'; +import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:zhiying_base_widget/pages/goods_details_page/goods_details_page.dart'; import 'package:zhiying_base_widget/widgets/home/home_goods/models/home_goods_model.dart'; @@ -24,8 +25,7 @@ class HomeGoodsItemSingle extends StatelessWidget { /// 跳到商品详情 void _onJumpGoodsDetails(BuildContext context, HomeGoodsModel goods) { - Navigator.push(context, - MaterialPageRoute(builder: (_) => GoodsDetailsPage(goods.toJson()))); + Navigator.push(context, CupertinoPageRoute(builder: (_) => GoodsDetailsPage(goods.toJson()))); } @override diff --git a/lib/widgets/home/home_quick_entry/home_quick_entry.dart b/lib/widgets/home/home_quick_entry/home_quick_entry.dart index 3975c09..09195ef 100644 --- a/lib/widgets/home/home_quick_entry/home_quick_entry.dart +++ b/lib/widgets/home/home_quick_entry/home_quick_entry.dart @@ -41,7 +41,7 @@ class _HomeQuickEntryContianerState extends State { Widget build(BuildContext context) { return BlocConsumer( listener: (context, state) { - Logger.log('数据加载出错'); + Logger.log('home_quick_entry = 数据加载出错'); }, buildWhen: (prev, current) { if (current is HomeQuickEntryErrorState) { diff --git a/lib/widgets/home/home_sreach/home_sreach_widget.dart b/lib/widgets/home/home_sreach/home_sreach_widget.dart index 4538e24..0bf81a4 100644 --- a/lib/widgets/home/home_sreach/home_sreach_widget.dart +++ b/lib/widgets/home/home_sreach/home_sreach_widget.dart @@ -2,6 +2,7 @@ import 'dart:convert' as convert; import 'dart:ui'; import 'package:cached_network_image/cached_network_image.dart'; +import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:zhiying_base_widget/pages/search_page/search_page.dart'; import 'package:zhiying_comm/zhiying_comm.dart'; @@ -72,7 +73,7 @@ class _HomeSreachContainer extends StatelessWidget { void _openSreach(BuildContext context){ // SkipModel skipModel = SkipModel.fromJson(model); // RouterUtil.route(skipModel, null, context); - Navigator.push(context, MaterialPageRoute( + Navigator.push(context, CupertinoPageRoute( builder: (context) => SearchPage(null) )); } diff --git a/lib/widgets/search/history_tag/search_history_tag.dart b/lib/widgets/search/history_tag/search_history_tag.dart index 270c1ab..1526e8b 100644 --- a/lib/widgets/search/history_tag/search_history_tag.dart +++ b/lib/widgets/search/history_tag/search_history_tag.dart @@ -1,5 +1,6 @@ import 'dart:convert'; +import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:shared_preferences/shared_preferences.dart'; import 'package:zhiying_base_widget/pages/search_page/notifier/search_tag_notifier.dart'; @@ -40,7 +41,7 @@ class _SearchHistoryTagWidgetState extends State { /// 点击历史标签 void _historyTagClick(String tag) { if (!EmptyUtil.isEmpty(tag)) { - Navigator.push(context, MaterialPageRoute(builder: (_) => SearchResultPage({'keywords': tag ?? '', 'tag': 'search_page'}))); + Navigator.push(context, CupertinoPageRoute(builder: (_) => SearchResultPage({'keywords': tag ?? '', 'tag': 'search_page'}))); } } diff --git a/lib/widgets/search/hot_tag/search_hot_tag_widget.dart b/lib/widgets/search/hot_tag/search_hot_tag_widget.dart index df92a9c..9dd32a2 100644 --- a/lib/widgets/search/hot_tag/search_hot_tag_widget.dart +++ b/lib/widgets/search/hot_tag/search_hot_tag_widget.dart @@ -1,5 +1,6 @@ import 'dart:convert'; +import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:zhiying_base_widget/pages/search_page/notifier/search_tag_notifier.dart'; import 'package:zhiying_base_widget/pages/search_result_page/search_result_page.dart'; @@ -31,7 +32,7 @@ class SearchHotTagWidget extends StatelessWidget { await Provider.of(context, listen: false).addTag(model.keyword); - Navigator.push(context, MaterialPageRoute(builder: (_) => SearchResultPage({'keywords': model?.keyword ?? '', 'tag': 'search_page'}))); + Navigator.push(context, CupertinoPageRoute(builder: (_) => SearchResultPage({'keywords': model?.keyword ?? '', 'tag': 'search_page'}))); } } diff --git a/lib/widgets/search/input/search_input_widget.dart b/lib/widgets/search/input/search_input_widget.dart index 165dbc7..1b2c6df 100644 --- a/lib/widgets/search/input/search_input_widget.dart +++ b/lib/widgets/search/input/search_input_widget.dart @@ -1,5 +1,6 @@ import 'dart:convert'; import 'dart:ui'; +import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:zhiying_base_widget/pages/search_page/notifier/search_tag_notifier.dart'; import 'package:zhiying_base_widget/pages/search_result_page/search_result_page.dart'; @@ -40,7 +41,7 @@ class _SearchInputWidgetState extends State { /// TODO 保存历史标签 if (!EmptyUtil.isEmpty(content)) { await Provider.of(context, listen: false).addTag(content); - Navigator.push(context, MaterialPageRoute(builder: (_) => SearchResultPage({'keywords': content, 'tag': 'search_page'}))); + Navigator.push(context, CupertinoPageRoute(builder: (_) => SearchResultPage({'keywords': content, 'tag': 'search_page'}))); }else{ Fluttertoast.showToast(msg: '输入内容不能为空!'); } diff --git a/lib/widgets/search/tabbar/search_tab_widget.dart b/lib/widgets/search/tabbar/search_tab_widget.dart index 6b7a764..66965e2 100644 --- a/lib/widgets/search/tabbar/search_tab_widget.dart +++ b/lib/widgets/search/tabbar/search_tab_widget.dart @@ -1,5 +1,6 @@ import 'dart:convert'; +import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:cached_network_image/cached_network_image.dart'; import 'package:tab_indicator_styler/tab_indicator_styler.dart'; @@ -36,7 +37,7 @@ class _SearchTabWidgetState extends State { /// 联想列表的item点击事件 _onThinkItemClick(SearchThinkModel model){ - Navigator.push(context, MaterialPageRoute( + Navigator.push(context, CupertinoPageRoute( builder: (_)=> SearchResultPage(model.toJson()..['tag'] = 'search_page') )); } diff --git a/lib/widgets/search_result/goods_list/bloc/search_result_goods_list_bloc.dart b/lib/widgets/search_result/goods_list/bloc/search_result_goods_list_bloc.dart index 7fabed6..d0b8ab3 100644 --- a/lib/widgets/search_result/goods_list/bloc/search_result_goods_list_bloc.dart +++ b/lib/widgets/search_result/goods_list/bloc/search_result_goods_list_bloc.dart @@ -55,25 +55,25 @@ class SearchResultGoodsListBloc extends Bloc _mapZhSortEventToState(SearchResultGoodsListZHSortEvent event) async* { - var result = await repository.fetchZhSort(event.args); - if (!EmptyUtil.isEmpty(result)) { - yield SearchResultGoodsListLoadedState(model: result); - } else { - yield SearchResultGoodsListErrorState(); - } - } - - /// 补贴排序 - Stream _mapBTSortEventToState(SearchResultGoodsListBtSortEvent event) async* { - var result = await repository.fetchBt(event.args); - if (!EmptyUtil.isEmpty(result)) { - yield SearchResultGoodsListLoadedState(model: result); - } else { - yield SearchResultGoodsListErrorState(); - } - } - - /// 优惠券排序 - Stream _mapYHQSortEventToState(SearchResultGoodsListYHQSortEvent event) async* { - var result = await repository.fetchYhq(event.args); - if (!EmptyUtil.isEmpty(result)) { - yield SearchResultGoodsListLoadedState(model: result); - } else { - yield SearchResultGoodsListErrorState(); - } - } - - /// 筛选排序 - Stream _mapSXSortEventToState(SearchResultGoodsListSXSortEvent event) async* { - var result = await repository.fetchSX(event.args); - if (!EmptyUtil.isEmpty(result)) { - yield SearchResultGoodsListLoadedState(model: result); - } else { - yield SearchResultGoodsListErrorState(); - } - } + // /// 综合排序 + // Stream _mapZhSortEventToState(SearchResultGoodsListZHSortEvent event) async* { + // var result = await repository.fetchZhSort(event.args); + // if (!EmptyUtil.isEmpty(result)) { + // yield SearchResultGoodsListLoadedState(model: result); + // } else { + // yield SearchResultGoodsListErrorState(); + // } + // } + // + // /// 补贴排序 + // Stream _mapBTSortEventToState(SearchResultGoodsListBtSortEvent event) async* { + // var result = await repository.fetchBt(event.args); + // if (!EmptyUtil.isEmpty(result)) { + // yield SearchResultGoodsListLoadedState(model: result); + // } else { + // yield SearchResultGoodsListErrorState(); + // } + // } + // + // /// 优惠券排序 + // Stream _mapYHQSortEventToState(SearchResultGoodsListYHQSortEvent event) async* { + // var result = await repository.fetchYhq(event.args); + // if (!EmptyUtil.isEmpty(result)) { + // yield SearchResultGoodsListLoadedState(model: result); + // } else { + // yield SearchResultGoodsListErrorState(); + // } + // } + // + // /// 筛选排序 + // Stream _mapSXSortEventToState(SearchResultGoodsListSXSortEvent event) async* { + // var result = await repository.fetchSX(event.args); + // if (!EmptyUtil.isEmpty(result)) { + // yield SearchResultGoodsListLoadedState(model: result); + // } else { + // yield SearchResultGoodsListErrorState(); + // } + // } } diff --git a/lib/widgets/search_result/goods_list/bloc/search_result_goods_list_event.dart b/lib/widgets/search_result/goods_list/bloc/search_result_goods_list_event.dart index 6fbd07d..e95d605 100644 --- a/lib/widgets/search_result/goods_list/bloc/search_result_goods_list_event.dart +++ b/lib/widgets/search_result/goods_list/bloc/search_result_goods_list_event.dart @@ -36,41 +36,41 @@ class SearchResultGoodsListSortEvent extends SearchResultGoodsListEvent{ } /// 综合排序 -class SearchResultGoodsListZHSortEvent extends SearchResultGoodsListEvent{ - String args; - String id; - - SearchResultGoodsListZHSortEvent(this.args, this.id); - @override - List get props => [this.args, this.id]; -} - -/// 补贴排序 -class SearchResultGoodsListBtSortEvent extends SearchResultGoodsListEvent{ - String args; - String id; - - SearchResultGoodsListBtSortEvent(this.args, this.id); - @override - List get props => [this.args, this.id]; -} - -/// 优惠券排序 -class SearchResultGoodsListYHQSortEvent extends SearchResultGoodsListEvent{ - String args; - String id; - - SearchResultGoodsListYHQSortEvent(this.args, this.id); - @override - List get props => [this.args, this.id]; -} - -/// 优惠券排序 -class SearchResultGoodsListSXSortEvent extends SearchResultGoodsListEvent{ - String args; - String id; - - SearchResultGoodsListSXSortEvent(this.args, this.id); - @override - List get props => [this.args, this.id]; -} \ No newline at end of file +// class SearchResultGoodsListZHSortEvent extends SearchResultGoodsListEvent{ +// String args; +// String id; +// +// SearchResultGoodsListZHSortEvent(this.args, this.id); +// @override +// List get props => [this.args, this.id]; +// } +// +// /// 补贴排序 +// class SearchResultGoodsListBtSortEvent extends SearchResultGoodsListEvent{ +// String args; +// String id; +// +// SearchResultGoodsListBtSortEvent(this.args, this.id); +// @override +// List get props => [this.args, this.id]; +// } +// +// /// 优惠券排序 +// class SearchResultGoodsListYHQSortEvent extends SearchResultGoodsListEvent{ +// String args; +// String id; +// +// SearchResultGoodsListYHQSortEvent(this.args, this.id); +// @override +// List get props => [this.args, this.id]; +// } +// +// /// 优惠券排序 +// class SearchResultGoodsListSXSortEvent extends SearchResultGoodsListEvent{ +// String args; +// String id; +// +// SearchResultGoodsListSXSortEvent(this.args, this.id); +// @override +// List get props => [this.args, this.id]; +// } \ No newline at end of file diff --git a/lib/widgets/search_result/goods_list/bloc/search_result_goods_list_repository.dart b/lib/widgets/search_result/goods_list/bloc/search_result_goods_list_repository.dart index d2ed7df..0b01b1a 100644 --- a/lib/widgets/search_result/goods_list/bloc/search_result_goods_list_repository.dart +++ b/lib/widgets/search_result/goods_list/bloc/search_result_goods_list_repository.dart @@ -78,38 +78,6 @@ class SearchResultGoodsListRepository { return _baseInitData(true, reqData); } - /// 综合排序 - Future> fetchZhSort(String arg) async { - _urlArgs['zh'] = arg; - _currentPage = 1; - _hasNomore = true; - return _baseInitData(true, reqData); - } - - /// 补贴 - Future> fetchBt(String arg) async { - _urlArgs['bt'] = arg; - _currentPage = 1; - _hasNomore = true; - return _baseInitData(true, reqData); - } - - /// 优惠券 - Future> fetchYhq(String arg) async { - _urlArgs['yhq'] = arg; - _currentPage = 1; - _hasNomore = true; - return _baseInitData(true, reqData); - } - - /// 筛选 - Future> fetchSX(String arg) async { - _urlArgs['sx'] = arg; - _currentPage = 1; - _hasNomore = true; - return _baseInitData(true, reqData); - } - /// 查询 Future> _baseInitData(bool refresh, final Map model) async { String keyword = model['keywords'] ?? ''; @@ -177,4 +145,37 @@ class SearchResultGoodsListRepository { return url; } } + + +// /// 综合排序 +// Future> fetchZhSort(String arg) async { +// _urlArgs['zh'] = arg; +// _currentPage = 1; +// _hasNomore = true; +// return _baseInitData(true, reqData); +// } +// +// /// 补贴 +// Future> fetchBt(String arg) async { +// _urlArgs['bt'] = arg; +// _currentPage = 1; +// _hasNomore = true; +// return _baseInitData(true, reqData); +// } +// +// /// 优惠券 +// Future> fetchYhq(String arg) async { +// _urlArgs['yhq'] = arg; +// _currentPage = 1; +// _hasNomore = true; +// return _baseInitData(true, reqData); +// } +// +// /// 筛选 +// Future> fetchSX(String arg) async { +// _urlArgs['sx'] = arg; +// _currentPage = 1; +// _hasNomore = true; +// return _baseInitData(true, reqData); +// } } diff --git a/lib/widgets/search_result/goods_list/search_result_goods_list_creater.dart b/lib/widgets/search_result/goods_list/search_result_goods_list_creater.dart new file mode 100644 index 0000000..03d7470 --- /dev/null +++ b/lib/widgets/search_result/goods_list/search_result_goods_list_creater.dart @@ -0,0 +1,18 @@ +import 'package:flutter/src/widgets/framework.dart'; +import 'package:zhiying_comm/zhiying_comm.dart'; + +import 'search_result_goods_list_widget.dart'; + + +class SearchResultGoodsListCreater extends WidgetCreater { + @override + List createWidgets(Map model) { + + return [SearchResultGoodsListWidget(model)]; + } + + @override + bool isSliverChild() { + return true; + } +} \ No newline at end of file diff --git a/lib/widgets/search_result/goods_list/search_result_goods_list_widget.dart b/lib/widgets/search_result/goods_list/search_result_goods_list_widget.dart index ba637fc..e5e508a 100644 --- a/lib/widgets/search_result/goods_list/search_result_goods_list_widget.dart +++ b/lib/widgets/search_result/goods_list/search_result_goods_list_widget.dart @@ -61,11 +61,6 @@ class _SearchResultGoodsListWidgetContainerState extends State(context).add(SearchResultGoodsListOnLoadEvent()); } - /// 跳转商品详情 - void _openGoodsDetailsPage() { - Navigator.push(context, MaterialPageRoute(builder: (_) => GoodsDetailsPage(null))); - } - @override void initState() { /// 初始化 @@ -75,20 +70,35 @@ class _SearchResultGoodsListWidgetContainerState extends State( - listener: (BuildContext context, SearchResultGoodsListState state) { - if (state is SearchResultGoodsListErrorState) { - print('数据加载出错'); - } - }, - buildWhen: (previous, current) { - /// 数据加载出错不进行build - if (current is SearchResultGoodsListErrorState) { - return false; - } + // return BlocConsumer( + // listener: (BuildContext context, SearchResultGoodsListState state) { + // if (state is SearchResultGoodsListErrorState) { + // print('search_result_goods_list_widget = 数据加载出错'); + // } + // }, + // buildWhen: (previous, current) { + // /// 数据加载出错不进行build + // if (current is SearchResultGoodsListErrorState) { + // return false; + // } + // + // return true; + // }, + // builder: (context, state) { + // if (state is SearchResultGoodsListLoadedState) { + // return _getMainWidget(state?.model, widget?.style); + // } + // if (state is SearchResultGoodsListChangeStyleState) { + // _isShowOneColumn = state.isShowOneColumn; + // return _getMainWidget(state?.model, widget?.style); + // } + // + // /// 骨架屏幕 + // return HomeGoodsSkeleton(); + // }, + // ); - return true; - }, + return BlocBuilder( builder: (context, state) { if (state is SearchResultGoodsListLoadedState) { return _getMainWidget(state?.model, widget?.style); @@ -97,9 +107,7 @@ class _SearchResultGoodsListWidgetContainerState extends State goods, HomeGoodsStyleModel styleModel) { int column = _isShowOneColumn ? 1 : 2; - return ListView.builder( - shrinkWrap: true, - physics: NeverScrollableScrollPhysics(), - itemCount: goods?.length ?? 0, - itemBuilder: (context, index) { + return SliverPadding( + padding: const EdgeInsets.only(top: 25), + sliver: SliverList( + delegate: SliverChildBuilderDelegate((context, index) { if (column == 1) { return HomeGoodsItemSingle( goods[index], @@ -139,54 +146,41 @@ class _SearchResultGoodsListWidgetContainerState extends State goods, HomeGoodsStyleModel styleModel) { -// return ListView.builder( -// shrinkWrap: true, -// physics: NeverScrollableScrollPhysics(), -// itemCount: goods.length, -// itemBuilder: (context, index) { -// if (column == 1) { -// return HomeGoodsItemSingle( -// goods[index], -// styleModel, -// data: widget.data, -// ); -// } else { -// // return Container(color: Colors.red, height: 126,margin: EdgeInsets.all(10),); -// return Padding( -// padding: const EdgeInsets.only(left: 5, right: 5), -// child: Row( -// children: List.generate(column, (c) { -// int i = index * column + c; -// return Expanded( -// child: i < goods.length -// ? HomeGoodsItem( -// goods[i], -// _style, -// data: widget.data, -// ) -// : Container(), -// ); -// }).toList(), -// ), -// ); -// } -// }); -// -// return HomeGoodsItemSingle(model, styleModel); -// } -// -// /// 双列 -// Widget _getTowWidget(List goods, HomeGoodsStyleModel styleModel) { -// int column = 2; -// int count = (goods.length / column).ceil(); -// -// return Container( -// child: Text('22222222'), -// ); -// } + // return ListView.builder( + // shrinkWrap: true, + // // physics: NeverScrollableScrollPhysics(), + // itemCount: goods?.length ?? 0, + // itemBuilder: (context, index) { + // if (column == 1) { + // return HomeGoodsItemSingle( + // goods[index], + // styleModel, + // data: widget.data, + // ); + // } else { + // // return Container(color: Colors.red, height: 126,margin: EdgeInsets.all(10),); + // return Padding( + // padding: const EdgeInsets.only(left: 5, right: 5), + // child: Row( + // children: List.generate(column, (c) { + // int i = index * column + c; + // return Expanded( + // child: i < goods.length + // ? HomeGoodsItem( + // goods[i], + // styleModel, + // data: widget.data, + // ) + // : Container(), + // ); + // }).toList(), + // ), + // ); + // } + // }); + } } diff --git a/lib/widgets/search_result/sort/search_result_sort_widget.dart b/lib/widgets/search_result/sort/search_result_sort_widget.dart index cb7f579..055861a 100644 --- a/lib/widgets/search_result/sort/search_result_sort_widget.dart +++ b/lib/widgets/search_result/sort/search_result_sort_widget.dart @@ -330,7 +330,7 @@ class _SearchResultSortWidgetState extends State { width: double.infinity, child: Text( item?.name ?? '', - style: TextStyle(fontSize: 12, color: HexColor.fromHex(item.isSelect ? widget?.model?.text_select_color ?? '' : widget?.model?.text_no_select_color ?? '')), + style: TextStyle(fontSize: 14, color: HexColor.fromHex(item.isSelect ? widget?.model?.text_select_color ?? '' : widget?.model?.text_no_select_color ?? '')), ), ), )); diff --git a/lib/widgets/team/data/team_data_widet.dart b/lib/widgets/team/data/team_data_widet.dart new file mode 100644 index 0000000..738bbce --- /dev/null +++ b/lib/widgets/team/data/team_data_widet.dart @@ -0,0 +1,110 @@ +import 'package:flutter/material.dart'; +import 'package:zhiying_comm/zhiying_comm.dart'; + +/// +/// 我的团队 - 数据widget +/// +class TeamDataWidget extends StatefulWidget { + @override + _TeamDataWidgetState createState() => _TeamDataWidgetState(); +} + +class _TeamDataWidgetState extends State { + @override + Widget build(BuildContext context) { + return _getMainWidget(); + } + + /// 主视图 + Widget _getMainWidget() { + return Container( + margin: const EdgeInsets.only(left: 12.5, right: 12.5, top: 8), + padding: const EdgeInsets.only(left: 10.5, right: 9.5), + decoration: BoxDecoration(borderRadius: BorderRadius.circular(10), color: HexColor.fromHex('#FFFFFF')), + child: Column( + children: [ + /// 直推人数 & 间推人数 + Row( + children: [ + /// 直推人数 + _getCustomWidget(text: '直推人数', textColor: '#999999', textSize: 12, number: '2258', numberColor: '#333333', numberSize: 30, icon: 'sss'), + + /// 分割线 + VerticalDivider(width: 40, thickness: 0.5, color: HexColor.fromHex('#F0F0F0')), + + /// 间推人数 + _getCustomWidget(text: '间推人数', textColor: '#999999', textSize: 12, number: '469', numberColor: '#333333', numberSize: 30, icon: 'sss'), + ], + ), + + /// 分割线 + Divider(thickness: 0.5, height: double.infinity, color: HexColor.fromHex('#F0F0F0')), + + /// 全部粉丝 & 今日新增 & 昨日新增 + Row( + children: [ + /// 全部粉丝 + _getCustomWidget( + text: '全部粉丝', + textColor: '#999999', + textSize: 11, + number: '2258', + numberColor: '#333333', + numberSize: 15, + ), + + /// 分割线 + VerticalDivider(thickness: 0.5, width: 35, color: HexColor.fromHex('#F0F0F0')), + + /// 今日新增 + _getCustomWidget( + text: '今日新增', + textColor: '#999999', + textSize: 11, + number: '4', + numberColor: '#333333', + numberSize: 15, + ), + + /// 分割线 + VerticalDivider(thickness: 0.5, width: 35, color: HexColor.fromHex('#F0F0F0')), + + /// 昨日新增 + _getCustomWidget( + text: '昨日新增', + textColor: '#999999', + textSize: 11, + number: '12', + numberColor: '#333333', + numberSize: 15, + ), + ], + ) + ], + ), + ); + } + + /// 自定义Widget + Widget _getCustomWidget({String text, String textColor, double textSize, String number, String numberColor, double numberSize, String icon}) { + return Column( + children: [ + /// Number + Row( + children: [ + /// nummber\ + Text(number, + style: TextStyle(color: HexColor.fromHex(numberColor), fontSize: numberSize, fontWeight: FontWeight.bold, fontFamily: 'Din', package: 'zhiying_base_widget')), + const SizedBox(width: 3), + + /// icon + Visibility(visible: !EmptyUtil.isEmpty(icon), child: Container(height: 7, width: 5, color: Colors.red)) + ], + ), + + /// Text + Text(text, style: TextStyle(color: HexColor.fromHex(textColor), fontSize: textSize)) + ], + ); + } +} diff --git a/lib/widgets/team/fans/team_fans_item.dart b/lib/widgets/team/fans/team_fans_item.dart new file mode 100644 index 0000000..4e94fa5 --- /dev/null +++ b/lib/widgets/team/fans/team_fans_item.dart @@ -0,0 +1,46 @@ +import 'package:flutter/material.dart'; +import 'package:zhiying_comm/zhiying_comm.dart'; + +/// +/// 我的团队 - 粉丝信息 +/// +class TeamFansItem extends StatefulWidget { + @override + _TeamFansItemState createState() => _TeamFansItemState(); +} + +class _TeamFansItemState extends State { + @override + Widget build(BuildContext context) { + return Container(); + } + + /// 主体视图 + Widget _getMainWidget() { + return Container( + decoration: BoxDecoration( + color: HexColor.fromHex('#FFFFFF'), + borderRadius: BorderRadius.circular(10) + ), + margin: const EdgeInsets.only(left: 12.5, right: 12.5), + padding: const EdgeInsets.only(left: 20, right: 20, top: 17.5, bottom: 15), + child: Column( + children: [ + + ], + ), + ); + } + + + /// 粉丝头像信息等 + Widget _getFansInfoWidget() { + + } + + /// 数据信息 + Widget _getDataWidget() { + + } + +} diff --git a/lib/widgets/team/recommend/team_recommend_widget.dart b/lib/widgets/team/recommend/team_recommend_widget.dart new file mode 100644 index 0000000..086488f --- /dev/null +++ b/lib/widgets/team/recommend/team_recommend_widget.dart @@ -0,0 +1,204 @@ +import 'package:flutter/material.dart'; +import 'package:zhiying_comm/zhiying_comm.dart'; + +/// +/// 我的团队 - 我的推荐人 +/// +class TeamRecommendWidget extends StatefulWidget { + final Map data; + + const TeamRecommendWidget(this.data); + + @override + _TeamRecommendWidgetState createState() => _TeamRecommendWidgetState(); +} + +class _TeamRecommendWidgetState extends State { + @override + Widget build(BuildContext context) { + return Container(); + } + + /// 按钮点击事件 + void _onClickListener() {} + + /// 主体Widget + Widget _getMainWidget() { + return Container( + decoration: BoxDecoration(borderRadius: BorderRadius.circular(10), color: Colors.white), + child: Column( + children: [ + /// 左上角的Icon + + /// 数据视图 + ], + ), + ); + } + + /// 我的推荐人IconWidget(左上角的ICON) + Widget _getLeftTopWidget() { + return Container(width: 73.5, height: 23.5, color: Colors.red); + } + + /// 输入框 + Widget _getInputWidget() { + return Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(30), + color: HexColor.fromHex('#F7F7F7'), + ), + child: Column( + children: [ + /// 输入框 + Row( + children: [ + /// 输入框 + Expanded( + child: TextField( + decoration: InputDecoration( + border: InputBorder.none, + focusedBorder: InputBorder.none, + focusedErrorBorder: InputBorder.none, + errorBorder: InputBorder.none, + disabledBorder: InputBorder.none, + enabledBorder: InputBorder.none, + filled: true, + fillColor: Colors.transparent), + ), + ), + /// 按钮 + _getAddButtomWidget(), + ], + ), + + const SizedBox(height: 10.5), + + /// 文字提示 + Text('还没有填写邀请人ID,填写后双方都可以获得奖励', style: TextStyle(color: HexColor.fromHex('#909090'), fontSize: 11)), + ], + ), + ); + } + + /// 添加的按钮 + Widget _getAddButtomWidget() { + return Material( + child: Container( + height: 24, + width: double.infinity, + color: Colors.white, + child: RaisedButton( + child: Text('添加', style: TextStyle(fontSize: 13)), + textColor: HexColor.fromHex('#FFFFFF'), + color: HexColor.fromHex('#F94B47'), + disabledColor: HexColor.fromHex('#F94B47'), + disabledTextColor: HexColor.fromHex('#FFFFFF'), + elevation: 5, + shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(24 / 2)), + onPressed: () => _onClickListener(), + ), + ), + ); + } + + /// 数据视图 + Widget _getDataWidget() { + return Row( + children: [ + /// 头像widget + _getAvatarWidget(), + + const SizedBox(width: 12), + + /// 数据 + _getDataRightWidget(), + ], + ); + } + + /// 头像widget + Widget _getAvatarWidget() { + return Container( + width: 55, + height: 55, + color: Colors.red, + ); + } + + /// 数据右边视图,头像右边的widget + Widget _getDataRightWidget() { + return Column( + children: [ + /// 昵称 + _getNickNameWidget(), + + /// 手机号 + _getPhoneNumberWidget(), + + /// 微信号 + _getWXWidget() + ], + ); + } + + /// 昵称 + Widget _getNickNameWidget() { + return Row( + children: [ + /// 昵称 + Text('毛毛虫', style: TextStyle(fontSize: 14, color: HexColor.fromHex('#000000'), fontWeight: FontWeight.bold)), + const SizedBox(width: 6), + Text('邀请码:', style: TextStyle(fontSize: 11, color: HexColor.fromHex('#909090'))), + Text('123456', style: TextStyle(fontSize: 11, color: HexColor.fromHex('#909090'))), + ], + ); + } + + /// 手机号 + Widget _getPhoneNumberWidget() { + return Row( + children: [ + Text('手机号:', style: TextStyle(fontSize: 11, color: HexColor.fromHex('#AFAFAF'))), + Text('12354678910', style: TextStyle(fontSize: 11, color: HexColor.fromHex('#AFAFAF'))), + const SizedBox(width: 6), + + /// 拷贝按钮 + _getCustomCopyWidget(), + ], + ); + } + + /// 微信号 + Widget _getWXWidget() { + return Row( + children: [ + Text('微信号:', style: TextStyle(fontSize: 11, color: HexColor.fromHex('#AFAFAF'))), + Text('12354678910', style: TextStyle(fontSize: 11, color: HexColor.fromHex('#AFAFAF'))), + const SizedBox(width: 6), + + /// 拷贝按钮 + _getCustomCopyWidget(), + ], + ); + } + + /// 自定义复制按钮的Widget + Widget _getCustomCopyWidget() { + return Container( + padding: const EdgeInsets.only(left: 4, bottom: 2, top: 2, right: 6), + decoration: BoxDecoration( + color: HexColor.fromHex('#FFF2F2'), + borderRadius: BorderRadius.circular(30), + ), + child: Row( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Container(width: 11, height: 11, color: Colors.red), + const SizedBox(width: 4.5), + Text('复制', style: TextStyle(fontSize: 8, color: HexColor.fromHex('#F94B47'))) + ], + ), + ); + } +} diff --git a/lib/widgets/team/temp/team_temp_widget.dart b/lib/widgets/team/temp/team_temp_widget.dart new file mode 100644 index 0000000..fbb3110 --- /dev/null +++ b/lib/widgets/team/temp/team_temp_widget.dart @@ -0,0 +1,29 @@ +import 'package:flutter/material.dart'; +import 'package:zhiying_comm/zhiying_comm.dart'; + +/// +/// 我的团队 - 空数据视图 +/// +class TeamTempWidget extends StatefulWidget { + @override + _TeamTempWidgetState createState() => _TeamTempWidgetState(); +} + +class _TeamTempWidgetState extends State { + @override + Widget build(BuildContext context) { + return Container( + child: Column( + children: [ + /// 空数据图片 + Container(width: 108, height: 116.5, color: Colors.red), + + const SizedBox(height: 26), + + /// 文字提示 + Text('暂时木有好友呀~', style: TextStyle(color: HexColor.fromHex('#999999'), fontSize: 12)) + ], + ), + ); + } +} diff --git a/lib/widgets/wallet/wallet_detail/wallet_detail.dart b/lib/widgets/wallet/wallet_detail/wallet_detail.dart index 2f350c9..bd1c2c9 100644 --- a/lib/widgets/wallet/wallet_detail/wallet_detail.dart +++ b/lib/widgets/wallet/wallet_detail/wallet_detail.dart @@ -161,7 +161,7 @@ class _WalletDetailState extends State margin: EdgeInsets.only(right: 8), decoration: BoxDecoration( image: DecorationImage( - image: CachedNetworkImageProvider(item.leftBgImg), + image: CachedNetworkImageProvider(item?.leftBgImg ?? ''), fit: BoxFit.fill)), child: Center(child: Text("ddd")), ), @@ -172,7 +172,7 @@ class _WalletDetailState extends State margin: EdgeInsets.only(left: 8), decoration: BoxDecoration( image: DecorationImage( - image: CachedNetworkImageProvider(item.rightBgImg))), + image: CachedNetworkImageProvider(item?.rightBgImg ?? ''))), child: Center(child: Text("dddd")), )) ],