浏览代码

更新首页商品列表

tags/0.0.1
Weller 4 年前
父节点
当前提交
056698f640
共有 13 个文件被更改,包括 166 次插入227 次删除
  1. 二进制
     
  2. +1
    -0
      .dart_tool/build_resolvers/sdk.sum.deps
  3. +29
    -11
      .dart_tool/package_config.json
  4. +6
    -0
      example/ios/Podfile.lock
  5. +50
    -33
      lib/register.dart
  6. +0
    -6
      lib/widgets/home/home_goods/bloc/home_goods_bloc.dart
  7. +10
    -1
      lib/widgets/home/home_goods/home_goods.dart
  8. +22
    -54
      lib/widgets/home/home_goods/home_goods_header.dart
  9. +6
    -7
      lib/widgets/home/home_goods/home_goods_item.dart
  10. +12
    -68
      lib/widgets/home/home_goods/models/home_goods_header_model.dart
  11. +8
    -36
      lib/widgets/home/home_goods/models/home_goods_header_model.g.dart
  12. +12
    -7
      lib/widgets/home/home_goods/models/home_goods_style_model.dart
  13. +10
    -4
      lib/widgets/home/home_goods/models/home_goods_style_model.g.dart

二进制
查看文件


+ 1
- 0
.dart_tool/build_resolvers/sdk.sum.deps 查看文件

@@ -0,0 +1 @@
{"sdk":"2.7.2 (Mon Mar 23 22:11:27 2020 +0100) on \"macos_x64\"","analyzer":"/Users/fnuser/.pub-cache/hosted/pub.flutter-io.cn/analyzer-0.39.14","build_resolvers":"/Users/fnuser/.pub-cache/hosted/pub.flutter-io.cn/build_resolvers-1.3.11"}

+ 29
- 11
.dart_tool/package_config.json 查看文件

@@ -165,7 +165,7 @@
}, },
{ {
"name": "device_info_platform_interface", "name": "device_info_platform_interface",
"rootUri": "file:///Users/fnuser/.pub-cache/hosted/pub.flutter-io.cn/device_info_platform_interface-1.0.0",
"rootUri": "file:///Users/fnuser/.pub-cache/hosted/pub.flutter-io.cn/device_info_platform_interface-1.0.1",
"packageUri": "lib/", "packageUri": "lib/",
"languageVersion": "2.7" "languageVersion": "2.7"
}, },
@@ -177,7 +177,7 @@
}, },
{ {
"name": "equatable", "name": "equatable",
"rootUri": "file:///Users/fnuser/.pub-cache/hosted/pub.flutter-io.cn/equatable-1.2.4",
"rootUri": "file:///Users/fnuser/.pub-cache/hosted/pub.flutter-io.cn/equatable-1.2.5",
"packageUri": "lib/", "packageUri": "lib/",
"languageVersion": "2.0" "languageVersion": "2.0"
}, },
@@ -187,6 +187,12 @@
"packageUri": "lib/", "packageUri": "lib/",
"languageVersion": "2.0" "languageVersion": "2.0"
}, },
{
"name": "ffi",
"rootUri": "file:///Users/fnuser/.pub-cache/hosted/pub.flutter-io.cn/ffi-0.1.3",
"packageUri": "lib/",
"languageVersion": "2.6"
},
{ {
"name": "file", "name": "file",
"rootUri": "file:///Users/fnuser/.pub-cache/hosted/pub.flutter-io.cn/file-5.2.1", "rootUri": "file:///Users/fnuser/.pub-cache/hosted/pub.flutter-io.cn/file-5.2.1",
@@ -219,7 +225,7 @@
}, },
{ {
"name": "flutter_cache_manager", "name": "flutter_cache_manager",
"rootUri": "file:///Users/fnuser/.pub-cache/hosted/pub.flutter-io.cn/flutter_cache_manager-1.4.1",
"rootUri": "file:///Users/fnuser/.pub-cache/hosted/pub.flutter-io.cn/flutter_cache_manager-1.4.2",
"packageUri": "lib/", "packageUri": "lib/",
"languageVersion": "2.6" "languageVersion": "2.6"
}, },
@@ -327,13 +333,13 @@
}, },
{ {
"name": "image_picker", "name": "image_picker",
"rootUri": "file:///Users/fnuser/.pub-cache/hosted/pub.flutter-io.cn/image_picker-0.6.7+7",
"rootUri": "file:///Users/fnuser/.pub-cache/hosted/pub.flutter-io.cn/image_picker-0.6.7+10",
"packageUri": "lib/", "packageUri": "lib/",
"languageVersion": "2.1" "languageVersion": "2.1"
}, },
{ {
"name": "image_picker_platform_interface", "name": "image_picker_platform_interface",
"rootUri": "file:///Users/fnuser/.pub-cache/hosted/pub.flutter-io.cn/image_picker_platform_interface-1.1.0",
"rootUri": "file:///Users/fnuser/.pub-cache/hosted/pub.flutter-io.cn/image_picker_platform_interface-1.1.1",
"packageUri": "lib/", "packageUri": "lib/",
"languageVersion": "2.5" "languageVersion": "2.5"
}, },
@@ -435,7 +441,7 @@
}, },
{ {
"name": "path_provider", "name": "path_provider",
"rootUri": "file:///Users/fnuser/.pub-cache/hosted/pub.flutter-io.cn/path_provider-1.6.14",
"rootUri": "file:///Users/fnuser/.pub-cache/hosted/pub.flutter-io.cn/path_provider-1.6.16",
"packageUri": "lib/", "packageUri": "lib/",
"languageVersion": "2.1" "languageVersion": "2.1"
}, },
@@ -447,7 +453,7 @@
}, },
{ {
"name": "path_provider_macos", "name": "path_provider_macos",
"rootUri": "file:///Users/fnuser/.pub-cache/hosted/pub.flutter-io.cn/path_provider_macos-0.0.4+3",
"rootUri": "file:///Users/fnuser/.pub-cache/hosted/pub.flutter-io.cn/path_provider_macos-0.0.4+4",
"packageUri": "lib/", "packageUri": "lib/",
"languageVersion": "2.1" "languageVersion": "2.1"
}, },
@@ -457,6 +463,12 @@
"packageUri": "lib/", "packageUri": "lib/",
"languageVersion": "2.1" "languageVersion": "2.1"
}, },
{
"name": "path_provider_windows",
"rootUri": "file:///Users/fnuser/.pub-cache/hosted/pub.flutter-io.cn/path_provider_windows-0.0.4+1",
"packageUri": "lib/",
"languageVersion": "2.1"
},
{ {
"name": "pedantic", "name": "pedantic",
"rootUri": "file:///Users/fnuser/.pub-cache/hosted/pub.flutter-io.cn/pedantic-1.8.0+1", "rootUri": "file:///Users/fnuser/.pub-cache/hosted/pub.flutter-io.cn/pedantic-1.8.0+1",
@@ -519,7 +531,7 @@
}, },
{ {
"name": "pull_to_refresh", "name": "pull_to_refresh",
"rootUri": "file:///Users/fnuser/.pub-cache/hosted/pub.flutter-io.cn/pull_to_refresh-1.6.1",
"rootUri": "file:///Users/fnuser/.pub-cache/hosted/pub.flutter-io.cn/pull_to_refresh-1.6.2",
"packageUri": "lib/", "packageUri": "lib/",
"languageVersion": "2.1" "languageVersion": "2.1"
}, },
@@ -675,7 +687,7 @@
}, },
{ {
"name": "url_launcher", "name": "url_launcher",
"rootUri": "file:///Users/fnuser/.pub-cache/hosted/pub.flutter-io.cn/url_launcher-5.6.0",
"rootUri": "file:///Users/fnuser/.pub-cache/hosted/pub.flutter-io.cn/url_launcher-5.7.0",
"packageUri": "lib/", "packageUri": "lib/",
"languageVersion": "2.1" "languageVersion": "2.1"
}, },
@@ -735,7 +747,13 @@
}, },
{ {
"name": "webview_flutter", "name": "webview_flutter",
"rootUri": "file:///Users/fnuser/.pub-cache/hosted/pub.flutter-io.cn/webview_flutter-0.3.22+1",
"rootUri": "file:///Users/fnuser/.pub-cache/hosted/pub.flutter-io.cn/webview_flutter-0.3.23",
"packageUri": "lib/",
"languageVersion": "2.7"
},
{
"name": "win32",
"rootUri": "file:///Users/fnuser/.pub-cache/hosted/pub.flutter-io.cn/win32-1.7.3",
"packageUri": "lib/", "packageUri": "lib/",
"languageVersion": "2.7" "languageVersion": "2.7"
}, },
@@ -770,7 +788,7 @@
"languageVersion": "2.1" "languageVersion": "2.1"
} }
], ],
"generated": "2020-09-22T07:54:03.242397Z",
"generated": "2020-09-22T09:35:21.193093Z",
"generator": "pub", "generator": "pub",
"generatorVersion": "2.7.2" "generatorVersion": "2.7.2"
} }

