From 3251174b474555c2c2c8846c2cb6cc7c51b4dd8c Mon Sep 17 00:00:00 2001 From: Weller <1812208341@qq.com> Date: Fri, 9 Oct 2020 14:40:37 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E9=A6=96=E9=A1=B5=E5=95=86?= =?UTF-8?q?=E5=93=81=E5=88=97=E8=A1=A8item=E4=B8=8D=E9=87=8D=E7=94=A8?= =?UTF-8?q?=E5=AF=BC=E8=87=B4=E9=97=AA=E9=80=80=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .dart_tool/package_config.json | 56 ++++++------ example/ios/Runner.xcodeproj/project.pbxproj | 14 +-- lib/pages/test_page/test_page.dart | 75 ++++++++++++++++ lib/register.dart | 5 +- lib/widgets/home/home_goods/home_goods.dart | 88 ++++++++++--------- .../home/home_goods/home_goods_creater.dart | 4 +- pubspec.yaml | 2 +- 7 files changed, 155 insertions(+), 89 deletions(-) create mode 100644 lib/pages/test_page/test_page.dart diff --git a/.dart_tool/package_config.json b/.dart_tool/package_config.json index d356de5..d4befa7 100644 --- a/.dart_tool/package_config.json +++ b/.dart_tool/package_config.json @@ -3,21 +3,21 @@ "packages": [ { "name": "archive", - "rootUri": "file:///Users/fnuser/.pub-cache/hosted/pub.flutter-io.cn/archive-2.0.11", + "rootUri": "file:///Users/fnuser/.pub-cache/hosted/pub.flutter-io.cn/archive-2.0.13", "packageUri": "lib/", "languageVersion": "2.0" }, { "name": "args", - "rootUri": "file:///Users/fnuser/.pub-cache/hosted/pub.flutter-io.cn/args-1.5.2", + "rootUri": "file:///Users/fnuser/.pub-cache/hosted/pub.flutter-io.cn/args-1.6.0", "packageUri": "lib/", - "languageVersion": "2.0" + "languageVersion": "2.3" }, { "name": "async", - "rootUri": "file:///Users/fnuser/.pub-cache/hosted/pub.flutter-io.cn/async-2.4.0", + "rootUri": "file:///Users/fnuser/.pub-cache/hosted/pub.flutter-io.cn/async-2.4.1", "packageUri": "lib/", - "languageVersion": "2.0" + "languageVersion": "2.2" }, { "name": "bloc", @@ -27,9 +27,9 @@ }, { "name": "boolean_selector", - "rootUri": "file:///Users/fnuser/.pub-cache/hosted/pub.flutter-io.cn/boolean_selector-1.0.5", + "rootUri": "file:///Users/fnuser/.pub-cache/hosted/pub.flutter-io.cn/boolean_selector-2.0.0", "packageUri": "lib/", - "languageVersion": "2.0" + "languageVersion": "2.4" }, { "name": "cached_network_image", @@ -39,9 +39,9 @@ }, { "name": "charcode", - "rootUri": "file:///Users/fnuser/.pub-cache/hosted/pub.flutter-io.cn/charcode-1.1.2", + "rootUri": "file:///Users/fnuser/.pub-cache/hosted/pub.flutter-io.cn/charcode-1.1.3", "packageUri": "lib/", - "languageVersion": "1.0" + "languageVersion": "2.0" }, { "name": "clock", @@ -51,7 +51,7 @@ }, { "name": "collection", - "rootUri": "file:///Users/fnuser/.pub-cache/hosted/pub.flutter-io.cn/collection-1.14.11", + "rootUri": "file:///Users/fnuser/.pub-cache/hosted/pub.flutter-io.cn/collection-1.14.12", "packageUri": "lib/", "languageVersion": "2.0" }, @@ -87,7 +87,7 @@ }, { "name": "crypto", - "rootUri": "file:///Users/fnuser/.pub-cache/hosted/pub.flutter-io.cn/crypto-2.1.3", + "rootUri": "file:///Users/fnuser/.pub-cache/hosted/pub.flutter-io.cn/crypto-2.1.4", "packageUri": "lib/", "languageVersion": "2.1" }, @@ -225,7 +225,7 @@ }, { "name": "image", - "rootUri": "file:///Users/fnuser/.pub-cache/hosted/pub.flutter-io.cn/image-2.1.4", + "rootUri": "file:///Users/fnuser/.pub-cache/hosted/pub.flutter-io.cn/image-2.1.12", "packageUri": "lib/", "languageVersion": "2.0" }, @@ -249,9 +249,9 @@ }, { "name": "intl", - "rootUri": "file:///Users/fnuser/.pub-cache/hosted/pub.flutter-io.cn/intl-0.16.0", + "rootUri": "file:///Users/fnuser/.pub-cache/hosted/pub.flutter-io.cn/intl-0.16.1", "packageUri": "lib/", - "languageVersion": "2.0" + "languageVersion": "2.5" }, { "name": "jdsdk", @@ -321,7 +321,7 @@ }, { "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.9.0", "packageUri": "lib/", "languageVersion": "2.1" }, @@ -363,9 +363,9 @@ }, { "name": "provider", - "rootUri": "file:///Users/fnuser/.pub-cache/hosted/pub.flutter-io.cn/provider-4.0.5+1", + "rootUri": "file:///Users/fnuser/.pub-cache/hosted/pub.flutter-io.cn/provider-4.3.2+2", "packageUri": "lib/", - "languageVersion": "2.2" + "languageVersion": "2.7" }, { "name": "pull_to_refresh", @@ -375,7 +375,7 @@ }, { "name": "quiver", - "rootUri": "file:///Users/fnuser/.pub-cache/hosted/pub.flutter-io.cn/quiver-2.0.5", + "rootUri": "file:///Users/fnuser/.pub-cache/hosted/pub.flutter-io.cn/quiver-2.1.3", "packageUri": "lib/", "languageVersion": "2.0" }, @@ -453,9 +453,9 @@ }, { "name": "source_span", - "rootUri": "file:///Users/fnuser/.pub-cache/hosted/pub.flutter-io.cn/source_span-1.5.5", + "rootUri": "file:///Users/fnuser/.pub-cache/hosted/pub.flutter-io.cn/source_span-1.7.0", "packageUri": "lib/", - "languageVersion": "1.8" + "languageVersion": "2.6" }, { "name": "sqflite", @@ -495,9 +495,9 @@ }, { "name": "synchronized", - "rootUri": "file:///Users/fnuser/.pub-cache/hosted/pub.flutter-io.cn/synchronized-2.2.0", + "rootUri": "file:///Users/fnuser/.pub-cache/hosted/pub.flutter-io.cn/synchronized-2.2.0+2", "packageUri": "lib/", - "languageVersion": "2.6" + "languageVersion": "2.8" }, { "name": "tab_indicator_styler", @@ -513,9 +513,9 @@ }, { "name": "test_api", - "rootUri": "file:///Users/fnuser/.pub-cache/hosted/pub.flutter-io.cn/test_api-0.2.11", + "rootUri": "file:///Users/fnuser/.pub-cache/hosted/pub.flutter-io.cn/test_api-0.2.15", "packageUri": "lib/", - "languageVersion": "2.2" + "languageVersion": "2.4" }, { "name": "transformer_page_view", @@ -597,9 +597,9 @@ }, { "name": "xml", - "rootUri": "file:///Users/fnuser/.pub-cache/hosted/pub.flutter-io.cn/xml-3.5.0", + "rootUri": "file:///Users/fnuser/.pub-cache/hosted/pub.flutter-io.cn/xml-3.6.1", "packageUri": "lib/", - "languageVersion": "2.3" + "languageVersion": "2.6" }, { "name": "zhiying_comm", @@ -614,7 +614,7 @@ "languageVersion": "2.1" } ], - "generated": "2020-09-30T09:06:30.237124Z", + "generated": "2020-10-09T05:51:18.485612Z", "generator": "pub", - "generatorVersion": "2.7.2" + "generatorVersion": "2.8.2" } diff --git a/example/ios/Runner.xcodeproj/project.pbxproj b/example/ios/Runner.xcodeproj/project.pbxproj index 5002535..ae111d6 100644 --- a/example/ios/Runner.xcodeproj/project.pbxproj +++ b/example/ios/Runner.xcodeproj/project.pbxproj @@ -10,10 +10,6 @@ 0AE1282E2855C01A7663C354 /* libPods-Runner.a in Frameworks */ = {isa = PBXBuildFile; fileRef = A860D105A09AEA74261219D2 /* libPods-Runner.a */; }; 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; }; 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; - 3B80C3941E831B6300D905FE /* App.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; }; - 3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; - 9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; }; - 9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 978B8F6F1D3862AE00F588F7 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */; }; 97C146F31CF9000F007C117D /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 97C146F21CF9000F007C117D /* main.m */; }; 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; @@ -33,8 +29,6 @@ dstPath = ""; dstSubfolderSpec = 10; files = ( - 3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */, - 9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */, ); name = "Embed Frameworks"; runOnlyForDeploymentPostprocessing = 0; @@ -45,7 +39,6 @@ 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; }; 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; }; 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; - 3B80C3931E831B6300D905FE /* App.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = App.framework; path = Flutter/App.framework; sourceTree = ""; }; 3CF5E07C1CDF5F802B057127 /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = ""; }; 5F28AF46041AA2464EF2701A /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = ""; }; 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; @@ -53,7 +46,6 @@ 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; }; 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; }; - 9740EEBA1CF902C7004384FC /* Flutter.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Flutter.framework; path = Flutter/Flutter.framework; sourceTree = ""; }; 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; }; 97C146F21CF9000F007C117D /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; @@ -75,8 +67,6 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */, - 3B80C3941E831B6300D905FE /* App.framework in Frameworks */, 0AE1282E2855C01A7663C354 /* libPods-Runner.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; @@ -97,9 +87,7 @@ 9740EEB11CF90186004384FC /* Flutter */ = { isa = PBXGroup; children = ( - 3B80C3931E831B6300D905FE /* App.framework */, 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */, - 9740EEBA1CF902C7004384FC /* Flutter.framework */, 9740EEB21CF90195004384FC /* Debug.xcconfig */, 7AFA3C8E1D35360C0083082E /* Release.xcconfig */, 9740EEB31CF90195004384FC /* Generated.xcconfig */, @@ -311,7 +299,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" thin"; + shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin"; }; 3DD5E1C6552F1CEFD4C31B18 /* [CP] Embed Pods Frameworks */ = { isa = PBXShellScriptBuildPhase; diff --git a/lib/pages/test_page/test_page.dart b/lib/pages/test_page/test_page.dart new file mode 100644 index 0000000..1d6e9b0 --- /dev/null +++ b/lib/pages/test_page/test_page.dart @@ -0,0 +1,75 @@ +import 'package:flutter/material.dart'; +import 'package:zhiying_base_widget/widgets/home/home_goods/home_goods_item_single.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/net_util.dart'; + +class TestPage extends StatefulWidget { + @override + _TestPageState createState() => _TestPageState(); +} + +class _TestPageState extends State { + List _goods; + HomeGoodsStyleModel _styleModel; + + @override + void initState() { + NetUtil.request('/api/v1/rec/featured?page=3', method: NetMethod.GET, + onSuccess: (data) { + List goods = data['good']; + _styleModel = HomeGoodsStyleModel( + listColumn: '1', + // recommendList, + providerNameColor: '#ffffff', + providerNameBackgroundColor: '#ff4242', + shopNameColor: '#ffffff', + shopIcon: '', + couponFontColor: '#ffffff', + couponBgColor: '#ff4242', + commissionFontColor: '#ffffff', + commissionBgColor: '#ff4242', + marketPriceColor: '#ffffff', + currentPriceColor: '#ff4242', + ); + _goods = goods.map((e) { + return HomeGoodsModel.fromJson(Map.from(e)); + }).toList(); + setState(() {}); + }); + super.initState(); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: Text('测试'), + ), + body: CustomScrollView( + slivers: [ + SliverFixedExtentList( + itemExtent: 200.0, + delegate: new SliverChildBuilderDelegate( + (BuildContext context, int index) { + //创建列表项 + return HomeGoodsItemSingle( + _goods[index % _goods.length], _styleModel); + }, + childCount: (_goods?.length ?? 0) * 2000, //50个列表项 + ), + ), + // SliverToBoxAdapter( + // child: ListView.builder( + // shrinkWrap: true, + // physics: NeverScrollableScrollPhysics(), + // itemCount: (_goods?.length ?? 0) * 20, + // itemBuilder: (context, index) { + // return HomeGoodsItemSingle( + // _goods[index % _goods.length], _styleModel); + // }), + // ) + ], + )); + } +} diff --git a/lib/register.dart b/lib/register.dart index b5854ba..ec1df37 100644 --- a/lib/register.dart +++ b/lib/register.dart @@ -15,6 +15,7 @@ import 'package:zhiying_base_widget/pages/security_page/security_mobile/security import 'package:zhiying_base_widget/pages/security_page/security_page.dart'; import 'package:zhiying_base_widget/pages/security_page/security_password/security_password.dart'; import 'package:zhiying_base_widget/pages/setting_page/setting_page.dart'; +import 'package:zhiying_base_widget/pages/test_page/test_page.dart'; import 'package:zhiying_base_widget/pages/webview/base_webview.dart'; import 'package:zhiying_base_widget/widgets/goods_details/footer/goods_details_footer_widget.dart'; import 'package:zhiying_base_widget/widgets/goods_details/price/goods_details_price_widget.dart'; @@ -99,9 +100,11 @@ class BaseWidgetRegister { PageFactory.regist('goods_details', (model) => GoodsDetailsPage(model)); PageFactory.regist('search', (model) => SearchPage(model)); PageFactory.regist('search_item_page', (model) => SearchItemPage(model)); - PageFactory.regist('pub.flutter.search_index', (model) => SearchResultPage(model)); + PageFactory.regist( + 'pub.flutter.search_index', (model) => SearchResultPage(model)); PageFactory.regist( 'search_result_item', (model) => SearchResultItemPage(model)); + PageFactory.regist('pub.flutter.feedback', (model) => TestPage()); // PageFactory.regist('search_think_page', (model) => SearchThinkPage(model)); // PageFactory.regist('login', (model) => LoginPage(model)); // PageFactory.regist('login_quick', (model) => LoginQuickPage(model)); diff --git a/lib/widgets/home/home_goods/home_goods.dart b/lib/widgets/home/home_goods/home_goods.dart index 70d62f2..c26299f 100644 --- a/lib/widgets/home/home_goods/home_goods.dart +++ b/lib/widgets/home/home_goods/home_goods.dart @@ -11,7 +11,6 @@ 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_single.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_comm/util/base_bloc.dart'; class HomeGoods extends StatefulWidget { @@ -83,48 +82,51 @@ class _HomeGoodsContainerState extends State<_HomeGoodsContainer> { @override Widget build(BuildContext context) { - return Container( - width: double.infinity, - child: StreamBuilder>( - stream: _bloc.outData, - builder: (BuildContext context, AsyncSnapshot snapshot) { - if (snapshot.data == null) { - return HomeGoodsSkeleton(); - } - - List goods = snapshot.data; - int column = int.tryParse(_style.listColumn); - column = column <= 0 ? 1: column; - int count = (goods.length / column).ceil(); - return ListView.builder( - shrinkWrap: true, - physics: NeverScrollableScrollPhysics(), - itemCount: count, - itemBuilder: (context, index) { - if (column == 1) { - return HomeGoodsItemSingle( - goods[index], - _style, - 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 StreamBuilder>( + stream: _bloc.outData, + builder: (BuildContext context, AsyncSnapshot snapshot) { + // if (snapshot.data == null) { + // return SliverToBoxAdapter( + // child: HomeGoodsSkeleton(), + // ); + // } + + List goods = snapshot.data; + int column = int.tryParse(_style.listColumn); + column = column <= 0 ? 1 : column; + int count = ((goods?.length ?? 0) / column).ceil(); + return SliverFixedExtentList( + itemExtent: 200, + delegate: SliverChildBuilderDelegate((context, index) { + if (column == 1) { + return HomeGoodsItemSingle( + goods[index], + _style, + 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(), + ), + ); + } + }, childCount: count), + ); + }, ); } } diff --git a/lib/widgets/home/home_goods/home_goods_creater.dart b/lib/widgets/home/home_goods/home_goods_creater.dart index 2e2e5c3..315753a 100644 --- a/lib/widgets/home/home_goods/home_goods_creater.dart +++ b/lib/widgets/home/home_goods/home_goods_creater.dart @@ -23,9 +23,7 @@ class GoodsListCreater extends WidgetCreater { floating: false, delegate: HomeGoodsHeaderDelegate(_widget), ), - SliverToBoxAdapter( - child: HomeGoods(model, eventBus: _eventBus), - ), + HomeGoods(model, eventBus: _eventBus), ]; } diff --git a/pubspec.yaml b/pubspec.yaml index 3b79191..d34a675 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -39,7 +39,7 @@ dependencies: zhiying_comm: path: ../zhiying_comm - intl: 0.16.0 + intl: 0.16.1 dev_dependencies: flutter_test: