├── android ├── gradle.properties ├── key.properties ├── app │ ├── src │ │ ├── main │ │ │ ├── res │ │ │ │ ├── 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 │ │ │ │ └── drawable │ │ │ │ │ └── launch_background.xml │ │ │ ├── java │ │ │ │ └── com │ │ │ │ │ └── example │ │ │ │ │ └── flutter_shop │ │ │ │ │ └── MainActivity.java │ │ │ └── AndroidManifest.xml │ │ ├── debug │ │ │ └── AndroidManifest.xml │ │ └── profile │ │ │ └── AndroidManifest.xml │ └── build.gradle ├── gradle │ └── wrapper │ │ └── gradle-wrapper.properties ├── settings.gradle └── build.gradle ├── assets └── images │ ├── irving.jpeg │ ├── app_show.jpg │ ├── baixingQR.png │ └── background.png ├── ios ├── Flutter │ ├── Debug.xcconfig │ ├── Release.xcconfig │ └── AppFrameworkInfo.plist ├── Runner │ ├── AppDelegate.h │ ├── Assets.xcassets │ │ ├── LaunchImage.imageset │ │ │ ├── LaunchImage.png │ │ │ ├── LaunchImage@2x.png │ │ │ ├── LaunchImage@3x.png │ │ │ ├── README.md │ │ │ └── Contents.json │ │ └── AppIcon.appiconset │ │ │ ├── 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-1024x1024@1x.png │ │ │ ├── Icon-App-83.5x83.5@2x.png │ │ │ └── Contents.json │ ├── main.m │ ├── AppDelegate.m │ ├── Info.plist │ └── Base.lproj │ │ ├── Main.storyboard │ │ └── LaunchScreen.storyboard ├── Runner.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ │ └── IDEWorkspaceChecks.plist ├── Runner.xcodeproj │ ├── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ │ └── IDEWorkspaceChecks.plist │ ├── xcshareddata │ │ └── xcschemes │ │ │ └── Runner.xcscheme │ └── project.pbxproj └── Podfile ├── lib ├── route │ ├── application.dart │ ├── router_handler.dart │ └── index.dart ├── provide │ ├── router.dart │ ├── details_info.dart │ ├── childCategory.dart │ ├── homePage.dart │ ├── category_goods_list.dart │ └── cart.dart ├── config │ ├── service_url.dart │ └── httpHeaders.dart ├── pages │ ├── details_pages │ │ ├── details_explain.dart │ │ ├── detail_tab_bar.dart │ │ ├── details_webview.dart │ │ ├── details_bottom.dart │ │ └── details_top.dart │ ├── cart_page.dart │ ├── details_page.dart │ ├── cart_pages │ │ ├── cart_count.dart │ │ ├── cart_bottom.dart │ │ └── cart_item.dart │ ├── index_page.dart │ ├── member_page.dart │ ├── category_page.dart │ └── home_page.dart ├── model │ ├── cart_info.dart │ ├── hotGoods.dart │ ├── mallGoodsList.dart │ ├── category.dart │ ├── details_madel.dart │ └── homeContent.dart ├── service │ └── service_method.dart └── main.dart ├── .metadata ├── README.md ├── test └── widget_test.dart ├── .gitignore ├── pubspec.yaml └── pubspec.lock /android/gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xmx1536M 2 | -------------------------------------------------------------------------------- /assets/images/irving.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liyuandie/flutter_shop/HEAD/assets/images/irving.jpeg -------------------------------------------------------------------------------- /assets/images/app_show.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liyuandie/flutter_shop/HEAD/assets/images/app_show.jpg -------------------------------------------------------------------------------- /assets/images/baixingQR.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liyuandie/flutter_shop/HEAD/assets/images/baixingQR.png -------------------------------------------------------------------------------- /assets/images/background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liyuandie/flutter_shop/HEAD/assets/images/background.png -------------------------------------------------------------------------------- /android/key.properties: -------------------------------------------------------------------------------- 1 | storePassword=950623 2 | keyPassword=950623 3 | keyAlias=key 4 | storeFile=/Users/crawford/key.jks -------------------------------------------------------------------------------- /ios/Flutter/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig" 2 | #include "Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /ios/Flutter/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" 2 | #include "Generated.xcconfig" 3 | -------------------------------------------------------------------------------- /ios/Runner/AppDelegate.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | 4 | @interface AppDelegate : FlutterAppDelegate 5 | 6 | @end 7 | -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liyuandie/flutter_shop/HEAD/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liyuandie/flutter_shop/HEAD/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liyuandie/flutter_shop/HEAD/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liyuandie/flutter_shop/HEAD/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liyuandie/flutter_shop/HEAD/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /lib/route/application.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:fluro/fluro.dart'; 3 | 4 | class Application { 5 | static Router router; 6 | } 7 | -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liyuandie/flutter_shop/HEAD/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liyuandie/flutter_shop/HEAD/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/liyuandie/flutter_shop/HEAD/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/liyuandie/flutter_shop/HEAD/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/liyuandie/flutter_shop/HEAD/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/liyuandie/flutter_shop/HEAD/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/liyuandie/flutter_shop/HEAD/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/liyuandie/flutter_shop/HEAD/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/liyuandie/flutter_shop/HEAD/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/liyuandie/flutter_shop/HEAD/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/liyuandie/flutter_shop/HEAD/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/liyuandie/flutter_shop/HEAD/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/liyuandie/flutter_shop/HEAD/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/liyuandie/flutter_shop/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liyuandie/flutter_shop/HEAD/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liyuandie/flutter_shop/HEAD/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liyuandie/flutter_shop/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/liyuandie/flutter_shop/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png -------------------------------------------------------------------------------- /ios/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /lib/provide/router.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | class RouterProvide with ChangeNotifier { 4 | int currentIndex = 0; 5 | 6 | changeIndex(int newIndex) { 7 | currentIndex = newIndex; 8 | notifyListeners(); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /.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: 7a4c33425ddd78c54aba07d86f3f9a4a0051769b 8 | channel: stable 9 | 10 | project_type: app 11 | -------------------------------------------------------------------------------- /android/app/src/debug/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /android/app/src/profile/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /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. -------------------------------------------------------------------------------- /lib/route/router_handler.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:fluro/fluro.dart'; 3 | import '../pages/details_page.dart'; 4 | 5 | Handler detailHandler = Handler( 6 | handlerFunc: (BuildContext context, Map> params) { 7 | String goodsId = params['id'].first; 8 | print('index_details id is:$goodsId'); 9 | return DetailsPage(goodsId); 10 | }); 11 | -------------------------------------------------------------------------------- /android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | -------------------------------------------------------------------------------- /android/app/src/main/java/com/example/flutter_shop/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.example.flutter_shop; 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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /android/app/src/main/res/drawable/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /lib/route/index.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:fluro/fluro.dart'; 3 | import './router_handler.dart'; 4 | 5 | class Routes { 6 | static String root = '/'; 7 | static String detailsPage = '/detail'; 8 | 9 | static void configureRoute(Router router) { 10 | router.notFoundHandler = new Handler( 11 | handlerFunc: (BuildContext context, Map> param) { 12 | print('ERROR====>ROUTE WAS NOT FOUND!!!'); 13 | }); 14 | router.define(detailsPage, handler: detailHandler); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # flutter_shop 2 | 3 | 一个企业级移动电商实战项目,flutter 进阶实战练习,使用真实接口; 4 | 5 | 长期更新,欢迎讨论,共同进步。 6 | 7 | ps:来都来了,给个star吧🐶 8 | 9 | ## 效果预览 10 | 11 | ![](assets/images/app_show.jpg) 12 | 13 | ## 下载体验 14 | 15 | flutter原生体验更好,我打包了Android安装包供下载体验,扫描下方二维码即可下载: 16 | 17 | ![](assets/images/baixingQR.png) 18 | 19 | ## 运行项目 20 | 21 | ### 安装 flutter 22 | 23 | 环境搭建流程参照:[安装 Flutter](https://flutter.dev/docs/get-started/install) 24 | 25 | ### 下载项目 26 | 27 | ``` 28 | git clone https://github.com/liyuandie/flutter_shop.git 29 | ``` 30 | 31 | ### 运行 32 | 33 | ``` 34 | cd flutter_shop 35 | flutter run 36 | ``` 37 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /lib/config/service_url.dart: -------------------------------------------------------------------------------- 1 | // const serviceUrl = 'http://test.baixingliangfan.cn/baixing/'; 2 | // const serviceUrl = 3 | // 'https://wxmini.baixingliangfan.cn/baixing/'; //小程序接口,charles获取 4 | const serviceUrl = 'http://v.jspang.com:8088/baixing/'; 5 | 6 | const servicePath = { 7 | 'homePageContent': serviceUrl + 'wxmini/homePageContent', //商店首页信息 8 | 'homePageBelowConten': 9 | serviceUrl + 'wxmini/homePageBelowConten', // 首页商城底部火爆专区 10 | 'getCategory': serviceUrl + 'wxmini/getCategory', // 商品类别信息 11 | 'getMallGoods': serviceUrl + 'wxmini/getMallGoods', // 商品分类的商品列表信息 12 | 'getGoodDetailById': serviceUrl + 'wxmini/getGoodDetailById', // 获取商品详细信息 13 | }; 14 | -------------------------------------------------------------------------------- /lib/pages/details_pages/details_explain.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter/widgets.dart'; 3 | import 'package:provide/provide.dart'; 4 | import '../../provide/details_info.dart'; 5 | import 'package:flutter_screenutil/flutter_screenutil.dart'; 6 | 7 | class DetailsExplainPage extends StatelessWidget { 8 | @override 9 | Widget build(BuildContext context) { 10 | return Container( 11 | width: ScreenUtil().setWidth(740), 12 | color: Colors.white, 13 | margin: EdgeInsets.only(top: 10.0), 14 | padding: EdgeInsets.fromLTRB(10.0, 10.0, 10.0, 10.0), 15 | child: Text( 16 | '说明:>急速送达 >正品保证', 17 | style: TextStyle( 18 | color: Colors.redAccent, fontSize: ScreenUtil().setSp(27)), 19 | ), 20 | ); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /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,en;q=0.8', 5 | 'Cache-Control': 'no-cache', 6 | 'Connection': 'keep-alive', 7 | 'Content-Type': 'application/json', 8 | 'Cookie': 9 | ' _ga=GA1.2.1686916801.1548126361; _gid=GA1.2.831114524.1562211386; _gat=1; SERVERID=3431a294a18c59fc8f5805662e2bd51e|1562211418|1562211396; Hm_lvt_022f847c4e3acd44d4a2481d9187f1e6=1562211387,1562211406; Hm_lpvt_022f847c4e3acd44d4a2481d9187f1e6=1562211406', 10 | 'Host': 'time.geekbang.org', 11 | 'Origin': 'https://time.geekbang.org', 12 | 'Pragma': 'no-cache', 13 | 'Referer': 'https://time.geekbang.org/', 14 | 'User-Agent': 15 | 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.100 Safari/537.36', 16 | }; 17 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /lib/provide/details_info.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/foundation.dart'; 2 | import 'package:flutter/material.dart'; 3 | import '../model/details_madel.dart'; 4 | import '../service/service_method.dart'; 5 | import 'dart:convert'; 6 | 7 | class DetailInfoProvide with ChangeNotifier { 8 | DetailsModel goodsInfo = null; 9 | 10 | bool onLeft = true; 11 | bool onRight = false; 12 | 13 | // 从后台获取商品详情信息 14 | getGoodsDetailInfo(String id) async { 15 | switchTab('left'); 16 | var formData = {'goodId': id}; 17 | await getGoodsDetail(formData).then((val) { 18 | var responseData = json.decode(val.toString()); 19 | 20 | goodsInfo = DetailsModel.fromJson(responseData); 21 | notifyListeners(); 22 | return goodsInfo; 23 | }); 24 | } 25 | // tab状态切换 26 | 27 | switchTab(String type) { 28 | if (type == 'left') { 29 | onLeft = true; 30 | onRight = false; 31 | } else { 32 | onLeft = false; 33 | onRight = true; 34 | } 35 | notifyListeners(); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /lib/model/cart_info.dart: -------------------------------------------------------------------------------- 1 | class CartInfoModel { 2 | String goodsId; 3 | String goodsName; 4 | int count; 5 | double oriPrice; 6 | double price; 7 | String images; 8 | bool isCheck; 9 | 10 | CartInfoModel( 11 | {this.goodsId, 12 | this.goodsName, 13 | this.count, 14 | this.oriPrice, 15 | this.price, 16 | this.images, 17 | this.isCheck}); 18 | 19 | CartInfoModel.fromJson(Map json) { 20 | goodsId = json['goodsId']; 21 | goodsName = json['goodsName']; 22 | count = json['count']; 23 | oriPrice = json['oriPrice']; 24 | price = json['price']; 25 | images = json['images']; 26 | isCheck = json['isCheck']; 27 | } 28 | 29 | Map toJson() { 30 | final Map data = new Map(); 31 | data['goodsId'] = this.goodsId; 32 | data['goodsName'] = this.goodsName; 33 | data['count'] = this.count; 34 | data['oriPrice'] = this.oriPrice; 35 | data['price'] = this.price; 36 | data['images'] = this.images; 37 | data['isCheck'] = this.isCheck; 38 | return data; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /lib/provide/childCategory.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import '../model/category.dart'; 3 | 4 | class ChildCategory with ChangeNotifier { 5 | List childCategoryList = []; 6 | 7 | int childIndex = 0; 8 | String categoryId = '4'; //大类Id 9 | String categorySubId = ''; //小类Id 10 | int page = 1; //列表页数 11 | String noMoreText = ''; //没有数据时显示的文字 12 | 13 | // 切换大类 14 | getChildCategory(List list, String id) { 15 | childIndex = 0; 16 | categoryId = id; 17 | page = 1; 18 | noMoreText = ''; 19 | BxMallSubDto all = BxMallSubDto(); 20 | all.mallSubId = ''; 21 | all.mallCategoryId = '00'; 22 | all.comments = null; 23 | all.mallSubName = '全部'; 24 | 25 | childCategoryList = [all]; 26 | childCategoryList.addAll(list); 27 | categorySubId = ''; 28 | notifyListeners(); 29 | } 30 | 31 | //改变子类索引 32 | 33 | changeChildIndex(index, String id) { 34 | childIndex = index; 35 | categorySubId = id; 36 | page = 1; 37 | noMoreText = ''; 38 | 39 | notifyListeners(); 40 | } 41 | 42 | //增加page的方法 43 | 44 | addPage() { 45 | page++; 46 | notifyListeners(); 47 | } 48 | 49 | changeoMoreText(String text) { 50 | noMoreText = text; 51 | notifyListeners(); 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /lib/provide/homePage.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import '../service/service_method.dart'; 3 | import 'dart:convert'; 4 | import '../model/homeContent.dart'; 5 | import '../model/hotGoods.dart'; 6 | 7 | class HomePageContentProvide with ChangeNotifier { 8 | // HomePageContentModel homePageContentData; 9 | int page = 1; 10 | List hotGoodsList = []; 11 | 12 | // getHomePage() async { 13 | // await getHomePageContent().then((val) { 14 | // var homePageContent = json.decode(val.toString()); 15 | // homePageContentData = HomePageContentModel.fromJson(homePageContent); 16 | // notifyListeners(); 17 | // }); 18 | // } 19 | 20 | getHotGoods() async { 21 | var formData = {'page': 1}; 22 | 23 | await getHomePageBelowContent(formData).then((val) { 24 | var hotGoodsData = json.decode(val.toString()); 25 | // print(hotGoodsData); 26 | hotGoodsList = HotGoodsModel.fromJson(hotGoodsData).data; 27 | page = 1; 28 | notifyListeners(); 29 | }); 30 | } 31 | 32 | loadMoreHotGoods() async { 33 | var formData = {'page': page + 1}; 34 | 35 | return await getHomePageBelowContent(formData).then((val) { 36 | var hotGoodsData = json.decode(val.toString()); 37 | // print(hotGoodsData); 38 | var newList = HotGoodsModel.fromJson(hotGoodsData).data; 39 | hotGoodsList.addAll(newList); 40 | page++; 41 | notifyListeners(); 42 | }); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Miscellaneous 2 | *.class 3 | *.log 4 | *.pyc 5 | *.swp 6 | .DS_Store 7 | .atom/ 8 | .buildlog/ 9 | .history 10 | .svn/ 11 | 12 | # IntelliJ related 13 | *.iml 14 | *.ipr 15 | *.iws 16 | .idea/ 17 | 18 | # Visual Studio Code related 19 | .vscode/ 20 | 21 | # Flutter/Dart/Pub related 22 | **/doc/api/ 23 | .dart_tool/ 24 | .flutter-plugins 25 | .packages 26 | .pub-cache/ 27 | .pub/ 28 | /build/ 29 | 30 | # Android related 31 | **/android/**/gradle-wrapper.jar 32 | **/android/.gradle 33 | **/android/captures/ 34 | **/android/gradlew 35 | **/android/gradlew.bat 36 | **/android/local.properties 37 | **/android/**/GeneratedPluginRegistrant.java 38 | 39 | # iOS/XCode related 40 | **/ios/**/*.mode1v3 41 | **/ios/**/*.mode2v3 42 | **/ios/**/*.moved-aside 43 | **/ios/**/*.pbxuser 44 | **/ios/**/*.perspectivev3 45 | **/ios/**/*sync/ 46 | **/ios/**/.sconsign.dblite 47 | **/ios/**/.tags* 48 | **/ios/**/.vagrant/ 49 | **/ios/**/DerivedData/ 50 | **/ios/**/Icon? 51 | **/ios/**/Pods/ 52 | **/ios/**/.symlinks/ 53 | **/ios/**/profile 54 | **/ios/**/xcuserdata 55 | **/ios/.generated/ 56 | **/ios/Flutter/App.framework 57 | **/ios/Flutter/Flutter.framework 58 | **/ios/Flutter/Generated.xcconfig 59 | **/ios/Flutter/app.flx 60 | **/ios/Flutter/app.zip 61 | **/ios/Flutter/flutter_assets/ 62 | **/ios/ServiceDefinitions.json 63 | **/ios/Runner/GeneratedPluginRegistrant.* 64 | 65 | # Exceptions to above rules. 66 | !**/ios/**/default.mode1v3 67 | !**/ios/**/default.mode2v3 68 | !**/ios/**/default.pbxuser 69 | !**/ios/**/default.perspectivev3 70 | !/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages 71 | -------------------------------------------------------------------------------- /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 | import 'dart:convert'; 6 | 7 | // 获取数据通用方法 8 | Future requestData(url, {formData}) async { 9 | try { 10 | print('开始获取数据...............'); 11 | Response response; 12 | Dio dio = new Dio(); 13 | dio.options.contentType = 14 | ContentType.parse('application/x-www-form-urlencoded'); 15 | if (formData == null) { 16 | response = await dio.post(servicePath[url]); 17 | } else { 18 | response = await dio.post(servicePath[url], data: formData); 19 | } 20 | if (response.statusCode == 200) { 21 | // var _data = json.decode(response.data.toString()); 22 | // print(_data['data']); 23 | return response.data; 24 | } else { 25 | throw Exception('后端接口有异常'); 26 | } 27 | } catch (e) { 28 | return print('ERROR:........$e'); 29 | } 30 | } 31 | 32 | //获取首页主题内容 33 | 34 | Future getHomePageContent() { 35 | return requestData('homePageContent', 36 | formData: {'lon': '115.02932', 'lat': '35.76189'}); 37 | } 38 | 39 | // 获取火爆专区内容 40 | Future getHomePageBelowContent(formData) { 41 | return requestData('homePageBelowConten', formData: formData); 42 | } 43 | 44 | // 获取分类页面内容 45 | Future getCategoryPageContent() { 46 | return requestData('getCategory'); 47 | } 48 | 49 | // 获取分类页面内容 50 | Future getMallGoods(formData) { 51 | return requestData('getMallGoods', formData: formData); 52 | } 53 | 54 | // 获取分类页面内容 55 | Future getGoodsDetail(formData) { 56 | return requestData('getGoodDetailById', formData: formData); 57 | } 58 | -------------------------------------------------------------------------------- /lib/model/hotGoods.dart: -------------------------------------------------------------------------------- 1 | class HotGoodsModel { 2 | String code; 3 | String message; 4 | List data; 5 | 6 | HotGoodsModel({this.code, this.message, this.data}); 7 | 8 | HotGoodsModel.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 HotGoodsData.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 HotGoodsData { 31 | String name; 32 | String image; 33 | double mallPrice; 34 | String goodsId; 35 | double price; 36 | 37 | HotGoodsData( 38 | {this.name, this.image, this.mallPrice, this.goodsId, this.price}); 39 | 40 | HotGoodsData.fromJson(Map json) { 41 | name = json['name']; 42 | image = json['image']; 43 | mallPrice = json['mallPrice']; 44 | goodsId = json['goodsId']; 45 | price = json['price']; 46 | } 47 | 48 | Map toJson() { 49 | final Map data = new Map(); 50 | data['name'] = this.name; 51 | data['image'] = this.image; 52 | data['mallPrice'] = this.mallPrice; 53 | data['goodsId'] = this.goodsId; 54 | data['price'] = this.price; 55 | return data; 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /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/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 | -------------------------------------------------------------------------------- /lib/model/mallGoodsList.dart: -------------------------------------------------------------------------------- 1 | class MallGoodsListModel { 2 | String code; 3 | String message; 4 | List data; 5 | 6 | MallGoodsListModel({this.code, this.message, this.data}); 7 | 8 | MallGoodsListModel.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 MallGoodsListData.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 MallGoodsListData { 31 | String image; 32 | double oriPrice; 33 | double presentPrice; 34 | String goodsName; 35 | String goodsId; 36 | 37 | MallGoodsListData( 38 | {this.image, 39 | this.oriPrice, 40 | this.presentPrice, 41 | this.goodsName, 42 | this.goodsId}); 43 | 44 | MallGoodsListData.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 | } 62 | -------------------------------------------------------------------------------- /lib/pages/details_pages/detail_tab_bar.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 | class DetailsTabBar extends StatelessWidget { 7 | @override 8 | Widget build(BuildContext context) { 9 | return Provide( 10 | builder: (context, child, val) { 11 | var onLeft = Provide.value(context).onLeft; 12 | var onRight = Provide.value(context).onRight; 13 | return Container( 14 | margin: EdgeInsets.only(top: 8.0), 15 | decoration: BoxDecoration(color: Colors.white), 16 | child: Row( 17 | children: [ 18 | _tab(context, '详情', 'left', onLeft), 19 | _tab(context, '评论', 'rghit', onRight), 20 | ], 21 | ), 22 | ); 23 | }, 24 | ); 25 | } 26 | 27 | Widget _tab(BuildContext context, String title, String type, bool state) { 28 | return InkWell( 29 | onTap: () { 30 | Provide.value(context).switchTab(type); 31 | }, 32 | child: Container( 33 | width: ScreenUtil().setWidth(375), 34 | alignment: Alignment.center, 35 | padding: EdgeInsets.all(10.0), 36 | decoration: BoxDecoration( 37 | border: Border( 38 | bottom: BorderSide( 39 | color: state ? Colors.pink : Colors.black12, 40 | width: 1.0, 41 | ))), 42 | child: Text(title, 43 | style: TextStyle( 44 | color: state ? Colors.pink : Colors.black, 45 | fontSize: ScreenUtil().setSp(28))), 46 | )); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /lib/pages/cart_page.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:shared_preferences/shared_preferences.dart'; 3 | import '../provide/cart.dart'; 4 | import 'package:provide/provide.dart'; 5 | import 'package:flutter_screenutil/flutter_screenutil.dart'; 6 | import './cart_pages/cart_item.dart'; 7 | import './cart_pages/cart_bottom.dart'; 8 | 9 | class CartPage extends StatelessWidget { 10 | @override 11 | Widget build(BuildContext context) { 12 | return Scaffold( 13 | appBar: AppBar( 14 | title: Text('购物车'), 15 | ), 16 | body: Provide( 17 | builder: (context, child, val) { 18 | return FutureBuilder( 19 | future: _getCartInfo(context), 20 | builder: (context, snapshot) { 21 | if (snapshot.hasData) { 22 | var cartList = Provide.value(context).cartList; 23 | 24 | return Stack( 25 | children: [ 26 | ListView.builder( 27 | itemCount: cartList.length, 28 | itemBuilder: (BuildContext context, index) { 29 | return CartItem(cartList[index]); 30 | }, 31 | ), 32 | Positioned( 33 | bottom: 0, 34 | left: 0, 35 | child: CartBottom(), 36 | ) 37 | ], 38 | ); 39 | } else { 40 | return Text('加载中'); 41 | } 42 | }, 43 | ); 44 | }, 45 | )); 46 | } 47 | 48 | Future _getCartInfo(BuildContext context) async { 49 | await Provide.value(context).getCartInfo(); 50 | return 'end'; 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 9 | 13 | 20 | 24 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /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_pages/details_top.dart'; 5 | import './details_pages/details_explain.dart'; 6 | import './details_pages/detail_tab_bar.dart'; 7 | import './details_pages/details_webview.dart'; 8 | import './details_pages/details_bottom.dart'; 9 | 10 | class DetailsPage extends StatelessWidget { 11 | final String goodsId; 12 | DetailsPage(this.goodsId); 13 | 14 | @override 15 | Widget build(BuildContext context) { 16 | // _getDetailsInfo(context); 17 | return Scaffold( 18 | appBar: AppBar( 19 | leading: IconButton( 20 | icon: Icon(Icons.arrow_back), 21 | onPressed: () { 22 | Navigator.pop(context); 23 | }, 24 | ), 25 | title: Text('商品详情'), 26 | ), 27 | body: FutureBuilder( 28 | builder: (context, snapshot) { 29 | if (snapshot.hasData) { 30 | return Stack( 31 | children: [ 32 | Container( 33 | child: ListView( 34 | children: [ 35 | DetailsTop(), 36 | DetailsExplainPage(), 37 | DetailsTabBar(), 38 | DetailsWebview() 39 | ], 40 | ), 41 | ), 42 | Positioned( 43 | bottom: 0, 44 | left: 0, 45 | child: DetailsBottom(), 46 | ) 47 | ], 48 | ); 49 | } else { 50 | return Text('加载中...'); 51 | } 52 | }, 53 | future: _getDetailsInfo(context), 54 | ), 55 | ); 56 | } 57 | 58 | Future _getDetailsInfo(BuildContext context) async { 59 | await Provide.value(context).getGoodsDetailInfo(goodsId); 60 | return 'finish loading'; 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /lib/main.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_shop/model/details_madel.dart'; 3 | import 'package:flutter_shop/pages/index_page.dart'; 4 | import './provide/childCategory.dart'; 5 | import './provide/category_goods_list.dart'; 6 | import './provide/details_info.dart'; 7 | import './provide/cart.dart'; 8 | import './provide/homePage.dart'; 9 | import 'package:provide/provide.dart'; 10 | import 'package:fluro/fluro.dart'; 11 | import './route/index.dart'; 12 | import './route/application.dart'; 13 | import './provide/router.dart'; 14 | 15 | void main() { 16 | var childCategory = ChildCategory(); 17 | var categoryGoodsList = CategoryGoodsListProvide(); 18 | var detailsInfoProvide = DetailInfoProvide(); 19 | var cartProvide = CartProvide(); 20 | var routerProvide = RouterProvide(); 21 | var homePageProvide = HomePageContentProvide(); 22 | var providers = Providers(); 23 | 24 | providers..provide(Provider.value(childCategory)); 25 | providers 26 | ..provide(Provider.value(categoryGoodsList)); 27 | providers..provide(Provider.value(detailsInfoProvide)); 28 | providers..provide(Provider.value(cartProvide)); 29 | providers..provide(Provider.value(routerProvide)); 30 | providers..provide(Provider.value(homePageProvide)); 31 | runApp(ProviderNode( 32 | child: MyApp(), 33 | providers: providers, 34 | )); 35 | } 36 | 37 | class MyApp extends StatelessWidget { 38 | const MyApp({Key key}) : super(key: key); 39 | 40 | @override 41 | Widget build(BuildContext context) { 42 | final router = Router(); 43 | Routes.configureRoute(router); 44 | Application.router = router; 45 | 46 | return Container( 47 | child: MaterialApp( 48 | title: '百姓生活+', 49 | onGenerateRoute: Application.router.generator, 50 | debugShowCheckedModeBanner: false, 51 | theme: ThemeData(primaryColor: Colors.pink), 52 | home: IndexPage(), 53 | ), 54 | ); 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /lib/pages/cart_pages/cart_count.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_screenutil/flutter_screenutil.dart'; 3 | import 'package:flutter_shop/model/cart_info.dart'; 4 | import 'package:provide/provide.dart'; 5 | import '../../provide/cart.dart'; 6 | 7 | class CartCount extends StatelessWidget { 8 | CartInfoModel item; 9 | CartCount(this.item); 10 | @override 11 | Widget build(BuildContext context) { 12 | return Container( 13 | width: ScreenUtil().setWidth(145), 14 | decoration: 15 | BoxDecoration(border: Border.all(width: 1.0, color: Colors.black12)), 16 | child: Row( 17 | children: [ 18 | _reduceBtn(context), 19 | _countArea(context), 20 | _addBtn(context) 21 | ], 22 | ), 23 | ); 24 | } 25 | 26 | // 减少按钮 27 | Widget _reduceBtn(context) { 28 | return InkWell( 29 | onTap: () { 30 | Provide.value(context).changeGoodsCount(item, 'reduce'); 31 | }, 32 | child: Container( 33 | width: ScreenUtil().setWidth(45), 34 | height: ScreenUtil().setHeight(45), 35 | alignment: Alignment.center, 36 | decoration: BoxDecoration( 37 | // color: item.count > 1 ? Colors.white : Colors.black12, 38 | border: 39 | Border(right: BorderSide(width: 1.0, color: Colors.black12))), 40 | child: Text('—'), 41 | ), 42 | ); 43 | } 44 | 45 | // 增加按钮 46 | Widget _addBtn(context) { 47 | return InkWell( 48 | onTap: () { 49 | Provide.value(context).changeGoodsCount(item, 'add'); 50 | }, 51 | child: Container( 52 | width: ScreenUtil().setWidth(45), 53 | height: ScreenUtil().setHeight(45), 54 | alignment: Alignment.center, 55 | decoration: BoxDecoration( 56 | border: 57 | Border(left: BorderSide(width: 1.0, color: Colors.black12))), 58 | child: Text('+'), 59 | ), 60 | ); 61 | } 62 | 63 | //数量显示区域 64 | Widget _countArea(context) { 65 | return Container( 66 | width: ScreenUtil().setWidth(50), 67 | height: ScreenUtil().setHeight(45), 68 | alignment: Alignment.center, 69 | color: Colors.white, 70 | child: Text( 71 | item.count.toString(), 72 | style: TextStyle(fontSize: ScreenUtil().setSp(25)), 73 | ), 74 | ); 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /ios/Podfile: -------------------------------------------------------------------------------- 1 | # Uncomment this line to define a global platform for your project 2 | # platform :ios, '9.0' 3 | 4 | # CocoaPods analytics sends network stats synchronously affecting flutter build latency. 5 | ENV['COCOAPODS_DISABLE_STATS'] = 'true' 6 | 7 | project 'Runner', { 8 | 'Debug' => :debug, 9 | 'Profile' => :release, 10 | 'Release' => :release, 11 | } 12 | 13 | def parse_KV_file(file, separator='=') 14 | file_abs_path = File.expand_path(file) 15 | if !File.exists? file_abs_path 16 | return []; 17 | end 18 | pods_ary = [] 19 | skip_line_start_symbols = ["#", "/"] 20 | File.foreach(file_abs_path) { |line| 21 | next if skip_line_start_symbols.any? { |symbol| line =~ /^\s*#{symbol}/ } 22 | plugin = line.split(pattern=separator) 23 | if plugin.length == 2 24 | podname = plugin[0].strip() 25 | path = plugin[1].strip() 26 | podpath = File.expand_path("#{path}", file_abs_path) 27 | pods_ary.push({:name => podname, :path => podpath}); 28 | else 29 | puts "Invalid plugin specification: #{line}" 30 | end 31 | } 32 | return pods_ary 33 | end 34 | 35 | target 'Runner' do 36 | # Prepare symlinks folder. We use symlinks to avoid having Podfile.lock 37 | # referring to absolute paths on developers' machines. 38 | system('rm -rf .symlinks') 39 | system('mkdir -p .symlinks/plugins') 40 | 41 | # Flutter Pods 42 | generated_xcode_build_settings = parse_KV_file('./Flutter/Generated.xcconfig') 43 | if generated_xcode_build_settings.empty? 44 | puts "Generated.xcconfig must exist. If you're running pod install manually, make sure flutter packages get is executed first." 45 | end 46 | generated_xcode_build_settings.map { |p| 47 | if p[:name] == 'FLUTTER_FRAMEWORK_DIR' 48 | symlink = File.join('.symlinks', 'flutter') 49 | File.symlink(File.dirname(p[:path]), symlink) 50 | pod 'Flutter', :path => File.join(symlink, File.basename(p[:path])) 51 | end 52 | } 53 | 54 | # Plugin Pods 55 | plugin_pods = parse_KV_file('../.flutter-plugins') 56 | plugin_pods.map { |p| 57 | symlink = File.join('.symlinks', 'plugins', p[:name]) 58 | File.symlink(p[:path], symlink) 59 | pod p[:name], :path => File.join(symlink, 'ios') 60 | } 61 | end 62 | 63 | post_install do |installer| 64 | installer.pods_project.targets.each do |target| 65 | target.build_configurations.each do |config| 66 | config.build_settings['ENABLE_BITCODE'] = 'NO' 67 | end 68 | end 69 | end 70 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /lib/provide/category_goods_list.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import '../model/mallGoodsList.dart'; 3 | import 'package:provide/provide.dart'; 4 | import './childCategory.dart'; 5 | import '../service/service_method.dart'; 6 | import 'dart:convert'; 7 | import '../model/category.dart'; 8 | 9 | class CategoryGoodsListProvide with ChangeNotifier { 10 | List goodsList = []; 11 | List list = []; 12 | var currentIndex = 0; 13 | //点击大类时更换商品列表 14 | changeGoodsList(context) async { 15 | var formData = { 16 | 'categoryId': Provide.value(context).categoryId, 17 | 'categorySubId': Provide.value(context).categorySubId, 18 | 'page': 1, 19 | }; 20 | print(formData.toString()); 21 | return await getMallGoods(formData).then((val) { 22 | var data = json.decode(val.toString()); 23 | MallGoodsListModel list = MallGoodsListModel.fromJson(data); 24 | goodsList = list.data; 25 | notifyListeners(); 26 | }); 27 | } 28 | 29 | loadMoreGoodsList(context) async { 30 | Provide.value(context).addPage(); 31 | var formData = { 32 | 'categoryId': Provide.value(context).categoryId, 33 | 'categorySubId': Provide.value(context).categorySubId, 34 | 'page': Provide.value(context).page, 35 | }; 36 | return await getMallGoods(formData).then((val) { 37 | var data = json.decode(val.toString()); 38 | MallGoodsListModel newList = MallGoodsListModel.fromJson(data); 39 | if (newList.data == null) { 40 | return Provide.value(context).changeoMoreText('没有更多了'); 41 | } else { 42 | goodsList.addAll(newList.data); 43 | } 44 | notifyListeners(); 45 | }); 46 | } 47 | 48 | //获取左侧大类 49 | getCategory(context) async { 50 | await getCategoryPageContent().then((val) { 51 | var data = json.decode(val.toString()); 52 | CategoryModel category = CategoryModel.fromJson(data); 53 | // list.data.forEach((item) => print(item.mallCategoryName)); 54 | 55 | list = category.data; 56 | 57 | Provide.value(context).getChildCategory( 58 | category.data[0].bxMallSubDto, category.data[0].mallCategoryId); 59 | }); 60 | notifyListeners(); 61 | return list; 62 | } 63 | // 改变当前大类索引 64 | 65 | changeCurrentIndex(index) { 66 | currentIndex = index; 67 | notifyListeners(); 68 | } 69 | 70 | clearGoodsList() { 71 | goodsList = []; 72 | notifyListeners(); 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /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 | def keystorePropertiesFile = rootProject.file("key.properties") 28 | def keystoreProperties = new Properties() 29 | keystoreProperties.load(new FileInputStream(keystorePropertiesFile)) 30 | 31 | android { 32 | compileSdkVersion 28 33 | 34 | lintOptions { 35 | disable 'InvalidPackage' 36 | } 37 | 38 | defaultConfig { 39 | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). 40 | applicationId "com.example.flutter_shop" 41 | minSdkVersion 16 42 | targetSdkVersion 28 43 | versionCode flutterVersionCode.toInteger() 44 | versionName flutterVersionName 45 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 46 | } 47 | 48 | signingConfigs { 49 | release { 50 | keyAlias keystoreProperties['keyAlias'] 51 | keyPassword keystoreProperties['keyPassword'] 52 | storeFile file(keystoreProperties['storeFile']) 53 | storePassword keystoreProperties['storePassword'] 54 | } 55 | } 56 | 57 | buildTypes { 58 | release { 59 | // TODO: Add your own signing config for the release build. 60 | // Signing with the debug keys for now, so `flutter run --release` works. 61 | signingConfig signingConfigs.release 62 | } 63 | } 64 | } 65 | 66 | flutter { 67 | source '../..' 68 | } 69 | 70 | dependencies { 71 | testImplementation 'junit:junit:4.12' 72 | androidTestImplementation 'com.android.support.test:runner:1.0.2' 73 | androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2' 74 | } 75 | -------------------------------------------------------------------------------- /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 | } 95 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | # In Android, build-name is used as versionName while build-number used as versionCode. 10 | # Read more about Android versioning at https://developer.android.com/studio/publish/versioning 11 | # In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion. 12 | # Read more about iOS versioning at 13 | # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html 14 | version: 1.0.0+1 15 | 16 | environment: 17 | sdk: '>=2.1.0 <3.0.0' 18 | 19 | dependencies: 20 | flutter: 21 | sdk: flutter 22 | 23 | # The following adds the Cupertino Icons font to your application. 24 | # Use with the CupertinoIcons class for iOS style icons. 25 | cupertino_icons: ^0.1.2 26 | dio: ^2.1.13 27 | flutter_swiper: ^1.1.6 28 | flutter_screenutil: ^0.5.3 29 | url_launcher: ^5.0.2 30 | flutter_easyrefresh: ^1.2.7 31 | provide: ^1.0.2 32 | fluttertoast: ^3.0.1 33 | fluro: '^1.5.0' 34 | flutter_html: ^0.9.6 35 | shared_preferences: ^0.5.3+2 36 | 37 | dev_dependencies: 38 | flutter_test: 39 | sdk: flutter 40 | 41 | # For information on the generic Dart part of this file, see the 42 | # following page: https://www.dartlang.org/tools/pub/pubspec 43 | 44 | # The following section is specific to Flutter. 45 | flutter: 46 | # The following line ensures that the Material Icons font is 47 | # included with your application, so that you can use the icons in 48 | # the material Icons class. 49 | uses-material-design: true 50 | assets: 51 | - assets/images/irving.jpeg 52 | - assets/images/background.png 53 | # To add assets to your application, add an assets section, like this: 54 | # assets: 55 | # - images/a_dot_burr.jpeg 56 | # - images/a_dot_ham.jpeg 57 | # An image asset can refer to one or more resolution-specific "variants", see 58 | # https://flutter.dev/assets-and-images/#resolution-aware. 59 | # For details regarding adding assets from package dependencies, see 60 | # https://flutter.dev/assets-and-images/#from-packages 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.dev/custom-fonts/#from-packages 80 | -------------------------------------------------------------------------------- /lib/pages/details_pages/details_webview.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter/widgets.dart'; 3 | import 'package:provide/provide.dart'; 4 | import '../../provide/details_info.dart'; 5 | import 'package:flutter_screenutil/flutter_screenutil.dart'; 6 | import 'package:flutter_html/flutter_html.dart'; 7 | 8 | class DetailsWebview extends StatelessWidget { 9 | @override 10 | Widget build(BuildContext context) { 11 | var goodsDetails = Provide.value(context) 12 | .goodsInfo 13 | .data 14 | .goodInfo 15 | .goodsDetail; 16 | var comment = 17 | Provide.value(context).goodsInfo.data.goodComments; 18 | 19 | return Provide( 20 | builder: (context, child, val) { 21 | var onLeft = Provide.value(context).onLeft; 22 | Widget _commenItem(context, index) { 23 | return Container( 24 | padding: EdgeInsets.fromLTRB(10.0, 10.0, 10.0, 10.0), 25 | decoration: BoxDecoration( 26 | border: Border( 27 | bottom: BorderSide(width: 1.0, color: Colors.black12))), 28 | child: Column( 29 | crossAxisAlignment: CrossAxisAlignment.start, 30 | children: [ 31 | Container( 32 | child: Text( 33 | comment[index].userName, 34 | style: TextStyle( 35 | color: Colors.black38, fontWeight: FontWeight.bold), 36 | ), 37 | ), 38 | Container( 39 | padding: EdgeInsets.fromLTRB(0, 8.0, 0, 8.0), 40 | child: Text(comment[index].comments), 41 | ), 42 | Container( 43 | child: Text( 44 | DateTime.fromMillisecondsSinceEpoch( 45 | comment[index].discussTime, 46 | ).toString().replaceRange(18, 22, ''), 47 | style: TextStyle(color: Colors.black38), 48 | ), 49 | ) 50 | ], 51 | ), 52 | ); 53 | } 54 | 55 | if (onLeft) { 56 | return Container( 57 | child: Html( 58 | data: goodsDetails, 59 | ), 60 | ); 61 | } else { 62 | if (comment.length > 0) { 63 | return Container( 64 | // width: ScreenUtil().setWidth(750), 65 | height: ScreenUtil().setHeight(2000), 66 | child: ListView.builder( 67 | physics: NeverScrollableScrollPhysics(), 68 | itemCount: comment.length, 69 | itemBuilder: (BuildContext context, index) { 70 | return _commenItem(context, index); 71 | }, 72 | ), 73 | ); 74 | } else { 75 | return Container( 76 | alignment: Alignment.center, 77 | padding: EdgeInsets.only(top: 15.0), 78 | child: Text( 79 | '暂时没有评论哦', 80 | style: TextStyle( 81 | fontSize: ScreenUtil().setSp(27), color: Colors.black87), 82 | ), 83 | ); 84 | } 85 | } 86 | }, 87 | ); 88 | } 89 | } 90 | -------------------------------------------------------------------------------- /lib/pages/cart_pages/cart_bottom.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_screenutil/flutter_screenutil.dart'; 3 | import 'package:flutter_shop/model/cart_info.dart'; 4 | import 'package:provide/provide.dart'; 5 | import '../../provide/cart.dart'; 6 | 7 | class CartBottom extends StatelessWidget { 8 | @override 9 | Widget build(BuildContext context) { 10 | return Container( 11 | padding: EdgeInsets.fromLTRB(10.0, 10.0, 10.0, 10.0), 12 | color: Colors.white, 13 | child: Provide( 14 | builder: (context, child, val) { 15 | return Row( 16 | children: [ 17 | _selectAllBtn(context), 18 | _allPrice(context), 19 | _accountBtn(context) 20 | ], 21 | ); 22 | }, 23 | )); 24 | } 25 | 26 | //复选框 27 | Widget _selectAllBtn(context) { 28 | return Container( 29 | width: ScreenUtil().setWidth(150), 30 | child: Row( 31 | children: [ 32 | Checkbox( 33 | value: Provide.value(context).isAllCheck, 34 | activeColor: Colors.pink, 35 | onChanged: (bool val) { 36 | Provide.value(context).allCheck(val); 37 | }, 38 | ), 39 | Container( 40 | child: Text('全选'), 41 | ) 42 | ], 43 | ), 44 | ); 45 | } 46 | 47 | // 价格 48 | Widget _allPrice(context) { 49 | return Container( 50 | width: ScreenUtil().setWidth(430), 51 | padding: EdgeInsets.only(right: 20.0), 52 | // color: Colors.pink, 53 | child: Column( 54 | children: [ 55 | Row( 56 | mainAxisAlignment: MainAxisAlignment.end, 57 | children: [ 58 | Container( 59 | child: Text( 60 | '合计:', 61 | style: TextStyle(fontSize: ScreenUtil().setSp(30)), 62 | ), 63 | ), 64 | Container( 65 | child: Text( 66 | Provide.value(context).totalPrice.toString(), 67 | style: TextStyle( 68 | fontSize: ScreenUtil().setSp(35), color: Colors.red), 69 | ), 70 | ) 71 | ], 72 | ), 73 | Container( 74 | width: ScreenUtil().setWidth(430), 75 | child: Text( 76 | '满10元免配送费,预购免配送费', 77 | style: TextStyle( 78 | color: Colors.black38, fontSize: ScreenUtil().setSp(22)), 79 | textAlign: TextAlign.right, 80 | ), 81 | ) 82 | ], 83 | ), 84 | ); 85 | } 86 | 87 | // 结算 88 | Widget _accountBtn(context) { 89 | return Container( 90 | child: InkWell( 91 | onTap: () {}, 92 | child: Container( 93 | padding: EdgeInsets.all(10), 94 | alignment: Alignment.center, 95 | decoration: BoxDecoration( 96 | color: Colors.red, borderRadius: BorderRadius.circular(3.0)), 97 | child: Text( 98 | '结算(${Provide.value(context).totalCount.toString()})', 99 | style: TextStyle(color: Colors.white), 100 | ), 101 | ), 102 | ), 103 | ); 104 | } 105 | } 106 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /lib/pages/details_pages/details_bottom.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:provide/provide.dart'; 3 | import '../../provide/details_info.dart'; 4 | import '../../provide/cart.dart'; 5 | import 'package:flutter_screenutil/flutter_screenutil.dart'; 6 | import '../../provide/router.dart'; 7 | 8 | class DetailsBottom extends StatelessWidget { 9 | @override 10 | Widget build(BuildContext context) { 11 | var goodsInfo = 12 | Provide.value(context).goodsInfo.data.goodInfo; 13 | var goodsId = goodsInfo.goodsId; 14 | var goodsName = goodsInfo.goodsName; 15 | var count = 1; 16 | var price = goodsInfo.presentPrice; 17 | var images = goodsInfo.image1; 18 | var oriPrice = goodsInfo.oriPrice; 19 | return Container( 20 | width: ScreenUtil().setWidth(750), 21 | height: ScreenUtil().setHeight(100), 22 | color: Colors.white, 23 | child: Row( 24 | children: [ 25 | Stack( 26 | children: [ 27 | InkWell( 28 | onTap: () { 29 | Provide.value(context).changeIndex(2); 30 | Navigator.pop(context); 31 | }, 32 | child: Container( 33 | width: ScreenUtil().setWidth(130.0), 34 | alignment: Alignment.center, 35 | child: Icon(Icons.shopping_cart, size: 35, color: Colors.red), 36 | ), 37 | ), 38 | Provide( 39 | builder: (context, child, val) { 40 | var count = Provide.value(context).totalCount; 41 | return Positioned( 42 | top: 0, 43 | right: 10, 44 | child: Container( 45 | padding: EdgeInsets.fromLTRB(6, 3, 6, 3), 46 | decoration: BoxDecoration( 47 | color: Colors.red, 48 | border: Border.all(width: 2, color: Colors.white), 49 | borderRadius: BorderRadius.circular(12.0)), 50 | child: Text( 51 | count.toString(), 52 | style: TextStyle( 53 | color: Colors.white, 54 | fontSize: ScreenUtil().setSp(22)), 55 | ), 56 | ), 57 | ); 58 | }, 59 | ) 60 | ], 61 | ), 62 | InkWell( 63 | onTap: () { 64 | Provide.value(context) 65 | .save(goodsId, goodsName, count, oriPrice, price, images); 66 | }, 67 | child: Container( 68 | width: ScreenUtil().setWidth(310), 69 | color: Colors.green, 70 | height: ScreenUtil().setHeight(100), 71 | alignment: Alignment.center, 72 | child: Text('加入购物车', 73 | style: TextStyle( 74 | color: Colors.white, fontSize: ScreenUtil().setSp(30))), 75 | ), 76 | ), 77 | InkWell( 78 | onTap: () { 79 | Provide.value(context).clear(); 80 | }, 81 | child: Container( 82 | width: ScreenUtil().setWidth(310), 83 | color: Colors.red, 84 | height: ScreenUtil().setHeight(100), 85 | alignment: Alignment.center, 86 | child: Text('立即购买', 87 | style: TextStyle( 88 | color: Colors.white, fontSize: ScreenUtil().setSp(30))), 89 | ), 90 | ) 91 | ], 92 | ), 93 | ); 94 | } 95 | } 96 | -------------------------------------------------------------------------------- /lib/pages/details_pages/details_top.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 | import 'package:flutter_swiper/flutter_swiper.dart'; 6 | 7 | class DetailsTop extends StatelessWidget { 8 | @override 9 | Widget build(BuildContext context) { 10 | return Provide( 11 | builder: (context, child, data) { 12 | var goodsInfo = 13 | Provide.value(context).goodsInfo.data.goodInfo; 14 | if (goodsInfo != null) { 15 | return Container( 16 | padding: EdgeInsets.all(2.0), 17 | child: Column( 18 | children: [ 19 | _goodsImage(goodsInfo.image1, context), 20 | _goodsName(goodsInfo.goodsName), 21 | _goodsId(goodsInfo.goodsSerialNumber), 22 | _goodsPrice(goodsInfo.presentPrice, goodsInfo.oriPrice) 23 | ], 24 | ), 25 | ); 26 | } else { 27 | return Center( 28 | child: Text('加载中...'), 29 | ); 30 | } 31 | }, 32 | ); 33 | } 34 | 35 | //s商品地址 36 | Widget _goodsImage(url, context) { 37 | List goodsImageList = []; 38 | var goodsInfo = 39 | Provide.value(context).goodsInfo.data.goodInfo; 40 | goodsImageList 41 | ..add(goodsInfo.image1) 42 | ..add(goodsInfo.image1) 43 | ..add(goodsInfo.image1) 44 | ..add(goodsInfo.image1); 45 | return Container( 46 | width: ScreenUtil().setWidth(750), 47 | height: ScreenUtil().setHeight(580), 48 | child: Swiper( 49 | itemBuilder: (BuildContext context, int index) { 50 | return Image.network( 51 | goodsImageList[index], 52 | fit: BoxFit.cover, 53 | ); 54 | }, 55 | itemCount: goodsImageList.length, 56 | pagination: new SwiperPagination(), 57 | autoplay: true, 58 | ), 59 | ); 60 | } 61 | 62 | //商品名称 63 | Widget _goodsName(name) { 64 | return Container( 65 | // margin: EdgeInsets.only(top: 8.0), 66 | color: Colors.white, 67 | width: ScreenUtil().setWidth(750), 68 | padding: EdgeInsets.fromLTRB(10.0, 8.0, 0, 0), 69 | child: Text( 70 | name, 71 | style: TextStyle(fontSize: ScreenUtil().setSp(30.0)), 72 | ), 73 | ); 74 | } 75 | 76 | // 商品编号 77 | 78 | Widget _goodsId(id) { 79 | return Container( 80 | color: Colors.white, 81 | width: ScreenUtil().setWidth(750), 82 | padding: EdgeInsets.fromLTRB(10.0, 8.0, 0, 0), 83 | child: Text('编号:${id}', style: TextStyle(color: Colors.black26)), 84 | ); 85 | } 86 | 87 | //商品价格方法 88 | 89 | Widget _goodsPrice(presentPrice, oriPrice) { 90 | return Container( 91 | color: Colors.white, 92 | width: ScreenUtil().setWidth(730), 93 | padding: EdgeInsets.fromLTRB(10.0, 8.0, 15.0, 8.0), 94 | // margin: EdgeInsets.only(top: 8.0), 95 | child: Row( 96 | mainAxisAlignment: MainAxisAlignment.spaceBetween, 97 | children: [ 98 | Text( 99 | '¥${presentPrice}', 100 | style: TextStyle( 101 | color: Colors.pinkAccent, 102 | fontSize: ScreenUtil().setSp(40), 103 | ), 104 | ), 105 | Text( 106 | '市场价:¥${oriPrice}', 107 | style: TextStyle( 108 | color: Colors.black26, decoration: TextDecoration.lineThrough), 109 | ) 110 | ], 111 | ), 112 | ); 113 | } 114 | } 115 | -------------------------------------------------------------------------------- /lib/pages/index_page.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter/cupertino.dart'; 3 | import './cart_page.dart'; 4 | import './home_page.dart'; 5 | import './member_page.dart'; 6 | import './category_page.dart'; 7 | import 'package:flutter_screenutil/flutter_screenutil.dart'; 8 | import '../provide/router.dart'; 9 | import 'package:provide/provide.dart'; 10 | 11 | class IndexPage extends StatelessWidget { 12 | final List bottomTabs = [ 13 | BottomNavigationBarItem(icon: Icon(Icons.home), title: Text('首页')), 14 | BottomNavigationBarItem(icon: Icon(Icons.search), title: Text('分类')), 15 | BottomNavigationBarItem( 16 | icon: Icon(Icons.shopping_cart), title: Text('购物车')), 17 | BottomNavigationBarItem( 18 | icon: Icon(CupertinoIcons.profile_circled), title: Text('会员中心')), 19 | ]; 20 | 21 | final List tabbodies = [ 22 | HomePage(), 23 | CategoryPage(), 24 | CartPage(), 25 | MemberPage() 26 | ]; 27 | @override 28 | Widget build(BuildContext context) { 29 | ScreenUtil.instance = ScreenUtil(height: 1334, width: 750)..init(context); 30 | return Provide( 31 | builder: (context, child, val) { 32 | int currentIndex = Provide.value(context).currentIndex; 33 | return Scaffold( 34 | backgroundColor: Color.fromRGBO(244, 245, 245, 1.0), 35 | bottomNavigationBar: BottomNavigationBar( 36 | type: BottomNavigationBarType.fixed, 37 | currentIndex: currentIndex, 38 | items: bottomTabs, 39 | onTap: (index) { 40 | Provide.value(context).changeIndex(index); 41 | }, 42 | ), 43 | body: IndexedStack( 44 | index: currentIndex, 45 | children: tabbodies, 46 | )); 47 | }, 48 | ); 49 | } 50 | } 51 | 52 | // class IndexPage extends StatefulWidget { 53 | // @override 54 | // _IndexPageState createState() => _IndexPageState(); 55 | // } 56 | 57 | // class _IndexPageState extends State { 58 | // final List bottomTabs = [ 59 | // BottomNavigationBarItem(icon: Icon(Icons.home), title: Text('首页')), 60 | // BottomNavigationBarItem(icon: Icon(Icons.search), title: Text('分类')), 61 | // BottomNavigationBarItem( 62 | // icon: Icon(Icons.shopping_cart), title: Text('购物车')), 63 | // BottomNavigationBarItem( 64 | // icon: Icon(CupertinoIcons.profile_circled), title: Text('会员中心')), 65 | // ]; 66 | 67 | // final List tabbodies = [ 68 | // HomePage(), 69 | // CategoryPage(), 70 | // CartPage(), 71 | // MemberPage() 72 | // ]; 73 | 74 | // int currentIndex = 0; 75 | // var currentPage; 76 | 77 | // @override 78 | // void initState() { 79 | // currentPage = tabbodies[0]; 80 | // super.initState(); 81 | // } 82 | 83 | // @override 84 | // Widget build(BuildContext context) { 85 | // ScreenUtil.instance = ScreenUtil(height: 1334, width: 750)..init(context); 86 | 87 | // return Scaffold( 88 | // backgroundColor: Color.fromRGBO(244, 245, 245, 1.0), 89 | // bottomNavigationBar: BottomNavigationBar( 90 | // type: BottomNavigationBarType.fixed, 91 | // currentIndex: currentIndex, 92 | // items: bottomTabs, 93 | // onTap: (index) { 94 | // setState(() { 95 | // currentIndex = index; 96 | // currentPage = tabbodies[index]; 97 | // }); 98 | // }, 99 | // ), 100 | // body: IndexedStack( 101 | // index: currentIndex, 102 | // children: tabbodies, 103 | // )); 104 | // } 105 | // } 106 | -------------------------------------------------------------------------------- /lib/pages/cart_pages/cart_item.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_screenutil/flutter_screenutil.dart'; 3 | import 'package:flutter_shop/model/cart_info.dart'; 4 | import 'package:provide/provide.dart'; 5 | import '../../provide/cart.dart'; 6 | import './cart_count.dart'; 7 | 8 | class CartItem extends StatelessWidget { 9 | final CartInfoModel item; 10 | 11 | CartItem(this.item); 12 | 13 | @override 14 | Widget build(BuildContext context) { 15 | // print(item); 16 | return Container( 17 | margin: EdgeInsets.fromLTRB(0, 2.0, 0, 2.0), 18 | padding: EdgeInsets.fromLTRB(10.0, 10.0, 10.0, 10.0), 19 | decoration: BoxDecoration( 20 | color: Colors.white, 21 | border: Border(bottom: BorderSide(width: 1, color: Colors.black12))), 22 | child: Row( 23 | mainAxisAlignment: MainAxisAlignment.spaceBetween, 24 | children: [ 25 | _cartCheckBtn(context), 26 | _cartImage(), 27 | _cartGoodsName(), 28 | _cartPrice(context) 29 | ], 30 | ), 31 | ); 32 | } 33 | 34 | // 复选按钮 35 | Widget _cartCheckBtn(context) { 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 | // 商品图片 49 | Widget _cartImage() { 50 | return Container( 51 | height: ScreenUtil().setHeight(130), 52 | padding: EdgeInsets.all(3.0), 53 | decoration: 54 | BoxDecoration(border: Border.all(width: 0.5, color: Colors.black12)), 55 | child: Image.network(item.images), 56 | ); 57 | } 58 | 59 | //商品名称 60 | Widget _cartGoodsName() { 61 | return Container( 62 | width: ScreenUtil().setWidth(300), 63 | height: ScreenUtil().setHeight(130), 64 | padding: EdgeInsets.only(left: 10), 65 | alignment: Alignment.topLeft, 66 | child: Column( 67 | mainAxisAlignment: MainAxisAlignment.spaceBetween, 68 | crossAxisAlignment: CrossAxisAlignment.start, 69 | children: [ 70 | Text( 71 | item.goodsName, 72 | style: TextStyle(fontSize: ScreenUtil().setSp(27)), 73 | ), 74 | CartCount(item), 75 | ], 76 | ), 77 | ); 78 | } 79 | 80 | //商品价格 81 | Widget _cartPrice(context) { 82 | return Container( 83 | width: ScreenUtil().setWidth(150), 84 | // height: ScreenUtil().setHeight(100), 85 | alignment: Alignment.centerRight, 86 | child: Column( 87 | mainAxisAlignment: MainAxisAlignment.spaceBetween, 88 | crossAxisAlignment: CrossAxisAlignment.end, 89 | children: [ 90 | Column( 91 | crossAxisAlignment: CrossAxisAlignment.end, 92 | children: [ 93 | Text('¥ ${item.price}', 94 | style: TextStyle( 95 | fontSize: ScreenUtil().setSp(30), 96 | fontWeight: FontWeight.w300)), 97 | Text( 98 | '¥ ${item.oriPrice}', 99 | style: TextStyle( 100 | color: Colors.black26, 101 | fontSize: ScreenUtil().setSp(24), 102 | decoration: TextDecoration.lineThrough, 103 | fontWeight: FontWeight.w300), 104 | ), 105 | ], 106 | ), 107 | Container( 108 | padding: EdgeInsets.only(top: 15), 109 | child: InkWell( 110 | onTap: () { 111 | Provide.value(context).deleteGoods(item.goodsId); 112 | }, 113 | child: Icon( 114 | Icons.delete, 115 | color: Colors.black26, 116 | size: 25, 117 | ), 118 | )) 119 | ], 120 | ), 121 | ); 122 | } 123 | } 124 | -------------------------------------------------------------------------------- /lib/model/details_madel.dart: -------------------------------------------------------------------------------- 1 | class DetailsModel { 2 | String code; 3 | String message; 4 | DetailsGoods 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 = 12 | json['data'] != null ? new DetailsGoods.fromJson(json['data']) : null; 13 | } 14 | 15 | Map toJson() { 16 | final Map data = new Map(); 17 | data['code'] = this.code; 18 | data['message'] = this.message; 19 | if (this.data != null) { 20 | data['data'] = this.data.toJson(); 21 | } 22 | return data; 23 | } 24 | } 25 | 26 | class DetailsGoods { 27 | GoodInfo goodInfo; 28 | List goodComments; 29 | AdvertesPicture advertesPicture; 30 | 31 | DetailsGoods({this.goodInfo, this.goodComments, this.advertesPicture}); 32 | 33 | DetailsGoods.fromJson(Map json) { 34 | goodInfo = json['goodInfo'] != null 35 | ? new GoodInfo.fromJson(json['goodInfo']) 36 | : null; 37 | if (json['goodComments'] != null) { 38 | goodComments = new List(); 39 | json['goodComments'].forEach((v) { 40 | goodComments.add(new GoodComments.fromJson(v)); 41 | }); 42 | } 43 | advertesPicture = json['advertesPicture'] != null 44 | ? new AdvertesPicture.fromJson(json['advertesPicture']) 45 | : null; 46 | } 47 | 48 | Map toJson() { 49 | final Map data = new Map(); 50 | if (this.goodInfo != null) { 51 | data['goodInfo'] = this.goodInfo.toJson(); 52 | } 53 | if (this.goodComments != null) { 54 | data['goodComments'] = this.goodComments.map((v) => v.toJson()).toList(); 55 | } 56 | if (this.advertesPicture != null) { 57 | data['advertesPicture'] = this.advertesPicture.toJson(); 58 | } 59 | return data; 60 | } 61 | } 62 | 63 | class GoodInfo { 64 | String image5; 65 | int amount; 66 | String image3; 67 | String image4; 68 | String goodsId; 69 | String isOnline; 70 | String image1; 71 | String image2; 72 | String goodsSerialNumber; 73 | double oriPrice; 74 | double presentPrice; 75 | String comPic; 76 | int state; 77 | String shopId; 78 | String goodsName; 79 | String goodsDetail; 80 | 81 | GoodInfo( 82 | {this.image5, 83 | this.amount, 84 | this.image3, 85 | this.image4, 86 | this.goodsId, 87 | this.isOnline, 88 | this.image1, 89 | this.image2, 90 | this.goodsSerialNumber, 91 | this.oriPrice, 92 | this.presentPrice, 93 | this.comPic, 94 | this.state, 95 | this.shopId, 96 | this.goodsName, 97 | this.goodsDetail}); 98 | 99 | GoodInfo.fromJson(Map json) { 100 | image5 = json['image5']; 101 | amount = json['amount']; 102 | image3 = json['image3']; 103 | image4 = json['image4']; 104 | goodsId = json['goodsId']; 105 | isOnline = json['isOnline']; 106 | image1 = json['image1']; 107 | image2 = json['image2']; 108 | goodsSerialNumber = json['goodsSerialNumber']; 109 | oriPrice = json['oriPrice']; 110 | presentPrice = json['presentPrice']; 111 | comPic = json['comPic']; 112 | state = json['state']; 113 | shopId = json['shopId']; 114 | goodsName = json['goodsName']; 115 | goodsDetail = json['goodsDetail']; 116 | } 117 | 118 | Map toJson() { 119 | final Map data = new Map(); 120 | data['image5'] = this.image5; 121 | data['amount'] = this.amount; 122 | data['image3'] = this.image3; 123 | data['image4'] = this.image4; 124 | data['goodsId'] = this.goodsId; 125 | data['isOnline'] = this.isOnline; 126 | data['image1'] = this.image1; 127 | data['image2'] = this.image2; 128 | data['goodsSerialNumber'] = this.goodsSerialNumber; 129 | data['oriPrice'] = this.oriPrice; 130 | data['presentPrice'] = this.presentPrice; 131 | data['comPic'] = this.comPic; 132 | data['state'] = this.state; 133 | data['shopId'] = this.shopId; 134 | data['goodsName'] = this.goodsName; 135 | data['goodsDetail'] = this.goodsDetail; 136 | return data; 137 | } 138 | } 139 | 140 | class GoodComments { 141 | int sCORE; 142 | String comments; 143 | String userName; 144 | int discussTime; 145 | 146 | GoodComments({this.sCORE, this.comments, this.userName, this.discussTime}); 147 | 148 | GoodComments.fromJson(Map json) { 149 | sCORE = json['SCORE']; 150 | comments = json['comments']; 151 | userName = json['userName']; 152 | discussTime = json['discussTime']; 153 | } 154 | 155 | Map toJson() { 156 | final Map data = new Map(); 157 | data['SCORE'] = this.sCORE; 158 | data['comments'] = this.comments; 159 | data['userName'] = this.userName; 160 | data['discussTime'] = this.discussTime; 161 | return data; 162 | } 163 | } 164 | 165 | class AdvertesPicture { 166 | String pICTUREADDRESS; 167 | String tOPLACE; 168 | 169 | AdvertesPicture({this.pICTUREADDRESS, this.tOPLACE}); 170 | 171 | AdvertesPicture.fromJson(Map json) { 172 | pICTUREADDRESS = json['PICTURE_ADDRESS']; 173 | tOPLACE = json['TO_PLACE']; 174 | } 175 | 176 | Map toJson() { 177 | final Map data = new Map(); 178 | data['PICTURE_ADDRESS'] = this.pICTUREADDRESS; 179 | data['TO_PLACE'] = this.tOPLACE; 180 | return data; 181 | } 182 | } 183 | -------------------------------------------------------------------------------- /lib/provide/cart.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:shared_preferences/shared_preferences.dart'; 3 | import 'dart:convert'; 4 | import '../model/cart_info.dart'; 5 | 6 | class CartProvide with ChangeNotifier { 7 | String cartString = '[]'; 8 | 9 | List cartList = []; 10 | 11 | double totalPrice = 0.0; //总价 12 | int totalCount = 0; 13 | bool isAllCheck = true; // 是否全选 14 | 15 | save(goodsId, goodsName, count, oriPrice, price, images) async { 16 | SharedPreferences prefs = await SharedPreferences.getInstance(); 17 | cartString = prefs.getString('cartInfo'); 18 | var temp = cartString == null ? [] : json.decode(cartString.toString()); 19 | List tempList = (temp as List).cast(); 20 | 21 | bool isHave = false; 22 | int i = 0; 23 | 24 | totalCount = 0; 25 | totalPrice = 0; 26 | 27 | tempList.forEach((item) { 28 | if (item['goodsId'] == goodsId) { 29 | tempList[i]['count'] = item['count'] + 1; 30 | cartList[i].count++; 31 | isHave = true; 32 | } 33 | if (item['isCheck']) { 34 | totalPrice += cartList[i].price * cartList[i].count; 35 | totalCount += cartList[i].count; 36 | } 37 | i++; 38 | }); 39 | if (!isHave) { 40 | Map newGoods = { 41 | 'goodsId': goodsId, 42 | 'goodsName': goodsName, 43 | 'count': count, 44 | 'oriPrice': oriPrice, 45 | 'price': price, 46 | 'images': images, 47 | 'isCheck': true 48 | }; 49 | tempList.add(newGoods); 50 | cartList.add(CartInfoModel.fromJson(newGoods)); 51 | totalPrice += (count * price); 52 | totalCount += count; 53 | } 54 | cartString = json.encode(tempList).toString(); 55 | // print(cartString); 56 | prefs.setString('cartInfo', cartString); 57 | notifyListeners(); 58 | } 59 | 60 | clear() async { 61 | SharedPreferences prefs = await SharedPreferences.getInstance(); 62 | prefs.remove('cartInfo'); 63 | cartList = []; 64 | print('清除完成----------------------------'); 65 | notifyListeners(); 66 | } 67 | 68 | getCartInfo() async { 69 | SharedPreferences prefs = await SharedPreferences.getInstance(); 70 | cartString = prefs.getString('cartInfo'); 71 | cartList = []; 72 | if (cartString == null) { 73 | cartList = []; 74 | } else { 75 | List tempList = (json.decode(cartString) as List).cast(); 76 | totalCount = 0; 77 | totalPrice = 0.0; 78 | isAllCheck = true; 79 | 80 | tempList.forEach((item) { 81 | if (item['isCheck']) { 82 | totalPrice += (item['count'] * item['price']); 83 | totalCount += item['count']; 84 | } else { 85 | isAllCheck = false; 86 | } 87 | cartList.add(CartInfoModel.fromJson(item)); 88 | }); 89 | } 90 | notifyListeners(); 91 | } 92 | // 删除商品 93 | 94 | deleteGoods(String goodsId) async { 95 | SharedPreferences prefs = await SharedPreferences.getInstance(); 96 | cartString = prefs.getString('cartInfo'); 97 | List tempList = (json.decode(cartString) as List).cast(); 98 | 99 | int index = 0; 100 | int detIndex = 0; 101 | 102 | tempList.forEach((item) { 103 | if (item['goodsId'] == goodsId) { 104 | detIndex = index; 105 | } 106 | }); 107 | tempList.removeAt(detIndex); 108 | cartString = json.encode(tempList).toString(); 109 | prefs.setString('cartInfo', cartString); 110 | getCartInfo(); 111 | } 112 | 113 | // 改变商品Check状态 114 | changeCheckState(CartInfoModel goods) async { 115 | SharedPreferences prefs = await SharedPreferences.getInstance(); 116 | cartString = prefs.getString('cartInfo'); 117 | List tempList = (json.decode(cartString) as List).cast(); 118 | 119 | int index = 0; 120 | int changeIndex = 0; 121 | 122 | tempList.forEach((item) { 123 | if (item['goodsId'] == goods.goodsId) { 124 | changeIndex = index; 125 | } 126 | index++; 127 | }); 128 | tempList[changeIndex] = goods.toJson(); 129 | cartString = json.encode(tempList).toString(); 130 | prefs.setString('cartInfo', cartString); 131 | await getCartInfo(); 132 | } 133 | 134 | // 全选商品 135 | allCheck(bool isCheck) async { 136 | SharedPreferences prefs = await SharedPreferences.getInstance(); 137 | // cartString = prefs.getString('cartInfo'); 138 | List tempList = (json.decode(cartString) as List).cast(); 139 | List newList = []; 140 | for (var item in tempList) { 141 | var newItem = item; 142 | newItem['isCheck'] = isCheck; 143 | newList.add(newItem); 144 | } 145 | cartString = json.encode(newList).toString(); 146 | prefs.setString('cartInfo', cartString); 147 | await getCartInfo(); 148 | } 149 | 150 | // 改变商品数量 151 | changeGoodsCount(CartInfoModel goods, String type) async { 152 | SharedPreferences prefs = await SharedPreferences.getInstance(); 153 | // cartString = prefs.getString('cartInfo'); 154 | List tempList = (json.decode(cartString) as List).cast(); 155 | 156 | int index = 0; 157 | int changeIndex = 0; 158 | 159 | tempList.forEach((item) { 160 | if (item['goodsId'] == goods.goodsId) { 161 | changeIndex = index; 162 | } 163 | index++; 164 | }); 165 | 166 | if (type == 'add') { 167 | goods.count++; 168 | } else if (goods.count > 1) { 169 | goods.count--; 170 | } 171 | tempList[changeIndex] = goods.toJson(); 172 | cartString = json.encode(tempList).toString(); 173 | prefs.setString('cartInfo', cartString); 174 | await getCartInfo(); 175 | } 176 | } 177 | -------------------------------------------------------------------------------- /pubspec.lock: -------------------------------------------------------------------------------- 1 | # Generated by pub 2 | # See https://www.dartlang.org/tools/pub/glossary#lockfile 3 | packages: 4 | async: 5 | dependency: transitive 6 | description: 7 | name: async 8 | url: "https://pub.flutter-io.cn" 9 | source: hosted 10 | version: "2.1.0" 11 | boolean_selector: 12 | dependency: transitive 13 | description: 14 | name: boolean_selector 15 | url: "https://pub.flutter-io.cn" 16 | source: hosted 17 | version: "1.0.4" 18 | charcode: 19 | dependency: transitive 20 | description: 21 | name: charcode 22 | url: "https://pub.flutter-io.cn" 23 | source: hosted 24 | version: "1.1.2" 25 | collection: 26 | dependency: transitive 27 | description: 28 | name: collection 29 | url: "https://pub.flutter-io.cn" 30 | source: hosted 31 | version: "1.14.11" 32 | cookie_jar: 33 | dependency: transitive 34 | description: 35 | name: cookie_jar 36 | url: "https://pub.flutter-io.cn" 37 | source: hosted 38 | version: "1.0.1" 39 | csslib: 40 | dependency: transitive 41 | description: 42 | name: csslib 43 | url: "https://pub.flutter-io.cn" 44 | source: hosted 45 | version: "0.16.1" 46 | cupertino_icons: 47 | dependency: "direct main" 48 | description: 49 | name: cupertino_icons 50 | url: "https://pub.flutter-io.cn" 51 | source: hosted 52 | version: "0.1.2" 53 | dio: 54 | dependency: "direct main" 55 | description: 56 | name: dio 57 | url: "https://pub.flutter-io.cn" 58 | source: hosted 59 | version: "2.1.13" 60 | fluro: 61 | dependency: "direct main" 62 | description: 63 | name: fluro 64 | url: "https://pub.flutter-io.cn" 65 | source: hosted 66 | version: "1.5.0" 67 | flutter: 68 | dependency: "direct main" 69 | description: flutter 70 | source: sdk 71 | version: "0.0.0" 72 | flutter_easyrefresh: 73 | dependency: "direct main" 74 | description: 75 | name: flutter_easyrefresh 76 | url: "https://pub.flutter-io.cn" 77 | source: hosted 78 | version: "1.2.7" 79 | flutter_html: 80 | dependency: "direct main" 81 | description: 82 | name: flutter_html 83 | url: "https://pub.flutter-io.cn" 84 | source: hosted 85 | version: "0.9.9" 86 | flutter_page_indicator: 87 | dependency: transitive 88 | description: 89 | name: flutter_page_indicator 90 | url: "https://pub.flutter-io.cn" 91 | source: hosted 92 | version: "0.0.3" 93 | flutter_screenutil: 94 | dependency: "direct main" 95 | description: 96 | name: flutter_screenutil 97 | url: "https://pub.flutter-io.cn" 98 | source: hosted 99 | version: "0.5.3" 100 | flutter_swiper: 101 | dependency: "direct main" 102 | description: 103 | name: flutter_swiper 104 | url: "https://pub.flutter-io.cn" 105 | source: hosted 106 | version: "1.1.6" 107 | flutter_test: 108 | dependency: "direct dev" 109 | description: flutter 110 | source: sdk 111 | version: "0.0.0" 112 | fluttertoast: 113 | dependency: "direct main" 114 | description: 115 | name: fluttertoast 116 | url: "https://pub.flutter-io.cn" 117 | source: hosted 118 | version: "3.1.0" 119 | html: 120 | dependency: transitive 121 | description: 122 | name: html 123 | url: "https://pub.flutter-io.cn" 124 | source: hosted 125 | version: "0.14.0+2" 126 | matcher: 127 | dependency: transitive 128 | description: 129 | name: matcher 130 | url: "https://pub.flutter-io.cn" 131 | source: hosted 132 | version: "0.12.5" 133 | meta: 134 | dependency: transitive 135 | description: 136 | name: meta 137 | url: "https://pub.flutter-io.cn" 138 | source: hosted 139 | version: "1.1.6" 140 | path: 141 | dependency: transitive 142 | description: 143 | name: path 144 | url: "https://pub.flutter-io.cn" 145 | source: hosted 146 | version: "1.6.2" 147 | pedantic: 148 | dependency: transitive 149 | description: 150 | name: pedantic 151 | url: "https://pub.flutter-io.cn" 152 | source: hosted 153 | version: "1.5.0" 154 | provide: 155 | dependency: "direct main" 156 | description: 157 | name: provide 158 | url: "https://pub.flutter-io.cn" 159 | source: hosted 160 | version: "1.0.2" 161 | quiver: 162 | dependency: transitive 163 | description: 164 | name: quiver 165 | url: "https://pub.flutter-io.cn" 166 | source: hosted 167 | version: "2.0.2" 168 | shared_preferences: 169 | dependency: "direct main" 170 | description: 171 | name: shared_preferences 172 | url: "https://pub.flutter-io.cn" 173 | source: hosted 174 | version: "0.5.3+2" 175 | sky_engine: 176 | dependency: transitive 177 | description: flutter 178 | source: sdk 179 | version: "0.0.99" 180 | source_span: 181 | dependency: transitive 182 | description: 183 | name: source_span 184 | url: "https://pub.flutter-io.cn" 185 | source: hosted 186 | version: "1.5.5" 187 | stack_trace: 188 | dependency: transitive 189 | description: 190 | name: stack_trace 191 | url: "https://pub.flutter-io.cn" 192 | source: hosted 193 | version: "1.9.3" 194 | stream_channel: 195 | dependency: transitive 196 | description: 197 | name: stream_channel 198 | url: "https://pub.flutter-io.cn" 199 | source: hosted 200 | version: "2.0.0" 201 | string_scanner: 202 | dependency: transitive 203 | description: 204 | name: string_scanner 205 | url: "https://pub.flutter-io.cn" 206 | source: hosted 207 | version: "1.0.4" 208 | term_glyph: 209 | dependency: transitive 210 | description: 211 | name: term_glyph 212 | url: "https://pub.flutter-io.cn" 213 | source: hosted 214 | version: "1.1.0" 215 | test_api: 216 | dependency: transitive 217 | description: 218 | name: test_api 219 | url: "https://pub.flutter-io.cn" 220 | source: hosted 221 | version: "0.2.4" 222 | transformer_page_view: 223 | dependency: transitive 224 | description: 225 | name: transformer_page_view 226 | url: "https://pub.flutter-io.cn" 227 | source: hosted 228 | version: "0.1.6" 229 | typed_data: 230 | dependency: transitive 231 | description: 232 | name: typed_data 233 | url: "https://pub.flutter-io.cn" 234 | source: hosted 235 | version: "1.1.6" 236 | url_launcher: 237 | dependency: "direct main" 238 | description: 239 | name: url_launcher 240 | url: "https://pub.flutter-io.cn" 241 | source: hosted 242 | version: "5.0.3" 243 | vector_math: 244 | dependency: transitive 245 | description: 246 | name: vector_math 247 | url: "https://pub.flutter-io.cn" 248 | source: hosted 249 | version: "2.0.8" 250 | sdks: 251 | dart: ">=2.2.0 <3.0.0" 252 | flutter: ">=1.5.0 <2.0.0" 253 | -------------------------------------------------------------------------------- /lib/pages/member_page.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter/cupertino.dart'; 3 | import 'package:flutter_screenutil/flutter_screenutil.dart'; 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: [_avatar(), _orderArea(), _listArea()], 14 | ), 15 | ); 16 | } 17 | 18 | _avatar() { 19 | return Container( 20 | decoration: BoxDecoration( 21 | image: DecorationImage( 22 | fit: BoxFit.cover, 23 | image: AssetImage('assets/images/background.png'))), 24 | width: ScreenUtil().setWidth(750), 25 | height: ScreenUtil().setHeight(350), 26 | child: Column( 27 | children: [ 28 | Container( 29 | width: ScreenUtil().setWidth(180), 30 | margin: EdgeInsets.only(top: 40), 31 | decoration: BoxDecoration( 32 | border: Border.all(width: 1.0, color: Colors.white), 33 | borderRadius: BorderRadius.circular(60)), 34 | child: ClipOval( 35 | child: Image.asset('assets/images/irving.jpeg'), 36 | ), 37 | ), 38 | Container( 39 | margin: EdgeInsets.only(top: 10), 40 | child: Text('桥豆麻袋', 41 | style: TextStyle( 42 | fontSize: ScreenUtil().setSp(35), color: Colors.black87)), 43 | ) 44 | ], 45 | ), 46 | ); 47 | } 48 | 49 | _orderArea() { 50 | return Container( 51 | color: Colors.white, 52 | margin: EdgeInsets.only(top: 10), 53 | child: Column( 54 | children: [ 55 | Container( 56 | decoration: BoxDecoration( 57 | border: Border( 58 | bottom: BorderSide(width: 0.5, color: Colors.black12))), 59 | child: ListTile( 60 | title: Text('我的订单'), 61 | leading: Icon(Icons.assignment), 62 | trailing: Icon(CupertinoIcons.right_chevron), 63 | ), 64 | ), 65 | Container( 66 | padding: EdgeInsets.fromLTRB(0, 20, 0, 20), 67 | child: Row( 68 | mainAxisAlignment: MainAxisAlignment.spaceAround, 69 | children: [ 70 | Container( 71 | child: Column( 72 | children: [ 73 | Container( 74 | padding: EdgeInsets.only(bottom: 10), 75 | child: Icon( 76 | Icons.description, 77 | size: 30, 78 | ), 79 | ), 80 | Container( 81 | child: Text('待付款'), 82 | ) 83 | ], 84 | ), 85 | ), 86 | Container( 87 | child: Column( 88 | children: [ 89 | Container( 90 | padding: EdgeInsets.only(bottom: 10), 91 | child: Icon( 92 | Icons.query_builder, 93 | size: 30, 94 | ), 95 | ), 96 | Container( 97 | child: Text('待发货'), 98 | ) 99 | ], 100 | ), 101 | ), 102 | Container( 103 | child: Column( 104 | children: [ 105 | Container( 106 | padding: EdgeInsets.only(bottom: 10), 107 | child: Icon( 108 | Icons.departure_board, 109 | size: 30, 110 | color: Colors.black, 111 | ), 112 | ), 113 | Container( 114 | child: Text('待收货'), 115 | ) 116 | ], 117 | ), 118 | ), 119 | Container( 120 | child: Column( 121 | children: [ 122 | Container( 123 | padding: EdgeInsets.only(bottom: 10), 124 | child: Icon( 125 | Icons.content_paste, 126 | size: 30, 127 | ), 128 | ), 129 | Container( 130 | child: Text('待评价'), 131 | ) 132 | ], 133 | ), 134 | ) 135 | ], 136 | ), 137 | ) 138 | ], 139 | ), 140 | ); 141 | } 142 | 143 | _listArea() { 144 | return Column( 145 | children: [ 146 | Container( 147 | margin: EdgeInsets.only(top: 10), 148 | child: Column( 149 | children: [ 150 | Container( 151 | decoration: BoxDecoration( 152 | color: Colors.white, 153 | border: Border( 154 | bottom: BorderSide(width: 0.5, color: Colors.black12))), 155 | child: ListTile( 156 | leading: Icon(Icons.card_giftcard), 157 | title: Text('领取优惠券'), 158 | trailing: Icon(CupertinoIcons.right_chevron), 159 | ), 160 | ), 161 | Container( 162 | decoration: BoxDecoration( 163 | color: Colors.white, 164 | border: Border( 165 | bottom: BorderSide(width: 0.5, color: Colors.black12))), 166 | child: ListTile( 167 | leading: Icon(Icons.check_circle), 168 | title: Text('已领取优惠券'), 169 | trailing: Icon(CupertinoIcons.right_chevron), 170 | ), 171 | ), 172 | Container( 173 | decoration: BoxDecoration( 174 | color: Colors.white, 175 | border: Border( 176 | bottom: BorderSide(width: 0.5, color: Colors.black12))), 177 | child: ListTile( 178 | leading: Icon(Icons.location_on), 179 | title: Text('地址管理'), 180 | trailing: Icon(CupertinoIcons.right_chevron), 181 | ), 182 | ), 183 | ], 184 | ), 185 | ), 186 | Container( 187 | margin: EdgeInsets.only(top: 10), 188 | child: Column( 189 | children: [ 190 | Container( 191 | decoration: BoxDecoration( 192 | color: Colors.white, 193 | border: Border( 194 | bottom: BorderSide(width: 0.5, color: Colors.black12))), 195 | child: ListTile( 196 | leading: Icon(Icons.phone_android), 197 | title: Text('联系我们'), 198 | trailing: Icon(CupertinoIcons.right_chevron), 199 | ), 200 | ), 201 | Container( 202 | decoration: BoxDecoration( 203 | color: Colors.white, 204 | border: Border( 205 | bottom: BorderSide(width: 0.5, color: Colors.black12))), 206 | child: ListTile( 207 | leading: Icon(Icons.info), 208 | title: Text('关于商城'), 209 | trailing: Icon(CupertinoIcons.right_chevron), 210 | ), 211 | ), 212 | ], 213 | ), 214 | ) 215 | ], 216 | ); 217 | } 218 | } 219 | -------------------------------------------------------------------------------- /lib/pages/category_page.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_screenutil/flutter_screenutil.dart'; 3 | import '../service/service_method.dart'; 4 | import 'dart:convert'; 5 | import '../model/category.dart'; 6 | import '../model/mallGoodsList.dart'; 7 | import 'package:flutter_screenutil/flutter_screenutil.dart'; 8 | import '../provide/childCategory.dart'; 9 | import '../provide/category_goods_list.dart'; 10 | import 'package:provide/provide.dart'; 11 | import 'package:flutter_easyrefresh/easy_refresh.dart'; 12 | import 'package:fluttertoast/fluttertoast.dart'; 13 | import '../route/application.dart'; 14 | 15 | class CategoryPage extends StatelessWidget { 16 | GlobalKey _footerkey = 17 | new GlobalKey(); 18 | 19 | GlobalKey _headerKey = 20 | new GlobalKey(); 21 | 22 | GlobalKey _easyRefreshKey = 23 | new GlobalKey(); 24 | @override 25 | Widget build(BuildContext context) { 26 | return Scaffold( 27 | appBar: AppBar( 28 | title: Text('商品分类'), 29 | ), 30 | body: Container( 31 | child: Row( 32 | children: [ 33 | LeftCategoryNav(_easyRefreshKey), 34 | Column( 35 | children: [ 36 | RightCategoryNav(_easyRefreshKey), 37 | CategoryGoodsList(_footerkey, _headerKey, _easyRefreshKey) 38 | ], 39 | ) 40 | ], 41 | ), 42 | ), 43 | ); 44 | } 45 | } 46 | 47 | // 左侧大类导航 48 | 49 | class LeftCategoryNav extends StatelessWidget { 50 | final _easyRefreshKey; 51 | LeftCategoryNav(this._easyRefreshKey); 52 | @override 53 | Widget build(BuildContext context) { 54 | Provide.value(context).getCategory(context); 55 | return Provide( 56 | builder: (context, child, val) { 57 | return Container( 58 | width: ScreenUtil().setWidth(180), 59 | decoration: BoxDecoration( 60 | border: 61 | Border(right: BorderSide(width: 0.5, color: Colors.black12))), 62 | child: ListView.builder( 63 | itemCount: 64 | Provide.value(context).list.length, 65 | itemBuilder: (context, index) { 66 | return _leftInkWell(index, context); 67 | }, 68 | ), 69 | ); 70 | }, 71 | ); 72 | } 73 | 74 | Widget _leftInkWell(int index, context) { 75 | List list = Provide.value(context).list; 76 | int currentIndex = 77 | Provide.value(context).currentIndex; 78 | return InkWell( 79 | onTap: () async { 80 | Provide.value(context).clearGoodsList(); 81 | await Provide.value(context) 82 | .changeCurrentIndex(index); 83 | var childList = list[index].bxMallSubDto; 84 | var categoryId = list[index].mallCategoryId; 85 | await Provide.value(context) 86 | .getChildCategory(childList, categoryId); 87 | _easyRefreshKey.currentState.callRefresh(); 88 | // await Provide.value(context) 89 | // .changeGoodsList(context); 90 | }, 91 | child: Container( 92 | height: ScreenUtil().setHeight(100), 93 | padding: EdgeInsets.only(left: 10.0, top: 20.0), 94 | decoration: BoxDecoration( 95 | color: (currentIndex == index) 96 | ? Color.fromRGBO(236, 236, 236, 1.0) 97 | : Colors.white, 98 | border: 99 | Border(bottom: BorderSide(width: 0.5, color: Colors.black12))), 100 | child: Text( 101 | list[index].mallCategoryName, 102 | style: TextStyle(fontSize: ScreenUtil().setSp(28)), 103 | ), 104 | ), 105 | ); 106 | } 107 | } 108 | 109 | //小类右侧导航 110 | class RightCategoryNav extends StatelessWidget { 111 | final _easyRefreshKey; 112 | RightCategoryNav(this._easyRefreshKey); 113 | @override 114 | Widget build(BuildContext context) { 115 | return Provide( 116 | builder: (context, child, childCategory) { 117 | return Container( 118 | height: ScreenUtil().setHeight(80), 119 | width: ScreenUtil().setWidth(570.0), 120 | decoration: BoxDecoration( 121 | border: 122 | Border(bottom: BorderSide(width: 0.5, color: Colors.black12)), 123 | color: Colors.white), 124 | child: ListView.builder( 125 | scrollDirection: Axis.horizontal, 126 | itemCount: childCategory.childCategoryList.length, 127 | itemBuilder: (context, index) { 128 | return _rightInkWell( 129 | childCategory.childCategoryList[index], index, context); 130 | }, 131 | ), 132 | ); 133 | }, 134 | ); 135 | } 136 | 137 | Widget _rightInkWell(BxMallSubDto item, index, context) { 138 | return InkWell( 139 | onTap: () { 140 | Provide.value(context).clearGoodsList(); 141 | Provide.value(context) 142 | .changeChildIndex(index, item.mallSubId); 143 | 144 | _easyRefreshKey.currentState.callRefresh(); 145 | // Provide.value(context) 146 | // .changeGoodsList(context); 147 | // _easyRefreshKey.currentState.callRefresh(); 148 | }, 149 | child: Container( 150 | padding: EdgeInsets.fromLTRB(5.0, 10.0, 10.0, 10.0), 151 | child: Text( 152 | item.mallSubName, 153 | style: TextStyle( 154 | fontSize: ScreenUtil().setSp(28), 155 | color: Provide.value(context).childIndex == index 156 | ? Colors.pink 157 | : Colors.black), 158 | ), 159 | ), 160 | ); 161 | } 162 | } 163 | 164 | // 商品列表,可以上拉加载 165 | 166 | class CategoryGoodsList extends StatelessWidget { 167 | final _footerkey; 168 | final _headerKey; 169 | final _easyRefreshKey; 170 | CategoryGoodsList(this._footerkey, this._headerKey, this._easyRefreshKey); 171 | // final GlobalKey _footerkey = 172 | // new GlobalKey(); 173 | 174 | // final GlobalKey _headerKey = 175 | // new GlobalKey(); 176 | 177 | // final GlobalKey _easyRefreshKey = 178 | // new GlobalKey(); 179 | 180 | final ScrollController scrollController = new ScrollController(); 181 | 182 | @override 183 | Widget build(BuildContext context) { 184 | Provide.value(context).changeGoodsList(context); 185 | return Provide( 186 | builder: (context, child, data) { 187 | return Expanded( 188 | child: Container( 189 | margin: EdgeInsets.only(top: 2.0), 190 | width: ScreenUtil().setWidth(570), 191 | child: EasyRefresh( 192 | // emptyWidget: Text('加载中。。。'), 193 | key: _easyRefreshKey, 194 | refreshFooter: ClassicsFooter( 195 | bgColor: Colors.white, 196 | textColor: Colors.black38, 197 | moreInfoColor: Colors.black38, 198 | showMore: true, 199 | noMoreText: '加载完成', 200 | moreInfo: 'loading', 201 | loadReadyText: '松手加载', 202 | loadText: '上拉加载更多', 203 | loadingText: '加载中...', 204 | loadedText: '加载成功', 205 | key: _footerkey, 206 | loadHeight: 50.0, 207 | ), 208 | refreshHeader: ClassicsHeader( 209 | bgColor: Colors.white, 210 | key: _headerKey, 211 | textColor: Colors.black38, 212 | refreshingText: '加载中...', 213 | refreshText: '下拉释放刷新', 214 | refreshReadyText: '释放刷新', 215 | refreshedText: '刷新成功', 216 | ), 217 | child: ListView( 218 | controller: scrollController, 219 | children: [_wrapList(data.goodsList, context)], 220 | // scrollDirection: Axis.vertical, 221 | ), 222 | loadMore: () async { 223 | await Provide.value(context) 224 | .loadMoreGoodsList(context); 225 | }, 226 | onRefresh: () async { 227 | await Provide.value(context) 228 | .changeGoodsList(context); 229 | }, 230 | ), 231 | )); 232 | }, 233 | ); 234 | } 235 | 236 | Widget _wrapList(List list, context) { 237 | if (list != null) { 238 | List listWidget = list.map((val) { 239 | return InkWell( 240 | onTap: () { 241 | Application.router.navigateTo(context, '/detail?id=${val.goodsId}'); 242 | }, 243 | child: Container( 244 | width: ScreenUtil().setWidth(280), 245 | color: Colors.white, 246 | padding: EdgeInsets.all(5.0), 247 | margin: EdgeInsets.only(bottom: 3.0), 248 | child: Column( 249 | children: [ 250 | Image.network( 251 | '${val.image}', 252 | width: ScreenUtil().setWidth(280), 253 | ), 254 | Text( 255 | '${val.goodsName}', 256 | maxLines: 1, 257 | overflow: TextOverflow.ellipsis, 258 | style: TextStyle( 259 | color: Colors.pink, fontSize: ScreenUtil().setSp(22)), 260 | ), 261 | Row( 262 | children: [ 263 | Text( 264 | '¥${val.oriPrice}', 265 | style: TextStyle( 266 | color: Colors.black26, 267 | decoration: TextDecoration.lineThrough, 268 | fontSize: ScreenUtil().setSp(22)), 269 | ), 270 | Text( 271 | '¥${val.presentPrice}', 272 | style: TextStyle(fontSize: ScreenUtil().setSp(22)), 273 | ), 274 | ], 275 | mainAxisAlignment: MainAxisAlignment.spaceBetween, 276 | ) 277 | ], 278 | ), 279 | ), 280 | ); 281 | }).toList(); 282 | return Wrap( 283 | spacing: 2, 284 | children: listWidget, 285 | ); 286 | } else { 287 | return Text( 288 | '该分类下暂无产品', 289 | textAlign: TextAlign.center, 290 | ); 291 | } 292 | } 293 | } 294 | -------------------------------------------------------------------------------- /lib/model/homeContent.dart: -------------------------------------------------------------------------------- 1 | class HomePageContentModel { 2 | String code; 3 | String message; 4 | HomePageContentData data; 5 | 6 | HomePageContentModel({this.code, this.message, this.data}); 7 | 8 | HomePageContentModel.fromJson(Map json) { 9 | code = json['code']; 10 | message = json['message']; 11 | data = json['data'] != null 12 | ? new HomePageContentData.fromJson(json['data']) 13 | : null; 14 | } 15 | 16 | Map toJson() { 17 | final Map data = new Map(); 18 | data['code'] = this.code; 19 | data['message'] = this.message; 20 | if (this.data != null) { 21 | data['data'] = this.data.toJson(); 22 | } 23 | return data; 24 | } 25 | } 26 | 27 | class HomePageContentData { 28 | List slides; 29 | ShopInfo shopInfo; 30 | IntegralMallPic integralMallPic; 31 | ToShareCode toShareCode; 32 | List recommend; 33 | AdvertesPicture advertesPicture; 34 | List floor1; 35 | List floor2; 36 | List floor3; 37 | Saoma saoma; 38 | NewUser newUser; 39 | Floor1Pic floor1Pic; 40 | Floor2Pic floor2Pic; 41 | FloorName floorName; 42 | List category; 43 | Floor3Pic floor3Pic; 44 | 45 | HomePageContentData( 46 | {this.slides, 47 | this.shopInfo, 48 | this.integralMallPic, 49 | this.toShareCode, 50 | this.recommend, 51 | this.advertesPicture, 52 | this.floor1, 53 | this.floor2, 54 | this.floor3, 55 | this.saoma, 56 | this.newUser, 57 | this.floor1Pic, 58 | this.floor2Pic, 59 | this.floorName, 60 | this.category, 61 | this.floor3Pic}); 62 | 63 | HomePageContentData.fromJson(Map json) { 64 | if (json['slides'] != null) { 65 | slides = new List(); 66 | json['slides'].forEach((v) { 67 | slides.add(new Slides.fromJson(v)); 68 | }); 69 | } 70 | shopInfo = json['shopInfo'] != null 71 | ? new ShopInfo.fromJson(json['shopInfo']) 72 | : null; 73 | integralMallPic = json['integralMallPic'] != null 74 | ? new IntegralMallPic.fromJson(json['integralMallPic']) 75 | : null; 76 | toShareCode = json['toShareCode'] != null 77 | ? new ToShareCode.fromJson(json['toShareCode']) 78 | : null; 79 | if (json['recommend'] != null) { 80 | recommend = new List(); 81 | json['recommend'].forEach((v) { 82 | recommend.add(new Recommend.fromJson(v)); 83 | }); 84 | } 85 | advertesPicture = json['advertesPicture'] != null 86 | ? new AdvertesPicture.fromJson(json['advertesPicture']) 87 | : null; 88 | if (json['floor1'] != null) { 89 | floor1 = new List(); 90 | json['floor1'].forEach((v) { 91 | floor1.add(new Floor1.fromJson(v)); 92 | }); 93 | } 94 | if (json['floor2'] != null) { 95 | floor2 = new List(); 96 | json['floor2'].forEach((v) { 97 | floor2.add(new Floor2.fromJson(v)); 98 | }); 99 | } 100 | if (json['floor3'] != null) { 101 | floor3 = new List(); 102 | json['floor3'].forEach((v) { 103 | floor3.add(new Floor3.fromJson(v)); 104 | }); 105 | } 106 | saoma = json['saoma'] != null ? new Saoma.fromJson(json['saoma']) : null; 107 | newUser = 108 | json['newUser'] != null ? new NewUser.fromJson(json['newUser']) : null; 109 | floor1Pic = json['floor1Pic'] != null 110 | ? new Floor1Pic.fromJson(json['floor1Pic']) 111 | : null; 112 | floor2Pic = json['floor2Pic'] != null 113 | ? new Floor2Pic.fromJson(json['floor2Pic']) 114 | : null; 115 | floorName = json['floorName'] != null 116 | ? new FloorName.fromJson(json['floorName']) 117 | : null; 118 | if (json['category'] != null) { 119 | category = new List(); 120 | json['category'].forEach((v) { 121 | category.add(new Category.fromJson(v)); 122 | }); 123 | } 124 | floor3Pic = json['floor3Pic'] != null 125 | ? new Floor3Pic.fromJson(json['floor3Pic']) 126 | : null; 127 | } 128 | 129 | Map toJson() { 130 | final Map data = new Map(); 131 | if (this.slides != null) { 132 | data['slides'] = this.slides.map((v) => v.toJson()).toList(); 133 | } 134 | if (this.shopInfo != null) { 135 | data['shopInfo'] = this.shopInfo.toJson(); 136 | } 137 | if (this.integralMallPic != null) { 138 | data['integralMallPic'] = this.integralMallPic.toJson(); 139 | } 140 | if (this.toShareCode != null) { 141 | data['toShareCode'] = this.toShareCode.toJson(); 142 | } 143 | if (this.recommend != null) { 144 | data['recommend'] = this.recommend.map((v) => v.toJson()).toList(); 145 | } 146 | if (this.advertesPicture != null) { 147 | data['advertesPicture'] = this.advertesPicture.toJson(); 148 | } 149 | if (this.floor1 != null) { 150 | data['floor1'] = this.floor1.map((v) => v.toJson()).toList(); 151 | } 152 | if (this.floor2 != null) { 153 | data['floor2'] = this.floor2.map((v) => v.toJson()).toList(); 154 | } 155 | if (this.floor3 != null) { 156 | data['floor3'] = this.floor3.map((v) => v.toJson()).toList(); 157 | } 158 | if (this.saoma != null) { 159 | data['saoma'] = this.saoma.toJson(); 160 | } 161 | if (this.newUser != null) { 162 | data['newUser'] = this.newUser.toJson(); 163 | } 164 | if (this.floor1Pic != null) { 165 | data['floor1Pic'] = this.floor1Pic.toJson(); 166 | } 167 | if (this.floor2Pic != null) { 168 | data['floor2Pic'] = this.floor2Pic.toJson(); 169 | } 170 | if (this.floorName != null) { 171 | data['floorName'] = this.floorName.toJson(); 172 | } 173 | if (this.category != null) { 174 | data['category'] = this.category.map((v) => v.toJson()).toList(); 175 | } 176 | if (this.floor3Pic != null) { 177 | data['floor3Pic'] = this.floor3Pic.toJson(); 178 | } 179 | 180 | return data; 181 | } 182 | } 183 | 184 | class Slides { 185 | String image; 186 | String goodsId; 187 | 188 | Slides({this.image, this.goodsId}); 189 | 190 | Slides.fromJson(Map json) { 191 | image = json['image']; 192 | goodsId = json['goodsId']; 193 | } 194 | 195 | Map toJson() { 196 | final Map data = new Map(); 197 | data['image'] = this.image; 198 | data['goodsId'] = this.goodsId; 199 | return data; 200 | } 201 | } 202 | 203 | class ShopInfo { 204 | String leaderImage; 205 | String leaderPhone; 206 | 207 | ShopInfo({this.leaderImage, this.leaderPhone}); 208 | 209 | ShopInfo.fromJson(Map json) { 210 | leaderImage = json['leaderImage']; 211 | leaderPhone = json['leaderPhone']; 212 | } 213 | 214 | Map toJson() { 215 | final Map data = new Map(); 216 | data['leaderImage'] = this.leaderImage; 217 | data['leaderPhone'] = this.leaderPhone; 218 | return data; 219 | } 220 | } 221 | 222 | class IntegralMallPic { 223 | String pICTUREADDRESS; 224 | String tOPLACE; 225 | 226 | IntegralMallPic({this.pICTUREADDRESS, this.tOPLACE}); 227 | 228 | IntegralMallPic.fromJson(Map json) { 229 | pICTUREADDRESS = json['PICTURE_ADDRESS']; 230 | tOPLACE = json['TO_PLACE']; 231 | } 232 | 233 | Map toJson() { 234 | final Map data = new Map(); 235 | data['PICTURE_ADDRESS'] = this.pICTUREADDRESS; 236 | data['TO_PLACE'] = this.tOPLACE; 237 | return data; 238 | } 239 | } 240 | 241 | class ToShareCode { 242 | String pICTUREADDRESS; 243 | String tOPLACE; 244 | 245 | ToShareCode({this.pICTUREADDRESS, this.tOPLACE}); 246 | 247 | ToShareCode.fromJson(Map json) { 248 | pICTUREADDRESS = json['PICTURE_ADDRESS']; 249 | tOPLACE = json['TO_PLACE']; 250 | } 251 | 252 | Map toJson() { 253 | final Map data = new Map(); 254 | data['PICTURE_ADDRESS'] = this.pICTUREADDRESS; 255 | data['TO_PLACE'] = this.tOPLACE; 256 | return data; 257 | } 258 | } 259 | 260 | class Recommend { 261 | String image; 262 | double mallPrice; 263 | String goodsName; 264 | String goodsId; 265 | double price; 266 | 267 | Recommend( 268 | {this.image, this.mallPrice, this.goodsName, this.goodsId, this.price}); 269 | 270 | Recommend.fromJson(Map json) { 271 | image = json['image']; 272 | mallPrice = json['mallPrice']; 273 | goodsName = json['goodsName']; 274 | goodsId = json['goodsId']; 275 | price = json['price']; 276 | } 277 | 278 | Map toJson() { 279 | final Map data = new Map(); 280 | data['image'] = this.image; 281 | data['mallPrice'] = this.mallPrice; 282 | data['goodsName'] = this.goodsName; 283 | data['goodsId'] = this.goodsId; 284 | data['price'] = this.price; 285 | return data; 286 | } 287 | } 288 | 289 | class AdvertesPicture { 290 | String pICTUREADDRESS; 291 | String tOPLACE; 292 | 293 | AdvertesPicture({this.pICTUREADDRESS, this.tOPLACE}); 294 | 295 | AdvertesPicture.fromJson(Map json) { 296 | pICTUREADDRESS = json['PICTURE_ADDRESS']; 297 | tOPLACE = json['TO_PLACE']; 298 | } 299 | 300 | Map toJson() { 301 | final Map data = new Map(); 302 | data['PICTURE_ADDRESS'] = this.pICTUREADDRESS; 303 | data['TO_PLACE'] = this.tOPLACE; 304 | return data; 305 | } 306 | } 307 | 308 | class Floor1 { 309 | String image; 310 | String goodsId; 311 | 312 | Floor1({this.image, this.goodsId}); 313 | 314 | Floor1.fromJson(Map json) { 315 | image = json['image']; 316 | goodsId = json['goodsId']; 317 | } 318 | 319 | Map toJson() { 320 | final Map data = new Map(); 321 | data['image'] = this.image; 322 | data['goodsId'] = this.goodsId; 323 | return data; 324 | } 325 | } 326 | 327 | class Floor2 { 328 | String image; 329 | String goodsId; 330 | 331 | Floor2({this.image, this.goodsId}); 332 | 333 | Floor2.fromJson(Map json) { 334 | image = json['image']; 335 | goodsId = json['goodsId']; 336 | } 337 | 338 | Map toJson() { 339 | final Map data = new Map(); 340 | data['image'] = this.image; 341 | data['goodsId'] = this.goodsId; 342 | return data; 343 | } 344 | } 345 | 346 | class Floor3 { 347 | String image; 348 | String goodsId; 349 | 350 | Floor3({this.image, this.goodsId}); 351 | 352 | Floor3.fromJson(Map json) { 353 | image = json['image']; 354 | goodsId = json['goodsId']; 355 | } 356 | 357 | Map toJson() { 358 | final Map data = new Map(); 359 | data['image'] = this.image; 360 | data['goodsId'] = this.goodsId; 361 | return data; 362 | } 363 | } 364 | 365 | class Saoma { 366 | String pICTUREADDRESS; 367 | String tOPLACE; 368 | 369 | Saoma({this.pICTUREADDRESS, this.tOPLACE}); 370 | 371 | Saoma.fromJson(Map json) { 372 | pICTUREADDRESS = json['PICTURE_ADDRESS']; 373 | tOPLACE = json['TO_PLACE']; 374 | } 375 | 376 | Map toJson() { 377 | final Map data = new Map(); 378 | data['PICTURE_ADDRESS'] = this.pICTUREADDRESS; 379 | data['TO_PLACE'] = this.tOPLACE; 380 | return data; 381 | } 382 | } 383 | 384 | class NewUser { 385 | String pICTUREADDRESS; 386 | String tOPLACE; 387 | 388 | NewUser({this.pICTUREADDRESS, this.tOPLACE}); 389 | 390 | NewUser.fromJson(Map json) { 391 | pICTUREADDRESS = json['PICTURE_ADDRESS']; 392 | tOPLACE = json['TO_PLACE']; 393 | } 394 | 395 | Map toJson() { 396 | final Map data = new Map(); 397 | data['PICTURE_ADDRESS'] = this.pICTUREADDRESS; 398 | data['TO_PLACE'] = this.tOPLACE; 399 | return data; 400 | } 401 | } 402 | 403 | class Floor1Pic { 404 | String pICTUREADDRESS; 405 | String tOPLACE; 406 | 407 | Floor1Pic({this.pICTUREADDRESS, this.tOPLACE}); 408 | 409 | Floor1Pic.fromJson(Map json) { 410 | pICTUREADDRESS = json['PICTURE_ADDRESS']; 411 | tOPLACE = json['TO_PLACE']; 412 | } 413 | 414 | Map toJson() { 415 | final Map data = new Map(); 416 | data['PICTURE_ADDRESS'] = this.pICTUREADDRESS; 417 | data['TO_PLACE'] = this.tOPLACE; 418 | return data; 419 | } 420 | } 421 | 422 | class Floor2Pic { 423 | String pICTUREADDRESS; 424 | String tOPLACE; 425 | 426 | Floor2Pic({this.pICTUREADDRESS, this.tOPLACE}); 427 | 428 | Floor2Pic.fromJson(Map json) { 429 | pICTUREADDRESS = json['PICTURE_ADDRESS']; 430 | tOPLACE = json['TO_PLACE']; 431 | } 432 | 433 | Map toJson() { 434 | final Map data = new Map(); 435 | data['PICTURE_ADDRESS'] = this.pICTUREADDRESS; 436 | data['TO_PLACE'] = this.tOPLACE; 437 | return data; 438 | } 439 | } 440 | 441 | class FloorName { 442 | String floor1; 443 | String floor2; 444 | String floor3; 445 | 446 | FloorName({this.floor1, this.floor2, this.floor3}); 447 | 448 | FloorName.fromJson(Map json) { 449 | floor1 = json['floor1']; 450 | floor2 = json['floor2']; 451 | floor3 = json['floor3']; 452 | } 453 | 454 | Map toJson() { 455 | final Map data = new Map(); 456 | data['floor1'] = this.floor1; 457 | data['floor2'] = this.floor2; 458 | data['floor3'] = this.floor3; 459 | return data; 460 | } 461 | } 462 | 463 | class Category { 464 | String mallCategoryId; 465 | String mallCategoryName; 466 | List bxMallSubDto; 467 | Null comments; 468 | String image; 469 | 470 | Category( 471 | {this.mallCategoryId, 472 | this.mallCategoryName, 473 | this.bxMallSubDto, 474 | this.comments, 475 | this.image}); 476 | 477 | Category.fromJson(Map json) { 478 | mallCategoryId = json['mallCategoryId']; 479 | mallCategoryName = json['mallCategoryName']; 480 | if (json['bxMallSubDto'] != null) { 481 | bxMallSubDto = new List(); 482 | json['bxMallSubDto'].forEach((v) { 483 | bxMallSubDto.add(new BxMallSubDto.fromJson(v)); 484 | }); 485 | } 486 | comments = json['comments']; 487 | image = json['image']; 488 | } 489 | 490 | Map toJson() { 491 | final Map data = new Map(); 492 | data['mallCategoryId'] = this.mallCategoryId; 493 | data['mallCategoryName'] = this.mallCategoryName; 494 | if (this.bxMallSubDto != null) { 495 | data['bxMallSubDto'] = this.bxMallSubDto.map((v) => v.toJson()).toList(); 496 | } 497 | data['comments'] = this.comments; 498 | data['image'] = this.image; 499 | return data; 500 | } 501 | } 502 | 503 | class BxMallSubDto { 504 | String mallSubId; 505 | String mallCategoryId; 506 | String mallSubName; 507 | String comments; 508 | 509 | BxMallSubDto( 510 | {this.mallSubId, this.mallCategoryId, this.mallSubName, this.comments}); 511 | 512 | BxMallSubDto.fromJson(Map json) { 513 | mallSubId = json['mallSubId']; 514 | mallCategoryId = json['mallCategoryId']; 515 | mallSubName = json['mallSubName']; 516 | comments = json['comments']; 517 | } 518 | 519 | Map toJson() { 520 | final Map data = new Map(); 521 | data['mallSubId'] = this.mallSubId; 522 | data['mallCategoryId'] = this.mallCategoryId; 523 | data['mallSubName'] = this.mallSubName; 524 | data['comments'] = this.comments; 525 | return data; 526 | } 527 | } 528 | 529 | class Floor3Pic { 530 | String pICTUREADDRESS; 531 | String tOPLACE; 532 | 533 | Floor3Pic({this.pICTUREADDRESS, this.tOPLACE}); 534 | 535 | Floor3Pic.fromJson(Map json) { 536 | pICTUREADDRESS = json['PICTURE_ADDRESS']; 537 | tOPLACE = json['TO_PLACE']; 538 | } 539 | 540 | Map toJson() { 541 | final Map data = new Map(); 542 | data['PICTURE_ADDRESS'] = this.pICTUREADDRESS; 543 | data['TO_PLACE'] = this.tOPLACE; 544 | return data; 545 | } 546 | } 547 | -------------------------------------------------------------------------------- /lib/pages/home_page.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:provide/provide.dart'; 3 | import '../service/service_method.dart'; 4 | import 'package:flutter_swiper/flutter_swiper.dart'; 5 | import 'dart:convert'; 6 | import 'package:flutter_screenutil/flutter_screenutil.dart'; 7 | import 'package:url_launcher/url_launcher.dart'; 8 | import 'package:flutter_easyrefresh/easy_refresh.dart'; 9 | import '../route/application.dart'; 10 | import '../provide/homePage.dart'; 11 | import '../provide/childCategory.dart'; 12 | import '../provide/category_goods_list.dart'; 13 | import '../model/homeContent.dart'; 14 | import '../provide/router.dart'; 15 | 16 | class HomePage extends StatefulWidget { 17 | @override 18 | _HomePageState createState() => _HomePageState(); 19 | } 20 | 21 | class _HomePageState extends State 22 | with AutomaticKeepAliveClientMixin { 23 | GlobalKey _footerkey = 24 | new GlobalKey(); 25 | GlobalKey _headerKey = 26 | new GlobalKey(); 27 | @override 28 | bool get wantKeepAlive => true; 29 | 30 | @override 31 | void initState() { 32 | super.initState(); 33 | } 34 | 35 | @override 36 | Widget build(BuildContext context) { 37 | return Scaffold( 38 | appBar: AppBar( 39 | title: Text('百姓生活+'), 40 | ), 41 | body: FutureBuilder( 42 | future: getHomePageContent(), 43 | builder: (context, snapshot) { 44 | if (snapshot.hasData) { 45 | //处理数据 46 | var data = (HomePageContentModel.fromJson( 47 | json.decode((snapshot.data).toString()))) 48 | .data; 49 | List swiper = data.slides; 50 | List navigatorList = data.category; 51 | String adPicture = data.advertesPicture.pICTUREADDRESS; 52 | String leaderImage = data.shopInfo.leaderImage; 53 | String leaderPhone = data.shopInfo.leaderPhone; 54 | List recommendList = data.recommend; 55 | String floor1Title = data.floor1Pic.pICTUREADDRESS; 56 | List floor1 = data.floor1; 57 | String floor2Title = data.floor2Pic.pICTUREADDRESS; 58 | List floor2 = data.floor2; 59 | String floor3Title = data.floor3Pic.pICTUREADDRESS; 60 | List floor3 = data.floor3; 61 | 62 | return EasyRefresh( 63 | refreshFooter: ClassicsFooter( 64 | bgColor: Colors.white, 65 | textColor: Colors.black38, 66 | moreInfoColor: Colors.black38, 67 | showMore: true, 68 | noMoreText: '已经到底啦', 69 | moreInfo: '加载中...', 70 | loadReadyText: '松手加载', 71 | loadText: '上拉加载更多', 72 | loadingText: '加载中...', 73 | loadedText: '加载成功', 74 | key: _footerkey, 75 | ), 76 | child: ListView( 77 | children: [ 78 | HomeSwiper( 79 | swiperDataList: swiper, 80 | ), 81 | TopNavigator(navigatorList: navigatorList), 82 | AdBanner( 83 | adPicture, 84 | ), 85 | LeaderPhone( 86 | leaderImage: leaderImage, 87 | leaderPhone: leaderPhone, 88 | ), 89 | Recommond(recommendList), 90 | FloorTitle( 91 | pictrueAddress: floor1Title, 92 | ), 93 | FloorContent( 94 | floorGoodsList: floor1, 95 | ), 96 | FloorTitle( 97 | pictrueAddress: floor2Title, 98 | ), 99 | FloorContent( 100 | floorGoodsList: floor2, 101 | ), 102 | FloorTitle( 103 | pictrueAddress: floor3Title, 104 | ), 105 | FloorContent( 106 | floorGoodsList: floor3, 107 | ), 108 | HotGoods() 109 | ], 110 | ), 111 | loadMore: () async { 112 | await Provide.value(context) 113 | .loadMoreHotGoods(); 114 | }, 115 | onRefresh: () async { 116 | await getHomePageContent(); 117 | await Provide.value(context) 118 | .getHotGoods(); 119 | }, 120 | refreshHeader: ClassicsHeader( 121 | bgColor: Colors.white, 122 | key: _headerKey, 123 | textColor: Colors.black38, 124 | refreshingText: '加载中...', 125 | refreshText: '下拉释放刷新', 126 | refreshReadyText: '释放刷新', 127 | refreshedText: '刷新成功', 128 | ), 129 | ); 130 | } else { 131 | return Center( 132 | child: Text('加载中...'), 133 | ); 134 | } 135 | }, 136 | )); 137 | } 138 | } 139 | 140 | //首页轮播组件 141 | class HomeSwiper extends StatelessWidget { 142 | final List swiperDataList; 143 | 144 | HomeSwiper({this.swiperDataList}); 145 | 146 | @override 147 | Widget build(BuildContext context) { 148 | // var s_height = ScreenUtil.screenHeight; 149 | // var s_width = ScreenUtil.screenWidth; 150 | // print('屏幕高度:$s_height'); 151 | // print('屏幕宽度:$s_width'); 152 | ScreenUtil.instance = ScreenUtil(height: 1334, width: 750)..init(context); 153 | return Container( 154 | height: ScreenUtil().setHeight(333), 155 | width: ScreenUtil().setWidth(750), 156 | child: new Swiper( 157 | itemBuilder: (BuildContext context, int index) { 158 | return InkWell( 159 | onTap: () { 160 | Application.router.navigateTo( 161 | context, '/detail?id=${swiperDataList[index]['goodsId']}'); 162 | }, 163 | child: Image.network( 164 | '${swiperDataList[index].image}', 165 | fit: BoxFit.cover, 166 | ), 167 | ); 168 | }, 169 | itemCount: swiperDataList.length, 170 | pagination: new SwiperPagination(), 171 | autoplay: true, 172 | ), 173 | ); 174 | } 175 | } 176 | 177 | //商品类别目录 178 | class TopNavigator extends StatelessWidget { 179 | final List navigatorList; 180 | TopNavigator({this.navigatorList}); 181 | 182 | Widget _gridViewItemUI(BuildContext context, item) { 183 | return InkWell( 184 | onTap: () { 185 | // var list = Provide.value(context).list; 186 | // var categoryId = item.mallCategoryId; 187 | print('点击了导航'); 188 | Provide.value(context).changeIndex(1); 189 | // Provide.value(context) 190 | // .changeCurrentIndex(item); 191 | // Provide.value(context) 192 | // .getChildCategory(childList, item.mallCategoryId); 193 | // Provide.value(context) 194 | // .changeGoodsList(context); 195 | }, 196 | child: Column( 197 | children: [ 198 | Image.network( 199 | item.image, 200 | width: ScreenUtil().setWidth(95), 201 | ), 202 | Text(item.mallCategoryName) 203 | ], 204 | ), 205 | ); 206 | } 207 | 208 | @override 209 | Widget build(BuildContext context) { 210 | if (navigatorList.length > 10) { 211 | this.navigatorList.removeRange(10, navigatorList.length); 212 | } 213 | 214 | return Container( 215 | height: ScreenUtil().setHeight(320), 216 | padding: EdgeInsets.all(3.0), 217 | child: GridView.count( 218 | crossAxisCount: 5, 219 | physics: NeverScrollableScrollPhysics(), 220 | padding: EdgeInsets.all(5.0), 221 | children: navigatorList.map((item) { 222 | return _gridViewItemUI(context, item); 223 | }).toList(), 224 | ), 225 | ); 226 | } 227 | } 228 | 229 | //广告bannner 230 | class AdBanner extends StatelessWidget { 231 | final String adPicture; 232 | AdBanner(this.adPicture); 233 | 234 | @override 235 | Widget build(BuildContext context) { 236 | return Container( 237 | // padding: EdgeInsets.only(top: 10.0), 238 | child: Image.network(adPicture), 239 | ); 240 | } 241 | } 242 | 243 | //店长电话 244 | class LeaderPhone extends StatelessWidget { 245 | final String leaderImage; 246 | final String leaderPhone; 247 | LeaderPhone({this.leaderImage, this.leaderPhone}); 248 | 249 | @override 250 | Widget build(BuildContext context) { 251 | return Container( 252 | child: InkWell( 253 | onTap: _launchURL, 254 | child: Image.network(leaderImage), 255 | ), 256 | ); 257 | } 258 | 259 | void _launchURL() async { 260 | String url = 'tel:' + leaderPhone; 261 | try { 262 | if (await canLaunch(url)) { 263 | await launch(url); 264 | } else { 265 | throw '拨打电话失败,请稍后再试或手动拨打$leaderPhone'; 266 | } 267 | } catch (e) { 268 | return print(e); 269 | } 270 | } 271 | } 272 | 273 | //商品推荐 274 | class Recommond extends StatelessWidget { 275 | List recommendList; 276 | Recommond(this.recommendList); 277 | // 标题方法 278 | Widget _titleWidget() { 279 | return Container( 280 | alignment: Alignment.centerLeft, 281 | padding: EdgeInsets.fromLTRB(10.0, 5.0, 0, 5.0), 282 | decoration: BoxDecoration( 283 | color: Colors.white, 284 | border: 285 | Border(bottom: BorderSide(width: 0.5, color: Colors.black12))), 286 | child: Text( 287 | '商品推荐', 288 | style: TextStyle(color: Colors.pinkAccent), 289 | ), 290 | ); 291 | } 292 | 293 | // 商品单独项方法 294 | Widget _item(context, index) { 295 | return InkWell( 296 | onTap: () { 297 | Application.router 298 | .navigateTo(context, '/detail?id=${recommendList[index].goodsId}'); 299 | }, 300 | child: Container( 301 | height: ScreenUtil().setHeight(330), 302 | width: ScreenUtil().setWidth(250), 303 | padding: EdgeInsets.all(8.0), 304 | decoration: BoxDecoration( 305 | color: Colors.white, 306 | border: 307 | Border(left: BorderSide(width: 0.5, color: Colors.black12))), 308 | child: Column( 309 | children: [ 310 | Image.network(recommendList[index].image), 311 | Text('¥${recommendList[index].mallPrice}'), 312 | Text( 313 | '¥${recommendList[index].price}', 314 | style: TextStyle( 315 | color: Colors.grey, decoration: TextDecoration.lineThrough), 316 | ), 317 | Text( 318 | '${recommendList[index].goodsName}', 319 | maxLines: 2, 320 | overflow: TextOverflow.visible, 321 | style: TextStyle(fontSize: 10.0), 322 | textAlign: TextAlign.center, 323 | ) 324 | ], 325 | ), 326 | ), 327 | ); 328 | } 329 | 330 | //横向列表 331 | Widget _recommendList() { 332 | return Container( 333 | height: ScreenUtil().setHeight(330), 334 | // margin: EdgeInsets.only(top: 10.0), 335 | child: ListView.builder( 336 | // physics: NeverScrollableScrollPhysics(), 337 | scrollDirection: Axis.horizontal, 338 | itemCount: recommendList.length, 339 | itemBuilder: (context, index) { 340 | return _item(context, index); 341 | }, 342 | ), 343 | ); 344 | } 345 | 346 | @override 347 | Widget build(BuildContext context) { 348 | return Container( 349 | margin: EdgeInsets.only(top: 10.0), 350 | height: ScreenUtil().setHeight(380), 351 | child: SingleChildScrollView( 352 | physics: NeverScrollableScrollPhysics(), 353 | child: Column( 354 | children: [_titleWidget(), _recommendList()], 355 | )), 356 | ); 357 | } 358 | } 359 | 360 | // 楼层标题 361 | class FloorTitle extends StatelessWidget { 362 | final String pictrueAddress; 363 | FloorTitle({this.pictrueAddress}); 364 | 365 | @override 366 | Widget build(BuildContext context) { 367 | return Container( 368 | padding: EdgeInsets.all(8.0), 369 | child: Image.network(pictrueAddress), 370 | ); 371 | } 372 | } 373 | 374 | // 楼层商品列表 375 | 376 | class FloorContent extends StatelessWidget { 377 | List floorGoodsList; 378 | 379 | FloorContent({this.floorGoodsList}); 380 | @override 381 | Widget build(BuildContext context) { 382 | return Container( 383 | child: Column( 384 | children: [_firstRow(context), _otherGoods(context)], 385 | ), 386 | ); 387 | } 388 | 389 | Widget _goodsItem(context, goods) { 390 | return Container( 391 | width: ScreenUtil().setWidth(375), 392 | // height: ScreenUtil().setWidth(375), 393 | child: InkWell( 394 | onTap: () { 395 | Application.router.navigateTo(context, '/detail?id=${goods.goodsId}'); 396 | }, 397 | child: Image.network(goods.image), 398 | ), 399 | ); 400 | } 401 | 402 | Widget _firstRow(context) { 403 | return Row( 404 | children: [ 405 | _goodsItem(context, floorGoodsList[0]), 406 | Column( 407 | children: [ 408 | _goodsItem(context, floorGoodsList[1]), 409 | _goodsItem(context, floorGoodsList[2]) 410 | ], 411 | ) 412 | ], 413 | ); 414 | } 415 | 416 | Widget _otherGoods(context) { 417 | return Row( 418 | children: [ 419 | _goodsItem(context, floorGoodsList[3]), 420 | _goodsItem(context, floorGoodsList[4]) 421 | ], 422 | ); 423 | } 424 | } 425 | 426 | class HotGoods extends StatelessWidget { 427 | @override 428 | Widget build(BuildContext context) { 429 | Provide.value(context).getHotGoods(); 430 | return Provide( 431 | builder: (context, child, val) { 432 | return Container( 433 | child: Column(children: [_hotTitle, _wrapList(context)]), 434 | ); 435 | }, 436 | ); 437 | } 438 | 439 | Widget _hotTitle = Container( 440 | margin: EdgeInsets.only(top: 10.0), 441 | alignment: Alignment.center, 442 | child: Text( 443 | '火爆专区', 444 | style: TextStyle(color: Colors.pink, fontSize: ScreenUtil().setSp(30)), 445 | ), 446 | padding: EdgeInsets.only(bottom: 5.0), 447 | ); 448 | 449 | Widget _wrapList(context) { 450 | var hotGoodsList = 451 | Provide.value(context).hotGoodsList; 452 | if (hotGoodsList.length != 0) { 453 | List listWidget = hotGoodsList.map((val) { 454 | return InkWell( 455 | onTap: () { 456 | Application.router.navigateTo(context, '/detail?id=${val.goodsId}'); 457 | }, 458 | child: Container( 459 | width: ScreenUtil().setWidth(370), 460 | color: Colors.white, 461 | padding: EdgeInsets.all(5.0), 462 | margin: EdgeInsets.only(bottom: 3.0), 463 | child: Column( 464 | children: [ 465 | Image.network( 466 | val.image, 467 | width: ScreenUtil().setWidth(370), 468 | ), 469 | Text( 470 | val.name, 471 | maxLines: 1, 472 | overflow: TextOverflow.ellipsis, 473 | style: TextStyle( 474 | color: Colors.pink, fontSize: ScreenUtil().setSp(26)), 475 | ), 476 | Row( 477 | children: [ 478 | Text( 479 | '¥${val.price}', 480 | style: TextStyle( 481 | color: Colors.black26, 482 | decoration: TextDecoration.lineThrough), 483 | ), 484 | Text('¥${val.mallPrice}'), 485 | ], 486 | mainAxisAlignment: MainAxisAlignment.spaceBetween, 487 | ) 488 | ], 489 | ), 490 | ), 491 | ); 492 | }).toList(); 493 | return Wrap( 494 | spacing: 2, 495 | children: listWidget, 496 | ); 497 | } else { 498 | return Text('暂无推荐商品'); 499 | } 500 | } 501 | } 502 | -------------------------------------------------------------------------------- /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 | 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; 12 | 3B80C3941E831B6300D905FE /* App.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; }; 13 | 3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 14 | 9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; }; 15 | 9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 16 | 9740EEB41CF90195004384FC /* Debug.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = 9740EEB21CF90195004384FC /* Debug.xcconfig */; }; 17 | 978B8F6F1D3862AE00F588F7 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */; }; 18 | 97C146F31CF9000F007C117D /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 97C146F21CF9000F007C117D /* main.m */; }; 19 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; 20 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; 21 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; 22 | /* End PBXBuildFile section */ 23 | 24 | /* Begin PBXCopyFilesBuildPhase section */ 25 | 9705A1C41CF9048500538489 /* Embed Frameworks */ = { 26 | isa = PBXCopyFilesBuildPhase; 27 | buildActionMask = 2147483647; 28 | dstPath = ""; 29 | dstSubfolderSpec = 10; 30 | files = ( 31 | 3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */, 32 | 9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */, 33 | ); 34 | name = "Embed Frameworks"; 35 | runOnlyForDeploymentPostprocessing = 0; 36 | }; 37 | /* End PBXCopyFilesBuildPhase section */ 38 | 39 | /* Begin PBXFileReference section */ 40 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; }; 41 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; }; 42 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; 43 | 3B80C3931E831B6300D905FE /* App.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = App.framework; path = Flutter/App.framework; sourceTree = ""; }; 44 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; 45 | 7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 46 | 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 47 | 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; }; 48 | 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; }; 49 | 9740EEBA1CF902C7004384FC /* Flutter.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Flutter.framework; path = Flutter/Flutter.framework; sourceTree = ""; }; 50 | 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; }; 51 | 97C146F21CF9000F007C117D /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 52 | 97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 53 | 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 54 | 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 55 | 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 56 | /* End PBXFileReference section */ 57 | 58 | /* Begin PBXFrameworksBuildPhase section */ 59 | 97C146EB1CF9000F007C117D /* Frameworks */ = { 60 | isa = PBXFrameworksBuildPhase; 61 | buildActionMask = 2147483647; 62 | files = ( 63 | 9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */, 64 | 3B80C3941E831B6300D905FE /* App.framework in Frameworks */, 65 | ); 66 | runOnlyForDeploymentPostprocessing = 0; 67 | }; 68 | /* End PBXFrameworksBuildPhase section */ 69 | 70 | /* Begin PBXGroup section */ 71 | 9740EEB11CF90186004384FC /* Flutter */ = { 72 | isa = PBXGroup; 73 | children = ( 74 | 3B80C3931E831B6300D905FE /* App.framework */, 75 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */, 76 | 9740EEBA1CF902C7004384FC /* Flutter.framework */, 77 | 9740EEB21CF90195004384FC /* Debug.xcconfig */, 78 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */, 79 | 9740EEB31CF90195004384FC /* Generated.xcconfig */, 80 | ); 81 | name = Flutter; 82 | sourceTree = ""; 83 | }; 84 | 97C146E51CF9000F007C117D = { 85 | isa = PBXGroup; 86 | children = ( 87 | 9740EEB11CF90186004384FC /* Flutter */, 88 | 97C146F01CF9000F007C117D /* Runner */, 89 | 97C146EF1CF9000F007C117D /* Products */, 90 | CF3B75C9A7D2FA2A4C99F110 /* Frameworks */, 91 | ); 92 | sourceTree = ""; 93 | }; 94 | 97C146EF1CF9000F007C117D /* Products */ = { 95 | isa = PBXGroup; 96 | children = ( 97 | 97C146EE1CF9000F007C117D /* Runner.app */, 98 | ); 99 | name = Products; 100 | sourceTree = ""; 101 | }; 102 | 97C146F01CF9000F007C117D /* Runner */ = { 103 | isa = PBXGroup; 104 | children = ( 105 | 7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */, 106 | 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */, 107 | 97C146FA1CF9000F007C117D /* Main.storyboard */, 108 | 97C146FD1CF9000F007C117D /* Assets.xcassets */, 109 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */, 110 | 97C147021CF9000F007C117D /* Info.plist */, 111 | 97C146F11CF9000F007C117D /* Supporting Files */, 112 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */, 113 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */, 114 | ); 115 | path = Runner; 116 | sourceTree = ""; 117 | }; 118 | 97C146F11CF9000F007C117D /* Supporting Files */ = { 119 | isa = PBXGroup; 120 | children = ( 121 | 97C146F21CF9000F007C117D /* main.m */, 122 | ); 123 | name = "Supporting Files"; 124 | sourceTree = ""; 125 | }; 126 | /* End PBXGroup section */ 127 | 128 | /* Begin PBXNativeTarget section */ 129 | 97C146ED1CF9000F007C117D /* Runner */ = { 130 | isa = PBXNativeTarget; 131 | buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; 132 | buildPhases = ( 133 | 9740EEB61CF901F6004384FC /* Run Script */, 134 | 97C146EA1CF9000F007C117D /* Sources */, 135 | 97C146EB1CF9000F007C117D /* Frameworks */, 136 | 97C146EC1CF9000F007C117D /* Resources */, 137 | 9705A1C41CF9048500538489 /* Embed Frameworks */, 138 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */, 139 | ); 140 | buildRules = ( 141 | ); 142 | dependencies = ( 143 | ); 144 | name = Runner; 145 | productName = Runner; 146 | productReference = 97C146EE1CF9000F007C117D /* Runner.app */; 147 | productType = "com.apple.product-type.application"; 148 | }; 149 | /* End PBXNativeTarget section */ 150 | 151 | /* Begin PBXProject section */ 152 | 97C146E61CF9000F007C117D /* Project object */ = { 153 | isa = PBXProject; 154 | attributes = { 155 | LastUpgradeCheck = 0910; 156 | ORGANIZATIONNAME = "The Chromium Authors"; 157 | TargetAttributes = { 158 | 97C146ED1CF9000F007C117D = { 159 | CreatedOnToolsVersion = 7.3.1; 160 | }; 161 | }; 162 | }; 163 | buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */; 164 | compatibilityVersion = "Xcode 3.2"; 165 | developmentRegion = English; 166 | hasScannedForEncodings = 0; 167 | knownRegions = ( 168 | en, 169 | Base, 170 | ); 171 | mainGroup = 97C146E51CF9000F007C117D; 172 | productRefGroup = 97C146EF1CF9000F007C117D /* Products */; 173 | projectDirPath = ""; 174 | projectRoot = ""; 175 | targets = ( 176 | 97C146ED1CF9000F007C117D /* Runner */, 177 | ); 178 | }; 179 | /* End PBXProject section */ 180 | 181 | /* Begin PBXResourcesBuildPhase section */ 182 | 97C146EC1CF9000F007C117D /* Resources */ = { 183 | isa = PBXResourcesBuildPhase; 184 | buildActionMask = 2147483647; 185 | files = ( 186 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */, 187 | 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */, 188 | 9740EEB41CF90195004384FC /* Debug.xcconfig in Resources */, 189 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */, 190 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */, 191 | ); 192 | runOnlyForDeploymentPostprocessing = 0; 193 | }; 194 | /* End PBXResourcesBuildPhase section */ 195 | 196 | /* Begin PBXShellScriptBuildPhase section */ 197 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { 198 | isa = PBXShellScriptBuildPhase; 199 | buildActionMask = 2147483647; 200 | files = ( 201 | ); 202 | inputPaths = ( 203 | ); 204 | name = "Thin Binary"; 205 | outputPaths = ( 206 | ); 207 | runOnlyForDeploymentPostprocessing = 0; 208 | shellPath = /bin/sh; 209 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" thin"; 210 | }; 211 | 9740EEB61CF901F6004384FC /* Run Script */ = { 212 | isa = PBXShellScriptBuildPhase; 213 | buildActionMask = 2147483647; 214 | files = ( 215 | ); 216 | inputPaths = ( 217 | ); 218 | name = "Run Script"; 219 | outputPaths = ( 220 | ); 221 | runOnlyForDeploymentPostprocessing = 0; 222 | shellPath = /bin/sh; 223 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; 224 | }; 225 | /* End PBXShellScriptBuildPhase section */ 226 | 227 | /* Begin PBXSourcesBuildPhase section */ 228 | 97C146EA1CF9000F007C117D /* Sources */ = { 229 | isa = PBXSourcesBuildPhase; 230 | buildActionMask = 2147483647; 231 | files = ( 232 | 978B8F6F1D3862AE00F588F7 /* AppDelegate.m in Sources */, 233 | 97C146F31CF9000F007C117D /* main.m in Sources */, 234 | 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */, 235 | ); 236 | runOnlyForDeploymentPostprocessing = 0; 237 | }; 238 | /* End PBXSourcesBuildPhase section */ 239 | 240 | /* Begin PBXVariantGroup section */ 241 | 97C146FA1CF9000F007C117D /* Main.storyboard */ = { 242 | isa = PBXVariantGroup; 243 | children = ( 244 | 97C146FB1CF9000F007C117D /* Base */, 245 | ); 246 | name = Main.storyboard; 247 | sourceTree = ""; 248 | }; 249 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */ = { 250 | isa = PBXVariantGroup; 251 | children = ( 252 | 97C147001CF9000F007C117D /* Base */, 253 | ); 254 | name = LaunchScreen.storyboard; 255 | sourceTree = ""; 256 | }; 257 | /* End PBXVariantGroup section */ 258 | 259 | /* Begin XCBuildConfiguration section */ 260 | 249021D3217E4FDB00AE95B9 /* Profile */ = { 261 | isa = XCBuildConfiguration; 262 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 263 | buildSettings = { 264 | ALWAYS_SEARCH_USER_PATHS = NO; 265 | CLANG_ANALYZER_NONNULL = YES; 266 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 267 | CLANG_CXX_LIBRARY = "libc++"; 268 | CLANG_ENABLE_MODULES = YES; 269 | CLANG_ENABLE_OBJC_ARC = YES; 270 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 271 | CLANG_WARN_BOOL_CONVERSION = YES; 272 | CLANG_WARN_COMMA = YES; 273 | CLANG_WARN_CONSTANT_CONVERSION = YES; 274 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 275 | CLANG_WARN_EMPTY_BODY = YES; 276 | CLANG_WARN_ENUM_CONVERSION = YES; 277 | CLANG_WARN_INFINITE_RECURSION = YES; 278 | CLANG_WARN_INT_CONVERSION = YES; 279 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 280 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 281 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 282 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 283 | CLANG_WARN_STRICT_PROTOTYPES = YES; 284 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 285 | CLANG_WARN_UNREACHABLE_CODE = YES; 286 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 287 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 288 | COPY_PHASE_STRIP = NO; 289 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 290 | ENABLE_NS_ASSERTIONS = NO; 291 | ENABLE_STRICT_OBJC_MSGSEND = YES; 292 | GCC_C_LANGUAGE_STANDARD = gnu99; 293 | GCC_NO_COMMON_BLOCKS = YES; 294 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 295 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 296 | GCC_WARN_UNDECLARED_SELECTOR = YES; 297 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 298 | GCC_WARN_UNUSED_FUNCTION = YES; 299 | GCC_WARN_UNUSED_VARIABLE = YES; 300 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 301 | MTL_ENABLE_DEBUG_INFO = NO; 302 | SDKROOT = iphoneos; 303 | TARGETED_DEVICE_FAMILY = "1,2"; 304 | VALIDATE_PRODUCT = YES; 305 | }; 306 | name = Profile; 307 | }; 308 | 249021D4217E4FDB00AE95B9 /* Profile */ = { 309 | isa = XCBuildConfiguration; 310 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 311 | buildSettings = { 312 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 313 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 314 | DEVELOPMENT_TEAM = S8QB4VV633; 315 | ENABLE_BITCODE = NO; 316 | FRAMEWORK_SEARCH_PATHS = ( 317 | "$(inherited)", 318 | "$(PROJECT_DIR)/Flutter", 319 | ); 320 | INFOPLIST_FILE = Runner/Info.plist; 321 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 322 | LIBRARY_SEARCH_PATHS = ( 323 | "$(inherited)", 324 | "$(PROJECT_DIR)/Flutter", 325 | ); 326 | PRODUCT_BUNDLE_IDENTIFIER = com.example.flutterShop; 327 | PRODUCT_NAME = "$(TARGET_NAME)"; 328 | VERSIONING_SYSTEM = "apple-generic"; 329 | }; 330 | name = Profile; 331 | }; 332 | 97C147031CF9000F007C117D /* Debug */ = { 333 | isa = XCBuildConfiguration; 334 | baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; 335 | buildSettings = { 336 | ALWAYS_SEARCH_USER_PATHS = NO; 337 | CLANG_ANALYZER_NONNULL = YES; 338 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 339 | CLANG_CXX_LIBRARY = "libc++"; 340 | CLANG_ENABLE_MODULES = YES; 341 | CLANG_ENABLE_OBJC_ARC = YES; 342 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 343 | CLANG_WARN_BOOL_CONVERSION = YES; 344 | CLANG_WARN_COMMA = YES; 345 | CLANG_WARN_CONSTANT_CONVERSION = YES; 346 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 347 | CLANG_WARN_EMPTY_BODY = YES; 348 | CLANG_WARN_ENUM_CONVERSION = YES; 349 | CLANG_WARN_INFINITE_RECURSION = YES; 350 | CLANG_WARN_INT_CONVERSION = YES; 351 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 352 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 353 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 354 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 355 | CLANG_WARN_STRICT_PROTOTYPES = YES; 356 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 357 | CLANG_WARN_UNREACHABLE_CODE = YES; 358 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 359 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 360 | COPY_PHASE_STRIP = NO; 361 | DEBUG_INFORMATION_FORMAT = dwarf; 362 | ENABLE_STRICT_OBJC_MSGSEND = YES; 363 | ENABLE_TESTABILITY = YES; 364 | GCC_C_LANGUAGE_STANDARD = gnu99; 365 | GCC_DYNAMIC_NO_PIC = NO; 366 | GCC_NO_COMMON_BLOCKS = YES; 367 | GCC_OPTIMIZATION_LEVEL = 0; 368 | GCC_PREPROCESSOR_DEFINITIONS = ( 369 | "DEBUG=1", 370 | "$(inherited)", 371 | ); 372 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 373 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 374 | GCC_WARN_UNDECLARED_SELECTOR = YES; 375 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 376 | GCC_WARN_UNUSED_FUNCTION = YES; 377 | GCC_WARN_UNUSED_VARIABLE = YES; 378 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 379 | MTL_ENABLE_DEBUG_INFO = YES; 380 | ONLY_ACTIVE_ARCH = YES; 381 | SDKROOT = iphoneos; 382 | TARGETED_DEVICE_FAMILY = "1,2"; 383 | }; 384 | name = Debug; 385 | }; 386 | 97C147041CF9000F007C117D /* Release */ = { 387 | isa = XCBuildConfiguration; 388 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 389 | buildSettings = { 390 | ALWAYS_SEARCH_USER_PATHS = NO; 391 | CLANG_ANALYZER_NONNULL = YES; 392 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 393 | CLANG_CXX_LIBRARY = "libc++"; 394 | CLANG_ENABLE_MODULES = YES; 395 | CLANG_ENABLE_OBJC_ARC = YES; 396 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 397 | CLANG_WARN_BOOL_CONVERSION = YES; 398 | CLANG_WARN_COMMA = YES; 399 | CLANG_WARN_CONSTANT_CONVERSION = YES; 400 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 401 | CLANG_WARN_EMPTY_BODY = YES; 402 | CLANG_WARN_ENUM_CONVERSION = YES; 403 | CLANG_WARN_INFINITE_RECURSION = YES; 404 | CLANG_WARN_INT_CONVERSION = YES; 405 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 406 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 407 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 408 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 409 | CLANG_WARN_STRICT_PROTOTYPES = YES; 410 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 411 | CLANG_WARN_UNREACHABLE_CODE = YES; 412 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 413 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 414 | COPY_PHASE_STRIP = NO; 415 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 416 | ENABLE_NS_ASSERTIONS = NO; 417 | ENABLE_STRICT_OBJC_MSGSEND = YES; 418 | GCC_C_LANGUAGE_STANDARD = gnu99; 419 | GCC_NO_COMMON_BLOCKS = YES; 420 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 421 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 422 | GCC_WARN_UNDECLARED_SELECTOR = YES; 423 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 424 | GCC_WARN_UNUSED_FUNCTION = YES; 425 | GCC_WARN_UNUSED_VARIABLE = YES; 426 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 427 | MTL_ENABLE_DEBUG_INFO = NO; 428 | SDKROOT = iphoneos; 429 | TARGETED_DEVICE_FAMILY = "1,2"; 430 | VALIDATE_PRODUCT = YES; 431 | }; 432 | name = Release; 433 | }; 434 | 97C147061CF9000F007C117D /* Debug */ = { 435 | isa = XCBuildConfiguration; 436 | baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; 437 | buildSettings = { 438 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 439 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 440 | ENABLE_BITCODE = NO; 441 | FRAMEWORK_SEARCH_PATHS = ( 442 | "$(inherited)", 443 | "$(PROJECT_DIR)/Flutter", 444 | ); 445 | INFOPLIST_FILE = Runner/Info.plist; 446 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 447 | LIBRARY_SEARCH_PATHS = ( 448 | "$(inherited)", 449 | "$(PROJECT_DIR)/Flutter", 450 | ); 451 | PRODUCT_BUNDLE_IDENTIFIER = com.example.flutterShop; 452 | PRODUCT_NAME = "$(TARGET_NAME)"; 453 | VERSIONING_SYSTEM = "apple-generic"; 454 | }; 455 | name = Debug; 456 | }; 457 | 97C147071CF9000F007C117D /* Release */ = { 458 | isa = XCBuildConfiguration; 459 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 460 | buildSettings = { 461 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 462 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 463 | ENABLE_BITCODE = NO; 464 | FRAMEWORK_SEARCH_PATHS = ( 465 | "$(inherited)", 466 | "$(PROJECT_DIR)/Flutter", 467 | ); 468 | INFOPLIST_FILE = Runner/Info.plist; 469 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 470 | LIBRARY_SEARCH_PATHS = ( 471 | "$(inherited)", 472 | "$(PROJECT_DIR)/Flutter", 473 | ); 474 | PRODUCT_BUNDLE_IDENTIFIER = com.example.flutterShop; 475 | PRODUCT_NAME = "$(TARGET_NAME)"; 476 | VERSIONING_SYSTEM = "apple-generic"; 477 | }; 478 | name = Release; 479 | }; 480 | /* End XCBuildConfiguration section */ 481 | 482 | /* Begin XCConfigurationList section */ 483 | 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = { 484 | isa = XCConfigurationList; 485 | buildConfigurations = ( 486 | 97C147031CF9000F007C117D /* Debug */, 487 | 97C147041CF9000F007C117D /* Release */, 488 | 249021D3217E4FDB00AE95B9 /* Profile */, 489 | ); 490 | defaultConfigurationIsVisible = 0; 491 | defaultConfigurationName = Release; 492 | }; 493 | 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */ = { 494 | isa = XCConfigurationList; 495 | buildConfigurations = ( 496 | 97C147061CF9000F007C117D /* Debug */, 497 | 97C147071CF9000F007C117D /* Release */, 498 | 249021D4217E4FDB00AE95B9 /* Profile */, 499 | ); 500 | defaultConfigurationIsVisible = 0; 501 | defaultConfigurationName = Release; 502 | }; 503 | /* End XCConfigurationList section */ 504 | }; 505 | rootObject = 97C146E61CF9000F007C117D /* Project object */; 506 | } 507 | --------------------------------------------------------------------------------