+ 6
- 0
example/ios/Podfile.lock 查看文件

@@ -42,6 +42,8 @@ PODS:
- Flutter - Flutter
- path_provider_macos (0.0.1): - path_provider_macos (0.0.1):
- Flutter - Flutter
- path_provider_windows (0.0.1):
- Flutter
- securityGuard (5.4.191) - securityGuard (5.4.191)
- shared_preferences (0.0.1): - shared_preferences (0.0.1):
- Flutter - Flutter
@@ -94,6 +96,7 @@ DEPENDENCIES:
- path_provider (from `.symlinks/plugins/path_provider/ios`) - path_provider (from `.symlinks/plugins/path_provider/ios`)
- path_provider_linux (from `.symlinks/plugins/path_provider_linux/ios`) - path_provider_linux (from `.symlinks/plugins/path_provider_linux/ios`)
- path_provider_macos (from `.symlinks/plugins/path_provider_macos/ios`) - path_provider_macos (from `.symlinks/plugins/path_provider_macos/ios`)
- path_provider_windows (from `.symlinks/plugins/path_provider_windows/ios`)
- shared_preferences (from `.symlinks/plugins/shared_preferences/ios`) - shared_preferences (from `.symlinks/plugins/shared_preferences/ios`)
- shared_preferences_linux (from `.symlinks/plugins/shared_preferences_linux/ios`) - shared_preferences_linux (from `.symlinks/plugins/shared_preferences_linux/ios`)
- shared_preferences_macos (from `.symlinks/plugins/shared_preferences_macos/ios`) - shared_preferences_macos (from `.symlinks/plugins/shared_preferences_macos/ios`)
@@ -149,6 +152,8 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/path_provider_linux/ios" :path: ".symlinks/plugins/path_provider_linux/ios"
path_provider_macos: path_provider_macos:
:path: ".symlinks/plugins/path_provider_macos/ios" :path: ".symlinks/plugins/path_provider_macos/ios"
path_provider_windows:
:path: ".symlinks/plugins/path_provider_windows/ios"
shared_preferences: shared_preferences:
:path: ".symlinks/plugins/shared_preferences/ios" :path: ".symlinks/plugins/shared_preferences/ios"
shared_preferences_linux: shared_preferences_linux:
@@ -196,6 +201,7 @@ SPEC CHECKSUMS:
path_provider: abfe2b5c733d04e238b0d8691db0cfd63a27a93c path_provider: abfe2b5c733d04e238b0d8691db0cfd63a27a93c
path_provider_linux: 4d630dc393e1f20364f3e3b4a2ff41d9674a84e4 path_provider_linux: 4d630dc393e1f20364f3e3b4a2ff41d9674a84e4
path_provider_macos: f760a3c5b04357c380e2fddb6f9db6f3015897e0 path_provider_macos: f760a3c5b04357c380e2fddb6f9db6f3015897e0
path_provider_windows: a2b81600c677ac1959367280991971cb9a1edb3b
securityGuard: 9c04c44a3b663f36e15064042abfc107fa07133c securityGuard: 9c04c44a3b663f36e15064042abfc107fa07133c
shared_preferences: af6bfa751691cdc24be3045c43ec037377ada40d shared_preferences: af6bfa751691cdc24be3045c43ec037377ada40d
shared_preferences_linux: afefbfe8d921e207f01ede8b60373d9e3b566b78 shared_preferences_linux: afefbfe8d921e207f01ede8b60373d9e3b566b78


+ 50
- 33
lib/register.dart 查看文件

@@ -1,4 +1,3 @@
import 'package:flutter/cupertino.dart';
import 'package:zhiying_base_widget/pages/goods_details_page/goods_details_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/home_page/home_page.dart';
import 'package:zhiying_base_widget/pages/main_page/main_page.dart'; import 'package:zhiying_base_widget/pages/main_page/main_page.dart';
@@ -17,9 +16,7 @@ import 'package:zhiying_base_widget/widgets/home/home_banner/home_banner_creater
import 'package:zhiying_base_widget/widgets/home/home_banner/home_banner_widget.dart'; import 'package:zhiying_base_widget/widgets/home/home_banner/home_banner_widget.dart';
import 'package:zhiying_base_widget/widgets/home/home_goods/home_goods_creater.dart'; import 'package:zhiying_base_widget/widgets/home/home_goods/home_goods_creater.dart';
import 'package:zhiying_base_widget/widgets/home/home_notice/home_notice_widget.dart'; import 'package:zhiying_base_widget/widgets/home/home_notice/home_notice_widget.dart';
import 'package:zhiying_base_widget/widgets/home/home_notice/model/home_notice_model.dart';
import 'package:zhiying_base_widget/widgets/home/home_slide_banner/home_slide_banner_creater.dart'; import 'package:zhiying_base_widget/widgets/home/home_slide_banner/home_slide_banner_creater.dart';
import 'package:zhiying_base_widget/widgets/home/home_sreach/home_sreach_creater.dart';
import 'package:zhiying_base_widget/widgets/home/home_sreach/home_sreach_widget.dart'; import 'package:zhiying_base_widget/widgets/home/home_sreach/home_sreach_widget.dart';
import 'package:zhiying_base_widget/widgets/mine/mine_data/mine_data.dart'; import 'package:zhiying_base_widget/widgets/mine/mine_data/mine_data.dart';
import 'package:zhiying_base_widget/widgets/mine/mine_header/mine_header.dart'; import 'package:zhiying_base_widget/widgets/mine/mine_header/mine_header.dart';
@@ -53,18 +50,18 @@ class BaseWidgetRegister {
PageFactory.regist('profile', (model) => MainPage(model)); PageFactory.regist('profile', (model) => MainPage(model));
PageFactory.regist('category', (model) => WalletPage()); PageFactory.regist('category', (model) => WalletPage());
PageFactory.regist('goods_details', (model) => GoodsDetailsPage(model)); PageFactory.regist('goods_details', (model) => GoodsDetailsPage(model));
PageFactory.regist('sreach', (model) => SreachPage() );
PageFactory.regist('sreach_result', (model) => SreachResultPage() );
PageFactory.regist('sreach', (model) => SreachPage());
PageFactory.regist('sreach_result', (model) => SreachResultPage());
// PageFactory.regist('login', (model) => LoginPage(model)); // PageFactory.regist('login', (model) => LoginPage(model));
// PageFactory.regist('login_quick', (model) => LoginQuickPage(model)); // PageFactory.regist('login_quick', (model) => LoginQuickPage(model));
// PageFactory.regist('login_account', (model) => LoginAccountPage(model)); // PageFactory.regist('login_account', (model) => LoginAccountPage(model));
// PageFactory.regist('login_invite', (model) => LoginInvitePage()); // PageFactory.regist('login_invite', (model) => LoginInvitePage());


PageFactory.regist('pub.flutter.profile_settings', (model) => MineDetailPage());
PageFactory.regist(
'pub.flutter.profile_settings', (model) => MineDetailPage());
PageFactory.regist('pub.flutter.settings', (model) => SettingPage(model)); PageFactory.regist('pub.flutter.settings', (model) => SettingPage(model));


PageFactory.regist('pub.flutter.my_orders', (model) => OrdersPage(model)); PageFactory.regist('pub.flutter.my_orders', (model) => OrdersPage(model));

} }


// 注册控件 // 注册控件
@@ -77,64 +74,84 @@ class BaseWidgetRegister {
// WidgetFactory.regist('index_title', NormalNavCreater()); // WidgetFactory.regist('index_title', NormalNavCreater());
/// 首页搜索栏 /// 首页搜索栏
// WidgetFactory.regist('index_search', HomeSreachCreater()); // WidgetFactory.regist('index_search', HomeSreachCreater());
WidgetFactory.regist('index_search', DefaultWidgetCreater((model) => HomeSreachWidget(model)));
WidgetFactory.regist('index_search',
DefaultWidgetCreater((model) => HomeSreachWidget(model)));

/// 可滚动banner /// 可滚动banner
WidgetFactory.regist('index_carousel', HomeSlideBannerCreater()); WidgetFactory.regist('index_carousel', HomeSlideBannerCreater());
WidgetFactory.regist('index_recommend_list', GoodsListCreater()); WidgetFactory.regist('index_recommend_list', GoodsListCreater());


/// 首页快速入口 /// 首页快速入口
WidgetFactory.regist('multi_nav', DefaultWidgetCreater((model) => HomeQuickEntry(model)));
WidgetFactory.regist(
'multi_nav', DefaultWidgetCreater((model) => HomeQuickEntry(model)));


/// 滚动公告 /// 滚动公告
WidgetFactory.regist('index_placard', DefaultWidgetCreater((model) => HomeNoticeWidget(model)));
WidgetFactory.regist('index_placard',
DefaultWidgetCreater((model) => HomeNoticeWidget(model)));


/// 不可以滚动banner /// 不可以滚动banner
WidgetFactory.regist('index_banner_one', HomeBannerCreater()); WidgetFactory.regist('index_banner_one', HomeBannerCreater());
WidgetFactory.regist('index_banner_two', HomeBannerCreater()); WidgetFactory.regist('index_banner_two', HomeBannerCreater());
WidgetFactory.regist('index_taobao_auth_tip', HomeAuthCreater());


/// ==================== 商品详情 ==================== /// /// ==================== 商品详情 ==================== ///
// 商品详情轮播图 // 商品详情轮播图
WidgetFactory.regist('product_detail_carousel', DefaultWidgetCreater((model) => GoodsDetailsSlideBannerWidget(model)));
WidgetFactory.regist('product_detail_carousel',
DefaultWidgetCreater((model) => GoodsDetailsSlideBannerWidget(model)));
// 商品详情下载APP提示 // 商品详情下载APP提示
WidgetFactory.regist('product_detail_download_tips', DefaultWidgetCreater((model) => UpgradeTipWidget(model)));
WidgetFactory.regist('product_detail_download_tips',
DefaultWidgetCreater((model) => UpgradeTipWidget(model)));
// 商品详情价格显示 // 商品详情价格显示
WidgetFactory.regist('product_detail_price', DefaultWidgetCreater((model) => GoodsDetailsPriceWidget(model)));
WidgetFactory.regist('product_detail_price',
DefaultWidgetCreater((model) => GoodsDetailsPriceWidget(model)));
// 商品详情标题 // 商品详情标题
WidgetFactory.regist('product_detail_title', DefaultWidgetCreater((model) => GoodsDetailsTitleWidget(model)));
WidgetFactory.regist('product_detail_title',
DefaultWidgetCreater((model) => GoodsDetailsTitleWidget(model)));
// 商品详情优惠劵 // 商品详情优惠劵
WidgetFactory.regist('product_detail_coupon', DefaultWidgetCreater((model) => CounponWidget(model)));
WidgetFactory.regist('product_detail_coupon',
DefaultWidgetCreater((model) => CounponWidget(model)));
// 商品详情店铺 // 商品详情店铺
WidgetFactory.regist('product_detail_shop', DefaultWidgetCreater((model) => StoreWidget(model)));
WidgetFactory.regist('product_detail_shop',
DefaultWidgetCreater((model) => StoreWidget(model)));
// 商品详情宝贝评价 // 商品详情宝贝评价
WidgetFactory.regist('product_detail_comment', DefaultWidgetCreater((model) => GoodsDetailsEvaluateWidget(model)));
WidgetFactory.regist('product_detail_comment',
DefaultWidgetCreater((model) => GoodsDetailsEvaluateWidget(model)));
// 商品详情图片 // 商品详情图片
WidgetFactory.regist('product_detail_img_list', DefaultWidgetCreater((model) => GoodsDetailsImgWidget(model)));
WidgetFactory.regist('product_detail_img_list',
DefaultWidgetCreater((model) => GoodsDetailsImgWidget(model)));
// 商品详情底部推荐列表 // 商品详情底部推荐列表
// WidgetFactory.regist('product_detail_bottom_rec', DefaultWidgetCreater((model) => GoodsListCreater(model))); // WidgetFactory.regist('product_detail_bottom_rec', DefaultWidgetCreater((model) => GoodsListCreater(model)));
WidgetFactory.regist('product_detail_bottom_rec', GoodsListCreater()); WidgetFactory.regist('product_detail_bottom_rec', GoodsListCreater());
// 商品详情底部 // 商品详情底部
WidgetFactory.regist('product_detail_bottom', DefaultWidgetCreater((model) => GoodsDetailsFooterWidget(model)));
WidgetFactory.regist('product_detail_bottom',
DefaultWidgetCreater((model) => GoodsDetailsFooterWidget(model)));


// ==================== 个人中心 // ==================== 个人中心
WidgetFactory.regist('profile_appbar', MineNavCreater()); WidgetFactory.regist('profile_appbar', MineNavCreater());
WidgetFactory.regist('profile_background', DefaultWidgetCreater((model) => MineNavBg(model)));
WidgetFactory.regist('profile_header', DefaultWidgetCreater((model) => MineHeader(model)));
WidgetFactory.regist('profile_earning', DefaultWidgetCreater((model) => MineData(model)));
WidgetFactory.regist('profile_functions', DefaultWidgetCreater((model) => MineQuickEntry(model)));
WidgetFactory.regist('profile_my_functions', DefaultWidgetCreater((model) => MineQuickEntry(model)));
WidgetFactory.regist('profile_carousel', DefaultWidgetCreater((model) => HomeBannerWidget(model)));
WidgetFactory.regist('profile_background',
DefaultWidgetCreater((model) => MineNavBg(model)));
WidgetFactory.regist(
'profile_header', DefaultWidgetCreater((model) => MineHeader(model)));
WidgetFactory.regist(
'profile_earning', DefaultWidgetCreater((model) => MineData(model)));
WidgetFactory.regist('profile_functions',
DefaultWidgetCreater((model) => MineQuickEntry(model)));
WidgetFactory.regist('profile_my_functions',
DefaultWidgetCreater((model) => MineQuickEntry(model)));
WidgetFactory.regist('profile_carousel',
DefaultWidgetCreater((model) => HomeBannerWidget(model)));


// ==================== 钱包 // ==================== 钱包
WidgetFactory.regist( WidgetFactory.regist(
'wallet_data', DefaultWidgetCreater((model) => WalletData())); 'wallet_data', DefaultWidgetCreater((model) => WalletData()));
// WidgetFactory.regist(
// 'wallet_detail', DefaultWidgetCreater((model) => WalletDetail()));
WidgetFactory.regist('wallet_detail', HomeAuthCreater());
WidgetFactory.regist('wallet_data', DefaultWidgetCreater((model) => WalletData()));
WidgetFactory.regist('wallet_detail', DefaultWidgetCreater((model) => WalletDetail()));
WidgetFactory.regist(
'wallet_detail', DefaultWidgetCreater((model) => WalletDetail()));
// WidgetFactory.regist('wallet_detail', HomeAuthCreater());
WidgetFactory.regist(
'wallet_data', DefaultWidgetCreater((model) => WalletData()));
WidgetFactory.regist(
'wallet_detail', DefaultWidgetCreater((model) => WalletDetail()));


WidgetFactory.regist('wallet_income', DefaultWidgetCreater((model) => WalletIncome()));
WidgetFactory.regist(
'wallet_income', DefaultWidgetCreater((model) => WalletIncome()));
} }
} }

