├── .gitignore ├── .metadata ├── README.md ├── android ├── app │ ├── build.gradle │ └── src │ │ └── main │ │ ├── AndroidManifest.xml │ │ ├── java │ │ └── com │ │ │ └── example │ │ │ └── fluttershop │ │ │ └── MainActivity.java │ │ └── res │ │ ├── drawable │ │ └── launch_background.xml │ │ ├── mipmap-hdpi │ │ └── ic_launcher.png │ │ ├── mipmap-mdpi │ │ └── ic_launcher.png │ │ ├── mipmap-xhdpi │ │ └── ic_launcher.png │ │ ├── mipmap-xxhdpi │ │ └── ic_launcher.png │ │ ├── mipmap-xxxhdpi │ │ └── ic_launcher.png │ │ └── values │ │ └── styles.xml ├── build.gradle ├── gradle.properties ├── gradle │ └── wrapper │ │ └── gradle-wrapper.properties └── settings.gradle ├── ios ├── Flutter │ ├── AppFrameworkInfo.plist │ ├── Debug.xcconfig │ └── Release.xcconfig ├── Runner.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ └── contents.xcworkspacedata │ └── xcshareddata │ │ └── xcschemes │ │ └── Runner.xcscheme ├── Runner.xcworkspace │ └── contents.xcworkspacedata └── Runner │ ├── AppDelegate.h │ ├── AppDelegate.m │ ├── Assets.xcassets │ ├── AppIcon.appiconset │ │ ├── Contents.json │ │ ├── Icon-App-1024x1024@1x.png │ │ ├── Icon-App-20x20@1x.png │ │ ├── Icon-App-20x20@2x.png │ │ ├── Icon-App-20x20@3x.png │ │ ├── Icon-App-29x29@1x.png │ │ ├── Icon-App-29x29@2x.png │ │ ├── Icon-App-29x29@3x.png │ │ ├── Icon-App-40x40@1x.png │ │ ├── Icon-App-40x40@2x.png │ │ ├── Icon-App-40x40@3x.png │ │ ├── Icon-App-60x60@2x.png │ │ ├── Icon-App-60x60@3x.png │ │ ├── Icon-App-76x76@1x.png │ │ ├── Icon-App-76x76@2x.png │ │ └── Icon-App-83.5x83.5@2x.png │ └── LaunchImage.imageset │ │ ├── Contents.json │ │ ├── LaunchImage.png │ │ ├── LaunchImage@2x.png │ │ ├── LaunchImage@3x.png │ │ └── README.md │ ├── Base.lproj │ ├── LaunchScreen.storyboard │ └── Main.storyboard │ ├── Info.plist │ └── main.m ├── lib ├── config │ ├── httpHeaders.dart │ └── service_url.dart ├── main.dart ├── model │ ├── cartInfo.dart │ ├── category.dart │ ├── categoryGoodsList.dart │ └── details.dart ├── pages │ ├── cart_page.dart │ ├── cart_page │ │ ├── cart_bottom.dart │ │ ├── cart_count.dart │ │ └── cart_item.dart │ ├── category_page.dart │ ├── details_page.dart │ ├── details_page │ │ ├── details_bottom.dart │ │ ├── details_explain.dart │ │ ├── details_tabbar.dart │ │ ├── details_top_area.dart │ │ └── details_web.dart │ ├── home_page.dart │ ├── index_page.dart │ └── member_page.dart ├── provide │ ├── cart.dart │ ├── category_goods_list.dart │ ├── child_category.dart │ ├── counter.dart │ ├── currentIndex.dart │ └── details_info.dart ├── routers │ ├── application.dart │ ├── router_handler.dart │ └── routes.dart └── service │ └── service_method.dart ├── pubspec.yaml └── test └── widget_test.dart /.gitignore: -------------------------------------------------------------------------------- 1 | # Miscellaneous 2 | *.class 3 | *.lock 4 | *.log 5 | *.pyc 6 | *.swp 7 | .DS_Store 8 | .atom/ 9 | .buildlog/ 10 | .history 11 | .svn/ 12 | 13 | # IntelliJ related 14 | *.iml 15 | *.ipr 16 | *.iws 17 | .idea/ 18 | 19 | # Visual Studio Code related 20 | .vscode/ 21 | 22 | # Flutter/Dart/Pub related 23 | **/doc/api/ 24 | .dart_tool/ 25 | .flutter-plugins 26 | .packages 27 | .pub-cache/ 28 | .pub/ 29 | build/ 30 | 31 | # Android related 32 | **/android/**/gradle-wrapper.jar 33 | **/android/.gradle 34 | **/android/captures/ 35 | **/android/gradlew 36 | **/android/gradlew.bat 37 | **/android/local.properties 38 | **/android/**/GeneratedPluginRegistrant.java 39 | 40 | # iOS/XCode related 41 | **/ios/**/*.mode1v3 42 | **/ios/**/*.mode2v3 43 | **/ios/**/*.moved-aside 44 | **/ios/**/*.pbxuser 45 | **/ios/**/*.perspectivev3 46 | **/ios/**/*sync/ 47 | **/ios/**/.sconsign.dblite 48 | **/ios/**/.tags* 49 | **/ios/**/.vagrant/ 50 | **/ios/**/DerivedData/ 51 | **/ios/**/Icon? 52 | **/ios/**/Pods/ 53 | **/ios/**/.symlinks/ 54 | **/ios/**/profile 55 | **/ios/**/xcuserdata 56 | **/ios/.generated/ 57 | **/ios/Flutter/App.framework 58 | **/ios/Flutter/Flutter.framework 59 | **/ios/Flutter/Generated.xcconfig 60 | **/ios/Flutter/app.flx 61 | **/ios/Flutter/app.zip 62 | **/ios/Flutter/flutter_assets/ 63 | **/ios/ServiceDefinitions.json 64 | **/ios/Runner/GeneratedPluginRegistrant.* 65 | 66 | # Exceptions to above rules. 67 | !**/ios/**/default.mode1v3 68 | !**/ios/**/default.mode2v3 69 | !**/ios/**/default.pbxuser 70 | !**/ios/**/default.perspectivev3 71 | !/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages 72 | -------------------------------------------------------------------------------- /.metadata: -------------------------------------------------------------------------------- 1 | # This file tracks properties of this Flutter project. 2 | # Used by Flutter tool to assess capabilities and perform upgrades etc. 3 | # 4 | # This file should be version controlled and should not be manually edited. 5 | 6 | version: 7 | revision: 5391447fae6209bb21a89e6a5a6583cac1af9b4b 8 | channel: stable 9 | 10 | project_type: app 11 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Flutter的移动电商实战 2 | 3 | 项目和教程都在更新中............ 4 | 5 | 完全模仿了百姓生活+小程序的项目,数据来自Fiddle提取,有完整的接口API文档。页面包括首页、商品列表页、商品详细页、购物车页面和会员中心。 6 | 7 | 目前项目还在开发当中,配有完整的视频和文字教程,是你Flutter进阶必备项目。 8 | 9 | ## 教程文章地址 10 | 11 | 教程文章地址(60节,超5万字教程,持续更新中):[https://jspang.com/post/FlutterShop.html](https://jspang.com/post/FlutterShop.html) 12 | 13 | ## 用到的组件 14 | 15 | - dio:用于向后端接口作HTTP请求数据 16 | - flutter_swiper: 轮播插件,制作了商城首页的轮播效果 17 | - flutter_screenutil:用于不同屏幕的适配,一次设计,适配所有屏幕 18 | - url_launcher:用于打开网页和实现原生电话的拨打 19 | - flutter_easyrefresh:下拉刷新或者上拉加载插件,方便好用,可定制。 20 | - provide:谷歌最新推出的Flutter状态管理插件,亲儿子,用的爽。 21 | - fluttertoast:Toast轻提示插件,APP必不可少,IOS和Android通用。 22 | 23 | 24 | ## 图片展示 25 | 26 | ![商城图片](http://blogimages.jspang.com/Flutter_shop_01.jpg) 27 | 28 | 29 | ## 所有项目知识点梳理 30 | 31 | ![知识点梳理](http://blogimages.jspang.com/Flutter%E7%A7%BB%E5%8A%A8%E7%94%B5%E5%95%86%E5%AE%9E%E6%88%98-%E7%9F%A5%E8%AF%86%E7%82%B9%E6%A2%B3%E7%90%86.png) 32 | 33 | 34 | ## 更新日志: 35 | 36 | - 商品分类页面增加了打开详细页的功能。[2019/4/23] 37 | 38 | - 更新首页的分类导航,跳转到分类页面,并且可以跟随变化。[2019/4/22] 39 | 40 | - 商品详细页面主要UI布局完成,还有app的路由系统制作完成。[2019/4/4] 41 | 42 | - 第一次上传项目到GitHub上,我已经写了35课教程,把首页和商品分类页面制作完成。[2019/3/28] 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | ## 知识架构图 51 | 52 | 53 | ## 一起学习 54 | 55 | 我建立了一个QQ群,大家一起学习: 56 | 57 | **qq群:806799257** 58 | 59 | 入群问题:Flutter出自于哪个公司? 60 | 61 | 入群答案:google (注意全小写,最好用电脑端加入,移动端Bug) 62 | 63 | 64 | 65 | 66 | -------------------------------------------------------------------------------- /android/app/build.gradle: -------------------------------------------------------------------------------- 1 | def localProperties = new Properties() 2 | def localPropertiesFile = rootProject.file('local.properties') 3 | if (localPropertiesFile.exists()) { 4 | localPropertiesFile.withReader('UTF-8') { reader -> 5 | localProperties.load(reader) 6 | } 7 | } 8 | 9 | def flutterRoot = localProperties.getProperty('flutter.sdk') 10 | if (flutterRoot == null) { 11 | throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") 12 | } 13 | 14 | def flutterVersionCode = localProperties.getProperty('flutter.versionCode') 15 | if (flutterVersionCode == null) { 16 | flutterVersionCode = '1' 17 | } 18 | 19 | def flutterVersionName = localProperties.getProperty('flutter.versionName') 20 | if (flutterVersionName == null) { 21 | flutterVersionName = '1.0' 22 | } 23 | 24 | apply plugin: 'com.android.application' 25 | apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" 26 | 27 | android { 28 | compileSdkVersion 27 29 | 30 | lintOptions { 31 | disable 'InvalidPackage' 32 | } 33 | 34 | defaultConfig { 35 | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). 36 | applicationId "com.example.fluttershop" 37 | minSdkVersion 16 38 | targetSdkVersion 27 39 | versionCode flutterVersionCode.toInteger() 40 | versionName flutterVersionName 41 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 42 | } 43 | 44 | buildTypes { 45 | release { 46 | // TODO: Add your own signing config for the release build. 47 | // Signing with the debug keys for now, so `flutter run --release` works. 48 | signingConfig signingConfigs.debug 49 | } 50 | } 51 | } 52 | 53 | flutter { 54 | source '../..' 55 | } 56 | 57 | dependencies { 58 | testImplementation 'junit:junit:4.12' 59 | androidTestImplementation 'com.android.support.test:runner:1.0.2' 60 | androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2' 61 | } 62 | -------------------------------------------------------------------------------- /android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 8 | 9 | 10 | 15 | 19 | 26 | 30 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /android/app/src/main/java/com/example/fluttershop/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.example.fluttershop; 2 | 3 | import android.os.Bundle; 4 | import io.flutter.app.FlutterActivity; 5 | import io.flutter.plugins.GeneratedPluginRegistrant; 6 | 7 | public class MainActivity extends FlutterActivity { 8 | @Override 9 | protected void onCreate(Bundle savedInstanceState) { 10 | super.onCreate(savedInstanceState); 11 | GeneratedPluginRegistrant.registerWith(this); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /android/app/src/main/res/drawable/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shenghy/flutter_shop/05ff32f82176b1f98cacccac16bd9e07efa17f2c/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shenghy/flutter_shop/05ff32f82176b1f98cacccac16bd9e07efa17f2c/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shenghy/flutter_shop/05ff32f82176b1f98cacccac16bd9e07efa17f2c/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shenghy/flutter_shop/05ff32f82176b1f98cacccac16bd9e07efa17f2c/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shenghy/flutter_shop/05ff32f82176b1f98cacccac16bd9e07efa17f2c/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | -------------------------------------------------------------------------------- /android/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | repositories { 3 | google() 4 | jcenter() 5 | } 6 | 7 | dependencies { 8 | classpath 'com.android.tools.build:gradle:3.2.1' 9 | } 10 | } 11 | 12 | allprojects { 13 | repositories { 14 | google() 15 | jcenter() 16 | } 17 | } 18 | 19 | rootProject.buildDir = '../build' 20 | subprojects { 21 | project.buildDir = "${rootProject.buildDir}/${project.name}" 22 | } 23 | subprojects { 24 | project.evaluationDependsOn(':app') 25 | } 26 | 27 | task clean(type: Delete) { 28 | delete rootProject.buildDir 29 | } 30 | -------------------------------------------------------------------------------- /android/gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xmx1536M 2 | -------------------------------------------------------------------------------- /android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Fri Jun 23 08:50:38 CEST 2017 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-all.zip 7 | -------------------------------------------------------------------------------- /android/settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | 3 | def flutterProjectRoot = rootProject.projectDir.parentFile.toPath() 4 | 5 | def plugins = new Properties() 6 | def pluginsFile = new File(flutterProjectRoot.toFile(), '.flutter-plugins') 7 | if (pluginsFile.exists()) { 8 | pluginsFile.withReader('UTF-8') { reader -> plugins.load(reader) } 9 | } 10 | 11 | plugins.each { name, path -> 12 | def pluginDirectory = flutterProjectRoot.resolve(path).resolve('android').toFile() 13 | include ":$name" 14 | project(":$name").projectDir = pluginDirectory 15 | } 16 | -------------------------------------------------------------------------------- /ios/Flutter/AppFrameworkInfo.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | App 9 | CFBundleIdentifier 10 | io.flutter.flutter.app 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | App 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1.0 23 | MinimumOSVersion 24 | 8.0 25 | 26 | 27 | -------------------------------------------------------------------------------- /ios/Flutter/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Generated.xcconfig" 2 | -------------------------------------------------------------------------------- /ios/Flutter/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Generated.xcconfig" 2 | -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; }; 11 | 2D5378261FAA1A9400D5DBA9 /* flutter_assets in Resources */ = {isa = PBXBuildFile; fileRef = 2D5378251FAA1A9400D5DBA9 /* flutter_assets */; }; 12 | 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; 13 | 3B80C3941E831B6300D905FE /* App.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; }; 14 | 3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 15 | 9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; }; 16 | 9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 17 | 9740EEB41CF90195004384FC /* Debug.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = 9740EEB21CF90195004384FC /* Debug.xcconfig */; }; 18 | 978B8F6F1D3862AE00F588F7 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */; }; 19 | 97C146F31CF9000F007C117D /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 97C146F21CF9000F007C117D /* main.m */; }; 20 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; 21 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; 22 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; 23 | /* End PBXBuildFile section */ 24 | 25 | /* Begin PBXCopyFilesBuildPhase section */ 26 | 9705A1C41CF9048500538489 /* Embed Frameworks */ = { 27 | isa = PBXCopyFilesBuildPhase; 28 | buildActionMask = 2147483647; 29 | dstPath = ""; 30 | dstSubfolderSpec = 10; 31 | files = ( 32 | 3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */, 33 | 9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */, 34 | ); 35 | name = "Embed Frameworks"; 36 | runOnlyForDeploymentPostprocessing = 0; 37 | }; 38 | /* End PBXCopyFilesBuildPhase section */ 39 | 40 | /* Begin PBXFileReference section */ 41 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; }; 42 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; }; 43 | 2D5378251FAA1A9400D5DBA9 /* flutter_assets */ = {isa = PBXFileReference; lastKnownFileType = folder; name = flutter_assets; path = Flutter/flutter_assets; sourceTree = SOURCE_ROOT; }; 44 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; 45 | 3B80C3931E831B6300D905FE /* App.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = App.framework; path = Flutter/App.framework; sourceTree = ""; }; 46 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; 47 | 7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 48 | 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 49 | 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; }; 50 | 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; }; 51 | 9740EEBA1CF902C7004384FC /* Flutter.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Flutter.framework; path = Flutter/Flutter.framework; sourceTree = ""; }; 52 | 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; }; 53 | 97C146F21CF9000F007C117D /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 54 | 97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 55 | 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 56 | 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 57 | 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 58 | /* End PBXFileReference section */ 59 | 60 | /* Begin PBXFrameworksBuildPhase section */ 61 | 97C146EB1CF9000F007C117D /* Frameworks */ = { 62 | isa = PBXFrameworksBuildPhase; 63 | buildActionMask = 2147483647; 64 | files = ( 65 | 9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */, 66 | 3B80C3941E831B6300D905FE /* App.framework in Frameworks */, 67 | ); 68 | runOnlyForDeploymentPostprocessing = 0; 69 | }; 70 | /* End PBXFrameworksBuildPhase section */ 71 | 72 | /* Begin PBXGroup section */ 73 | 9740EEB11CF90186004384FC /* Flutter */ = { 74 | isa = PBXGroup; 75 | children = ( 76 | 2D5378251FAA1A9400D5DBA9 /* flutter_assets */, 77 | 3B80C3931E831B6300D905FE /* App.framework */, 78 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */, 79 | 9740EEBA1CF902C7004384FC /* Flutter.framework */, 80 | 9740EEB21CF90195004384FC /* Debug.xcconfig */, 81 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */, 82 | 9740EEB31CF90195004384FC /* Generated.xcconfig */, 83 | ); 84 | name = Flutter; 85 | sourceTree = ""; 86 | }; 87 | 97C146E51CF9000F007C117D = { 88 | isa = PBXGroup; 89 | children = ( 90 | 9740EEB11CF90186004384FC /* Flutter */, 91 | 97C146F01CF9000F007C117D /* Runner */, 92 | 97C146EF1CF9000F007C117D /* Products */, 93 | CF3B75C9A7D2FA2A4C99F110 /* Frameworks */, 94 | ); 95 | sourceTree = ""; 96 | }; 97 | 97C146EF1CF9000F007C117D /* Products */ = { 98 | isa = PBXGroup; 99 | children = ( 100 | 97C146EE1CF9000F007C117D /* Runner.app */, 101 | ); 102 | name = Products; 103 | sourceTree = ""; 104 | }; 105 | 97C146F01CF9000F007C117D /* Runner */ = { 106 | isa = PBXGroup; 107 | children = ( 108 | 7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */, 109 | 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */, 110 | 97C146FA1CF9000F007C117D /* Main.storyboard */, 111 | 97C146FD1CF9000F007C117D /* Assets.xcassets */, 112 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */, 113 | 97C147021CF9000F007C117D /* Info.plist */, 114 | 97C146F11CF9000F007C117D /* Supporting Files */, 115 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */, 116 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */, 117 | ); 118 | path = Runner; 119 | sourceTree = ""; 120 | }; 121 | 97C146F11CF9000F007C117D /* Supporting Files */ = { 122 | isa = PBXGroup; 123 | children = ( 124 | 97C146F21CF9000F007C117D /* main.m */, 125 | ); 126 | name = "Supporting Files"; 127 | sourceTree = ""; 128 | }; 129 | /* End PBXGroup section */ 130 | 131 | /* Begin PBXNativeTarget section */ 132 | 97C146ED1CF9000F007C117D /* Runner */ = { 133 | isa = PBXNativeTarget; 134 | buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; 135 | buildPhases = ( 136 | 9740EEB61CF901F6004384FC /* Run Script */, 137 | 97C146EA1CF9000F007C117D /* Sources */, 138 | 97C146EB1CF9000F007C117D /* Frameworks */, 139 | 97C146EC1CF9000F007C117D /* Resources */, 140 | 9705A1C41CF9048500538489 /* Embed Frameworks */, 141 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */, 142 | ); 143 | buildRules = ( 144 | ); 145 | dependencies = ( 146 | ); 147 | name = Runner; 148 | productName = Runner; 149 | productReference = 97C146EE1CF9000F007C117D /* Runner.app */; 150 | productType = "com.apple.product-type.application"; 151 | }; 152 | /* End PBXNativeTarget section */ 153 | 154 | /* Begin PBXProject section */ 155 | 97C146E61CF9000F007C117D /* Project object */ = { 156 | isa = PBXProject; 157 | attributes = { 158 | LastUpgradeCheck = 0910; 159 | ORGANIZATIONNAME = "The Chromium Authors"; 160 | TargetAttributes = { 161 | 97C146ED1CF9000F007C117D = { 162 | CreatedOnToolsVersion = 7.3.1; 163 | }; 164 | }; 165 | }; 166 | buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */; 167 | compatibilityVersion = "Xcode 3.2"; 168 | developmentRegion = English; 169 | hasScannedForEncodings = 0; 170 | knownRegions = ( 171 | en, 172 | Base, 173 | ); 174 | mainGroup = 97C146E51CF9000F007C117D; 175 | productRefGroup = 97C146EF1CF9000F007C117D /* Products */; 176 | projectDirPath = ""; 177 | projectRoot = ""; 178 | targets = ( 179 | 97C146ED1CF9000F007C117D /* Runner */, 180 | ); 181 | }; 182 | /* End PBXProject section */ 183 | 184 | /* Begin PBXResourcesBuildPhase section */ 185 | 97C146EC1CF9000F007C117D /* Resources */ = { 186 | isa = PBXResourcesBuildPhase; 187 | buildActionMask = 2147483647; 188 | files = ( 189 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */, 190 | 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */, 191 | 9740EEB41CF90195004384FC /* Debug.xcconfig in Resources */, 192 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */, 193 | 2D5378261FAA1A9400D5DBA9 /* flutter_assets in Resources */, 194 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */, 195 | ); 196 | runOnlyForDeploymentPostprocessing = 0; 197 | }; 198 | /* End PBXResourcesBuildPhase section */ 199 | 200 | /* Begin PBXShellScriptBuildPhase section */ 201 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { 202 | isa = PBXShellScriptBuildPhase; 203 | buildActionMask = 2147483647; 204 | files = ( 205 | ); 206 | inputPaths = ( 207 | ); 208 | name = "Thin Binary"; 209 | outputPaths = ( 210 | ); 211 | runOnlyForDeploymentPostprocessing = 0; 212 | shellPath = /bin/sh; 213 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" thin"; 214 | }; 215 | 9740EEB61CF901F6004384FC /* Run Script */ = { 216 | isa = PBXShellScriptBuildPhase; 217 | buildActionMask = 2147483647; 218 | files = ( 219 | ); 220 | inputPaths = ( 221 | ); 222 | name = "Run Script"; 223 | outputPaths = ( 224 | ); 225 | runOnlyForDeploymentPostprocessing = 0; 226 | shellPath = /bin/sh; 227 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; 228 | }; 229 | /* End PBXShellScriptBuildPhase section */ 230 | 231 | /* Begin PBXSourcesBuildPhase section */ 232 | 97C146EA1CF9000F007C117D /* Sources */ = { 233 | isa = PBXSourcesBuildPhase; 234 | buildActionMask = 2147483647; 235 | files = ( 236 | 978B8F6F1D3862AE00F588F7 /* AppDelegate.m in Sources */, 237 | 97C146F31CF9000F007C117D /* main.m in Sources */, 238 | 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */, 239 | ); 240 | runOnlyForDeploymentPostprocessing = 0; 241 | }; 242 | /* End PBXSourcesBuildPhase section */ 243 | 244 | /* Begin PBXVariantGroup section */ 245 | 97C146FA1CF9000F007C117D /* Main.storyboard */ = { 246 | isa = PBXVariantGroup; 247 | children = ( 248 | 97C146FB1CF9000F007C117D /* Base */, 249 | ); 250 | name = Main.storyboard; 251 | sourceTree = ""; 252 | }; 253 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */ = { 254 | isa = PBXVariantGroup; 255 | children = ( 256 | 97C147001CF9000F007C117D /* Base */, 257 | ); 258 | name = LaunchScreen.storyboard; 259 | sourceTree = ""; 260 | }; 261 | /* End PBXVariantGroup section */ 262 | 263 | /* Begin XCBuildConfiguration section */ 264 | 249021D3217E4FDB00AE95B9 /* Profile */ = { 265 | isa = XCBuildConfiguration; 266 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 267 | buildSettings = { 268 | ALWAYS_SEARCH_USER_PATHS = NO; 269 | CLANG_ANALYZER_NONNULL = YES; 270 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 271 | CLANG_CXX_LIBRARY = "libc++"; 272 | CLANG_ENABLE_MODULES = YES; 273 | CLANG_ENABLE_OBJC_ARC = YES; 274 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 275 | CLANG_WARN_BOOL_CONVERSION = YES; 276 | CLANG_WARN_COMMA = YES; 277 | CLANG_WARN_CONSTANT_CONVERSION = YES; 278 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 279 | CLANG_WARN_EMPTY_BODY = YES; 280 | CLANG_WARN_ENUM_CONVERSION = YES; 281 | CLANG_WARN_INFINITE_RECURSION = YES; 282 | CLANG_WARN_INT_CONVERSION = YES; 283 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 284 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 285 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 286 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 287 | CLANG_WARN_STRICT_PROTOTYPES = YES; 288 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 289 | CLANG_WARN_UNREACHABLE_CODE = YES; 290 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 291 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 292 | COPY_PHASE_STRIP = NO; 293 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 294 | ENABLE_NS_ASSERTIONS = NO; 295 | ENABLE_STRICT_OBJC_MSGSEND = YES; 296 | GCC_C_LANGUAGE_STANDARD = gnu99; 297 | GCC_NO_COMMON_BLOCKS = YES; 298 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 299 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 300 | GCC_WARN_UNDECLARED_SELECTOR = YES; 301 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 302 | GCC_WARN_UNUSED_FUNCTION = YES; 303 | GCC_WARN_UNUSED_VARIABLE = YES; 304 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 305 | MTL_ENABLE_DEBUG_INFO = NO; 306 | SDKROOT = iphoneos; 307 | TARGETED_DEVICE_FAMILY = "1,2"; 308 | VALIDATE_PRODUCT = YES; 309 | }; 310 | name = Profile; 311 | }; 312 | 249021D4217E4FDB00AE95B9 /* Profile */ = { 313 | isa = XCBuildConfiguration; 314 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 315 | buildSettings = { 316 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 317 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 318 | DEVELOPMENT_TEAM = S8QB4VV633; 319 | ENABLE_BITCODE = NO; 320 | FRAMEWORK_SEARCH_PATHS = ( 321 | "$(inherited)", 322 | "$(PROJECT_DIR)/Flutter", 323 | ); 324 | INFOPLIST_FILE = Runner/Info.plist; 325 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 326 | LIBRARY_SEARCH_PATHS = ( 327 | "$(inherited)", 328 | "$(PROJECT_DIR)/Flutter", 329 | ); 330 | PRODUCT_BUNDLE_IDENTIFIER = com.example.flutterShop; 331 | PRODUCT_NAME = "$(TARGET_NAME)"; 332 | VERSIONING_SYSTEM = "apple-generic"; 333 | }; 334 | name = Profile; 335 | }; 336 | 97C147031CF9000F007C117D /* Debug */ = { 337 | isa = XCBuildConfiguration; 338 | baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; 339 | buildSettings = { 340 | ALWAYS_SEARCH_USER_PATHS = NO; 341 | CLANG_ANALYZER_NONNULL = YES; 342 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 343 | CLANG_CXX_LIBRARY = "libc++"; 344 | CLANG_ENABLE_MODULES = YES; 345 | CLANG_ENABLE_OBJC_ARC = YES; 346 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 347 | CLANG_WARN_BOOL_CONVERSION = YES; 348 | CLANG_WARN_COMMA = YES; 349 | CLANG_WARN_CONSTANT_CONVERSION = YES; 350 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 351 | CLANG_WARN_EMPTY_BODY = YES; 352 | CLANG_WARN_ENUM_CONVERSION = YES; 353 | CLANG_WARN_INFINITE_RECURSION = YES; 354 | CLANG_WARN_INT_CONVERSION = YES; 355 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 356 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 357 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 358 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 359 | CLANG_WARN_STRICT_PROTOTYPES = YES; 360 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 361 | CLANG_WARN_UNREACHABLE_CODE = YES; 362 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 363 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 364 | COPY_PHASE_STRIP = NO; 365 | DEBUG_INFORMATION_FORMAT = dwarf; 366 | ENABLE_STRICT_OBJC_MSGSEND = YES; 367 | ENABLE_TESTABILITY = YES; 368 | GCC_C_LANGUAGE_STANDARD = gnu99; 369 | GCC_DYNAMIC_NO_PIC = NO; 370 | GCC_NO_COMMON_BLOCKS = YES; 371 | GCC_OPTIMIZATION_LEVEL = 0; 372 | GCC_PREPROCESSOR_DEFINITIONS = ( 373 | "DEBUG=1", 374 | "$(inherited)", 375 | ); 376 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 377 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 378 | GCC_WARN_UNDECLARED_SELECTOR = YES; 379 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 380 | GCC_WARN_UNUSED_FUNCTION = YES; 381 | GCC_WARN_UNUSED_VARIABLE = YES; 382 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 383 | MTL_ENABLE_DEBUG_INFO = YES; 384 | ONLY_ACTIVE_ARCH = YES; 385 | SDKROOT = iphoneos; 386 | TARGETED_DEVICE_FAMILY = "1,2"; 387 | }; 388 | name = Debug; 389 | }; 390 | 97C147041CF9000F007C117D /* Release */ = { 391 | isa = XCBuildConfiguration; 392 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 393 | buildSettings = { 394 | ALWAYS_SEARCH_USER_PATHS = NO; 395 | CLANG_ANALYZER_NONNULL = YES; 396 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 397 | CLANG_CXX_LIBRARY = "libc++"; 398 | CLANG_ENABLE_MODULES = YES; 399 | CLANG_ENABLE_OBJC_ARC = YES; 400 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 401 | CLANG_WARN_BOOL_CONVERSION = YES; 402 | CLANG_WARN_COMMA = YES; 403 | CLANG_WARN_CONSTANT_CONVERSION = YES; 404 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 405 | CLANG_WARN_EMPTY_BODY = YES; 406 | CLANG_WARN_ENUM_CONVERSION = YES; 407 | CLANG_WARN_INFINITE_RECURSION = YES; 408 | CLANG_WARN_INT_CONVERSION = YES; 409 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 410 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 411 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 412 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 413 | CLANG_WARN_STRICT_PROTOTYPES = YES; 414 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 415 | CLANG_WARN_UNREACHABLE_CODE = YES; 416 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 417 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 418 | COPY_PHASE_STRIP = NO; 419 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 420 | ENABLE_NS_ASSERTIONS = NO; 421 | ENABLE_STRICT_OBJC_MSGSEND = YES; 422 | GCC_C_LANGUAGE_STANDARD = gnu99; 423 | GCC_NO_COMMON_BLOCKS = YES; 424 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 425 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 426 | GCC_WARN_UNDECLARED_SELECTOR = YES; 427 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 428 | GCC_WARN_UNUSED_FUNCTION = YES; 429 | GCC_WARN_UNUSED_VARIABLE = YES; 430 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 431 | MTL_ENABLE_DEBUG_INFO = NO; 432 | SDKROOT = iphoneos; 433 | TARGETED_DEVICE_FAMILY = "1,2"; 434 | VALIDATE_PRODUCT = YES; 435 | }; 436 | name = Release; 437 | }; 438 | 97C147061CF9000F007C117D /* Debug */ = { 439 | isa = XCBuildConfiguration; 440 | baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; 441 | buildSettings = { 442 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 443 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 444 | ENABLE_BITCODE = NO; 445 | FRAMEWORK_SEARCH_PATHS = ( 446 | "$(inherited)", 447 | "$(PROJECT_DIR)/Flutter", 448 | ); 449 | INFOPLIST_FILE = Runner/Info.plist; 450 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 451 | LIBRARY_SEARCH_PATHS = ( 452 | "$(inherited)", 453 | "$(PROJECT_DIR)/Flutter", 454 | ); 455 | PRODUCT_BUNDLE_IDENTIFIER = com.example.flutterShop; 456 | PRODUCT_NAME = "$(TARGET_NAME)"; 457 | VERSIONING_SYSTEM = "apple-generic"; 458 | }; 459 | name = Debug; 460 | }; 461 | 97C147071CF9000F007C117D /* Release */ = { 462 | isa = XCBuildConfiguration; 463 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 464 | buildSettings = { 465 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 466 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 467 | ENABLE_BITCODE = NO; 468 | FRAMEWORK_SEARCH_PATHS = ( 469 | "$(inherited)", 470 | "$(PROJECT_DIR)/Flutter", 471 | ); 472 | INFOPLIST_FILE = Runner/Info.plist; 473 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 474 | LIBRARY_SEARCH_PATHS = ( 475 | "$(inherited)", 476 | "$(PROJECT_DIR)/Flutter", 477 | ); 478 | PRODUCT_BUNDLE_IDENTIFIER = com.example.flutterShop; 479 | PRODUCT_NAME = "$(TARGET_NAME)"; 480 | VERSIONING_SYSTEM = "apple-generic"; 481 | }; 482 | name = Release; 483 | }; 484 | /* End XCBuildConfiguration section */ 485 | 486 | /* Begin XCConfigurationList section */ 487 | 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = { 488 | isa = XCConfigurationList; 489 | buildConfigurations = ( 490 | 97C147031CF9000F007C117D /* Debug */, 491 | 97C147041CF9000F007C117D /* Release */, 492 | 249021D3217E4FDB00AE95B9 /* Profile */, 493 | ); 494 | defaultConfigurationIsVisible = 0; 495 | defaultConfigurationName = Release; 496 | }; 497 | 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */ = { 498 | isa = XCConfigurationList; 499 | buildConfigurations = ( 500 | 97C147061CF9000F007C117D /* Debug */, 501 | 97C147071CF9000F007C117D /* Release */, 502 | 249021D4217E4FDB00AE95B9 /* Profile */, 503 | ); 504 | defaultConfigurationIsVisible = 0; 505 | defaultConfigurationName = Release; 506 | }; 507 | /* End XCConfigurationList section */ 508 | }; 509 | rootObject = 97C146E61CF9000F007C117D /* Project object */; 510 | } 511 | -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 31 | 32 | 33 | 34 | 40 | 41 | 42 | 43 | 44 | 45 | 56 | 58 | 64 | 65 | 66 | 67 | 68 | 69 | 75 | 77 | 83 | 84 | 85 | 86 | 88 | 89 | 92 | 93 | 94 | -------------------------------------------------------------------------------- /ios/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /ios/Runner/AppDelegate.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | 4 | @interface AppDelegate : FlutterAppDelegate 5 | 6 | @end 7 | -------------------------------------------------------------------------------- /ios/Runner/AppDelegate.m: -------------------------------------------------------------------------------- 1 | #include "AppDelegate.h" 2 | #include "GeneratedPluginRegistrant.h" 3 | 4 | @implementation AppDelegate 5 | 6 | - (BOOL)application:(UIApplication *)application 7 | didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 8 | [GeneratedPluginRegistrant registerWithRegistry:self]; 9 | // Override point for customization after application launch. 10 | return [super application:application didFinishLaunchingWithOptions:launchOptions]; 11 | } 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "size" : "20x20", 5 | "idiom" : "iphone", 6 | "filename" : "Icon-App-20x20@2x.png", 7 | "scale" : "2x" 8 | }, 9 | { 10 | "size" : "20x20", 11 | "idiom" : "iphone", 12 | "filename" : "Icon-App-20x20@3x.png", 13 | "scale" : "3x" 14 | }, 15 | { 16 | "size" : "29x29", 17 | "idiom" : "iphone", 18 | "filename" : "Icon-App-29x29@1x.png", 19 | "scale" : "1x" 20 | }, 21 | { 22 | "size" : "29x29", 23 | "idiom" : "iphone", 24 | "filename" : "Icon-App-29x29@2x.png", 25 | "scale" : "2x" 26 | }, 27 | { 28 | "size" : "29x29", 29 | "idiom" : "iphone", 30 | "filename" : "Icon-App-29x29@3x.png", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "size" : "40x40", 35 | "idiom" : "iphone", 36 | "filename" : "Icon-App-40x40@2x.png", 37 | "scale" : "2x" 38 | }, 39 | { 40 | "size" : "40x40", 41 | "idiom" : "iphone", 42 | "filename" : "Icon-App-40x40@3x.png", 43 | "scale" : "3x" 44 | }, 45 | { 46 | "size" : "60x60", 47 | "idiom" : "iphone", 48 | "filename" : "Icon-App-60x60@2x.png", 49 | "scale" : "2x" 50 | }, 51 | { 52 | "size" : "60x60", 53 | "idiom" : "iphone", 54 | "filename" : "Icon-App-60x60@3x.png", 55 | "scale" : "3x" 56 | }, 57 | { 58 | "size" : "20x20", 59 | "idiom" : "ipad", 60 | "filename" : "Icon-App-20x20@1x.png", 61 | "scale" : "1x" 62 | }, 63 | { 64 | "size" : "20x20", 65 | "idiom" : "ipad", 66 | "filename" : "Icon-App-20x20@2x.png", 67 | "scale" : "2x" 68 | }, 69 | { 70 | "size" : "29x29", 71 | "idiom" : "ipad", 72 | "filename" : "Icon-App-29x29@1x.png", 73 | "scale" : "1x" 74 | }, 75 | { 76 | "size" : "29x29", 77 | "idiom" : "ipad", 78 | "filename" : "Icon-App-29x29@2x.png", 79 | "scale" : "2x" 80 | }, 81 | { 82 | "size" : "40x40", 83 | "idiom" : "ipad", 84 | "filename" : "Icon-App-40x40@1x.png", 85 | "scale" : "1x" 86 | }, 87 | { 88 | "size" : "40x40", 89 | "idiom" : "ipad", 90 | "filename" : "Icon-App-40x40@2x.png", 91 | "scale" : "2x" 92 | }, 93 | { 94 | "size" : "76x76", 95 | "idiom" : "ipad", 96 | "filename" : "Icon-App-76x76@1x.png", 97 | "scale" : "1x" 98 | }, 99 | { 100 | "size" : "76x76", 101 | "idiom" : "ipad", 102 | "filename" : "Icon-App-76x76@2x.png", 103 | "scale" : "2x" 104 | }, 105 | { 106 | "size" : "83.5x83.5", 107 | "idiom" : "ipad", 108 | "filename" : "Icon-App-83.5x83.5@2x.png", 109 | "scale" : "2x" 110 | }, 111 | { 112 | "size" : "1024x1024", 113 | "idiom" : "ios-marketing", 114 | "filename" : "Icon-App-1024x1024@1x.png", 115 | "scale" : "1x" 116 | } 117 | ], 118 | "info" : { 119 | "version" : 1, 120 | "author" : "xcode" 121 | } 122 | } 123 | -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shenghy/flutter_shop/05ff32f82176b1f98cacccac16bd9e07efa17f2c/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shenghy/flutter_shop/05ff32f82176b1f98cacccac16bd9e07efa17f2c/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shenghy/flutter_shop/05ff32f82176b1f98cacccac16bd9e07efa17f2c/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shenghy/flutter_shop/05ff32f82176b1f98cacccac16bd9e07efa17f2c/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shenghy/flutter_shop/05ff32f82176b1f98cacccac16bd9e07efa17f2c/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shenghy/flutter_shop/05ff32f82176b1f98cacccac16bd9e07efa17f2c/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shenghy/flutter_shop/05ff32f82176b1f98cacccac16bd9e07efa17f2c/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shenghy/flutter_shop/05ff32f82176b1f98cacccac16bd9e07efa17f2c/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shenghy/flutter_shop/05ff32f82176b1f98cacccac16bd9e07efa17f2c/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shenghy/flutter_shop/05ff32f82176b1f98cacccac16bd9e07efa17f2c/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shenghy/flutter_shop/05ff32f82176b1f98cacccac16bd9e07efa17f2c/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shenghy/flutter_shop/05ff32f82176b1f98cacccac16bd9e07efa17f2c/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shenghy/flutter_shop/05ff32f82176b1f98cacccac16bd9e07efa17f2c/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shenghy/flutter_shop/05ff32f82176b1f98cacccac16bd9e07efa17f2c/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shenghy/flutter_shop/05ff32f82176b1f98cacccac16bd9e07efa17f2c/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "LaunchImage.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "LaunchImage@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "filename" : "LaunchImage@3x.png", 16 | "scale" : "3x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shenghy/flutter_shop/05ff32f82176b1f98cacccac16bd9e07efa17f2c/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shenghy/flutter_shop/05ff32f82176b1f98cacccac16bd9e07efa17f2c/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shenghy/flutter_shop/05ff32f82176b1f98cacccac16bd9e07efa17f2c/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md: -------------------------------------------------------------------------------- 1 | # Launch Screen Assets 2 | 3 | You can customize the launch screen with your own desired assets by replacing the image files in this directory. 4 | 5 | You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images. -------------------------------------------------------------------------------- /ios/Runner/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /ios/Runner/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /ios/Runner/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | flutter_shop 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | $(FLUTTER_BUILD_NAME) 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | $(FLUTTER_BUILD_NUMBER) 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UISupportedInterfaceOrientations 30 | 31 | UIInterfaceOrientationPortrait 32 | UIInterfaceOrientationLandscapeLeft 33 | UIInterfaceOrientationLandscapeRight 34 | 35 | UISupportedInterfaceOrientations~ipad 36 | 37 | UIInterfaceOrientationPortrait 38 | UIInterfaceOrientationPortraitUpsideDown 39 | UIInterfaceOrientationLandscapeLeft 40 | UIInterfaceOrientationLandscapeRight 41 | 42 | UIViewControllerBasedStatusBarAppearance 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /ios/Runner/main.m: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | #import "AppDelegate.h" 4 | 5 | int main(int argc, char* argv[]) { 6 | @autoreleasepool { 7 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /lib/config/httpHeaders.dart: -------------------------------------------------------------------------------- 1 | const httpHeaders={ 2 | 'Accept': 'application/json, text/plain, */*', 3 | 'Accept-Encoding': 'gzip, deflate, br', 4 | 'Accept-Language': 'zh-CN,zh;q=0.9', 5 | 'Connection': 'keep-alive', 6 | 'Content-Type': 'application/json', 7 | 'Cookie': '_ga=GA1.2.676402787.1548321037; GCID=9d149c5-11cb3b3-80ad198-04b551d; _gid=GA1.2.359074521.1550799897; _gat=1; Hm_lvt_022f847c4e3acd44d4a2481d9187f1e6=1550106367,1550115714,1550123110,1550799897; SERVERID=1fa1f330efedec1559b3abbcb6e30f50|1550799909|1550799898; Hm_lpvt_022f847c4e3acd44d4a2481d9187f1e6=1550799907', 8 | 'Host': 'time.geekbang.org', 9 | 'Origin': 'https://time.geekbang.org', 10 | 'Referer': 'https://time.geekbang.org/', 11 | 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.77 Safari/537.36' 12 | }; -------------------------------------------------------------------------------- /lib/config/service_url.dart: -------------------------------------------------------------------------------- 1 | const serviceUrl= 'http://v.jspang.com:8088/baixing/'; 2 | //const serviceUrl= 'http://test.baixingliangfan.cn/baixing/'; 3 | const servicePath={ 4 | 'homePageContext': serviceUrl+'wxmini/homePageContent', // 商家首页信息 5 | 'homePageBelowConten': serviceUrl+'wxmini/homePageBelowConten', //商城首页热卖商品拉取 6 | 'getCategory': serviceUrl+'wxmini/getCategory', //商品类别信息 7 | 'getMallGoods': serviceUrl+'wxmini/getMallGoods', //商品分类的商品列表 8 | 'getGoodDetailById':serviceUrl+'wxmini/getGoodDetailById', //商品详细信息列表 9 | }; 10 | 11 | -------------------------------------------------------------------------------- /lib/main.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import './pages/index_page.dart'; 3 | import 'package:provide/provide.dart'; 4 | import './provide/child_category.dart'; 5 | import './provide/category_goods_list.dart'; 6 | import './provide/details_info.dart'; 7 | import './provide/cart.dart'; 8 | import './provide/currentIndex.dart'; 9 | import 'package:fluro/fluro.dart'; 10 | import './routers/routes.dart'; 11 | import './routers/application.dart'; 12 | 13 | 14 | 15 | 16 | import './provide/counter.dart'; 17 | 18 | void main(){ 19 | var childCategory= ChildCategory(); 20 | var categoryGoodsListProvide= CategoryGoodsListProvide(); 21 | var detailsInfoProvide= DetailsInfoProvide(); 22 | var cartProvide =CartProvide(); 23 | var currentIndexProvide =CurrentIndexProvide(); 24 | var counter =Counter(); 25 | var providers =Providers(); 26 | 27 | providers 28 | ..provide(Provider.value(childCategory)) 29 | ..provide(Provider.value(categoryGoodsListProvide)) 30 | ..provide(Provider.value(detailsInfoProvide)) 31 | ..provide(Provider.value(cartProvide)) 32 | ..provide(Provider.value(currentIndexProvide)) 33 | ..provide(Provider.value(counter)); 34 | 35 | runApp(ProviderNode(child:MyApp(),providers:providers)); 36 | } 37 | 38 | class MyApp extends StatelessWidget { 39 | @override 40 | Widget build(BuildContext context) { 41 | 42 | final router = Router(); 43 | Routes.configureRoutes(router); 44 | Application.router=router; 45 | 46 | 47 | return Container( 48 | 49 | child: MaterialApp( 50 | title:'百姓生活+', 51 | debugShowCheckedModeBanner: false, 52 | onGenerateRoute: Application.router.generator, 53 | theme: ThemeData( 54 | primaryColor:Colors.pink, 55 | ), 56 | home:IndexPage() 57 | ), 58 | ); 59 | } 60 | } -------------------------------------------------------------------------------- /lib/model/cartInfo.dart: -------------------------------------------------------------------------------- 1 | class CartInfoMode { 2 | String goodsId; 3 | String goodsName; 4 | int count; 5 | double price; 6 | String images; 7 | bool isCheck; 8 | 9 | CartInfoMode( 10 | {this.goodsId, this.goodsName, this.count, this.price, this.images,this.isCheck}); 11 | 12 | CartInfoMode.fromJson(Map json) { 13 | goodsId = json['goodsId']; 14 | goodsName = json['goodsName']; 15 | count = json['count']; 16 | price = json['price']; 17 | images = json['images']; 18 | isCheck = json['isCheck']; 19 | } 20 | 21 | Map toJson() { 22 | final Map data = new Map(); 23 | data['goodsId'] = this.goodsId; 24 | data['goodsName'] = this.goodsName; 25 | data['count'] = this.count; 26 | data['price'] = this.price; 27 | data['images'] = this.images; 28 | data['isCheck']= this.isCheck; 29 | return data; 30 | } 31 | } -------------------------------------------------------------------------------- /lib/model/category.dart: -------------------------------------------------------------------------------- 1 | class CategoryModel { 2 | String code; 3 | String message; 4 | List data; 5 | 6 | CategoryModel({this.code, this.message, this.data}); 7 | 8 | CategoryModel.fromJson(Map json) { 9 | code = json['code']; 10 | message = json['message']; 11 | if (json['data'] != null) { 12 | data = new List(); 13 | json['data'].forEach((v) { 14 | data.add(new Data.fromJson(v)); 15 | }); 16 | } 17 | } 18 | 19 | Map toJson() { 20 | final Map data = new Map(); 21 | data['code'] = this.code; 22 | data['message'] = this.message; 23 | if (this.data != null) { 24 | data['data'] = this.data.map((v) => v.toJson()).toList(); 25 | } 26 | return data; 27 | } 28 | } 29 | 30 | class Data { 31 | String mallCategoryId; 32 | String mallCategoryName; 33 | List bxMallSubDto; 34 | Null comments; 35 | String image; 36 | 37 | Data( 38 | {this.mallCategoryId, 39 | this.mallCategoryName, 40 | this.bxMallSubDto, 41 | this.comments, 42 | this.image}); 43 | 44 | Data.fromJson(Map json) { 45 | mallCategoryId = json['mallCategoryId']; 46 | mallCategoryName = json['mallCategoryName']; 47 | if (json['bxMallSubDto'] != null) { 48 | bxMallSubDto = new List(); 49 | json['bxMallSubDto'].forEach((v) { 50 | bxMallSubDto.add(new BxMallSubDto.fromJson(v)); 51 | }); 52 | } 53 | comments = json['comments']; 54 | image = json['image']; 55 | } 56 | 57 | Map toJson() { 58 | final Map data = new Map(); 59 | data['mallCategoryId'] = this.mallCategoryId; 60 | data['mallCategoryName'] = this.mallCategoryName; 61 | if (this.bxMallSubDto != null) { 62 | data['bxMallSubDto'] = this.bxMallSubDto.map((v) => v.toJson()).toList(); 63 | } 64 | data['comments'] = this.comments; 65 | data['image'] = this.image; 66 | return data; 67 | } 68 | } 69 | 70 | class BxMallSubDto { 71 | String mallSubId; 72 | String mallCategoryId; 73 | String mallSubName; 74 | String comments; 75 | 76 | BxMallSubDto( 77 | {this.mallSubId, this.mallCategoryId, this.mallSubName, this.comments}); 78 | 79 | BxMallSubDto.fromJson(Map json) { 80 | mallSubId = json['mallSubId']; 81 | mallCategoryId = json['mallCategoryId']; 82 | mallSubName = json['mallSubName']; 83 | comments = json['comments']; 84 | } 85 | 86 | Map toJson() { 87 | final Map data = new Map(); 88 | data['mallSubId'] = this.mallSubId; 89 | data['mallCategoryId'] = this.mallCategoryId; 90 | data['mallSubName'] = this.mallSubName; 91 | data['comments'] = this.comments; 92 | return data; 93 | } 94 | } -------------------------------------------------------------------------------- /lib/model/categoryGoodsList.dart: -------------------------------------------------------------------------------- 1 | class CategoryGoodsListModel { 2 | String code; 3 | String message; 4 | List data; 5 | 6 | CategoryGoodsListModel({this.code, this.message, this.data}); 7 | 8 | CategoryGoodsListModel.fromJson(Map json) { 9 | code = json['code']; 10 | message = json['message']; 11 | if (json['data'] != null) { 12 | data = new List(); 13 | json['data'].forEach((v) { 14 | data.add(new CategoryListData.fromJson(v)); 15 | }); 16 | } 17 | } 18 | 19 | Map toJson() { 20 | final Map data = new Map(); 21 | data['code'] = this.code; 22 | data['message'] = this.message; 23 | if (this.data != null) { 24 | data['data'] = this.data.map((v) => v.toJson()).toList(); 25 | } 26 | return data; 27 | } 28 | } 29 | 30 | class CategoryListData { 31 | String image; 32 | double oriPrice; 33 | double presentPrice; 34 | String goodsName; 35 | String goodsId; 36 | 37 | CategoryListData( 38 | {this.image, 39 | this.oriPrice, 40 | this.presentPrice, 41 | this.goodsName, 42 | this.goodsId}); 43 | 44 | CategoryListData.fromJson(Map json) { 45 | image = json['image']; 46 | oriPrice = json['oriPrice']; 47 | presentPrice = json['presentPrice']; 48 | goodsName = json['goodsName']; 49 | goodsId = json['goodsId']; 50 | } 51 | 52 | Map toJson() { 53 | final Map data = new Map(); 54 | data['image'] = this.image; 55 | data['oriPrice'] = this.oriPrice; 56 | data['presentPrice'] = this.presentPrice; 57 | data['goodsName'] = this.goodsName; 58 | data['goodsId'] = this.goodsId; 59 | return data; 60 | } 61 | } -------------------------------------------------------------------------------- /lib/model/details.dart: -------------------------------------------------------------------------------- 1 | class DetailsModel { 2 | String code; 3 | String message; 4 | DetailsGoodsData data; 5 | 6 | DetailsModel({this.code, this.message, this.data}); 7 | 8 | DetailsModel.fromJson(Map json) { 9 | code = json['code']; 10 | message = json['message']; 11 | data = json['data'] != null ? new DetailsGoodsData.fromJson(json['data']) : null; 12 | } 13 | 14 | Map toJson() { 15 | final Map data = new Map(); 16 | data['code'] = this.code; 17 | data['message'] = this.message; 18 | if (this.data != null) { 19 | data['data'] = this.data.toJson(); 20 | } 21 | return data; 22 | } 23 | } 24 | 25 | class DetailsGoodsData { 26 | GoodInfo goodInfo; 27 | List goodComments; 28 | AdvertesPicture advertesPicture; 29 | 30 | DetailsGoodsData({this.goodInfo, this.goodComments, this.advertesPicture}); 31 | 32 | DetailsGoodsData.fromJson(Map json) { 33 | goodInfo = json['goodInfo'] != null 34 | ? new GoodInfo.fromJson(json['goodInfo']) 35 | : null; 36 | if (json['goodComments'] != null) { 37 | goodComments = new List(); 38 | json['goodComments'].forEach((v) { 39 | goodComments.add(new GoodComments.fromJson(v)); 40 | }); 41 | } 42 | advertesPicture = json['advertesPicture'] != null 43 | ? new AdvertesPicture.fromJson(json['advertesPicture']) 44 | : null; 45 | } 46 | 47 | Map toJson() { 48 | final Map data = new Map(); 49 | if (this.goodInfo != null) { 50 | data['goodInfo'] = this.goodInfo.toJson(); 51 | } 52 | if (this.goodComments != null) { 53 | data['goodComments'] = this.goodComments.map((v) => v.toJson()).toList(); 54 | } 55 | if (this.advertesPicture != null) { 56 | data['advertesPicture'] = this.advertesPicture.toJson(); 57 | } 58 | return data; 59 | } 60 | } 61 | 62 | class GoodInfo { 63 | String image5; 64 | int amount; 65 | String image3; 66 | String image4; 67 | String goodsId; 68 | String isOnline; 69 | String image1; 70 | String image2; 71 | String goodsSerialNumber; 72 | double oriPrice; 73 | double presentPrice; 74 | String comPic; 75 | int state; 76 | String shopId; 77 | String goodsName; 78 | String goodsDetail; 79 | 80 | GoodInfo( 81 | {this.image5, 82 | this.amount, 83 | this.image3, 84 | this.image4, 85 | this.goodsId, 86 | this.isOnline, 87 | this.image1, 88 | this.image2, 89 | this.goodsSerialNumber, 90 | this.oriPrice, 91 | this.presentPrice, 92 | this.comPic, 93 | this.state, 94 | this.shopId, 95 | this.goodsName, 96 | this.goodsDetail}); 97 | 98 | GoodInfo.fromJson(Map json) { 99 | image5 = json['image5']; 100 | amount = json['amount']; 101 | image3 = json['image3']; 102 | image4 = json['image4']; 103 | goodsId = json['goodsId']; 104 | isOnline = json['isOnline']; 105 | image1 = json['image1']; 106 | image2 = json['image2']; 107 | goodsSerialNumber = json['goodsSerialNumber']; 108 | oriPrice = json['oriPrice']; 109 | presentPrice = json['presentPrice']; 110 | comPic = json['comPic']; 111 | state = json['state']; 112 | shopId = json['shopId']; 113 | goodsName = json['goodsName']; 114 | goodsDetail = json['goodsDetail']; 115 | } 116 | 117 | Map toJson() { 118 | final Map data = new Map(); 119 | data['image5'] = this.image5; 120 | data['amount'] = this.amount; 121 | data['image3'] = this.image3; 122 | data['image4'] = this.image4; 123 | data['goodsId'] = this.goodsId; 124 | data['isOnline'] = this.isOnline; 125 | data['image1'] = this.image1; 126 | data['image2'] = this.image2; 127 | data['goodsSerialNumber'] = this.goodsSerialNumber; 128 | data['oriPrice'] = this.oriPrice; 129 | data['presentPrice'] = this.presentPrice; 130 | data['comPic'] = this.comPic; 131 | data['state'] = this.state; 132 | data['shopId'] = this.shopId; 133 | data['goodsName'] = this.goodsName; 134 | data['goodsDetail'] = this.goodsDetail; 135 | return data; 136 | } 137 | } 138 | 139 | class GoodComments { 140 | int sCORE; 141 | String comments; 142 | String userName; 143 | int discussTime; 144 | 145 | GoodComments({this.sCORE, this.comments, this.userName, this.discussTime}); 146 | 147 | GoodComments.fromJson(Map json) { 148 | sCORE = json['SCORE']; 149 | comments = json['comments']; 150 | userName = json['userName']; 151 | discussTime = json['discussTime']; 152 | } 153 | 154 | Map toJson() { 155 | final Map data = new Map(); 156 | data['SCORE'] = this.sCORE; 157 | data['comments'] = this.comments; 158 | data['userName'] = this.userName; 159 | data['discussTime'] = this.discussTime; 160 | return data; 161 | } 162 | } 163 | 164 | class AdvertesPicture { 165 | String pICTUREADDRESS; 166 | String tOPLACE; 167 | 168 | AdvertesPicture({this.pICTUREADDRESS, this.tOPLACE}); 169 | 170 | AdvertesPicture.fromJson(Map json) { 171 | pICTUREADDRESS = json['PICTURE_ADDRESS']; 172 | tOPLACE = json['TO_PLACE']; 173 | } 174 | 175 | Map toJson() { 176 | final Map data = new Map(); 177 | data['PICTURE_ADDRESS'] = this.pICTUREADDRESS; 178 | data['TO_PLACE'] = this.tOPLACE; 179 | return data; 180 | } 181 | } 182 | -------------------------------------------------------------------------------- /lib/pages/cart_page.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:provide/provide.dart'; 3 | import '../provide/cart.dart'; 4 | import './cart_page/cart_item.dart'; 5 | import './cart_page/cart_bottom.dart'; 6 | 7 | 8 | 9 | 10 | class CartPage extends StatelessWidget { 11 | 12 | @override 13 | Widget build(BuildContext context) { 14 | return Scaffold( 15 | appBar: AppBar( 16 | title: Text('购物车'), 17 | ), 18 | body: FutureBuilder( 19 | future:_getCartInfo(context), 20 | builder: (context,snapshot){ 21 | List cartList=Provide.value(context).cartList; 22 | if(snapshot.hasData && cartList!=null){ 23 | return Stack( 24 | children: [ 25 | Provide( 26 | 27 | builder: (context,child,childCategory){ 28 | cartList= Provide.value(context).cartList; 29 | print(cartList); 30 | return ListView.builder( 31 | itemCount: cartList.length, 32 | itemBuilder: (context,index){ 33 | return CartItem(cartList[index]); 34 | }, 35 | ); 36 | } 37 | ), 38 | Positioned( 39 | bottom:0, 40 | left:0, 41 | child: CartBottom(), 42 | ) 43 | ], 44 | ); 45 | 46 | 47 | }else{ 48 | return Text('正在加载'); 49 | } 50 | }, 51 | ), 52 | ); 53 | } 54 | 55 | Future _getCartInfo(BuildContext context) async{ 56 | await Provide.value(context).getCartInfo(); 57 | return 'end'; 58 | } 59 | 60 | 61 | } -------------------------------------------------------------------------------- /lib/pages/cart_page/cart_bottom.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_screenutil/flutter_screenutil.dart'; 3 | import 'package:provide/provide.dart'; 4 | import '../../provide/cart.dart'; 5 | 6 | class CartBottom extends StatelessWidget { 7 | @override 8 | Widget build(BuildContext context) { 9 | return Container( 10 | margin: EdgeInsets.all(5.0), 11 | color: Colors.white, 12 | width: ScreenUtil().setWidth(750), 13 | child: Provide( 14 | builder: (context,child,childCategory){ 15 | return Row( 16 | children: [ 17 | selectAllBtn(context), 18 | allPriceArea(context), 19 | goButton(context) 20 | ], 21 | ); 22 | }, 23 | ) 24 | ); 25 | } 26 | 27 | //全选按钮 28 | Widget selectAllBtn(context){ 29 | bool isAllCheck = Provide.value(context).isAllCheck; 30 | return Container( 31 | child: Row( 32 | children: [ 33 | Checkbox( 34 | value: isAllCheck, 35 | activeColor: Colors.pink, 36 | onChanged: (bool val){ 37 | Provide.value(context).changeAllCheckBtnState(val); 38 | }, 39 | ), 40 | Text('全选') 41 | ], 42 | ), 43 | ); 44 | } 45 | 46 | // 合计区域 47 | Widget allPriceArea(context){ 48 | double allPrice = Provide.value(context).allPrice; 49 | 50 | return Container( 51 | width: ScreenUtil().setWidth(430), 52 | alignment: Alignment.centerRight, 53 | child: Column( 54 | children: [ 55 | Row( 56 | children: [ 57 | Container( 58 | alignment: Alignment.centerRight, 59 | width: ScreenUtil().setWidth(280), 60 | child: Text( 61 | '合计:', 62 | style:TextStyle( 63 | fontSize: ScreenUtil().setSp(36) 64 | ) 65 | ), 66 | ), 67 | Container( 68 | alignment: Alignment.centerLeft, 69 | width: ScreenUtil().setWidth(150), 70 | child: Text( 71 | '¥${allPrice}', 72 | style:TextStyle( 73 | fontSize: ScreenUtil().setSp(36), 74 | color: Colors.red, 75 | ) 76 | ), 77 | 78 | ) 79 | 80 | 81 | ], 82 | ), 83 | Container( 84 | width: ScreenUtil().setWidth(430), 85 | alignment: Alignment.centerRight, 86 | child: Text( 87 | '满10元免配送费,预购免配送费', 88 | style: TextStyle( 89 | color: Colors.black38, 90 | fontSize: ScreenUtil().setSp(22) 91 | ), 92 | ), 93 | ) 94 | 95 | ], 96 | ), 97 | ); 98 | 99 | } 100 | 101 | //结算按钮 102 | Widget goButton(context){ 103 | int allGoodsCount = Provide.value(context).allGoodsCount; 104 | return Container( 105 | width: ScreenUtil().setWidth(160), 106 | padding: EdgeInsets.only(left: 10), 107 | child:InkWell( 108 | onTap: (){}, 109 | child: Container( 110 | padding: EdgeInsets.all(10.0), 111 | alignment: Alignment.center, 112 | decoration: BoxDecoration( 113 | color: Colors.red, 114 | borderRadius: BorderRadius.circular(3.0) 115 | ), 116 | child: Text( 117 | '结算(${allGoodsCount})', 118 | style: TextStyle( 119 | color: Colors.white 120 | ), 121 | ), 122 | ), 123 | ) , 124 | ); 125 | 126 | 127 | } 128 | 129 | } -------------------------------------------------------------------------------- /lib/pages/cart_page/cart_count.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_screenutil/flutter_screenutil.dart'; 3 | import 'package:provide/provide.dart'; 4 | import '../../provide/cart.dart'; 5 | 6 | class CartCount extends StatelessWidget { 7 | var item; 8 | CartCount(this.item); 9 | 10 | 11 | 12 | @override 13 | Widget build(BuildContext context) { 14 | return Container( 15 | width: ScreenUtil().setWidth(165), 16 | margin: EdgeInsets.only(top:5.0), 17 | decoration: BoxDecoration( 18 | border:Border.all(width: 1 , color:Colors.black12) 19 | ), 20 | child: Row( 21 | children: [ 22 | _reduceBtn(context), 23 | _countArea(), 24 | _addBtn(context), 25 | ], 26 | ), 27 | 28 | ); 29 | } 30 | // 减少按钮 31 | Widget _reduceBtn(context){ 32 | return InkWell( 33 | onTap: (){ 34 | Provide.value(context).addOrReduceAction(item,'reduce'); 35 | }, 36 | child: Container( 37 | width: ScreenUtil().setWidth(45), 38 | height: ScreenUtil().setHeight(45), 39 | alignment: Alignment.center, 40 | 41 | decoration: BoxDecoration( 42 | color: item.count>1?Colors.white:Colors.black12, 43 | border:Border( 44 | right:BorderSide(width:1,color:Colors.black12) 45 | ) 46 | ), 47 | child:item.count>1? Text('-'):Text(' '), 48 | ), 49 | ); 50 | } 51 | 52 | //添加按钮 53 | Widget _addBtn(context){ 54 | return InkWell( 55 | onTap: (){ 56 | Provide.value(context).addOrReduceAction(item,'add'); 57 | }, 58 | child: Container( 59 | width: ScreenUtil().setWidth(45), 60 | height: ScreenUtil().setHeight(45), 61 | alignment: Alignment.center, 62 | 63 | decoration: BoxDecoration( 64 | color: Colors.white, 65 | border:Border( 66 | left:BorderSide(width:1,color:Colors.black12) 67 | ) 68 | ), 69 | child: Text('+'), 70 | ), 71 | ); 72 | } 73 | 74 | //中间数量显示区域 75 | Widget _countArea(){ 76 | return Container( 77 | width: ScreenUtil().setWidth(70), 78 | height: ScreenUtil().setHeight(45), 79 | alignment: Alignment.center, 80 | color: Colors.white, 81 | child: Text('${item.count}'), 82 | ); 83 | } 84 | 85 | } -------------------------------------------------------------------------------- /lib/pages/cart_page/cart_item.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_screenutil/flutter_screenutil.dart'; 3 | import '../../model/cartInfo.dart'; 4 | import './cart_count.dart'; 5 | import 'package:provide/provide.dart'; 6 | import '../../provide/cart.dart'; 7 | 8 | class CartItem extends StatelessWidget { 9 | final CartInfoMode item; 10 | CartItem(this.item); 11 | 12 | @override 13 | Widget build(BuildContext context) { 14 | print(item); 15 | return Container( 16 | margin: EdgeInsets.fromLTRB(5.0,2.0,5.0,2.0), 17 | padding: EdgeInsets.fromLTRB(5.0,10.0,5.0,10.0), 18 | decoration: BoxDecoration( 19 | color: Colors.white, 20 | border: Border( 21 | bottom: BorderSide(width:1,color:Colors.black12) 22 | ) 23 | ), 24 | child: Row( 25 | children: [ 26 | _cartCheckBt(context,item), 27 | _cartImage(item), 28 | _cartGoodsName(item), 29 | _cartPrice(context,item) 30 | ], 31 | ), 32 | ); 33 | } 34 | //多选按钮 35 | Widget _cartCheckBt(context,item){ 36 | return Container( 37 | child: Checkbox( 38 | value: item.isCheck, 39 | activeColor:Colors.pink, 40 | onChanged: (bool val){ 41 | item.isCheck=val; 42 | Provide.value(context).changeCheckState(item); 43 | }, 44 | ), 45 | ); 46 | } 47 | //商品图片 48 | Widget _cartImage(item){ 49 | 50 | return Container( 51 | width: ScreenUtil().setWidth(150), 52 | padding: EdgeInsets.all(3.0), 53 | decoration: BoxDecoration( 54 | border: Border.all(width: 1,color:Colors.black12) 55 | ), 56 | child: Image.network(item.images), 57 | ); 58 | } 59 | //商品名称 60 | Widget _cartGoodsName(item){ 61 | return Container( 62 | width: ScreenUtil().setWidth(300), 63 | padding: EdgeInsets.all(10), 64 | alignment: Alignment.topLeft, 65 | child: Column( 66 | children: [ 67 | Text(item.goodsName), 68 | CartCount(item) 69 | ], 70 | ), 71 | ); 72 | } 73 | 74 | //商品价格 75 | Widget _cartPrice(context,item){ 76 | 77 | return Container( 78 | width:ScreenUtil().setWidth(150) , 79 | alignment: Alignment.centerRight, 80 | 81 | child: Column( 82 | children: [ 83 | Text('¥${item.price}'), 84 | Container( 85 | child: InkWell( 86 | onTap: (){ 87 | Provide.value(context).deleteOneGoods(item.goodsId); 88 | }, 89 | child: Icon( 90 | Icons.delete_forever, 91 | color: Colors.black26, 92 | size: 30, 93 | ), 94 | ), 95 | ) 96 | ], 97 | ), 98 | ); 99 | } 100 | 101 | } -------------------------------------------------------------------------------- /lib/pages/category_page.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import '../service/service_method.dart'; 3 | import 'dart:convert'; 4 | import 'package:flutter_easyrefresh/easy_refresh.dart'; 5 | import '../model/category.dart'; 6 | import '../model/categoryGoodsList.dart'; 7 | 8 | import 'package:provide/provide.dart'; 9 | import '../provide/child_category.dart'; 10 | import '../provide/category_goods_list.dart'; 11 | import 'package:fluttertoast/fluttertoast.dart'; 12 | import '../routers/application.dart'; 13 | 14 | 15 | 16 | import 'package:flutter_screenutil/flutter_screenutil.dart'; 17 | 18 | class CategoryPage extends StatefulWidget { 19 | _CategoryPageState createState() => _CategoryPageState(); 20 | } 21 | 22 | class _CategoryPageState extends State { 23 | // CategoryBigListModel listCategory = CategoryBigListModel([]); 24 | 25 | @override 26 | Widget build(BuildContext context) { 27 | return Scaffold( 28 | appBar: AppBar( 29 | title: Text('商品分类'), 30 | ), 31 | body: Container( 32 | child: Row( 33 | children: [ 34 | LeftCategoryNav(), 35 | Column( 36 | children: [ 37 | RightCategoryNav(), 38 | CategoryGoodsList() 39 | ], 40 | ) 41 | ], 42 | ), 43 | ), 44 | ); 45 | } 46 | } 47 | 48 | //左侧导航菜单 49 | class LeftCategoryNav extends StatefulWidget { 50 | _LeftCategoryNavState createState() => _LeftCategoryNavState(); 51 | } 52 | 53 | class _LeftCategoryNavState extends State { 54 | List list = []; 55 | var listIndex = 0; //索引 56 | 57 | @override 58 | void initState() { 59 | _getCategory(); 60 | 61 | 62 | super.initState(); 63 | } 64 | 65 | @override 66 | Widget build(BuildContext context) { 67 | 68 | return Provide( 69 | 70 | builder: (context,child,val){ 71 | _getGoodList(context); 72 | listIndex=val.categoryIndex; 73 | 74 | return Container( 75 | width: ScreenUtil().setWidth(180), 76 | decoration: BoxDecoration( 77 | border: Border(right: BorderSide(width: 1, color: Colors.black12))), 78 | child: ListView.builder( 79 | itemCount: list.length, 80 | itemBuilder: (context, index) { 81 | return _leftInkWel(index); 82 | }, 83 | ), 84 | ); 85 | }, 86 | ); 87 | } 88 | 89 | Widget _leftInkWel(int index) { 90 | bool isClick=false; 91 | isClick=(index==listIndex)?true:false; 92 | 93 | return InkWell( 94 | onTap: () { 95 | 96 | 97 | var childList = list[index].bxMallSubDto; 98 | var categoryId= list[index].mallCategoryId; 99 | Provide.value(context).changeCategory(categoryId,index); 100 | Provide.value(context).getChildCategory(childList,categoryId); 101 | _getGoodList(context,categoryId:categoryId ); 102 | }, 103 | child: Container( 104 | height: ScreenUtil().setHeight(100), 105 | padding: EdgeInsets.only(left: 10, top: 20), 106 | decoration: BoxDecoration( 107 | color: isClick?Color.fromRGBO(236, 238, 239, 1.0):Colors.white, 108 | border: 109 | Border(bottom: BorderSide(width: 1, color: Colors.black12))), 110 | child: Text( 111 | list[index].mallCategoryName, 112 | style: TextStyle(fontSize: ScreenUtil().setSp(28)), 113 | ), 114 | ), 115 | ); 116 | } 117 | 118 | //得到后台大类数据 119 | void _getCategory() async { 120 | await request('getCategory').then((val) { 121 | var data = json.decode(val.toString()); 122 | 123 | CategoryModel category = CategoryModel.fromJson(data); 124 | 125 | setState(() { 126 | list = category.data; 127 | }); 128 | 129 | Provide.value(context).getChildCategory( list[0].bxMallSubDto,'4'); 130 | 131 | //print(list[0].bxMallSubDto); 132 | 133 | //list[0].bxMallSubDto.forEach((item) => print(item.mallSubName)); 134 | }); 135 | } 136 | //得到商品列表数据 137 | void _getGoodList(context,{String categoryId }) { 138 | 139 | 140 | var data={ 141 | 'categoryId':categoryId==null?Provide.value(context).categoryId:categoryId, 142 | 'categorySubId':Provide.value(context).subId, 143 | 'page':1 144 | }; 145 | 146 | 147 | 148 | request('getMallGoods',formData:data ).then((val){ 149 | var data = json.decode(val.toString()); 150 | CategoryGoodsListModel goodsList= CategoryGoodsListModel.fromJson(data); 151 | // Provide.value(context).getGoodsList(goodsList.data); 152 | Provide.value(context).getGoodsList(goodsList.data); 153 | 154 | }); 155 | } 156 | 157 | } 158 | 159 | //右侧小类类别 160 | 161 | class RightCategoryNav extends StatefulWidget { 162 | _RightCategoryNavState createState() => _RightCategoryNavState(); 163 | } 164 | 165 | class _RightCategoryNavState extends State { 166 | 167 | 168 | 169 | 170 | 171 | @override 172 | Widget build(BuildContext context) { 173 | 174 | return Container( 175 | // child: Text('${childCategory.childCategoryList.length}'), 176 | 177 | child: Provide( 178 | builder: (context,child,childCategory){ 179 | return Container( 180 | height: ScreenUtil().setHeight(80), 181 | width: ScreenUtil().setWidth(570), 182 | decoration: BoxDecoration( 183 | color: Colors.white, 184 | border: Border( 185 | bottom: BorderSide(width: 1,color: Colors.black12) 186 | ) 187 | ), 188 | child:ListView.builder( 189 | scrollDirection: Axis.horizontal, 190 | itemCount: childCategory.childCategoryList.length, 191 | itemBuilder: (context,index){ 192 | 193 | return _rightInkWell(index,childCategory.childCategoryList[index]); 194 | }, 195 | ) 196 | ); 197 | }, 198 | ) 199 | ); 200 | } 201 | 202 | Widget _rightInkWell(int index,BxMallSubDto item){ 203 | bool isCheck = false; 204 | isCheck =(index==Provide.value(context).childIndex)?true:false; 205 | 206 | return InkWell( 207 | onTap: (){ 208 | print (2222222222); 209 | Provide.value(context).changeChildIndex(index,item.mallSubId); 210 | _getGoodList(context,item.mallSubId); 211 | }, 212 | child: Container( 213 | padding:EdgeInsets.fromLTRB(5.0,10.0,5.0,10.0), 214 | 215 | child: Text( 216 | item.mallSubName, 217 | 218 | style: TextStyle( 219 | fontSize:ScreenUtil().setSp(28), 220 | color:isCheck?Colors.pink:Colors.black ), 221 | ), 222 | ), 223 | ); 224 | } 225 | 226 | 227 | //得到商品列表数据 228 | void _getGoodList(context,String categorySubId) { 229 | 230 | var data={ 231 | 'categoryId':Provide.value(context).categoryId, 232 | 'categorySubId':categorySubId, 233 | 'page':1 234 | }; 235 | 236 | request('getMallGoods',formData:data ).then((val){ 237 | var data = json.decode(val.toString()); 238 | CategoryGoodsListModel goodsList= CategoryGoodsListModel.fromJson(data); 239 | // Provide.value(context).getGoodsList(goodsList.data); 240 | if(goodsList.data==null){ 241 | Provide.value(context).getGoodsList([]); 242 | }else{ 243 | Provide.value(context).getGoodsList(goodsList.data); 244 | 245 | } 246 | }); 247 | } 248 | 249 | 250 | 251 | } 252 | 253 | 254 | //商品列表,可以上拉加载 255 | 256 | class CategoryGoodsList extends StatefulWidget { 257 | @override 258 | _CategoryGoodsListState createState() => _CategoryGoodsListState(); 259 | } 260 | 261 | class _CategoryGoodsListState extends State { 262 | 263 | GlobalKey _easyRefreshKey =new GlobalKey(); 264 | GlobalKey _footerKey = new GlobalKey(); 265 | var scrollController=new ScrollController(); 266 | 267 | 268 | @override 269 | Widget build(BuildContext context) { 270 | return Provide( 271 | builder: (context,child,data){ 272 | try{ 273 | if(Provide.value(context).page==1){ 274 | scrollController.jumpTo(0.0); 275 | } 276 | }catch(e){ 277 | print('进入页面第一次初始化:${e}'); 278 | } 279 | 280 | if(data.goodsList.length>0){ 281 | return Expanded( 282 | child:Container( 283 | width: ScreenUtil().setWidth(570) , 284 | child:EasyRefresh( 285 | refreshFooter: ClassicsFooter( 286 | key:_footerKey, 287 | bgColor:Colors.white, 288 | textColor:Colors.pink, 289 | moreInfoColor: Colors.pink, 290 | showMore:true, 291 | noMoreText:Provide.value(context).noMoreText, 292 | moreInfo:'加载中', 293 | loadReadyText:'上拉加载' 294 | ), 295 | child:ListView.builder( 296 | controller: scrollController, 297 | itemCount: data.goodsList.length, 298 | itemBuilder: (context,index){ 299 | return _ListWidget(data.goodsList,index); 300 | }, 301 | ) , 302 | loadMore: ()async{ 303 | if(Provide.value(context).noMoreText=='没有更多了'){ 304 | Fluttertoast.showToast( 305 | msg: "已经到底了", 306 | toastLength: Toast.LENGTH_SHORT, 307 | gravity: ToastGravity.CENTER, 308 | timeInSecForIos: 1, 309 | backgroundColor: Colors.pink, 310 | textColor: Colors.white, 311 | fontSize: 16.0 312 | ); 313 | }else{ 314 | 315 | _getMoreList(); 316 | } 317 | 318 | }, 319 | ) 320 | 321 | ) , 322 | ); 323 | }else{ 324 | return Text('暂时没有数据'); 325 | } 326 | 327 | 328 | }, 329 | 330 | ); 331 | } 332 | 333 | //上拉加载更多的方法 334 | void _getMoreList(){ 335 | 336 | Provide.value(context).addPage(); 337 | var data={ 338 | 'categoryId':Provide.value(context).categoryId, 339 | 'categorySubId':Provide.value(context).subId, 340 | 'page':Provide.value(context).page 341 | }; 342 | 343 | request('getMallGoods',formData:data ).then((val){ 344 | var data = json.decode(val.toString()); 345 | CategoryGoodsListModel goodsList= CategoryGoodsListModel.fromJson(data); 346 | 347 | if(goodsList.data==null){ 348 | Provide.value(context).changeNoMore('没有更多了'); 349 | }else{ 350 | 351 | Provide.value(context).addGoodsList(goodsList.data); 352 | 353 | } 354 | }); 355 | 356 | 357 | } 358 | 359 | 360 | 361 | Widget _ListWidget(List newList,int index){ 362 | 363 | 364 | 365 | return InkWell( 366 | onTap: (){ 367 | Application.router.navigateTo(context,"/detail?id=${newList[index].goodsId}"); 368 | }, 369 | child: Container( 370 | padding: EdgeInsets.only(top: 5.0,bottom: 5.0), 371 | decoration: BoxDecoration( 372 | color: Colors.white, 373 | border: Border( 374 | bottom: BorderSide(width: 1.0,color: Colors.black12) 375 | ) 376 | ), 377 | 378 | child: Row( 379 | children: [ 380 | _goodsImage(newList,index) 381 | , 382 | Column( 383 | children: [ 384 | _goodsName(newList,index), 385 | _goodsPrice(newList,index) 386 | ], 387 | ) 388 | ], 389 | ), 390 | ) 391 | ); 392 | 393 | } 394 | //商品图片 395 | Widget _goodsImage(List newList,int index){ 396 | 397 | return Container( 398 | width: ScreenUtil().setWidth(200), 399 | child: Image.network(newList[index].image), 400 | ); 401 | 402 | } 403 | //商品名称方法 404 | Widget _goodsName(List newList,int index){ 405 | return Container( 406 | padding: EdgeInsets.all(5.0), 407 | width: ScreenUtil().setWidth(370), 408 | child: Text( 409 | newList[index].goodsName, 410 | maxLines: 2, 411 | overflow: TextOverflow.ellipsis, 412 | style: TextStyle(fontSize: ScreenUtil().setSp(28)), 413 | ), 414 | ); 415 | } 416 | //商品价格方法 417 | Widget _goodsPrice(List newList,int index){ 418 | return Container( 419 | margin: EdgeInsets.only(top:20.0), 420 | width: ScreenUtil().setWidth(370), 421 | child:Row( 422 | children: [ 423 | Text( 424 | '价格:¥${newList[index].presentPrice}', 425 | style: TextStyle(color:Colors.pink,fontSize:ScreenUtil().setSp(30)), 426 | ), 427 | Text( 428 | 429 | '¥${newList[index].oriPrice}', 430 | style: TextStyle( 431 | color: Colors.black26, 432 | decoration: TextDecoration.lineThrough 433 | ), 434 | ) 435 | ] 436 | ) 437 | ); 438 | } 439 | 440 | 441 | } 442 | 443 | -------------------------------------------------------------------------------- /lib/pages/details_page.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:provide/provide.dart'; 3 | import '../provide/details_info.dart'; 4 | import './details_page/details_top_area.dart'; 5 | import './details_page/details_explain.dart'; 6 | import './details_page/details_tabBar.dart'; 7 | import './details_page/details_web.dart'; 8 | import './details_page/details_bottom.dart'; 9 | 10 | 11 | class DetailsPage extends StatelessWidget { 12 | final String goodsId; 13 | DetailsPage(this.goodsId); 14 | 15 | @override 16 | Widget build(BuildContext context) { 17 | 18 | return Scaffold( 19 | appBar: AppBar( 20 | leading: IconButton( 21 | icon:Icon(Icons.arrow_back), 22 | onPressed: (){ 23 | print('返回上一页'); 24 | Navigator.pop(context); 25 | }, 26 | ), 27 | title: Text('商品详细页'), 28 | ), 29 | body:FutureBuilder( 30 | future: _getBackInfo(context) , 31 | builder: (context,snapshot){ 32 | if(snapshot.hasData){ 33 | return Stack( 34 | children: [ 35 | ListView( 36 | children: [ 37 | DetailsTopArea(), 38 | DetailsExplain(), 39 | DetailsTabBar(), 40 | DetailsWeb(), 41 | 42 | 43 | ], 44 | ), 45 | Positioned( 46 | bottom: 0, 47 | left: 0, 48 | child: DetailsBottom() 49 | ) 50 | ], 51 | ); 52 | 53 | 54 | 55 | 56 | }else{ 57 | return Text('加载中........'); 58 | } 59 | } 60 | ) 61 | ); 62 | } 63 | 64 | Future _getBackInfo(BuildContext context )async{ 65 | await Provide.value(context).getGoodsInfo(goodsId); 66 | return '完成加载'; 67 | } 68 | 69 | } -------------------------------------------------------------------------------- /lib/pages/details_page/details_bottom.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_screenutil/flutter_screenutil.dart'; 3 | import 'package:provide/provide.dart'; 4 | import '../../provide/cart.dart'; 5 | import '../../provide/details_info.dart'; 6 | import '../../provide/currentIndex.dart'; 7 | 8 | 9 | class DetailsBottom extends StatelessWidget { 10 | @override 11 | Widget build(BuildContext context) { 12 | var goodsInfo=Provide.value(context).goodsInfo.data.goodInfo; 13 | 14 | 15 | var goodsID= goodsInfo.goodsId; 16 | var goodsName =goodsInfo.goodsName; 17 | var count =1; 18 | var price =goodsInfo.presentPrice; 19 | var images= goodsInfo.image1; 20 | 21 | return Container( 22 | width:ScreenUtil().setWidth(750), 23 | color: Colors.white, 24 | height: ScreenUtil().setHeight(80), 25 | child: Row( 26 | children: [ 27 | Stack( 28 | children: [ 29 | InkWell( 30 | onTap: (){ 31 | Provide.value(context).changeIndex(2); 32 | Navigator.pop(context); 33 | }, 34 | child: Container( 35 | width: ScreenUtil().setWidth(110) , 36 | alignment: Alignment.center, 37 | child:Icon( 38 | Icons.shopping_cart, 39 | size: 35, 40 | color: Colors.red, 41 | ), 42 | ) , 43 | ), 44 | Provide( 45 | builder: (context,child,val){ 46 | int goodsCount = Provide.value(context).allGoodsCount; 47 | return Positioned( 48 | top:0, 49 | right: 10, 50 | child: Container( 51 | padding:EdgeInsets.fromLTRB(6, 3, 6, 3), 52 | decoration: BoxDecoration( 53 | color:Colors.pink, 54 | border:Border.all(width: 2,color: Colors.white), 55 | borderRadius: BorderRadius.circular(12.0) 56 | ), 57 | child: Text( 58 | '${goodsCount}', 59 | style: TextStyle( 60 | color: Colors.white, 61 | fontSize: ScreenUtil().setSp(22) 62 | ), 63 | ), 64 | ), 65 | ) ; 66 | }, 67 | ) 68 | 69 | ], 70 | ), 71 | 72 | InkWell( 73 | onTap: ()async { 74 | await Provide.value(context).save(goodsID,goodsName,count,price,images); 75 | 76 | }, 77 | child: Container( 78 | alignment: Alignment.center, 79 | width: ScreenUtil().setWidth(320), 80 | height: ScreenUtil().setHeight(80), 81 | color: Colors.green, 82 | child: Text( 83 | '加入购物车', 84 | style: TextStyle(color: Colors.white,fontSize: ScreenUtil().setSp(28)), 85 | ), 86 | ) , 87 | ), 88 | InkWell( 89 | onTap: ()async{ 90 | await Provide.value(context).remove(); 91 | }, 92 | child: Container( 93 | alignment: Alignment.center, 94 | width: ScreenUtil().setWidth(320), 95 | height: ScreenUtil().setHeight(80), 96 | color: Colors.red, 97 | child: Text( 98 | '马上购买', 99 | style: TextStyle(color: Colors.white,fontSize: ScreenUtil().setSp(28)), 100 | ), 101 | ) , 102 | ), 103 | ], 104 | ), 105 | ); 106 | } 107 | } -------------------------------------------------------------------------------- /lib/pages/details_page/details_explain.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_screenutil/flutter_screenutil.dart'; 3 | 4 | 5 | class DetailsExplain extends StatelessWidget { 6 | @override 7 | Widget build(BuildContext context) { 8 | return Container( 9 | color:Colors.white, 10 | margin: EdgeInsets.only(top: 10), 11 | width: ScreenUtil().setWidth(750), 12 | padding: EdgeInsets.all(10.0), 13 | child: Text( 14 | '说明:> 急速送达 > 正品保证', 15 | style: TextStyle( 16 | color:Colors.red, 17 | fontSize:ScreenUtil().setSp(30) ), 18 | ) 19 | ); 20 | } 21 | } -------------------------------------------------------------------------------- /lib/pages/details_page/details_tabbar.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_screenutil/flutter_screenutil.dart'; 3 | import 'package:provide/provide.dart'; 4 | import '../../provide/details_info.dart'; 5 | 6 | class DetailsTabBar extends StatelessWidget { 7 | 8 | Widget build(BuildContext context) { 9 | return Provide( 10 | builder: (context,child,val){ 11 | var isLeft= Provide.value(context).isLeft; 12 | var isRight =Provide.value(context).isRight; 13 | 14 | return Container( 15 | margin: EdgeInsets.only(top: 15.0), 16 | child: Column( 17 | children: [ 18 | Row( 19 | children: [ 20 | _myTabBarLeft(context,isLeft), 21 | _myTabBarRight(context,isRight) 22 | ], 23 | ), 24 | ], 25 | 26 | 27 | ), 28 | 29 | ) ; 30 | }, 31 | 32 | ); 33 | } 34 | 35 | Widget _myTabBarLeft(BuildContext context,bool isLeft){ 36 | return InkWell( 37 | onTap: (){ 38 | 39 | Provide.value(context).changeLeftAndRight('left'); 40 | }, 41 | child: Container( 42 | 43 | padding:EdgeInsets.all(10.0), 44 | alignment: Alignment.center, 45 | width: ScreenUtil().setWidth(375), 46 | decoration: BoxDecoration( 47 | color: Colors.white, 48 | border: Border( 49 | bottom: BorderSide( 50 | width: 1.0, 51 | color: isLeft?Colors.pink:Colors.black12 52 | ) 53 | ) 54 | ), 55 | child: Text( 56 | '详细', 57 | style: TextStyle( 58 | color:isLeft?Colors.pink:Colors.black 59 | ), 60 | ), 61 | ), 62 | ); 63 | } 64 | Widget _myTabBarRight(BuildContext context,bool isRight){ 65 | return InkWell( 66 | onTap: (){ 67 | 68 | Provide.value(context).changeLeftAndRight('right'); 69 | }, 70 | child: Container( 71 | 72 | padding:EdgeInsets.all(10.0), 73 | alignment: Alignment.center, 74 | width: ScreenUtil().setWidth(375), 75 | decoration: BoxDecoration( 76 | color: Colors.white, 77 | border: Border( 78 | bottom: BorderSide( 79 | width: 1.0, 80 | color: isRight?Colors.pink:Colors.black12 81 | ) 82 | ) 83 | ), 84 | child: Text( 85 | '评论', 86 | style: TextStyle( 87 | color:isRight?Colors.pink:Colors.black 88 | ), 89 | ), 90 | ), 91 | ); 92 | } 93 | 94 | } -------------------------------------------------------------------------------- /lib/pages/details_page/details_top_area.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:provide/provide.dart'; 3 | import '../../provide/details_info.dart'; 4 | import 'package:flutter_screenutil/flutter_screenutil.dart'; 5 | 6 | //商品详情页的首屏区域,包括图片、商品名称,商品价格,商品编号的UI展示 7 | class DetailsTopArea extends StatelessWidget { 8 | @override 9 | Widget build(BuildContext context) { 10 | return Provide( 11 | 12 | builder:(context,child,val){ 13 | var goodsInfo=Provide.value(context).goodsInfo.data.goodInfo; 14 | 15 | if(goodsInfo != null){ 16 | 17 | return Container( 18 | color: Colors.white, 19 | padding: EdgeInsets.all(2.0), 20 | child: Column( 21 | children: [ 22 | _goodsImage( goodsInfo.image1), 23 | _goodsName( goodsInfo.goodsName ), 24 | _goodsNum(goodsInfo.goodsSerialNumber), 25 | _goodsPrice(goodsInfo.presentPrice,goodsInfo.oriPrice), 26 | 27 | ], 28 | ), 29 | ); 30 | 31 | }else{ 32 | return Text('正在加载中......'); 33 | } 34 | } 35 | ); 36 | } 37 | 38 | //商品图片 39 | Widget _goodsImage(url){ 40 | return Image.network( 41 | url, 42 | width:ScreenUtil().setWidth(740) 43 | ); 44 | 45 | } 46 | 47 | //商品名称 48 | Widget _goodsName(name){ 49 | 50 | return Container( 51 | 52 | width: ScreenUtil().setWidth(730), 53 | padding: EdgeInsets.only(left:15.0), 54 | child: Text( 55 | name, 56 | maxLines: 1, 57 | style: TextStyle( 58 | fontSize: ScreenUtil().setSp(30) 59 | ), 60 | ), 61 | ); 62 | } 63 | 64 | //商品编号 65 | 66 | Widget _goodsNum(num){ 67 | return Container( 68 | 69 | width: ScreenUtil().setWidth(730), 70 | padding: EdgeInsets.only(left:15.0), 71 | margin: EdgeInsets.only(top:8.0), 72 | child: Text( 73 | '编号:${num}', 74 | style: TextStyle( 75 | color: Colors.black26 76 | ), 77 | ), 78 | 79 | ); 80 | } 81 | 82 | //商品价格方法 83 | 84 | Widget _goodsPrice(presentPrice,oriPrice){ 85 | 86 | return Container( 87 | 88 | width: ScreenUtil().setWidth(730), 89 | padding: EdgeInsets.only(left:15.0), 90 | margin: EdgeInsets.only(top:8.0), 91 | child: Row( 92 | children: [ 93 | Text( 94 | '¥${presentPrice}', 95 | style: TextStyle( 96 | color:Colors.pinkAccent, 97 | fontSize: ScreenUtil().setSp(40), 98 | 99 | ), 100 | 101 | ), 102 | Text( 103 | '市场价:¥${oriPrice}', 104 | style: TextStyle( 105 | color: Colors.black26, 106 | decoration: TextDecoration.lineThrough 107 | ), 108 | 109 | 110 | ) 111 | ], 112 | ), 113 | ); 114 | 115 | } 116 | 117 | 118 | 119 | } -------------------------------------------------------------------------------- /lib/pages/details_page/details_web.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:provide/provide.dart'; 3 | import '../../provide/details_info.dart'; 4 | import 'package:flutter_html/flutter_html.dart'; 5 | import 'package:flutter_screenutil/flutter_screenutil.dart'; 6 | 7 | class DetailsWeb extends StatelessWidget { 8 | 9 | @override 10 | Widget build(BuildContext context) { 11 | var goodsDetail=Provide.value(context).goodsInfo.data.goodInfo.goodsDetail; 12 | 13 | 14 | return Provide( 15 | 16 | builder: (context,child,val){ 17 | var isLeft = Provide.value(context).isLeft; 18 | if(isLeft){ 19 | return Container( 20 | child: Html( 21 | data:goodsDetail 22 | ), 23 | ); 24 | }else{ 25 | return Container( 26 | width: ScreenUtil().setWidth(750), 27 | padding: EdgeInsets.all(10), 28 | alignment: Alignment.center, 29 | child:Text('暂时没有数据') 30 | ); 31 | } 32 | }, 33 | ); 34 | 35 | } 36 | } -------------------------------------------------------------------------------- /lib/pages/home_page.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import '../service/service_method.dart'; 3 | import 'package:flutter_swiper/flutter_swiper.dart'; 4 | import 'dart:convert'; 5 | import 'package:flutter_screenutil/flutter_screenutil.dart'; 6 | import 'package:url_launcher/url_launcher.dart'; 7 | import 'package:flutter_easyrefresh/easy_refresh.dart'; 8 | import '../routers/application.dart'; 9 | 10 | //-------- 11 | import 'package:provide/provide.dart'; 12 | import '../provide/child_category.dart'; 13 | import '../provide/currentIndex.dart'; 14 | import '../model/category.dart'; 15 | 16 | 17 | class HomePage extends StatefulWidget { 18 | _HomePageState createState() => _HomePageState(); 19 | 20 | } 21 | 22 | class _HomePageState extends State with AutomaticKeepAliveClientMixin { 23 | 24 | int page = 1; 25 | List hotGoodsList=[]; 26 | 27 | @override 28 | bool get wantKeepAlive =>true; 29 | 30 | @override 31 | void initState() { 32 | super.initState(); 33 | 34 | } 35 | GlobalKey _easyRefreshKey =new GlobalKey(); 36 | GlobalKey _footerKey = new GlobalKey(); 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | @override 46 | Widget build(BuildContext context) { 47 | super.build(context); 48 | var formData = {'lon':'115.02932','lat':'35.76189'}; 49 | return Scaffold( 50 | backgroundColor: Color.fromRGBO(244, 245, 245, 1.0), 51 | appBar: AppBar(title: Text('百姓生活+'),), 52 | body:FutureBuilder( 53 | future:request('homePageContext',formData:formData), 54 | builder: (context,snapshot){ 55 | if(snapshot.hasData){ 56 | var data=json.decode(snapshot.data.toString()); 57 | List swiperDataList = (data['data']['slides'] as List).cast(); // 顶部轮播组件数 58 | List navigatorList =(data['data']['category'] as List).cast(); //类别列表 59 | String advertesPicture = data['data']['advertesPicture']['PICTURE_ADDRESS']; //广告图片 60 | String leaderImage= data['data']['shopInfo']['leaderImage']; //店长图片 61 | String leaderPhone = data['data']['shopInfo']['leaderPhone']; //店长电话 62 | List recommendList = (data['data']['recommend'] as List).cast(); // 商品推荐 63 | String floor1Title =data['data']['floor1Pic']['PICTURE_ADDRESS'];//楼层1的标题图片 64 | String floor2Title =data['data']['floor2Pic']['PICTURE_ADDRESS'];//楼层1的标题图片 65 | String floor3Title =data['data']['floor3Pic']['PICTURE_ADDRESS'];//楼层1的标题图片 66 | List floor1 = (data['data']['floor1'] as List).cast(); //楼层1商品和图片 67 | List floor2 = (data['data']['floor2'] as List).cast(); //楼层1商品和图片 68 | List floor3 = (data['data']['floor3'] as List).cast(); //楼层1商品和图片 69 | 70 | 71 | 72 | return EasyRefresh( 73 | 74 | 75 | refreshFooter: ClassicsFooter( 76 | key:_footerKey, 77 | bgColor:Colors.white, 78 | textColor: Colors.pink, 79 | moreInfoColor: Colors.pink, 80 | showMore: true, 81 | noMoreText: '', 82 | moreInfo: '加载中', 83 | loadReadyText:'上拉加载....' 84 | 85 | ), 86 | child: ListView( 87 | children: [ 88 | SwiperDiy(swiperDataList:swiperDataList ), //页面顶部轮播组件 89 | TopNavigator(navigatorList:navigatorList), //导航组件 90 | AdBanner(advertesPicture:advertesPicture), 91 | LeaderPhone(leaderImage:leaderImage,leaderPhone: leaderPhone), //广告组件 92 | Recommend(recommendList:recommendList), 93 | FloorTitle(picture_address:floor1Title), 94 | FloorContent(floorGoodsList:floor1), 95 | FloorTitle(picture_address:floor2Title), 96 | FloorContent(floorGoodsList:floor2), 97 | FloorTitle(picture_address:floor3Title), 98 | FloorContent(floorGoodsList:floor3), 99 | _hotGoods(), 100 | 101 | ], 102 | ) , 103 | loadMore: ()async{ 104 | print('开始加载更多'); 105 | var formPage={'page': page}; 106 | await request('homePageBelowConten',formData:formPage).then((val){ 107 | var data=json.decode(val.toString()); 108 | List newGoodsList = (data['data'] as List ).cast(); 109 | setState(() { 110 | hotGoodsList.addAll(newGoodsList); 111 | page++; 112 | }); 113 | }); 114 | }, 115 | ); 116 | 117 | 118 | }else{ 119 | return Center( 120 | child: Text('加载中'), 121 | 122 | ); 123 | } 124 | }, 125 | ) 126 | ); 127 | 128 | } 129 | //火爆商品接口 130 | void _getHotGoods(){ 131 | var formPage={'page': page}; 132 | request('homePageBelowConten',formData:formPage).then((val){ 133 | 134 | var data=json.decode(val.toString()); 135 | List newGoodsList = (data['data'] as List ).cast(); 136 | setState(() { 137 | hotGoodsList.addAll(newGoodsList); 138 | page++; 139 | }); 140 | 141 | 142 | }); 143 | } 144 | 145 | //火爆专区标题 146 | Widget hotTitle= Container( 147 | margin: EdgeInsets.only(top: 10.0), 148 | 149 | padding:EdgeInsets.all(5.0), 150 | alignment:Alignment.center, 151 | decoration: BoxDecoration( 152 | color: Colors.white, 153 | border:Border( 154 | bottom: BorderSide(width:0.5 ,color:Colors.black12) 155 | ) 156 | ), 157 | child: Text('火爆专区'), 158 | ); 159 | 160 | 161 | //火爆专区子项 162 | Widget _wrapList(){ 163 | 164 | if(hotGoodsList.length!=0){ 165 | List listWidget = hotGoodsList.map((val){ 166 | 167 | return InkWell( 168 | onTap:(){ 169 | 170 | Application.router.navigateTo(context,"/detail?id=${val['goodsId']}"); 171 | }, 172 | child: 173 | Container( 174 | width: ScreenUtil().setWidth(372), 175 | color:Colors.white, 176 | padding: EdgeInsets.all(5.0), 177 | margin:EdgeInsets.only(bottom:3.0), 178 | child: Column( 179 | children: [ 180 | Image.network(val['image'],width: ScreenUtil().setWidth(375),), 181 | Text( 182 | val['name'], 183 | maxLines: 1, 184 | overflow:TextOverflow.ellipsis , 185 | style: TextStyle(color:Colors.pink,fontSize: ScreenUtil().setSp(26)), 186 | ), 187 | Row( 188 | children: [ 189 | Text('¥${val['mallPrice']}'), 190 | Text( 191 | '¥${val['price']}', 192 | style: TextStyle(color:Colors.black26,decoration: TextDecoration.lineThrough), 193 | 194 | ) 195 | ], 196 | ) 197 | ], 198 | ), 199 | ) 200 | 201 | ); 202 | 203 | }).toList(); 204 | 205 | return Wrap( 206 | spacing: 2, 207 | children: listWidget, 208 | ); 209 | }else{ 210 | return Text(' '); 211 | } 212 | } 213 | 214 | //火爆专区组合 215 | Widget _hotGoods(){ 216 | 217 | return Container( 218 | 219 | child:Column( 220 | children: [ 221 | hotTitle, 222 | _wrapList(), 223 | ], 224 | ) 225 | ); 226 | } 227 | 228 | 229 | } 230 | // 首页轮播组件编写 231 | class SwiperDiy extends StatelessWidget{ 232 | 233 | 234 | 235 | final List swiperDataList; 236 | SwiperDiy({Key key,this.swiperDataList}):super(key:key); 237 | 238 | @override 239 | Widget build(BuildContext context) { 240 | 241 | 242 | return Container( 243 | color:Colors.white, 244 | height: ScreenUtil().setHeight(333), 245 | width: ScreenUtil().setWidth(750), 246 | child: Swiper( 247 | itemBuilder: (BuildContext context,int index){ 248 | return InkWell( 249 | onTap: (){ 250 | 251 | 252 | Application.router.navigateTo(context,"/detail?id=${swiperDataList[index]['goodsId']}"); 253 | 254 | }, 255 | child: Image.network("${swiperDataList[index]['image']}",fit:BoxFit.fill), 256 | ); 257 | 258 | }, 259 | itemCount: swiperDataList.length, 260 | pagination: new SwiperPagination(), 261 | autoplay: true, 262 | ), 263 | ); 264 | } 265 | } 266 | 267 | 268 | //首页导航组件 269 | class TopNavigator extends StatelessWidget { 270 | final List navigatorList; 271 | TopNavigator({Key key, this.navigatorList}) : super(key: key); 272 | Widget _gridViewItemUI(BuildContext context,item,index){ 273 | // print('------------------${item}'); 274 | return InkWell( 275 | onTap: (){ 276 | _goCategory(context,index,item['mallCategoryId']); 277 | }, 278 | child: Column( 279 | children: [ 280 | Image.network(item['image'],width:ScreenUtil().setWidth(95)), 281 | Text(item['mallCategoryName']) 282 | ], 283 | ), 284 | ); 285 | } 286 | 287 | void _goCategory(context,int index,String categroyId) async { 288 | await request('getCategory').then((val) { 289 | var data = json.decode(val.toString()); 290 | CategoryModel category = CategoryModel.fromJson(data); 291 | List list = category.data; 292 | Provide.value(context).changeCategory(categroyId,index); 293 | Provide.value(context).getChildCategory( list[index].bxMallSubDto,categroyId); 294 | Provide.value(context).changeIndex(1); 295 | }); 296 | } 297 | 298 | @override 299 | Widget build(BuildContext context) { 300 | 301 | if(navigatorList.length>10){ 302 | navigatorList.removeRange(10, navigatorList.length); 303 | } 304 | var tempIndex=-1; 305 | return Container( 306 | color:Colors.white, 307 | margin: EdgeInsets.only(top: 5.0), 308 | height: ScreenUtil().setHeight(320), 309 | padding:EdgeInsets.all(3.0), 310 | child: GridView.count( 311 | physics: NeverScrollableScrollPhysics(), 312 | crossAxisCount: 5, 313 | padding: EdgeInsets.all(4.0), 314 | children: navigatorList.map((item){ 315 | tempIndex++; 316 | return _gridViewItemUI(context, item,tempIndex); 317 | 318 | }).toList(), 319 | ), 320 | ); 321 | } 322 | } 323 | 324 | 325 | 326 | //广告图片 327 | class AdBanner extends StatelessWidget { 328 | final String advertesPicture; 329 | 330 | AdBanner({Key key, this.advertesPicture}) : super(key: key); 331 | 332 | @override 333 | Widget build(BuildContext context) { 334 | 335 | 336 | return Container( 337 | margin: EdgeInsets.only(top:5.0), 338 | color:Colors.white, 339 | child: Image.network(advertesPicture), 340 | ); 341 | } 342 | } 343 | 344 | class LeaderPhone extends StatelessWidget { 345 | final String leaderImage; //店长图片 346 | final String leaderPhone; //店长电话 347 | 348 | LeaderPhone({Key key, this.leaderImage,this.leaderPhone}) : super(key: key); 349 | 350 | @override 351 | Widget build(BuildContext context) { 352 | return Container( 353 | child: InkWell( 354 | onTap:_launchURL, 355 | child: Image.network(leaderImage), 356 | ), 357 | ); 358 | } 359 | 360 | void _launchURL() async { 361 | String url = 'tel:'+leaderPhone; 362 | if (await canLaunch(url)) { 363 | await launch(url); 364 | } else { 365 | throw 'Could not launch $url'; 366 | } 367 | } 368 | } 369 | 370 | //商品推荐 371 | class Recommend extends StatelessWidget { 372 | final List recommendList; 373 | 374 | Recommend({Key key, this.recommendList}) : super(key: key); 375 | 376 | @override 377 | Widget build(BuildContext context) { 378 | return Container( 379 | margin: EdgeInsets.only(top: 10.0), 380 | child: Column( 381 | children: [ 382 | _titleWidget(), 383 | _recommedList(context) 384 | ], 385 | ), 386 | ); 387 | 388 | } 389 | 390 | //推荐商品标题 391 | Widget _titleWidget(){ 392 | return Container( 393 | alignment: Alignment.centerLeft, 394 | padding: EdgeInsets.fromLTRB(10.0, 2.0, 0,5.0), 395 | decoration: BoxDecoration( 396 | color:Colors.white, 397 | border: Border( 398 | bottom: BorderSide(width:0.5,color:Colors.black12) 399 | ) 400 | ), 401 | child:Text( 402 | '商品推荐', 403 | style:TextStyle(color:Colors.pink) 404 | ) 405 | ); 406 | } 407 | 408 | Widget _recommedList(BuildContext context){ 409 | 410 | return Container( 411 | height: ScreenUtil().setHeight(380), 412 | 413 | child: ListView.builder( 414 | scrollDirection: Axis.horizontal, 415 | itemCount: recommendList.length, 416 | itemBuilder: (context,index){ 417 | return _item(index,context); 418 | }, 419 | ), 420 | ); 421 | } 422 | 423 | Widget _item(index,context){ 424 | return InkWell( 425 | onTap: (){ 426 | Application.router.navigateTo(context,"/detail?id=${recommendList[index]['goodsId']}"); 427 | }, 428 | child: Container( 429 | 430 | width: ScreenUtil().setWidth(280), 431 | padding: EdgeInsets.all(8.0), 432 | decoration:BoxDecoration( 433 | color:Colors.white, 434 | border:Border( 435 | left: BorderSide(width:0.5,color:Colors.black12) 436 | ) 437 | ), 438 | child: Column( 439 | children: [ 440 | Image.network(recommendList[index]['image']), 441 | Text('¥${recommendList[index]['mallPrice']}'), 442 | Text( 443 | '¥${recommendList[index]['price']}', 444 | style: TextStyle( 445 | decoration: TextDecoration.lineThrough, 446 | color:Colors.grey 447 | ), 448 | ) 449 | ], 450 | ), 451 | ), 452 | ); 453 | } 454 | } 455 | 456 | 457 | 458 | //楼层标题 459 | class FloorTitle extends StatelessWidget { 460 | final String picture_address; // 图片地址 461 | FloorTitle({Key key, this.picture_address}) : super(key: key); 462 | 463 | @override 464 | Widget build(BuildContext context) { 465 | return Container( 466 | padding: EdgeInsets.all(8.0), 467 | child: Image.network(picture_address), 468 | ); 469 | } 470 | } 471 | 472 | //楼层商品组件 473 | class FloorContent extends StatelessWidget { 474 | final List floorGoodsList; 475 | 476 | FloorContent({Key key, this.floorGoodsList}) : super(key: key); 477 | 478 | @override 479 | Widget build(BuildContext context) { 480 | return Container( 481 | child: Column( 482 | children: [ 483 | _firstRow(context), 484 | _otherGoods(context) 485 | ], 486 | ), 487 | ); 488 | } 489 | 490 | Widget _firstRow(context){ 491 | return Row( 492 | children: [ 493 | _goodsItem(context,floorGoodsList[0]), 494 | Column( 495 | children: [ 496 | _goodsItem(context,floorGoodsList[1]), 497 | _goodsItem(context,floorGoodsList[2]), 498 | ], 499 | ) 500 | ], 501 | ); 502 | } 503 | 504 | Widget _otherGoods(context){ 505 | return Row( 506 | children: [ 507 | _goodsItem(context,floorGoodsList[3]), 508 | _goodsItem(context,floorGoodsList[4]), 509 | ], 510 | ); 511 | } 512 | 513 | Widget _goodsItem(context,Map goods){ 514 | 515 | return Container( 516 | width:ScreenUtil().setWidth(375), 517 | child: InkWell( 518 | onTap:(){ 519 | Application.router.navigateTo(context, "/detail?id=${goods['goodsId']}"); 520 | }, 521 | child: Image.network(goods['image']), 522 | ), 523 | ); 524 | } 525 | 526 | } 527 | 528 | 529 | 530 | 531 | -------------------------------------------------------------------------------- /lib/pages/index_page.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/cupertino.dart'; 2 | import 'package:flutter/material.dart'; 3 | import 'home_page.dart'; 4 | import 'category_page.dart'; 5 | import 'cart_page.dart'; 6 | import 'member_page.dart'; 7 | import 'package:flutter_screenutil/flutter_screenutil.dart'; 8 | import 'package:provide/provide.dart'; 9 | import '../provide/currentIndex.dart'; 10 | 11 | 12 | class IndexPage extends StatelessWidget { 13 | final List bottomTabs = [ 14 | BottomNavigationBarItem( 15 | icon:Icon(CupertinoIcons.home), 16 | title:Text('首页') 17 | ), 18 | BottomNavigationBarItem( 19 | icon:Icon(CupertinoIcons.search), 20 | title:Text('分类') 21 | ), 22 | BottomNavigationBarItem( 23 | icon:Icon(CupertinoIcons.shopping_cart), 24 | title:Text('购物车') 25 | ), 26 | BottomNavigationBarItem( 27 | icon:Icon(CupertinoIcons.profile_circled), 28 | title:Text('会员中心') 29 | ), 30 | ]; 31 | 32 | final List tabBodies = [ 33 | HomePage(), 34 | CategoryPage(), 35 | CartPage(), 36 | MemberPage() 37 | ]; 38 | 39 | @override 40 | Widget build(BuildContext context) { 41 | ScreenUtil.instance = ScreenUtil(width: 750, height: 1334)..init(context); 42 | return Provide( 43 | 44 | builder: (context,child,val){ 45 | int currentIndex= Provide.value(context).currentIndex; 46 | return Scaffold( 47 | backgroundColor: Color.fromRGBO(244, 245, 245, 1.0), 48 | bottomNavigationBar: BottomNavigationBar( 49 | type:BottomNavigationBarType.fixed, 50 | currentIndex: currentIndex, 51 | items:bottomTabs, 52 | onTap: (index){ 53 | Provide.value(context).changeIndex(index); 54 | }, 55 | ), 56 | body: IndexedStack( 57 | index: currentIndex, 58 | children: tabBodies 59 | ), 60 | ); 61 | } 62 | ); 63 | 64 | } 65 | } 66 | 67 | 68 | // class IndexPage extends StatefulWidget { 69 | 70 | // _IndexPageState createState() => _IndexPageState(); 71 | // } 72 | 73 | // class _IndexPageState extends State{ 74 | 75 | // PageController _pageController; 76 | 77 | 78 | // final List bottomTabs = [ 79 | // BottomNavigationBarItem( 80 | // icon:Icon(CupertinoIcons.home), 81 | // title:Text('首页') 82 | // ), 83 | // BottomNavigationBarItem( 84 | // icon:Icon(CupertinoIcons.search), 85 | // title:Text('分类') 86 | // ), 87 | // BottomNavigationBarItem( 88 | // icon:Icon(CupertinoIcons.shopping_cart), 89 | // title:Text('购物车') 90 | // ), 91 | // BottomNavigationBarItem( 92 | // icon:Icon(CupertinoIcons.profile_circled), 93 | // title:Text('会员中心') 94 | // ), 95 | // ]; 96 | // final List tabBodies = [ 97 | // HomePage(), 98 | // CategoryPage(), 99 | // CartPage(), 100 | // MemberPage() 101 | // ]; 102 | // int currentIndex= 0; 103 | // var currentPage ; 104 | // @override 105 | // void initState() { 106 | // currentPage=tabBodies[currentIndex]; 107 | // _pageController=new PageController() 108 | // ..addListener(() { 109 | // if (currentPage != _pageController.page.round()) { 110 | // setState(() { 111 | // currentPage = _pageController.page.round(); 112 | // }); 113 | // } 114 | // }); 115 | // super.initState(); 116 | // } 117 | // @override 118 | // Widget build(BuildContext context) { 119 | // ScreenUtil.instance = ScreenUtil(width: 750, height: 1334)..init(context); 120 | // return Scaffold( 121 | // backgroundColor: Color.fromRGBO(244, 245, 245, 1.0), 122 | // bottomNavigationBar: BottomNavigationBar( 123 | // type:BottomNavigationBarType.fixed, 124 | // currentIndex: currentIndex, 125 | // items:bottomTabs, 126 | // onTap: (index){ 127 | // setState(() { 128 | // // currentIndex=index; 129 | // // currentPage =tabBodies[currentIndex]; 130 | // }); 131 | 132 | // }, 133 | // ), 134 | // body:Provide( 135 | // builder: (context,child,val){ 136 | 137 | // return IndexedStack( 138 | // index: 0, 139 | // children: tabBodies 140 | // ); 141 | // }, 142 | // ) 143 | // ); 144 | // } 145 | // } 146 | 147 | -------------------------------------------------------------------------------- /lib/pages/member_page.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_screenutil/flutter_screenutil.dart'; 3 | 4 | 5 | class MemberPage extends StatelessWidget { 6 | @override 7 | Widget build(BuildContext context) { 8 | return Scaffold( 9 | appBar: AppBar( 10 | title: Text('会员中心'), 11 | ), 12 | body:ListView( 13 | children: [ 14 | _topHeader(), 15 | _orderTitle(), 16 | _orderType(), 17 | _actionList() 18 | 19 | ], 20 | ) , 21 | ); 22 | } 23 | 24 | //头像区域 25 | 26 | Widget _topHeader(){ 27 | 28 | return Container( 29 | width: ScreenUtil().setWidth(750), 30 | padding: EdgeInsets.all(20), 31 | color: Colors.pinkAccent, 32 | child: Column( 33 | children: [ 34 | Container( 35 | margin: EdgeInsets.only(top: 30), 36 | child: ClipOval( 37 | 38 | child:Image.network('http://blogimages.jspang.com/blogtouxiang1.jpg') 39 | ), 40 | ), 41 | Container( 42 | margin: EdgeInsets.only(top: 10), 43 | child: Text( 44 | '技术胖', 45 | style: TextStyle( 46 | fontSize: ScreenUtil().setSp(36), 47 | color:Colors.white, 48 | 49 | ), 50 | ), 51 | ) 52 | ], 53 | ), 54 | ); 55 | 56 | } 57 | 58 | //我的订单顶部 59 | Widget _orderTitle(){ 60 | 61 | return Container( 62 | margin: EdgeInsets.only(top:10), 63 | decoration: BoxDecoration( 64 | color: Colors.white, 65 | border: Border( 66 | bottom:BorderSide(width: 1,color:Colors.black12) 67 | ) 68 | ), 69 | child: ListTile( 70 | leading: Icon(Icons.list), 71 | title:Text('我的订单'), 72 | trailing: Icon(Icons.arrow_right), 73 | ), 74 | ); 75 | 76 | } 77 | 78 | Widget _orderType(){ 79 | 80 | return Container( 81 | margin: EdgeInsets.only(top:5), 82 | width: ScreenUtil().setWidth(750), 83 | height: ScreenUtil().setHeight(150), 84 | padding: EdgeInsets.only(top:20), 85 | color: Colors.white, 86 | child: Row( 87 | children: [ 88 | Container( 89 | width: ScreenUtil().setWidth(187), 90 | child: Column( 91 | children: [ 92 | Icon( 93 | Icons.party_mode, 94 | size: 30, 95 | ), 96 | Text('待付款'), 97 | ], 98 | ), 99 | ), 100 | //----------------- 101 | Container( 102 | width: ScreenUtil().setWidth(187), 103 | child: Column( 104 | children: [ 105 | Icon( 106 | Icons.query_builder, 107 | size: 30, 108 | ), 109 | Text('待发货'), 110 | ], 111 | ), 112 | ), 113 | //----------------- 114 | Container( 115 | width: ScreenUtil().setWidth(187), 116 | child: Column( 117 | children: [ 118 | Icon( 119 | Icons.directions_car, 120 | size: 30, 121 | ), 122 | Text('待收货'), 123 | ], 124 | ), 125 | ), 126 | Container( 127 | width: ScreenUtil().setWidth(187), 128 | child: Column( 129 | children: [ 130 | Icon( 131 | Icons.content_paste, 132 | size: 30, 133 | ), 134 | Text('待评价'), 135 | ], 136 | ), 137 | ), 138 | ], 139 | ), 140 | ); 141 | 142 | } 143 | 144 | Widget _myListTile(String title){ 145 | 146 | return Container( 147 | decoration: BoxDecoration( 148 | color: Colors.white, 149 | border: Border( 150 | bottom:BorderSide(width: 1,color:Colors.black12) 151 | ) 152 | ), 153 | child: ListTile( 154 | leading: Icon(Icons.blur_circular), 155 | title: Text(title), 156 | trailing: Icon(Icons.arrow_right), 157 | ), 158 | ); 159 | } 160 | 161 | Widget _actionList(){ 162 | return Container( 163 | margin: EdgeInsets.only(top: 10), 164 | child: Column( 165 | children: [ 166 | _myListTile('领取优惠券'), 167 | _myListTile('已领取优惠券'), 168 | _myListTile('地址管理'), 169 | _myListTile('客服电话'), 170 | _myListTile('关于我们'), 171 | ], 172 | ), 173 | ); 174 | } 175 | 176 | 177 | 178 | 179 | } -------------------------------------------------------------------------------- /lib/provide/cart.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:shared_preferences/shared_preferences.dart'; 3 | import '../model/cartInfo.dart'; 4 | import 'dart:convert'; 5 | 6 | class CartProvide with ChangeNotifier{ 7 | 8 | String cartString="[]"; 9 | List cartList=[]; //商品列表对象 10 | 11 | double allPrice =0 ; //总价格 12 | int allGoodsCount =0; //商品总数量 13 | bool isAllCheck= true; //是否全选 14 | 15 | save(goodsId,goodsName,count,price,images) async{ 16 | //初始化SharedPreferences 17 | SharedPreferences prefs = await SharedPreferences.getInstance(); 18 | cartString=prefs.getString('cartInfo'); //获取持久化存储的值 19 | var temp=cartString==null?[]:json.decode(cartString.toString()); 20 | //把获得值转变成List 21 | List tempList= (temp as List).cast(); 22 | //声明变量,用于判断购物车中是否已经存在此商品ID 23 | var isHave= false; //默认为没有 24 | int ival=0; //用于进行循环的索引使用 25 | allPrice=0; 26 | allGoodsCount=0; //把商品总数量设置为0 27 | tempList.forEach((item){//进行循环,找出是否已经存在该商品 28 | //如果存在,数量进行+1操作 29 | if(item['goodsId']==goodsId){ 30 | tempList[ival]['count']=item['count']+1; 31 | cartList[ival].count++; 32 | isHave=true; 33 | } 34 | if(item['isCheck']){ 35 | allPrice+= (cartList[ival].price* cartList[ival].count); 36 | allGoodsCount+= cartList[ival].count; 37 | } 38 | 39 | 40 | ival++; 41 | }); 42 | // 如果没有,进行增加 43 | if(!isHave){ 44 | Map newGoods={ 45 | 'goodsId':goodsId, 46 | 'goodsName':goodsName, 47 | 'count':count, 48 | 'price':price, 49 | 'images':images, 50 | 'isCheck': true //是否已经选择 51 | }; 52 | tempList.add(newGoods); 53 | cartList.add(new CartInfoMode.fromJson(newGoods)); 54 | allPrice+= (count * price); 55 | allGoodsCount+=count; 56 | } 57 | //把字符串进行encode操作, 58 | cartString= json.encode(tempList).toString(); 59 | 60 | prefs.setString('cartInfo', cartString);//进行持久化 61 | notifyListeners(); 62 | } 63 | //删除购物车中的商品 64 | remove() async{ 65 | SharedPreferences prefs = await SharedPreferences.getInstance(); 66 | //prefs.clear();//清空键值对 67 | prefs.remove('cartInfo'); 68 | cartList=[]; 69 | allPrice =0 ; 70 | allGoodsCount=0; 71 | print('清空完成-----------------'); 72 | notifyListeners(); 73 | } 74 | 75 | //得到购物车中的商品 76 | getCartInfo() async { 77 | SharedPreferences prefs = await SharedPreferences.getInstance(); 78 | //获得购物车中的商品,这时候是一个字符串 79 | cartString=prefs.getString('cartInfo'); 80 | 81 | //把cartList进行初始化,防止数据混乱 82 | cartList=[]; 83 | //判断得到的字符串是否有值,如果不判断会报错 84 | if(cartString==null){ 85 | cartList=[]; 86 | }else{ 87 | List tempList= (json.decode(cartString.toString()) as List).cast(); 88 | allPrice=0; 89 | allGoodsCount=0; 90 | isAllCheck=true; 91 | tempList.forEach((item){ 92 | 93 | if(item['isCheck']){ 94 | allPrice+=(item['count']*item['price']); 95 | allGoodsCount+=item['count']; 96 | }else{ 97 | isAllCheck=false; 98 | } 99 | 100 | cartList.add(new CartInfoMode.fromJson(item)); 101 | 102 | }); 103 | 104 | } 105 | notifyListeners(); 106 | } 107 | 108 | //删除单个购物车商品 109 | deleteOneGoods(String goodsId) async{ 110 | SharedPreferences prefs = await SharedPreferences.getInstance(); 111 | cartString=prefs.getString('cartInfo'); 112 | List tempList= (json.decode(cartString.toString()) as List).cast(); 113 | 114 | int tempIndex =0; 115 | int delIndex=0; 116 | tempList.forEach((item){ 117 | 118 | if(item['goodsId']==goodsId){ 119 | delIndex=tempIndex; 120 | } 121 | tempIndex++; 122 | }); 123 | tempList.removeAt(delIndex); 124 | cartString= json.encode(tempList).toString(); 125 | prefs.setString('cartInfo', cartString);// 126 | await getCartInfo(); 127 | 128 | 129 | } 130 | 131 | //修改选中状态 132 | changeCheckState(CartInfoMode cartItem) async{ 133 | SharedPreferences prefs = await SharedPreferences.getInstance(); 134 | cartString=prefs.getString('cartInfo'); 135 | List tempList= (json.decode(cartString.toString()) as List).cast(); 136 | int tempIndex =0; 137 | int changeIndex=0; 138 | tempList.forEach((item){ 139 | 140 | if(item['goodsId']==cartItem.goodsId){ 141 | changeIndex=tempIndex; 142 | } 143 | tempIndex++; 144 | }); 145 | tempList[changeIndex]=cartItem.toJson(); 146 | cartString= json.encode(tempList).toString(); 147 | prefs.setString('cartInfo', cartString);// 148 | await getCartInfo(); 149 | 150 | } 151 | 152 | //点击全选按钮操作 153 | changeAllCheckBtnState(bool isCheck) async{ 154 | SharedPreferences prefs = await SharedPreferences.getInstance(); 155 | cartString=prefs.getString('cartInfo'); 156 | List tempList= (json.decode(cartString.toString()) as List).cast(); 157 | List newList=[]; 158 | for(var item in tempList ){ 159 | var newItem = item; 160 | newItem['isCheck']=isCheck; 161 | newList.add(newItem); 162 | } 163 | 164 | cartString= json.encode(newList).toString(); 165 | prefs.setString('cartInfo', cartString);// 166 | await getCartInfo(); 167 | 168 | } 169 | 170 | //增加减少数量的操作 171 | 172 | addOrReduceAction(var cartItem, String todo )async{ 173 | SharedPreferences prefs = await SharedPreferences.getInstance(); 174 | cartString=prefs.getString('cartInfo'); 175 | List tempList= (json.decode(cartString.toString()) as List).cast(); 176 | int tempIndex =0; 177 | int changeIndex=0; 178 | tempList.forEach((item){ 179 | if(item['goodsId']==cartItem.goodsId){ 180 | changeIndex=tempIndex; 181 | } 182 | tempIndex++; 183 | }); 184 | if(todo=='add'){ 185 | cartItem.count++; 186 | }else if(cartItem.count>1){ 187 | cartItem.count--; 188 | } 189 | tempList[changeIndex]=cartItem.toJson(); 190 | cartString= json.encode(tempList).toString(); 191 | prefs.setString('cartInfo', cartString);// 192 | await getCartInfo(); 193 | 194 | } 195 | 196 | 197 | 198 | 199 | 200 | 201 | } -------------------------------------------------------------------------------- /lib/provide/category_goods_list.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import '../model/categoryGoodsList.dart'; 3 | 4 | 5 | class CategoryGoodsListProvide with ChangeNotifier{ 6 | 7 | List goodsList = []; 8 | 9 | //点击大类时更换商品列表 10 | getGoodsList(List list){ 11 | 12 | goodsList=list; 13 | notifyListeners(); 14 | } 15 | //上拉加载列表 16 | addGoodsList(List list){ 17 | goodsList.addAll(list); 18 | notifyListeners(); 19 | } 20 | } -------------------------------------------------------------------------------- /lib/provide/child_category.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import '../model/category.dart'; 3 | 4 | 5 | //ChangeNotifier的混入是不用管理听众 6 | class ChildCategory with ChangeNotifier{ 7 | 8 | List childCategoryList = []; //商品列表 9 | int childIndex = 0; //子类索引值 10 | int categoryIndex=0; //大类索引 11 | String categoryId = '4'; //大类ID 12 | String subId =''; //小类ID 13 | int page=1; //列表页数,当改变大类或者小类时进行改变 14 | String noMoreText = ''; //显示更多的表示 15 | bool isNewCategory= true; 16 | 17 | 18 | //首页点击类别是更改类别 19 | changeCategory(String id,int index){ 20 | categoryId=id; 21 | categoryIndex=index; 22 | subId =''; 23 | notifyListeners(); 24 | } 25 | 26 | 27 | 28 | //点击大类时更换 29 | getChildCategory(List list,String id){ 30 | isNewCategory=true; 31 | categoryId=id; 32 | childIndex=0; 33 | page=1; 34 | subId=''; //点击大类时,把子类ID清空 35 | noMoreText=''; 36 | BxMallSubDto all= BxMallSubDto(); 37 | all.mallSubId=''; 38 | all.mallCategoryId='00'; 39 | all.mallSubName = '全部'; 40 | all.comments = 'null'; 41 | childCategoryList=[all]; 42 | childCategoryList.addAll(list); 43 | notifyListeners(); 44 | } 45 | //改变子类索引 , 46 | changeChildIndex(int index,String id){ 47 | isNewCategory=true; 48 | //传递两个参数,使用新传递的参数给状态赋值 49 | childIndex=index; 50 | subId=id; 51 | page=1; 52 | noMoreText=''; 53 | notifyListeners(); 54 | } 55 | //增加Page的方法f 56 | addPage(){ 57 | page++; 58 | } 59 | //改变noMoreText数据 60 | changeNoMore(String text){ 61 | noMoreText=text; 62 | notifyListeners(); 63 | } 64 | 65 | //改变为flas 66 | changeFalse(){ 67 | isNewCategory=false; 68 | } 69 | } -------------------------------------------------------------------------------- /lib/provide/counter.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | class Counter with ChangeNotifier { 4 | int value =0 ; 5 | 6 | increment(){ 7 | value++; 8 | notifyListeners(); 9 | } 10 | } -------------------------------------------------------------------------------- /lib/provide/currentIndex.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | class CurrentIndexProvide with ChangeNotifier{ 4 | int currentIndex=0; 5 | 6 | changeIndex(int newIndex){ 7 | currentIndex=newIndex; 8 | notifyListeners(); 9 | } 10 | 11 | } -------------------------------------------------------------------------------- /lib/provide/details_info.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import '../model/details.dart'; 3 | import '../service/service_method.dart'; 4 | import 'dart:convert'; 5 | 6 | class DetailsInfoProvide with ChangeNotifier{ 7 | 8 | DetailsModel goodsInfo =null; 9 | bool isLeft = true; 10 | bool isRight = false; 11 | 12 | //从后台获取商品信息 13 | 14 | getGoodsInfo(String id )async{ 15 | var formData = { 'goodId':id, }; 16 | 17 | await request('getGoodDetailById',formData:formData).then((val){ 18 | var responseData= json.decode(val.toString()); 19 | goodsInfo=DetailsModel.fromJson(responseData); 20 | notifyListeners(); 21 | }); 22 | 23 | 24 | } 25 | //改变tabBar的状态 26 | changeLeftAndRight(String changeState){ 27 | if(changeState=='left'){ 28 | isLeft=true; 29 | isRight=false; 30 | }else{ 31 | isLeft=false; 32 | isRight=true; 33 | } 34 | notifyListeners(); 35 | 36 | } 37 | 38 | 39 | } -------------------------------------------------------------------------------- /lib/routers/application.dart: -------------------------------------------------------------------------------- 1 | import 'package:fluro/fluro.dart'; 2 | 3 | class Application{ 4 | static Router router; 5 | } -------------------------------------------------------------------------------- /lib/routers/router_handler.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:fluro/fluro.dart'; 3 | import '../pages/details_page.dart'; 4 | 5 | 6 | Handler detailsHandler =Handler( 7 | handlerFunc: (BuildContext context,Map> params){ 8 | String goodsId = params['id'].first; 9 | print('index>details goodsID is ${goodsId}'); 10 | return DetailsPage(goodsId); 11 | 12 | } 13 | ); -------------------------------------------------------------------------------- /lib/routers/routes.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import './router_handler.dart'; 3 | import 'package:fluro/fluro.dart'; 4 | 5 | class Routes{ 6 | static String root='/'; 7 | static String detailsPage = '/detail'; 8 | static void configureRoutes(Router router){ 9 | router.notFoundHandler= new Handler( 10 | handlerFunc: (BuildContext context,Map> params){ 11 | print('ERROR====>ROUTE WAS NOT FONUND!!!'); 12 | } 13 | ); 14 | 15 | router.define(detailsPage,handler:detailsHandler); 16 | } 17 | 18 | } -------------------------------------------------------------------------------- /lib/service/service_method.dart: -------------------------------------------------------------------------------- 1 | import "package:dio/dio.dart"; 2 | import 'dart:async'; 3 | import 'dart:io'; 4 | import '../config/service_url.dart'; 5 | 6 | 7 | Future request(url,{formData})async{ 8 | try{ 9 | //print('开始获取数据...............'); 10 | Response response; 11 | Dio dio = new Dio(); 12 | dio.options.contentType=ContentType.parse("application/x-www-form-urlencoded"); 13 | if(formData==null){ 14 | 15 | response = await dio.post(servicePath[url]); 16 | }else{ 17 | response = await dio.post(servicePath[url],data:formData); 18 | } 19 | if(response.statusCode==200){ 20 | return response.data; 21 | }else{ 22 | throw Exception('后端接口出现异常,请检测代码和服务器情况.........'); 23 | } 24 | }catch(e){ 25 | return print('ERROR:======>${e}'); 26 | } 27 | 28 | } 29 | 30 | 31 | //获得商城首页信息的方法 32 | Future getHomePageContent() async{ 33 | 34 | try{ 35 | print('开始获取首页数据...............'); 36 | Response response; 37 | Dio dio = new Dio(); 38 | dio.options.contentType=ContentType.parse("application/x-www-form-urlencoded"); 39 | var formData = {'lon':'115.02932','lat':'35.76189'}; 40 | response = await dio.post(servicePath['homePageContext'],data:formData); 41 | if(response.statusCode==200){ 42 | return response.data; 43 | }else{ 44 | throw Exception('后端接口出现异常,请检测代码和服务器情况.........'); 45 | } 46 | }catch(e){ 47 | return print('ERROR:======>${e}'); 48 | } 49 | 50 | } 51 | 52 | //获得火爆专区商品的方法 53 | Future getHomePageBeloConten() async{ 54 | 55 | try{ 56 | print('开始获取下拉列表数据.................'); 57 | Response response; 58 | Dio dio = new Dio(); 59 | dio.options.contentType=ContentType.parse("application/x-www-form-urlencoded"); 60 | int page=1; 61 | response = await dio.post(servicePath['homePageBelowConten'],data:page); 62 | if(response.statusCode==200){ 63 | return response.data; 64 | }else{ 65 | throw Exception('后端接口出现异常,请检测代码和服务器情况.........'); 66 | } 67 | }catch(e){ 68 | return print('ERROR:======>${e}'); 69 | } 70 | 71 | 72 | } 73 | 74 | 75 | -------------------------------------------------------------------------------- /pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: flutter_shop 2 | description: A new Flutter project. 3 | 4 | # The following defines the version and build number for your application. 5 | # A version number is three numbers separated by dots, like 1.2.43 6 | # followed by an optional build number separated by a +. 7 | # Both the version and the builder number may be overridden in flutter 8 | # build by specifying --build-name and --build-number, respectively. 9 | # Read more about versioning at semver.org. 10 | version: 1.0.0+1 11 | 12 | environment: 13 | sdk: ">=2.0.0-dev.68.0 <3.0.0" 14 | 15 | dependencies: 16 | flutter: 17 | sdk: flutter 18 | 19 | # The following adds the Cupertino Icons font to your application. 20 | # Use with the CupertinoIcons class for iOS style icons. 21 | cupertino_icons: ^0.1.2 22 | dio: ^2.0.7 23 | flutter_swiper: ^1.1.4 24 | flutter_screenutil: ^0.5.1 25 | url_launcher: ^5.0.1 26 | flutter_easyrefresh: ^1.2.7 27 | provide: ^1.0.2 28 | fluttertoast: ^3.0.1 29 | fluro: ^1.4.0 30 | flutter_html: ^0.9.6 31 | sqflite: ^1.1.0 32 | shared_preferences: ^0.5.1 33 | 34 | dev_dependencies: 35 | flutter_test: 36 | sdk: flutter 37 | 38 | 39 | # For information on the generic Dart part of this file, see the 40 | # following page: https://www.dartlang.org/tools/pub/pubspec 41 | 42 | # The following section is specific to Flutter. 43 | flutter: 44 | 45 | # The following line ensures that the Material Icons font is 46 | # included with your application, so that you can use the icons in 47 | # the material Icons class. 48 | uses-material-design: true 49 | 50 | # To add assets to your application, add an assets section, like this: 51 | # assets: 52 | # - images/a_dot_burr.jpeg 53 | # - images/a_dot_ham.jpeg 54 | 55 | # An image asset can refer to one or more resolution-specific "variants", see 56 | # https://flutter.io/assets-and-images/#resolution-aware. 57 | 58 | # For details regarding adding assets from package dependencies, see 59 | # https://flutter.io/assets-and-images/#from-packages 60 | 61 | # To add custom fonts to your application, add a fonts section here, 62 | # in this "flutter" section. Each entry in this list should have a 63 | # "family" key with the font family name, and a "fonts" key with a 64 | # list giving the asset and other descriptors for the font. For 65 | # example: 66 | # fonts: 67 | # - family: Schyler 68 | # fonts: 69 | # - asset: fonts/Schyler-Regular.ttf 70 | # - asset: fonts/Schyler-Italic.ttf 71 | # style: italic 72 | # - family: Trajan Pro 73 | # fonts: 74 | # - asset: fonts/TrajanPro.ttf 75 | # - asset: fonts/TrajanPro_Bold.ttf 76 | # weight: 700 77 | # 78 | # For details regarding fonts from package dependencies, 79 | # see https://flutter.io/custom-fonts/#from-packages 80 | -------------------------------------------------------------------------------- /test/widget_test.dart: -------------------------------------------------------------------------------- 1 | // This is a basic Flutter widget test. 2 | // 3 | // To perform an interaction with a widget in your test, use the WidgetTester 4 | // utility that Flutter provides. For example, you can send tap and scroll 5 | // gestures. You can also use WidgetTester to find child widgets in the widget 6 | // tree, read text, and verify that the values of widget properties are correct. 7 | 8 | import 'package:flutter/material.dart'; 9 | import 'package:flutter_test/flutter_test.dart'; 10 | 11 | import 'package:flutter_shop/main.dart'; 12 | 13 | void main() { 14 | testWidgets('Counter increments smoke test', (WidgetTester tester) async { 15 | // Build our app and trigger a frame. 16 | await tester.pumpWidget(MyApp()); 17 | 18 | // Verify that our counter starts at 0. 19 | expect(find.text('0'), findsOneWidget); 20 | expect(find.text('1'), findsNothing); 21 | 22 | // Tap the '+' icon and trigger a frame. 23 | await tester.tap(find.byIcon(Icons.add)); 24 | await tester.pump(); 25 | 26 | // Verify that our counter has incremented. 27 | expect(find.text('0'), findsNothing); 28 | expect(find.text('1'), findsOneWidget); 29 | }); 30 | } 31 | --------------------------------------------------------------------------------