+ 0
- 6
lib/widgets/home/home_goods/bloc/home_goods_bloc.dart 查看文件

@@ -1,13 +1,11 @@
import 'dart:async'; import 'dart:async';


import 'package:zhiying_base_widget/widgets/home/home_goods/models/home_goods_model.dart'; import 'package:zhiying_base_widget/widgets/home/home_goods/models/home_goods_model.dart';
import 'package:zhiying_base_widget/widgets/home/home_goods/models/home_goods_style_model.dart';
import 'package:zhiying_comm/util/base_bloc.dart'; import 'package:zhiying_comm/util/base_bloc.dart';
import 'package:zhiying_comm/zhiying_comm.dart'; import 'package:zhiying_comm/zhiying_comm.dart';


class HomeGoodsBloc extends BlocBase { class HomeGoodsBloc extends BlocBase {
List<HomeGoodsModel> _goods = List(); List<HomeGoodsModel> _goods = List();
HomeGoodsStyleModel style;


String _provider = ''; String _provider = '';


@@ -49,10 +47,6 @@ class HomeGoodsBloc extends BlocBase {
} }
_goods.addAll(goods); _goods.addAll(goods);
} }
if (json.containsKey('style')) {
style = HomeGoodsStyleModel.fromJson(
Map<String, dynamic>.from(json['style']));
}


_goodsController.add(_goods); _goodsController.add(_goods);
}); });


+ 10
- 1
lib/widgets/home/home_goods/home_goods.dart 查看文件

@@ -1,3 +1,5 @@
import 'dart:convert' as convert;

import 'package:event_bus/event_bus.dart'; import 'package:event_bus/event_bus.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
@@ -7,6 +9,7 @@ import 'package:zhiying_base_widget/widgets/home/home_goods/bloc/home_goods_bloc
import 'package:zhiying_base_widget/widgets/home/home_goods/home_goods_creater.dart'; import 'package:zhiying_base_widget/widgets/home/home_goods/home_goods_creater.dart';
import 'package:zhiying_base_widget/widgets/home/home_goods/home_goods_item.dart'; import 'package:zhiying_base_widget/widgets/home/home_goods/home_goods_item.dart';
import 'package:zhiying_base_widget/widgets/home/home_goods/models/home_goods_model.dart'; import 'package:zhiying_base_widget/widgets/home/home_goods/models/home_goods_model.dart';
import 'package:zhiying_base_widget/widgets/home/home_goods/models/home_goods_style_model.dart';
import 'package:zhiying_base_widget/widgets/home/home_goods/skeleton/home_goods_sk.dart'; import 'package:zhiying_base_widget/widgets/home/home_goods/skeleton/home_goods_sk.dart';
import 'package:zhiying_comm/util/base_bloc.dart'; import 'package:zhiying_comm/util/base_bloc.dart';


@@ -48,10 +51,16 @@ class _HomeGoodsContainer extends StatefulWidget {
class _HomeGoodsContainerState extends State<_HomeGoodsContainer> { class _HomeGoodsContainerState extends State<_HomeGoodsContainer> {
HomeGoodsBloc _bloc; HomeGoodsBloc _bloc;
String _provider = ''; String _provider = '';
HomeGoodsStyleModel _style;


@override @override
void initState() { void initState() {
_bloc = BlocProvider.of<HomeGoodsBloc>(context); _bloc = BlocProvider.of<HomeGoodsBloc>(context);

String d = widget.data['data'];
dynamic json = convert.jsonDecode(d);
_style = HomeGoodsStyleModel.fromJson(Map<String, dynamic>.from(json));

widget.eventBus.on<HomeGoodsHeaderEvent>().listen((data) { widget.eventBus.on<HomeGoodsHeaderEvent>().listen((data) {
_provider = data.provider; _provider = data.provider;
_bloc.loadMore(_provider); _bloc.loadMore(_provider);
@@ -90,7 +99,7 @@ class _HomeGoodsContainerState extends State<_HomeGoodsContainer> {
itemBuilder: (context, index) { itemBuilder: (context, index) {
return HomeGoodsItem( return HomeGoodsItem(
goods[index], goods[index],
_bloc.style,
_style,
data: widget.data, data: widget.data,
); );
}); });


+ 22
- 54
lib/widgets/home/home_goods/home_goods_header.dart 查看文件

@@ -1,10 +1,12 @@
import 'dart:convert' as convert;

import 'package:event_bus/event_bus.dart'; import 'package:event_bus/event_bus.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:zhiying_base_widget/widgets/home/home_goods/bloc/home_goods_header_bloc.dart'; import 'package:zhiying_base_widget/widgets/home/home_goods/bloc/home_goods_header_bloc.dart';
import 'package:zhiying_base_widget/widgets/home/home_goods/home_goods_creater.dart'; import 'package:zhiying_base_widget/widgets/home/home_goods/home_goods_creater.dart';
import 'package:zhiying_base_widget/widgets/home/home_goods/models/home_goods_header_model.dart'; import 'package:zhiying_base_widget/widgets/home/home_goods/models/home_goods_header_model.dart';
import 'package:zhiying_base_widget/widgets/home/home_goods/skeleton/home_goods_header_sk.dart';
import 'package:zhiying_base_widget/widgets/home/home_goods/models/home_goods_style_model.dart';
import 'package:zhiying_comm/util/base_bloc.dart'; import 'package:zhiying_comm/util/base_bloc.dart';
import 'package:zhiying_comm/zhiying_comm.dart'; import 'package:zhiying_comm/zhiying_comm.dart';


@@ -60,50 +62,9 @@ class _HomeGoodsHeader extends StatefulWidget {
_HomeGoodsHeaderState createState() => _HomeGoodsHeaderState(); _HomeGoodsHeaderState createState() => _HomeGoodsHeaderState();
} }


class _HomeGoodsHeaderState extends State<_HomeGoodsHeader> {
HomeGoodsHeaderBloc _bloc;

@override
void dispose() {
_bloc.dispose();
super.dispose();
}

@override
void initState() {
_bloc = BlocProvider.of<HomeGoodsHeaderBloc>(context);
_bloc.loadData(widget.model['mod_id']);

super.initState();
}

@override
Widget build(BuildContext context) {
return StreamBuilder<List<HomeGoodsHeaderModel>>(
stream: _bloc.outData,
builder: (BuildContext context, AsyncSnapshot snapshot) {
if (snapshot.data == null) {
return HomeGoodsHeaderSkeleton();
}
return HomeGoodsHeaderContainer(snapshot.data, widget.eventBus);
});
}
}

class HomeGoodsHeaderContainer extends StatefulWidget {
final List<HomeGoodsHeaderModel> headers;
final EventBus eventBus;

HomeGoodsHeaderContainer(this.headers, this.eventBus, {Key key})
: super(key: key);

@override
_HomeGoodsHeaderContainerState createState() =>
_HomeGoodsHeaderContainerState();
}

class _HomeGoodsHeaderContainerState extends State<HomeGoodsHeaderContainer>
class _HomeGoodsHeaderState extends State<_HomeGoodsHeader>
with TickerProviderStateMixin { with TickerProviderStateMixin {
HomeGoodsStyleModel _style;
List<Widget> _widgets = List(); List<Widget> _widgets = List();


TabController _tabController; TabController _tabController;
@@ -111,20 +72,25 @@ class _HomeGoodsHeaderContainerState extends State<HomeGoodsHeaderContainer>


@override @override
void initState() { void initState() {
_tabController = TabController(length: widget.headers.length, vsync: this);
if (widget.headers.first != null) {
widget.eventBus.fire(HomeGoodsHeaderEvent(widget.headers.first.modName));
String d = widget.model['data'];
dynamic json = convert.jsonDecode(d);
_style = HomeGoodsStyleModel.fromJson(Map<String, dynamic>.from(json));

_tabController =
TabController(length: _style.recommendList.length, vsync: this);
if (_style.recommendList.first != null) {
widget.eventBus
.fire(HomeGoodsHeaderEvent(_style.recommendList.first.type));
} }

super.initState(); super.initState();
} }


@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
_widgets.clear(); _widgets.clear();
for (int index = 0; index < widget.headers.length; index++) {
for (int index = 0; index < _style.recommendList.length; index++) {
_widgets.add(_HomeGoodsHeaderItem( _widgets.add(_HomeGoodsHeaderItem(
widget.headers[index],
_style.recommendList[index],
isSelected: index == _currentIndex, isSelected: index == _currentIndex,
)); ));
} }
@@ -140,7 +106,7 @@ class _HomeGoodsHeaderContainerState extends State<HomeGoodsHeaderContainer>
tabs: _widgets, tabs: _widgets,
onTap: (index) { onTap: (index) {
widget.eventBus widget.eventBus
.fire(HomeGoodsHeaderEvent(widget.headers[index].modName));
.fire(HomeGoodsHeaderEvent(_style.recommendList[index].type));
setState(() { setState(() {
_currentIndex = index; _currentIndex = index;
}); });
@@ -169,7 +135,7 @@ class _HomeGoodsHeaderItem extends StatelessWidget {
Text( Text(
model.title, model.title,
style: TextStyle( style: TextStyle(
color: HexColor.fromHex(model.fontColor),
color: HexColor.fromHex(model.tilteTextColor),
fontSize: 17, fontSize: 17,
fontWeight: FontWeight.bold), fontWeight: FontWeight.bold),
), ),
@@ -178,14 +144,16 @@ class _HomeGoodsHeaderItem extends StatelessWidget {
padding: EdgeInsets.only(left: 6, right: 6, top: 2, bottom: 2), padding: EdgeInsets.only(left: 6, right: 6, top: 2, bottom: 2),
decoration: BoxDecoration( decoration: BoxDecoration(
color: isSelected color: isSelected
? HexColor.fromHex(model.fontColor)
? HexColor.fromHex(model.subtitleBgColor)
: Colors.transparent, : Colors.transparent,
borderRadius: BorderRadius.circular(18)), borderRadius: BorderRadius.circular(18)),
child: Text( child: Text(
model.subtitle, model.subtitle,
style: TextStyle( style: TextStyle(
fontSize: 10, fontSize: 10,
color: isSelected ? Colors.white : Color(0xff999999)),
color: isSelected
? HexColor.fromHex(model.subtitleTextColor)
: Color(0xff999999)),
textAlign: TextAlign.center, textAlign: TextAlign.center,
), ),
), ),


+ 6
- 7
lib/widgets/home/home_goods/home_goods_item.dart 查看文件

@@ -23,16 +23,15 @@ class HomeGoodsItem extends StatelessWidget {
} }


/// 跳到商品详情 /// 跳到商品详情
void _onJumpGoodsDetails(BuildContext context,HomeGoodsModel goods){
Navigator.push(context, MaterialPageRoute(
builder: (_)=> GoodsDetailsPage(goods.toJson())
));
void _onJumpGoodsDetails(BuildContext context, HomeGoodsModel goods) {
Navigator.push(context,
MaterialPageRoute(builder: (_) => GoodsDetailsPage(goods.toJson())));
} }


@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return GestureDetector( return GestureDetector(
onTap: ()=> _onJumpGoodsDetails(context, goods),
onTap: () => _onJumpGoodsDetails(context, goods),
child: Container( child: Container(
margin: EdgeInsets.only(left: 12.5, right: 12.5, top: 4, bottom: 4), margin: EdgeInsets.only(left: 12.5, right: 12.5, top: 4, bottom: 4),
padding: EdgeInsets.all(7.5), padding: EdgeInsets.all(7.5),
@@ -149,7 +148,7 @@ class HomeGoodsItem extends StatelessWidget {
margin: EdgeInsets.only(right: 5), margin: EdgeInsets.only(right: 5),
padding: EdgeInsets.only(left: 10, right: 10, top: 3, bottom: 3), padding: EdgeInsets.only(left: 10, right: 10, top: 3, bottom: 3),
decoration: BoxDecoration( decoration: BoxDecoration(
color: HexColor.fromHex(style.couponBackgroundColor),
color: HexColor.fromHex(style.couponBgColor),
borderRadius: BorderRadius.circular(2.5), borderRadius: BorderRadius.circular(2.5),
), ),
child: Text( child: Text(
@@ -170,7 +169,7 @@ class HomeGoodsItem extends StatelessWidget {
margin: EdgeInsets.only(right: 5), margin: EdgeInsets.only(right: 5),
padding: EdgeInsets.only(left: 10, right: 10, top: 3, bottom: 3), padding: EdgeInsets.only(left: 10, right: 10, top: 3, bottom: 3),
decoration: BoxDecoration( decoration: BoxDecoration(
color: HexColor.fromHex(style.commissionBackgroundColor),
color: HexColor.fromHex(style.commissionBgColor),
borderRadius: BorderRadius.circular(2.5), borderRadius: BorderRadius.circular(2.5),
), ),
child: Text( child: Text(


+ 12
- 68
lib/widgets/home/home_goods/models/home_goods_header_model.dart 查看文件

@@ -4,17 +4,8 @@ part 'home_goods_header_model.g.dart';


@JsonSerializable() @JsonSerializable()
class HomeGoodsHeaderModel extends Object { class HomeGoodsHeaderModel extends Object {
@JsonKey(name: 'mod_id')
int modId;

@JsonKey(name: 'mod_pid')
int modPid;

@JsonKey(name: 'mod_name')
String modName;

@JsonKey(name: 'position')
String position;
@JsonKey(name: 'type')
String type;


@JsonKey(name: 'title') @JsonKey(name: 'title')
String title; String title;
@@ -22,69 +13,22 @@ class HomeGoodsHeaderModel extends Object {
@JsonKey(name: 'subtitle') @JsonKey(name: 'subtitle')
String subtitle; String subtitle;


@JsonKey(name: 'url')
String url;

@JsonKey(name: 'margin')
String margin;

@JsonKey(name: 'aspect_ratio')
String aspectRatio;

@JsonKey(name: 'icon')
String icon;

@JsonKey(name: 'img')
String img;

@JsonKey(name: 'font_color')
String fontColor;

@JsonKey(name: 'bg_img')
String bgImg;

@JsonKey(name: 'bg_color')
String bgColor;

@JsonKey(name: 'bg_color_t')
String bgColorT;

@JsonKey(name: 'badge')
String badge;

@JsonKey(name: 'path')
String path;

@JsonKey(name: 'data')
String data;
@JsonKey(name: 'tilte_text_color')
String tilteTextColor;


@JsonKey(name: 'sort')
int sort;
@JsonKey(name: 'subtitle_bg_color')
String subtitleBgColor;


@JsonKey(name: 'is_global')
int isGlobal;
@JsonKey(name: 'subtitle_text_color')
String subtitleTextColor;


HomeGoodsHeaderModel( HomeGoodsHeaderModel(
this.modId,
this.modPid,
this.modName,
this.position,
this.type,
this.title, this.title,
this.subtitle, this.subtitle,
this.url,
this.margin,
this.aspectRatio,
this.icon,
this.img,
this.fontColor,
this.bgImg,
this.bgColor,
this.bgColorT,
this.badge,
this.path,
this.data,
this.sort,
this.isGlobal,
this.tilteTextColor,
this.subtitleBgColor,
this.subtitleTextColor,
); );


factory HomeGoodsHeaderModel.fromJson(Map<String, dynamic> srcJson) => factory HomeGoodsHeaderModel.fromJson(Map<String, dynamic> srcJson) =>


+ 8
- 36
lib/widgets/home/home_goods/models/home_goods_header_model.g.dart 查看文件

@@ -8,50 +8,22 @@ part of 'home_goods_header_model.dart';


HomeGoodsHeaderModel _$HomeGoodsHeaderModelFromJson(Map<String, dynamic> json) { HomeGoodsHeaderModel _$HomeGoodsHeaderModelFromJson(Map<String, dynamic> json) {
return HomeGoodsHeaderModel( return HomeGoodsHeaderModel(
json['mod_id'] as int,
json['mod_pid'] as int,
json['mod_name'] as String,
json['position'] as String,
json['type'] as String,
json['title'] as String, json['title'] as String,
json['subtitle'] as String, json['subtitle'] as String,
json['url'] as String,
json['margin'] as String,
json['aspect_ratio'] as String,
json['icon'] as String,
json['img'] as String,
json['font_color'] as String,
json['bg_img'] as String,
json['bg_color'] as String,
json['bg_color_t'] as String,
json['badge'] as String,
json['path'] as String,
json['data'] as String,
json['sort'] as int,
json['is_global'] as int,
json['tilte_text_color'] as String,
json['subtitle_bg_color'] as String,
json['subtitle_text_color'] as String,
); );
} }


Map<String, dynamic> _$HomeGoodsHeaderModelToJson( Map<String, dynamic> _$HomeGoodsHeaderModelToJson(
HomeGoodsHeaderModel instance) => HomeGoodsHeaderModel instance) =>
<String, dynamic>{ <String, dynamic>{
'mod_id': instance.modId,
'mod_pid': instance.modPid,
'mod_name': instance.modName,
'position': instance.position,
'type': instance.type,
'title': instance.title, 'title': instance.title,
'subtitle': instance.subtitle, 'subtitle': instance.subtitle,
'url': instance.url,
'margin': instance.margin,
'aspect_ratio': instance.aspectRatio,
'icon': instance.icon,
'img': instance.img,
'font_color': instance.fontColor,
'bg_img': instance.bgImg,
'bg_color': instance.bgColor,
'bg_color_t': instance.bgColorT,
'badge': instance.badge,
'path': instance.path,
'data': instance.data,
'sort': instance.sort,
'is_global': instance.isGlobal,
'tilte_text_color': instance.tilteTextColor,
'subtitle_bg_color': instance.subtitleBgColor,
'subtitle_text_color': instance.subtitleTextColor,
}; };

+ 12
- 7
lib/widgets/home/home_goods/models/home_goods_style_model.dart 查看文件

@@ -1,9 +1,13 @@
import 'package:json_annotation/json_annotation.dart'; import 'package:json_annotation/json_annotation.dart';
import 'package:zhiying_base_widget/widgets/home/home_goods/models/home_goods_header_model.dart';


part 'home_goods_style_model.g.dart'; part 'home_goods_style_model.g.dart';


@JsonSerializable() @JsonSerializable()
class HomeGoodsStyleModel extends Object { class HomeGoodsStyleModel extends Object {
@JsonKey(name: 'recommend_list')
List<HomeGoodsHeaderModel> recommendList;

@JsonKey(name: 'provider_name_color') @JsonKey(name: 'provider_name_color')
String providerNameColor; String providerNameColor;


@@ -16,18 +20,18 @@ class HomeGoodsStyleModel extends Object {
@JsonKey(name: 'shop_icon') @JsonKey(name: 'shop_icon')
String shopIcon; String shopIcon;


@JsonKey(name: 'coupon_background_color')
String couponBackgroundColor;

@JsonKey(name: 'coupon_font_color') @JsonKey(name: 'coupon_font_color')
String couponFontColor; String couponFontColor;


@JsonKey(name: 'commission_background_color')
String commissionBackgroundColor;
@JsonKey(name: 'coupon_bg_color')
String couponBgColor;


@JsonKey(name: 'commission_font_color') @JsonKey(name: 'commission_font_color')
String commissionFontColor; String commissionFontColor;


@JsonKey(name: 'commission_bg_color')
String commissionBgColor;

@JsonKey(name: 'market_price_color') @JsonKey(name: 'market_price_color')
String marketPriceColor; String marketPriceColor;


@@ -35,14 +39,15 @@ class HomeGoodsStyleModel extends Object {
String currentPriceColor; String currentPriceColor;


HomeGoodsStyleModel( HomeGoodsStyleModel(
this.recommendList,
this.providerNameColor, this.providerNameColor,
this.providerNameBackgroundColor, this.providerNameBackgroundColor,
this.shopNameColor, this.shopNameColor,
this.shopIcon, this.shopIcon,
this.couponBackgroundColor,
this.couponFontColor, this.couponFontColor,
this.commissionBackgroundColor,
this.couponBgColor,
this.commissionFontColor, this.commissionFontColor,
this.commissionBgColor,
this.marketPriceColor, this.marketPriceColor,
this.currentPriceColor, this.currentPriceColor,
); );


+ 10
- 4
lib/widgets/home/home_goods/models/home_goods_style_model.g.dart 查看文件

@@ -8,14 +8,19 @@ part of 'home_goods_style_model.dart';


HomeGoodsStyleModel _$HomeGoodsStyleModelFromJson(Map<String, dynamic> json) { HomeGoodsStyleModel _$HomeGoodsStyleModelFromJson(Map<String, dynamic> json) {
return HomeGoodsStyleModel( return HomeGoodsStyleModel(
(json['recommend_list'] as List)
?.map((e) => e == null
? null
: HomeGoodsHeaderModel.fromJson(e as Map<String, dynamic>))
?.toList(),
json['provider_name_color'] as String, json['provider_name_color'] as String,
json['provider_name_background_color'] as String, json['provider_name_background_color'] as String,
json['shop_name_color'] as String, json['shop_name_color'] as String,
json['shop_icon'] as String, json['shop_icon'] as String,
json['coupon_background_color'] as String,
json['coupon_font_color'] as String, json['coupon_font_color'] as String,
json['commission_background_color'] as String,
json['coupon_bg_color'] as String,
json['commission_font_color'] as String, json['commission_font_color'] as String,
json['commission_bg_color'] as String,
json['market_price_color'] as String, json['market_price_color'] as String,
json['current_price_color'] as String, json['current_price_color'] as String,
); );
@@ -24,14 +29,15 @@ HomeGoodsStyleModel _$HomeGoodsStyleModelFromJson(Map<String, dynamic> json) {
Map<String, dynamic> _$HomeGoodsStyleModelToJson( Map<String, dynamic> _$HomeGoodsStyleModelToJson(
HomeGoodsStyleModel instance) => HomeGoodsStyleModel instance) =>
<String, dynamic>{ <String, dynamic>{
'recommend_list': instance.recommendList,
'provider_name_color': instance.providerNameColor, 'provider_name_color': instance.providerNameColor,
'provider_name_background_color': instance.providerNameBackgroundColor, 'provider_name_background_color': instance.providerNameBackgroundColor,
'shop_name_color': instance.shopNameColor, 'shop_name_color': instance.shopNameColor,
'shop_icon': instance.shopIcon, 'shop_icon': instance.shopIcon,
'coupon_background_color': instance.couponBackgroundColor,
'coupon_font_color': instance.couponFontColor, 'coupon_font_color': instance.couponFontColor,
'commission_background_color': instance.commissionBackgroundColor,
'coupon_bg_color': instance.couponBgColor,
'commission_font_color': instance.commissionFontColor, 'commission_font_color': instance.commissionFontColor,
'commission_bg_color': instance.commissionBgColor,
'market_price_color': instance.marketPriceColor, 'market_price_color': instance.marketPriceColor,
'current_price_color': instance.currentPriceColor, 'current_price_color': instance.currentPriceColor,
}; };

正在加载...
取消
保存