├── .gitignore ├── .metadata ├── LICENSE ├── README.md ├── android ├── .gitignore ├── android_keystore.jks ├── app │ ├── build.gradle │ ├── proguard-rules.pro │ └── src │ │ ├── debug │ │ └── AndroidManifest.xml │ │ ├── main │ │ ├── AndroidManifest.xml │ │ ├── kotlin │ │ │ └── com │ │ │ │ └── wkl │ │ │ │ └── flutter_trip │ │ │ │ └── MainActivity.kt │ │ └── res │ │ │ ├── drawable-v21 │ │ │ └── launch_background.xml │ │ │ ├── drawable │ │ │ └── launch_background.xml │ │ │ ├── mipmap-hdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-mdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xhdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xxhdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xxxhdpi │ │ │ └── ic_launcher.png │ │ │ ├── values-night │ │ │ └── styles.xml │ │ │ └── values │ │ │ └── styles.xml │ │ └── profile │ │ └── AndroidManifest.xml ├── build.gradle ├── gradle.properties ├── gradle │ └── wrapper │ │ └── gradle-wrapper.properties ├── key.properties └── settings.gradle ├── assets ├── data │ └── china.json └── images │ ├── type_channelgroup.png │ ├── type_channelgs.png │ ├── type_channelplane.png │ ├── type_channeltrain.png │ ├── type_cruise.png │ ├── type_district.png │ ├── type_food.png │ ├── type_hotel.png │ ├── type_huodong.png │ ├── type_shop.png │ ├── type_sight.png │ ├── type_ticket.png │ └── type_travelgroup.png ├── ios ├── .gitignore ├── Flutter │ ├── AppFrameworkInfo.plist │ ├── Debug.xcconfig │ └── Release.xcconfig ├── Podfile ├── Podfile.lock ├── Runner.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ │ ├── IDEWorkspaceChecks.plist │ │ │ └── WorkspaceSettings.xcsettings │ └── xcshareddata │ │ └── xcschemes │ │ └── Runner.xcscheme ├── Runner.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ │ ├── IDEWorkspaceChecks.plist │ │ └── WorkspaceSettings.xcsettings └── Runner │ ├── AppDelegate.swift │ ├── Assets.xcassets │ ├── AppIcon.appiconset │ │ ├── Contents.json │ │ ├── Icon-App-1024x1024@1x.png │ │ ├── Icon-App-20x20@1x.png │ │ ├── Icon-App-20x20@2x.png │ │ ├── Icon-App-20x20@3x.png │ │ ├── Icon-App-29x29@1x.png │ │ ├── Icon-App-29x29@2x.png │ │ ├── Icon-App-29x29@3x.png │ │ ├── Icon-App-40x40@1x.png │ │ ├── Icon-App-40x40@2x.png │ │ ├── Icon-App-40x40@3x.png │ │ ├── Icon-App-60x60@2x.png │ │ ├── Icon-App-60x60@3x.png │ │ ├── Icon-App-76x76@1x.png │ │ ├── Icon-App-76x76@2x.png │ │ └── Icon-App-83.5x83.5@2x.png │ └── LaunchImage.imageset │ │ ├── Contents.json │ │ ├── LaunchImage.png │ │ ├── LaunchImage@2x.png │ │ ├── LaunchImage@3x.png │ │ └── README.md │ ├── Base.lproj │ ├── LaunchScreen.storyboard │ └── Main.storyboard │ ├── Info.plist │ └── Runner-Bridging-Header.h ├── lib ├── dao │ ├── home_dao.dart │ ├── search_dao.dart │ ├── travel_dao.dart │ └── travel_tab_dao.dart ├── main.dart ├── model │ ├── home_model.dart │ ├── search_model.dart │ ├── travel_model.dart │ └── travel_tab_model.dart ├── navigator │ └── tab_navigator.dart ├── pages │ ├── city_page.dart │ ├── home_page.dart │ ├── my_page.dart │ ├── search_page.dart │ ├── speak_page.dart │ ├── travel_page.dart │ └── travel_tab_page.dart ├── util │ ├── index.dart │ └── navigator_util.dart └── widgets │ ├── cached_image.dart │ ├── grid_nav.dart │ ├── loading_container.dart │ ├── local_nav.dart │ ├── sales_box.dart │ ├── search_bar.dart │ ├── sub_nav.dart │ └── webview.dart ├── pubspec.lock ├── pubspec.yaml └── test └── widget_test.dart /.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 | # The .vscode folder contains launch configuration and tasks you configure in 19 | # VS Code which you may wish to be included in version control, so this line 20 | # is commented out by default. 21 | #.vscode/ 22 | 23 | # Flutter/Dart/Pub related 24 | **/doc/api/ 25 | **/ios/Flutter/.last_build_id 26 | .dart_tool/ 27 | .flutter-plugins 28 | .flutter-plugins-dependencies 29 | .packages 30 | .pub-cache/ 31 | .pub/ 32 | /build/ 33 | 34 | # Web related 35 | lib/generated_plugin_registrant.dart 36 | 37 | # Symbolication related 38 | app.*.symbols 39 | 40 | # Obfuscation related 41 | app.*.map.json 42 | 43 | # Android Studio will place build artifacts here 44 | /android/app/debug 45 | /android/app/profile 46 | /android/app/release 47 | -------------------------------------------------------------------------------- /.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: 02c026b03cd31dd3f867e5faeb7e104cce174c5f 8 | channel: stable 9 | 10 | project_type: app 11 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 wkl 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # flutter_trip 2 | 3 | [慕课网仿携程网App](https://coding.imooc.com/class/321.html) ,基于`Flutter`支持`Android`与`iOS`平台。 4 | 5 | ## 目录 6 | 7 | - [下载](#下载) 8 | - [真机预览](#真机预览) 9 | - [功能与特性](#功能与特性) 10 | - [插件使用](#插件使用) 11 | - [运行调试](#运行调试) 12 | 13 | ## 下载 14 | 15 | ![Flutter_Trip](https://apk-1256738511.cos.ap-chengdu.myqcloud.com/FlutterTrip/images/flutter_trip_qr_code.png) 16 | 17 | ## 真机预览 18 | 19 | ![Flutter_Trip](https://apk-1256738511.cos.ap-chengdu.myqcloud.com/FlutterTrip/images/flutter_trip_preview.png) 20 | 21 | ## 功能与特性 22 | 23 | - 实现首页、搜索、旅拍、我的四大模块; 24 | - 实现网络图片本地缓存; 25 | - 旅拍模块实现瀑布流布局; 26 | - 接口数据抓取携程`H5`端; 27 | - 集成友盟数据统计; 28 | 29 | ## 插件使用 30 | 31 | - [azlistview ^2.0.0-nullsafety.0](https://pub.flutter-io.cn/packages/azlistview) 32 | - [cached_network_image ^3.0.0](https://pub.flutter-io.cn/packages/cached_network_image) 33 | - [dio ^4.0.0](https://pub.flutter-io.cn/packages/dio) 34 | - [flutter_card_swipper ^0.4.0](https://pub.flutter-io.cn/packages/flutter_card_swipper) 35 | - [flutter_staggered_grid_view ^0.4.0](https://pub.flutter-io.cn/packages/flutter_staggered_grid_view) 36 | - [fluttertoast ^8.0.7](https://pub.flutter-io.cn/packages/fluttertoast) 37 | - [webview_flutter ^2.0.8](https://pub.flutter-io.cn/packages/webview_flutter) 38 | - [umeng_common_sdk ^1.1.3](https://pub.flutter-io.cn/packages/umeng_common_sdk) 39 | 40 | ## 运行调试 41 | 42 | 1. 准备Flutter环境,可参考: [getting-started]()。 43 | 2. Clone [flutter_trip](https://github.com/wkl007/flutter_trip.git) ,然后终端进入项目根目录。 44 | 3. 终端运行 `flutter packages get`。 45 | 4. 然后运行 `flutter run`。 46 | 5. 打包运行 `flutter build apk`。 47 | -------------------------------------------------------------------------------- /android/.gitignore: -------------------------------------------------------------------------------- 1 | gradle-wrapper.jar 2 | /.gradle 3 | /captures/ 4 | /gradlew 5 | /gradlew.bat 6 | /local.properties 7 | GeneratedPluginRegistrant.java 8 | 9 | # Remember to never publicly share your keystore. 10 | # See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app 11 | # key.properties 12 | -------------------------------------------------------------------------------- /android/android_keystore.jks: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wkl007/flutter_trip/5436b2c1e74e6c5ef6100bb347ca115026fcc0d5/android/android_keystore.jks -------------------------------------------------------------------------------- /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 plugin: 'kotlin-android' 26 | apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" 27 | def keystoreProperties = new Properties() 28 | def keystorePropertiesFile = rootProject.file('key.properties') 29 | if (keystorePropertiesFile.exists()) { 30 | keystoreProperties.load(new FileInputStream(keystorePropertiesFile)) 31 | } 32 | 33 | android { 34 | compileSdkVersion 30 35 | 36 | sourceSets { 37 | main.java.srcDirs += 'src/main/kotlin' 38 | } 39 | 40 | defaultConfig { 41 | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). 42 | applicationId "com.wkl.flutter_trip" 43 | minSdkVersion 19 44 | targetSdkVersion 30 45 | versionCode flutterVersionCode.toInteger() 46 | versionName flutterVersionName 47 | ndk { 48 | abiFilters "armeabi-v7a", "arm64-v8a", "x86_64", "x86" 49 | // TODO 只打包flutter所支持的架构,flutter没有armeabi架构的so,加x86的原因是为了能够兼容模拟器 50 | // abiFilters "armeabi-v7a" // release 时只打"armeabi-v7包 51 | } 52 | } 53 | 54 | signingConfigs { 55 | release { 56 | keyAlias keystoreProperties['keyAlias'] 57 | keyPassword keystoreProperties['keyPassword'] 58 | storeFile file(keystoreProperties['storeFile']) 59 | storePassword keystoreProperties['storePassword'] 60 | } 61 | } 62 | 63 | buildTypes { 64 | release { 65 | // TODO: Add your own signing config for the release build. 66 | // Signing with the debug keys for now, so `flutter run --release` works. 67 | // 开启混淆 68 | minifyEnabled true // 启用代码混淆、压缩APK 69 | shrinkResources true // 删除无用资源 70 | useProguard true // 代码压缩设置 71 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' // 混淆文件 72 | signingConfig signingConfigs.release 73 | } 74 | } 75 | } 76 | 77 | flutter { 78 | source '../..' 79 | } 80 | 81 | dependencies { 82 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" 83 | } 84 | -------------------------------------------------------------------------------- /android/app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | #Flutter Wrapper 2 | -dontwarn io.flutter.** 3 | -keep class io.flutter.app.** { *; } 4 | -keep class io.flutter.plugin.** { *; } 5 | -keep class io.flutter.util.** { *; } 6 | -keep class io.flutter.view.** { *; } 7 | -keep class io.flutter.** { *; } 8 | -keep class io.flutter.plugins.** { *; } 9 | #友盟 10 | -keep class com.umeng.** {*;} 11 | -keepclassmembers class * { 12 | public (org.json.JSONObject); 13 | } 14 | -keepclassmembers enum * { 15 | public static **[] values(); 16 | public static ** valueOf(java.lang.String); 17 | } 18 | -keep public class [com.wkl.flutter_trip].R$*{ 19 | public static final int *; 20 | } -------------------------------------------------------------------------------- /android/app/src/debug/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 12 | 19 | 23 | 26 | 31 | 34 | 35 | 36 | 37 | 38 | 39 | 41 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /android/app/src/main/kotlin/com/wkl/flutter_trip/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package com.wkl.flutter_trip 2 | 3 | import android.os.Bundle 4 | 5 | import io.flutter.embedding.android.FlutterActivity 6 | import com.umeng.analytics.MobclickAgent 7 | import com.umeng.commonsdk.UMConfigure 8 | 9 | class MainActivity : FlutterActivity() { 10 | override fun onCreate(savedInstanceState: Bundle?) { 11 | super.onCreate(savedInstanceState) 12 | UMConfigure.init(this, "5cc2c66a570df33914000e9f", "Flutter Trip", UMConfigure.DEVICE_TYPE_PHONE, null) 13 | } 14 | 15 | override fun onPause() { 16 | super.onPause() 17 | MobclickAgent.onPause(this) 18 | } 19 | 20 | override fun onResume() { 21 | super.onResume() 22 | MobclickAgent.onResume(this) 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /android/app/src/main/res/drawable-v21/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /android/app/src/main/res/drawable/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wkl007/flutter_trip/5436b2c1e74e6c5ef6100bb347ca115026fcc0d5/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wkl007/flutter_trip/5436b2c1e74e6c5ef6100bb347ca115026fcc0d5/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wkl007/flutter_trip/5436b2c1e74e6c5ef6100bb347ca115026fcc0d5/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wkl007/flutter_trip/5436b2c1e74e6c5ef6100bb347ca115026fcc0d5/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wkl007/flutter_trip/5436b2c1e74e6c5ef6100bb347ca115026fcc0d5/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/values-night/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 15 | 18 | 19 | -------------------------------------------------------------------------------- /android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 15 | 18 | 19 | -------------------------------------------------------------------------------- /android/app/src/profile/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /android/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | ext.kotlin_version = '1.3.50' 3 | repositories { 4 | google() 5 | jcenter() 6 | } 7 | 8 | dependencies { 9 | classpath 'com.android.tools.build:gradle:4.1.0' 10 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" 11 | } 12 | } 13 | 14 | allprojects { 15 | repositories { 16 | google() 17 | jcenter() 18 | } 19 | } 20 | 21 | rootProject.buildDir = '../build' 22 | subprojects { 23 | project.buildDir = "${rootProject.buildDir}/${project.name}" 24 | project.evaluationDependsOn(':app') 25 | } 26 | 27 | task clean(type: Delete) { 28 | delete rootProject.buildDir 29 | } 30 | -------------------------------------------------------------------------------- /android/gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xmx1536M 2 | android.useAndroidX=true 3 | android.enableJetifier=true 4 | -------------------------------------------------------------------------------- /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\://mirrors.cloud.tencent.com/gradle/gradle-6.7-all.zip 7 | -------------------------------------------------------------------------------- /android/key.properties: -------------------------------------------------------------------------------- 1 | storePassword=wkl123456 2 | keyPassword=wkl123456 3 | keyAlias=android_keystore 4 | storeFile=../android_keystore.jks -------------------------------------------------------------------------------- /android/settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | 3 | def localPropertiesFile = new File(rootProject.projectDir, "local.properties") 4 | def properties = new Properties() 5 | 6 | assert localPropertiesFile.exists() 7 | localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) } 8 | 9 | def flutterSdkPath = properties.getProperty("flutter.sdk") 10 | assert flutterSdkPath != null, "flutter.sdk not set in local.properties" 11 | apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle" 12 | -------------------------------------------------------------------------------- /assets/data/china.json: -------------------------------------------------------------------------------- 1 | {"china":[{"name":"北京市"},{"name":"天津市"},{"name":"石家庄市"},{"name":"唐山市"},{"name":"秦皇岛市"},{"name":"邯郸市"},{"name":"邢台市"},{"name":"保定市"},{"name":"张家口市"},{"name":"承德市"},{"name":"沧州市"},{"name":"廊坊市"},{"name":"衡水市"},{"name":"太原市"},{"name":"大同市"},{"name":"阳泉市"},{"name":"长治市"},{"name":"晋城市"},{"name":"朔州市"},{"name":"晋中市"},{"name":"运城市"},{"name":"忻州市"},{"name":"临汾市"},{"name":"吕梁市"},{"name":"呼和浩特市"},{"name":"包头市"},{"name":"乌海市"},{"name":"赤峰市"},{"name":"通辽市"},{"name":"鄂尔多斯市"},{"name":"呼伦贝尔市"},{"name":"巴彦淖尔市"},{"name":"乌兰察布市"},{"name":"兴安盟"},{"name":"锡林郭勒盟"},{"name":"阿拉善盟"},{"name":"沈阳市"},{"name":"大连市"},{"name":"鞍山市"},{"name":"抚顺市"},{"name":"本溪市"},{"name":"丹东市"},{"name":"锦州市"},{"name":"营口市"},{"name":"阜新市"},{"name":"辽阳市"},{"name":"盘锦市"},{"name":"铁岭市"},{"name":"朝阳市"},{"name":"葫芦岛市"},{"name":"长春市"},{"name":"吉林市"},{"name":"四平市"},{"name":"辽源市"},{"name":"通化市"},{"name":"白山市"},{"name":"松原市"},{"name":"白城市"},{"name":"延边朝鲜族自治州"},{"name":"哈尔滨市"},{"name":"齐齐哈尔市"},{"name":"鸡西市"},{"name":"鹤岗市"},{"name":"双鸭山市"},{"name":"大庆市"},{"name":"伊春市"},{"name":"佳木斯市"},{"name":"七台河市"},{"name":"牡丹江市"},{"name":"黑河市"},{"name":"绥化市"},{"name":"大兴安岭地区"},{"name":"上海市"},{"name":"南京市"},{"name":"无锡市"},{"name":"徐州市"},{"name":"常州市"},{"name":"苏州市"},{"name":"南通市"},{"name":"连云港市"},{"name":"淮安市"},{"name":"盐城市"},{"name":"扬州市"},{"name":"镇江市"},{"name":"泰州市"},{"name":"宿迁市"},{"name":"杭州市"},{"name":"宁波市"},{"name":"温州市"},{"name":"嘉兴市"},{"name":"湖州市"},{"name":"绍兴市"},{"name":"金华市"},{"name":"衢州市"},{"name":"舟山市"},{"name":"台州市"},{"name":"丽水市"},{"name":"合肥市"},{"name":"芜湖市"},{"name":"蚌埠市"},{"name":"淮南市"},{"name":"马鞍山市"},{"name":"淮北市"},{"name":"铜陵市"},{"name":"安庆市"},{"name":"黄山市"},{"name":"滁州市"},{"name":"阜阳市"},{"name":"宿州市"},{"name":"巢湖市"},{"name":"六安市"},{"name":"亳州市"},{"name":"池州市"},{"name":"宣城市"},{"name":"福州市"},{"name":"厦门市"},{"name":"莆田市"},{"name":"三明市"},{"name":"泉州市"},{"name":"漳州市"},{"name":"南平市"},{"name":"龙岩市"},{"name":"宁德市"},{"name":"南昌市"},{"name":"景德镇市"},{"name":"萍乡市"},{"name":"九江市"},{"name":"新余市"},{"name":"鹰潭市"},{"name":"赣州市"},{"name":"吉安市"},{"name":"宜春市"},{"name":"抚州市"},{"name":"上饶市"},{"name":"济南市"},{"name":"青岛市"},{"name":"淄博市"},{"name":"枣庄市"},{"name":"东营市"},{"name":"烟台市"},{"name":"潍坊市"},{"name":"济宁市"},{"name":"泰安市"},{"name":"威海市"},{"name":"日照市"},{"name":"莱芜市"},{"name":"临沂市"},{"name":"德州市"},{"name":"聊城市"},{"name":"滨州市"},{"name":"菏泽市"},{"name":"郑州市"},{"name":"开封市"},{"name":"洛阳市"},{"name":"平顶山市"},{"name":"安阳市"},{"name":"鹤壁市"},{"name":"新乡市"},{"name":"焦作市"},{"name":"濮阳市"},{"name":"许昌市"},{"name":"漯河市"},{"name":"三门峡市"},{"name":"南阳市"},{"name":"商丘市"},{"name":"信阳市"},{"name":"周口市"},{"name":"驻马店市"},{"name":"武汉市"},{"name":"黄石市"},{"name":"十堰市"},{"name":"宜昌市"},{"name":"襄樊市"},{"name":"鄂州市"},{"name":"荆门市"},{"name":"孝感市"},{"name":"荆州市"},{"name":"黄冈市"},{"name":"咸宁市"},{"name":"随州市"},{"name":"恩施土家族苗族自治州"},{"name":"仙桃市"},{"name":"潜江市"},{"name":"天门市"},{"name":"神农架林区"},{"name":"长沙市"},{"name":"株洲市"},{"name":"湘潭市"},{"name":"衡阳市"},{"name":"邵阳市"},{"name":"岳阳市"},{"name":"常德市"},{"name":"张家界市"},{"name":"益阳市"},{"name":"郴州市"},{"name":"永州市"},{"name":"怀化市"},{"name":"娄底市"},{"name":"湘西土家族苗族自治州"},{"name":"广州市"},{"name":"韶关市"},{"name":"深圳市"},{"name":"珠海市"},{"name":"汕头市"},{"name":"佛山市"},{"name":"江门市"},{"name":"湛江市"},{"name":"茂名市"},{"name":"肇庆市"},{"name":"惠州市"},{"name":"梅州市"},{"name":"汕尾市"},{"name":"河源市"},{"name":"阳江市"},{"name":"清远市"},{"name":"东莞市"},{"name":"中山市"},{"name":"潮州市"},{"name":"揭阳市"},{"name":"云浮市"},{"name":"南宁市"},{"name":"柳州市"},{"name":"桂林市"},{"name":"梧州市"},{"name":"北海市"},{"name":"防城港市"},{"name":"钦州市"},{"name":"贵港市"},{"name":"玉林市"},{"name":"百色市"},{"name":"贺州市"},{"name":"河池市"},{"name":"来宾市"},{"name":"崇左市"},{"name":"海口市"},{"name":"三亚市"},{"name":"重庆市"},{"name":"成都市"},{"name":"自贡市"},{"name":"攀枝花市"},{"name":"泸州市"},{"name":"德阳市"},{"name":"绵阳市"},{"name":"广元市"},{"name":"遂宁市"},{"name":"内江市"},{"name":"乐山市"},{"name":"南充市"},{"name":"眉山市"},{"name":"宜宾市"},{"name":"广安市"},{"name":"达州市"},{"name":"雅安市"},{"name":"巴中市"},{"name":"资阳市"},{"name":"阿坝藏族羌族自治州"},{"name":"甘孜藏族自治州"},{"name":"凉山彝族自治州"},{"name":"贵阳市"},{"name":"六盘水市"},{"name":"遵义市"},{"name":"安顺市"},{"name":"铜仁市"},{"name":"黔西南布依族苗族自治州"},{"name":"毕节市"},{"name":"黔东南苗族侗族自治州"},{"name":"黔南布依族苗族自治州"},{"name":"昆明市"},{"name":"曲靖市"},{"name":"玉溪市"},{"name":"保山市"},{"name":"昭通市"},{"name":"丽江市"},{"name":"思茅市"},{"name":"临沧市"},{"name":"楚雄彝族自治州"},{"name":"红河哈尼族彝族自治州"},{"name":"文山壮族苗族自治州"},{"name":"西双版纳傣族自治州"},{"name":"大理白族自治州"},{"name":"德宏傣族景颇族自治州"},{"name":"怒江傈僳族自治州"},{"name":"迪庆藏族自治州"},{"name":"拉萨市"},{"name":"昌都地区"},{"name":"山南地区"},{"name":"日喀则地区"},{"name":"那曲地区"},{"name":"阿里地区"},{"name":"林芝地区"},{"name":"西安市"},{"name":"铜川市"},{"name":"宝鸡市"},{"name":"咸阳市"},{"name":"渭南市"},{"name":"延安市"},{"name":"汉中市"},{"name":"榆林市"},{"name":"安康市"},{"name":"商洛市"},{"name":"兰州市"},{"name":"嘉峪关市"},{"name":"金昌市"},{"name":"白银市"},{"name":"天水市"},{"name":"武威市"},{"name":"张掖市"},{"name":"平凉市"},{"name":"酒泉市"},{"name":"庆阳市"},{"name":"定西市"},{"name":"陇南市"},{"name":"临夏回族自治州"},{"name":"甘南藏族自治州"},{"name":"西宁市"},{"name":"海东地区"},{"name":"海北藏族自治州"},{"name":"黄南藏族自治州"},{"name":"海南藏族自治州"},{"name":"果洛藏族自治州"},{"name":"玉树藏族自治州"},{"name":"海西蒙古族藏族自治州"},{"name":"银川市"},{"name":"石嘴山市"},{"name":"吴忠市"},{"name":"固原市"},{"name":"中卫市"},{"name":"乌鲁木齐市"},{"name":"克拉玛依市"},{"name":"吐鲁番地区"},{"name":"哈密地区"},{"name":"昌吉回族自治州"},{"name":"博尔塔拉蒙古自治州"},{"name":"巴音郭楞蒙古自治州"},{"name":"阿克苏地区"},{"name":"克孜勒苏柯尔克孜自治州"},{"name":"喀什地区"},{"name":"和田地区"},{"name":"伊犁哈萨克"},{"name":"塔城地区"},{"name":"阿勒泰地区"},{"name":"石河子市"},{"name":"阿拉尔市"},{"name":"图木舒克市"},{"name":"五家渠市"},{"name":"台北"},{"name":"高雄"},{"name":"基隆"},{"name":"台中"},{"name":"台南"},{"name":"新竹"},{"name":"嘉义"},{"name":"宜兰"},{"name":"桃园"},{"name":"苗栗"},{"name":"彰化"},{"name":"南投"},{"name":"云林"},{"name":"屏东"},{"name":"台东"},{"name":"花莲"},{"name":"澎湖"},{"name":"香港岛"},{"name":"九龙"},{"name":"新界"},{"name":"澳门半岛"},{"name":"氹仔岛"},{"name":"路环岛"},{"name":"路氹城"}]} -------------------------------------------------------------------------------- /assets/images/type_channelgroup.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wkl007/flutter_trip/5436b2c1e74e6c5ef6100bb347ca115026fcc0d5/assets/images/type_channelgroup.png -------------------------------------------------------------------------------- /assets/images/type_channelgs.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wkl007/flutter_trip/5436b2c1e74e6c5ef6100bb347ca115026fcc0d5/assets/images/type_channelgs.png -------------------------------------------------------------------------------- /assets/images/type_channelplane.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wkl007/flutter_trip/5436b2c1e74e6c5ef6100bb347ca115026fcc0d5/assets/images/type_channelplane.png -------------------------------------------------------------------------------- /assets/images/type_channeltrain.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wkl007/flutter_trip/5436b2c1e74e6c5ef6100bb347ca115026fcc0d5/assets/images/type_channeltrain.png -------------------------------------------------------------------------------- /assets/images/type_cruise.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wkl007/flutter_trip/5436b2c1e74e6c5ef6100bb347ca115026fcc0d5/assets/images/type_cruise.png -------------------------------------------------------------------------------- /assets/images/type_district.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wkl007/flutter_trip/5436b2c1e74e6c5ef6100bb347ca115026fcc0d5/assets/images/type_district.png -------------------------------------------------------------------------------- /assets/images/type_food.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wkl007/flutter_trip/5436b2c1e74e6c5ef6100bb347ca115026fcc0d5/assets/images/type_food.png -------------------------------------------------------------------------------- /assets/images/type_hotel.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wkl007/flutter_trip/5436b2c1e74e6c5ef6100bb347ca115026fcc0d5/assets/images/type_hotel.png -------------------------------------------------------------------------------- /assets/images/type_huodong.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wkl007/flutter_trip/5436b2c1e74e6c5ef6100bb347ca115026fcc0d5/assets/images/type_huodong.png -------------------------------------------------------------------------------- /assets/images/type_shop.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wkl007/flutter_trip/5436b2c1e74e6c5ef6100bb347ca115026fcc0d5/assets/images/type_shop.png -------------------------------------------------------------------------------- /assets/images/type_sight.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wkl007/flutter_trip/5436b2c1e74e6c5ef6100bb347ca115026fcc0d5/assets/images/type_sight.png -------------------------------------------------------------------------------- /assets/images/type_ticket.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wkl007/flutter_trip/5436b2c1e74e6c5ef6100bb347ca115026fcc0d5/assets/images/type_ticket.png -------------------------------------------------------------------------------- /assets/images/type_travelgroup.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wkl007/flutter_trip/5436b2c1e74e6c5ef6100bb347ca115026fcc0d5/assets/images/type_travelgroup.png -------------------------------------------------------------------------------- /ios/.gitignore: -------------------------------------------------------------------------------- 1 | *.mode1v3 2 | *.mode2v3 3 | *.moved-aside 4 | *.pbxuser 5 | *.perspectivev3 6 | **/*sync/ 7 | .sconsign.dblite 8 | .tags* 9 | **/.vagrant/ 10 | **/DerivedData/ 11 | Icon? 12 | **/Pods/ 13 | **/.symlinks/ 14 | profile 15 | xcuserdata 16 | **/.generated/ 17 | Flutter/App.framework 18 | Flutter/Flutter.framework 19 | Flutter/Flutter.podspec 20 | Flutter/Generated.xcconfig 21 | Flutter/ephemeral/ 22 | Flutter/app.flx 23 | Flutter/app.zip 24 | Flutter/flutter_assets/ 25 | Flutter/flutter_export_environment.sh 26 | ServiceDefinitions.json 27 | Runner/GeneratedPluginRegistrant.* 28 | 29 | # Exceptions to above rules. 30 | !default.mode1v3 31 | !default.mode2v3 32 | !default.pbxuser 33 | !default.perspectivev3 34 | -------------------------------------------------------------------------------- /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 | 9.0 25 | 26 | 27 | -------------------------------------------------------------------------------- /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/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 flutter_root 14 | generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__) 15 | unless File.exist?(generated_xcode_build_settings_path) 16 | raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first" 17 | end 18 | 19 | File.foreach(generated_xcode_build_settings_path) do |line| 20 | matches = line.match(/FLUTTER_ROOT\=(.*)/) 21 | return matches[1].strip if matches 22 | end 23 | raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get" 24 | end 25 | 26 | require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root) 27 | 28 | flutter_ios_podfile_setup 29 | 30 | target 'Runner' do 31 | use_frameworks! 32 | use_modular_headers! 33 | 34 | flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__)) 35 | end 36 | 37 | post_install do |installer| 38 | installer.pods_project.targets.each do |target| 39 | flutter_additional_ios_build_settings(target) 40 | target.build_configurations.each do |config| 41 | config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '9.0' 42 | end 43 | end 44 | end 45 | -------------------------------------------------------------------------------- /ios/Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - Flutter (1.0.0) 3 | - fluttertoast (0.0.2): 4 | - Flutter 5 | - Toast 6 | - FMDB (2.7.5): 7 | - FMDB/standard (= 2.7.5) 8 | - FMDB/standard (2.7.5) 9 | - package_info (0.0.1): 10 | - Flutter 11 | - path_provider (0.0.1): 12 | - Flutter 13 | - sqflite (0.0.2): 14 | - Flutter 15 | - FMDB (>= 2.7.5) 16 | - Toast (4.0.0) 17 | - UMCommon (7.3.0): 18 | - UMDevice 19 | - UMDevice (2.0.1) 20 | - umeng_common_sdk (0.0.1): 21 | - Flutter 22 | - UMCommon 23 | - UMDevice 24 | - webview_flutter_wkwebview (0.0.1): 25 | - Flutter 26 | 27 | DEPENDENCIES: 28 | - Flutter (from `Flutter`) 29 | - fluttertoast (from `.symlinks/plugins/fluttertoast/ios`) 30 | - package_info (from `.symlinks/plugins/package_info/ios`) 31 | - path_provider (from `.symlinks/plugins/path_provider/ios`) 32 | - sqflite (from `.symlinks/plugins/sqflite/ios`) 33 | - umeng_common_sdk (from `.symlinks/plugins/umeng_common_sdk/ios`) 34 | - webview_flutter_wkwebview (from `.symlinks/plugins/webview_flutter_wkwebview/ios`) 35 | 36 | SPEC REPOS: 37 | trunk: 38 | - FMDB 39 | - Toast 40 | - UMCommon 41 | - UMDevice 42 | 43 | EXTERNAL SOURCES: 44 | Flutter: 45 | :path: Flutter 46 | fluttertoast: 47 | :path: ".symlinks/plugins/fluttertoast/ios" 48 | package_info: 49 | :path: ".symlinks/plugins/package_info/ios" 50 | path_provider: 51 | :path: ".symlinks/plugins/path_provider/ios" 52 | sqflite: 53 | :path: ".symlinks/plugins/sqflite/ios" 54 | umeng_common_sdk: 55 | :path: ".symlinks/plugins/umeng_common_sdk/ios" 56 | webview_flutter_wkwebview: 57 | :path: ".symlinks/plugins/webview_flutter_wkwebview/ios" 58 | 59 | SPEC CHECKSUMS: 60 | Flutter: 50d75fe2f02b26cc09d224853bb45737f8b3214a 61 | fluttertoast: 6122fa75143e992b1d3470f61000f591a798cc58 62 | FMDB: 2ce00b547f966261cd18927a3ddb07cb6f3db82a 63 | package_info: 873975fc26034f0b863a300ad47e7f1ac6c7ec62 64 | path_provider: abfe2b5c733d04e238b0d8691db0cfd63a27a93c 65 | sqflite: 6d358c025f5b867b29ed92fc697fd34924e11904 66 | Toast: 91b396c56ee72a5790816f40d3a94dd357abc196 67 | UMCommon: d654d43e83dcccb3dbb95d97f7b88045733a1380 68 | UMDevice: f9ed639486a73620bc7c800d1657f110df50c3e1 69 | umeng_common_sdk: a8abd7f86dfd013dbbeeae587ee143760c6582f2 70 | webview_flutter_wkwebview: 005fbd90c888a42c5690919a1527ecc6649e1162 71 | 72 | PODFILE CHECKSUM: adb00cec7b0eabb3be819164c29b992d03802cb4 73 | 74 | COCOAPODS: 1.10.1 75 | -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 50; 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 | 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; }; 13 | 853ED30FD86DAD2E8EFC1CDB /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 89F789A11E2A31B259E3252B /* Pods_Runner.framework */; }; 14 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; 15 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; 16 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; 17 | /* End PBXBuildFile section */ 18 | 19 | /* Begin PBXCopyFilesBuildPhase section */ 20 | 9705A1C41CF9048500538489 /* Embed Frameworks */ = { 21 | isa = PBXCopyFilesBuildPhase; 22 | buildActionMask = 2147483647; 23 | dstPath = ""; 24 | dstSubfolderSpec = 10; 25 | files = ( 26 | ); 27 | name = "Embed Frameworks"; 28 | runOnlyForDeploymentPostprocessing = 0; 29 | }; 30 | /* End PBXCopyFilesBuildPhase section */ 31 | 32 | /* Begin PBXFileReference section */ 33 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; }; 34 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; }; 35 | 2F16435701378097EC5797CE /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = ""; }; 36 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; 37 | 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = ""; }; 38 | 74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 39 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; 40 | 89F789A11E2A31B259E3252B /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 41 | 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; }; 42 | 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; }; 43 | 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; }; 44 | 97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 45 | 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 46 | 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 47 | 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 48 | A6575272F631A92052E7062C /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = ""; }; 49 | D7D6459FE8982BF0CB34CC91 /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = ""; }; 50 | /* End PBXFileReference section */ 51 | 52 | /* Begin PBXFrameworksBuildPhase section */ 53 | 97C146EB1CF9000F007C117D /* Frameworks */ = { 54 | isa = PBXFrameworksBuildPhase; 55 | buildActionMask = 2147483647; 56 | files = ( 57 | 853ED30FD86DAD2E8EFC1CDB /* Pods_Runner.framework in Frameworks */, 58 | ); 59 | runOnlyForDeploymentPostprocessing = 0; 60 | }; 61 | /* End PBXFrameworksBuildPhase section */ 62 | 63 | /* Begin PBXGroup section */ 64 | 05882C61E550FB2C9013BAA4 /* Pods */ = { 65 | isa = PBXGroup; 66 | children = ( 67 | D7D6459FE8982BF0CB34CC91 /* Pods-Runner.debug.xcconfig */, 68 | A6575272F631A92052E7062C /* Pods-Runner.release.xcconfig */, 69 | 2F16435701378097EC5797CE /* Pods-Runner.profile.xcconfig */, 70 | ); 71 | name = Pods; 72 | path = Pods; 73 | sourceTree = ""; 74 | }; 75 | 132D1567A5EF06889C782D5F /* Frameworks */ = { 76 | isa = PBXGroup; 77 | children = ( 78 | 89F789A11E2A31B259E3252B /* Pods_Runner.framework */, 79 | ); 80 | name = Frameworks; 81 | sourceTree = ""; 82 | }; 83 | 9740EEB11CF90186004384FC /* Flutter */ = { 84 | isa = PBXGroup; 85 | children = ( 86 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */, 87 | 9740EEB21CF90195004384FC /* Debug.xcconfig */, 88 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */, 89 | 9740EEB31CF90195004384FC /* Generated.xcconfig */, 90 | ); 91 | name = Flutter; 92 | sourceTree = ""; 93 | }; 94 | 97C146E51CF9000F007C117D = { 95 | isa = PBXGroup; 96 | children = ( 97 | 9740EEB11CF90186004384FC /* Flutter */, 98 | 97C146F01CF9000F007C117D /* Runner */, 99 | 97C146EF1CF9000F007C117D /* Products */, 100 | 05882C61E550FB2C9013BAA4 /* Pods */, 101 | 132D1567A5EF06889C782D5F /* Frameworks */, 102 | ); 103 | sourceTree = ""; 104 | }; 105 | 97C146EF1CF9000F007C117D /* Products */ = { 106 | isa = PBXGroup; 107 | children = ( 108 | 97C146EE1CF9000F007C117D /* Runner.app */, 109 | ); 110 | name = Products; 111 | sourceTree = ""; 112 | }; 113 | 97C146F01CF9000F007C117D /* Runner */ = { 114 | isa = PBXGroup; 115 | children = ( 116 | 97C146FA1CF9000F007C117D /* Main.storyboard */, 117 | 97C146FD1CF9000F007C117D /* Assets.xcassets */, 118 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */, 119 | 97C147021CF9000F007C117D /* Info.plist */, 120 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */, 121 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */, 122 | 74858FAE1ED2DC5600515810 /* AppDelegate.swift */, 123 | 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */, 124 | ); 125 | path = Runner; 126 | sourceTree = ""; 127 | }; 128 | /* End PBXGroup section */ 129 | 130 | /* Begin PBXNativeTarget section */ 131 | 97C146ED1CF9000F007C117D /* Runner */ = { 132 | isa = PBXNativeTarget; 133 | buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; 134 | buildPhases = ( 135 | 720B6209CFF77056A65E84BB /* [CP] Check Pods Manifest.lock */, 136 | 9740EEB61CF901F6004384FC /* Run Script */, 137 | 97C146EA1CF9000F007C117D /* Sources */, 138 | 97C146EB1CF9000F007C117D /* Frameworks */, 139 | 97C146EC1CF9000F007C117D /* Resources */, 140 | 9705A1C41CF9048500538489 /* Embed Frameworks */, 141 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */, 142 | C9C08F79B57F1106502D7ABE /* [CP] Embed Pods Frameworks */, 143 | ); 144 | buildRules = ( 145 | ); 146 | dependencies = ( 147 | ); 148 | name = Runner; 149 | productName = Runner; 150 | productReference = 97C146EE1CF9000F007C117D /* Runner.app */; 151 | productType = "com.apple.product-type.application"; 152 | }; 153 | /* End PBXNativeTarget section */ 154 | 155 | /* Begin PBXProject section */ 156 | 97C146E61CF9000F007C117D /* Project object */ = { 157 | isa = PBXProject; 158 | attributes = { 159 | LastUpgradeCheck = 1300; 160 | ORGANIZATIONNAME = ""; 161 | TargetAttributes = { 162 | 97C146ED1CF9000F007C117D = { 163 | CreatedOnToolsVersion = 7.3.1; 164 | LastSwiftMigration = 1100; 165 | }; 166 | }; 167 | }; 168 | buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */; 169 | compatibilityVersion = "Xcode 9.3"; 170 | developmentRegion = en; 171 | hasScannedForEncodings = 0; 172 | knownRegions = ( 173 | en, 174 | Base, 175 | ); 176 | mainGroup = 97C146E51CF9000F007C117D; 177 | productRefGroup = 97C146EF1CF9000F007C117D /* Products */; 178 | projectDirPath = ""; 179 | projectRoot = ""; 180 | targets = ( 181 | 97C146ED1CF9000F007C117D /* Runner */, 182 | ); 183 | }; 184 | /* End PBXProject section */ 185 | 186 | /* Begin PBXResourcesBuildPhase section */ 187 | 97C146EC1CF9000F007C117D /* Resources */ = { 188 | isa = PBXResourcesBuildPhase; 189 | buildActionMask = 2147483647; 190 | files = ( 191 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */, 192 | 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */, 193 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */, 194 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */, 195 | ); 196 | runOnlyForDeploymentPostprocessing = 0; 197 | }; 198 | /* End PBXResourcesBuildPhase section */ 199 | 200 | /* Begin PBXShellScriptBuildPhase section */ 201 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { 202 | isa = PBXShellScriptBuildPhase; 203 | buildActionMask = 2147483647; 204 | files = ( 205 | ); 206 | inputPaths = ( 207 | ); 208 | name = "Thin Binary"; 209 | outputPaths = ( 210 | ); 211 | runOnlyForDeploymentPostprocessing = 0; 212 | shellPath = /bin/sh; 213 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin"; 214 | }; 215 | 720B6209CFF77056A65E84BB /* [CP] Check Pods Manifest.lock */ = { 216 | isa = PBXShellScriptBuildPhase; 217 | buildActionMask = 2147483647; 218 | files = ( 219 | ); 220 | inputFileListPaths = ( 221 | ); 222 | inputPaths = ( 223 | "${PODS_PODFILE_DIR_PATH}/Podfile.lock", 224 | "${PODS_ROOT}/Manifest.lock", 225 | ); 226 | name = "[CP] Check Pods Manifest.lock"; 227 | outputFileListPaths = ( 228 | ); 229 | outputPaths = ( 230 | "$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt", 231 | ); 232 | runOnlyForDeploymentPostprocessing = 0; 233 | shellPath = /bin/sh; 234 | shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; 235 | showEnvVarsInLog = 0; 236 | }; 237 | 9740EEB61CF901F6004384FC /* Run Script */ = { 238 | isa = PBXShellScriptBuildPhase; 239 | buildActionMask = 2147483647; 240 | files = ( 241 | ); 242 | inputPaths = ( 243 | ); 244 | name = "Run Script"; 245 | outputPaths = ( 246 | ); 247 | runOnlyForDeploymentPostprocessing = 0; 248 | shellPath = /bin/sh; 249 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; 250 | }; 251 | C9C08F79B57F1106502D7ABE /* [CP] Embed Pods Frameworks */ = { 252 | isa = PBXShellScriptBuildPhase; 253 | buildActionMask = 2147483647; 254 | files = ( 255 | ); 256 | inputFileListPaths = ( 257 | "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-input-files.xcfilelist", 258 | ); 259 | name = "[CP] Embed Pods Frameworks"; 260 | outputFileListPaths = ( 261 | "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-output-files.xcfilelist", 262 | ); 263 | runOnlyForDeploymentPostprocessing = 0; 264 | shellPath = /bin/sh; 265 | shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n"; 266 | showEnvVarsInLog = 0; 267 | }; 268 | /* End PBXShellScriptBuildPhase section */ 269 | 270 | /* Begin PBXSourcesBuildPhase section */ 271 | 97C146EA1CF9000F007C117D /* Sources */ = { 272 | isa = PBXSourcesBuildPhase; 273 | buildActionMask = 2147483647; 274 | files = ( 275 | 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */, 276 | 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */, 277 | ); 278 | runOnlyForDeploymentPostprocessing = 0; 279 | }; 280 | /* End PBXSourcesBuildPhase section */ 281 | 282 | /* Begin PBXVariantGroup section */ 283 | 97C146FA1CF9000F007C117D /* Main.storyboard */ = { 284 | isa = PBXVariantGroup; 285 | children = ( 286 | 97C146FB1CF9000F007C117D /* Base */, 287 | ); 288 | name = Main.storyboard; 289 | sourceTree = ""; 290 | }; 291 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */ = { 292 | isa = PBXVariantGroup; 293 | children = ( 294 | 97C147001CF9000F007C117D /* Base */, 295 | ); 296 | name = LaunchScreen.storyboard; 297 | sourceTree = ""; 298 | }; 299 | /* End PBXVariantGroup section */ 300 | 301 | /* Begin XCBuildConfiguration section */ 302 | 249021D3217E4FDB00AE95B9 /* Profile */ = { 303 | isa = XCBuildConfiguration; 304 | buildSettings = { 305 | ALWAYS_SEARCH_USER_PATHS = NO; 306 | CLANG_ANALYZER_NONNULL = YES; 307 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 308 | CLANG_CXX_LIBRARY = "libc++"; 309 | CLANG_ENABLE_MODULES = YES; 310 | CLANG_ENABLE_OBJC_ARC = YES; 311 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 312 | CLANG_WARN_BOOL_CONVERSION = YES; 313 | CLANG_WARN_COMMA = YES; 314 | CLANG_WARN_CONSTANT_CONVERSION = YES; 315 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 316 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 317 | CLANG_WARN_EMPTY_BODY = YES; 318 | CLANG_WARN_ENUM_CONVERSION = YES; 319 | CLANG_WARN_INFINITE_RECURSION = YES; 320 | CLANG_WARN_INT_CONVERSION = YES; 321 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 322 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 323 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 324 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 325 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 326 | CLANG_WARN_STRICT_PROTOTYPES = YES; 327 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 328 | CLANG_WARN_UNREACHABLE_CODE = YES; 329 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 330 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 331 | COPY_PHASE_STRIP = NO; 332 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 333 | ENABLE_NS_ASSERTIONS = NO; 334 | ENABLE_STRICT_OBJC_MSGSEND = YES; 335 | GCC_C_LANGUAGE_STANDARD = gnu99; 336 | GCC_NO_COMMON_BLOCKS = YES; 337 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 338 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 339 | GCC_WARN_UNDECLARED_SELECTOR = YES; 340 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 341 | GCC_WARN_UNUSED_FUNCTION = YES; 342 | GCC_WARN_UNUSED_VARIABLE = YES; 343 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 344 | MTL_ENABLE_DEBUG_INFO = NO; 345 | SDKROOT = iphoneos; 346 | SUPPORTED_PLATFORMS = iphoneos; 347 | TARGETED_DEVICE_FAMILY = "1,2"; 348 | VALIDATE_PRODUCT = YES; 349 | }; 350 | name = Profile; 351 | }; 352 | 249021D4217E4FDB00AE95B9 /* Profile */ = { 353 | isa = XCBuildConfiguration; 354 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 355 | buildSettings = { 356 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 357 | CLANG_ENABLE_MODULES = YES; 358 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 359 | ENABLE_BITCODE = NO; 360 | INFOPLIST_FILE = Runner/Info.plist; 361 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 362 | PRODUCT_BUNDLE_IDENTIFIER = com.wkl.flutterTrip; 363 | PRODUCT_NAME = "$(TARGET_NAME)"; 364 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; 365 | SWIFT_VERSION = 5.0; 366 | VERSIONING_SYSTEM = "apple-generic"; 367 | }; 368 | name = Profile; 369 | }; 370 | 97C147031CF9000F007C117D /* Debug */ = { 371 | isa = XCBuildConfiguration; 372 | buildSettings = { 373 | ALWAYS_SEARCH_USER_PATHS = NO; 374 | CLANG_ANALYZER_NONNULL = YES; 375 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 376 | CLANG_CXX_LIBRARY = "libc++"; 377 | CLANG_ENABLE_MODULES = YES; 378 | CLANG_ENABLE_OBJC_ARC = YES; 379 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 380 | CLANG_WARN_BOOL_CONVERSION = YES; 381 | CLANG_WARN_COMMA = YES; 382 | CLANG_WARN_CONSTANT_CONVERSION = YES; 383 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 384 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 385 | CLANG_WARN_EMPTY_BODY = YES; 386 | CLANG_WARN_ENUM_CONVERSION = YES; 387 | CLANG_WARN_INFINITE_RECURSION = YES; 388 | CLANG_WARN_INT_CONVERSION = YES; 389 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 390 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 391 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 392 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 393 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 394 | CLANG_WARN_STRICT_PROTOTYPES = YES; 395 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 396 | CLANG_WARN_UNREACHABLE_CODE = YES; 397 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 398 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 399 | COPY_PHASE_STRIP = NO; 400 | DEBUG_INFORMATION_FORMAT = dwarf; 401 | ENABLE_STRICT_OBJC_MSGSEND = YES; 402 | ENABLE_TESTABILITY = YES; 403 | GCC_C_LANGUAGE_STANDARD = gnu99; 404 | GCC_DYNAMIC_NO_PIC = NO; 405 | GCC_NO_COMMON_BLOCKS = YES; 406 | GCC_OPTIMIZATION_LEVEL = 0; 407 | GCC_PREPROCESSOR_DEFINITIONS = ( 408 | "DEBUG=1", 409 | "$(inherited)", 410 | ); 411 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 412 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 413 | GCC_WARN_UNDECLARED_SELECTOR = YES; 414 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 415 | GCC_WARN_UNUSED_FUNCTION = YES; 416 | GCC_WARN_UNUSED_VARIABLE = YES; 417 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 418 | MTL_ENABLE_DEBUG_INFO = YES; 419 | ONLY_ACTIVE_ARCH = YES; 420 | SDKROOT = iphoneos; 421 | TARGETED_DEVICE_FAMILY = "1,2"; 422 | }; 423 | name = Debug; 424 | }; 425 | 97C147041CF9000F007C117D /* Release */ = { 426 | isa = XCBuildConfiguration; 427 | buildSettings = { 428 | ALWAYS_SEARCH_USER_PATHS = NO; 429 | CLANG_ANALYZER_NONNULL = YES; 430 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 431 | CLANG_CXX_LIBRARY = "libc++"; 432 | CLANG_ENABLE_MODULES = YES; 433 | CLANG_ENABLE_OBJC_ARC = YES; 434 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 435 | CLANG_WARN_BOOL_CONVERSION = YES; 436 | CLANG_WARN_COMMA = YES; 437 | CLANG_WARN_CONSTANT_CONVERSION = YES; 438 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 439 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 440 | CLANG_WARN_EMPTY_BODY = YES; 441 | CLANG_WARN_ENUM_CONVERSION = YES; 442 | CLANG_WARN_INFINITE_RECURSION = YES; 443 | CLANG_WARN_INT_CONVERSION = YES; 444 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 445 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 446 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 447 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 448 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 449 | CLANG_WARN_STRICT_PROTOTYPES = YES; 450 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 451 | CLANG_WARN_UNREACHABLE_CODE = YES; 452 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 453 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 454 | COPY_PHASE_STRIP = NO; 455 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 456 | ENABLE_NS_ASSERTIONS = NO; 457 | ENABLE_STRICT_OBJC_MSGSEND = YES; 458 | GCC_C_LANGUAGE_STANDARD = gnu99; 459 | GCC_NO_COMMON_BLOCKS = YES; 460 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 461 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 462 | GCC_WARN_UNDECLARED_SELECTOR = YES; 463 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 464 | GCC_WARN_UNUSED_FUNCTION = YES; 465 | GCC_WARN_UNUSED_VARIABLE = YES; 466 | IPHONEOS_DEPLOYMENT_TARGET = 9.0; 467 | MTL_ENABLE_DEBUG_INFO = NO; 468 | SDKROOT = iphoneos; 469 | SUPPORTED_PLATFORMS = iphoneos; 470 | SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; 471 | TARGETED_DEVICE_FAMILY = "1,2"; 472 | VALIDATE_PRODUCT = YES; 473 | }; 474 | name = Release; 475 | }; 476 | 97C147061CF9000F007C117D /* Debug */ = { 477 | isa = XCBuildConfiguration; 478 | baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; 479 | buildSettings = { 480 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 481 | CLANG_ENABLE_MODULES = YES; 482 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 483 | ENABLE_BITCODE = NO; 484 | INFOPLIST_FILE = Runner/Info.plist; 485 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 486 | PRODUCT_BUNDLE_IDENTIFIER = com.wkl.flutterTrip; 487 | PRODUCT_NAME = "$(TARGET_NAME)"; 488 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; 489 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 490 | SWIFT_VERSION = 5.0; 491 | VERSIONING_SYSTEM = "apple-generic"; 492 | }; 493 | name = Debug; 494 | }; 495 | 97C147071CF9000F007C117D /* Release */ = { 496 | isa = XCBuildConfiguration; 497 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 498 | buildSettings = { 499 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 500 | CLANG_ENABLE_MODULES = YES; 501 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 502 | ENABLE_BITCODE = NO; 503 | INFOPLIST_FILE = Runner/Info.plist; 504 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 505 | PRODUCT_BUNDLE_IDENTIFIER = com.wkl.flutterTrip; 506 | PRODUCT_NAME = "$(TARGET_NAME)"; 507 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; 508 | SWIFT_VERSION = 5.0; 509 | VERSIONING_SYSTEM = "apple-generic"; 510 | }; 511 | name = Release; 512 | }; 513 | /* End XCBuildConfiguration section */ 514 | 515 | /* Begin XCConfigurationList section */ 516 | 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = { 517 | isa = XCConfigurationList; 518 | buildConfigurations = ( 519 | 97C147031CF9000F007C117D /* Debug */, 520 | 97C147041CF9000F007C117D /* Release */, 521 | 249021D3217E4FDB00AE95B9 /* Profile */, 522 | ); 523 | defaultConfigurationIsVisible = 0; 524 | defaultConfigurationName = Release; 525 | }; 526 | 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */ = { 527 | isa = XCConfigurationList; 528 | buildConfigurations = ( 529 | 97C147061CF9000F007C117D /* Debug */, 530 | 97C147071CF9000F007C117D /* Release */, 531 | 249021D4217E4FDB00AE95B9 /* Profile */, 532 | ); 533 | defaultConfigurationIsVisible = 0; 534 | defaultConfigurationName = Release; 535 | }; 536 | /* End XCConfigurationList section */ 537 | }; 538 | rootObject = 97C146E61CF9000F007C117D /* Project object */; 539 | } 540 | -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreviewsEnabled 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 39 | 40 | 41 | 42 | 43 | 44 | 54 | 56 | 62 | 63 | 64 | 65 | 66 | 67 | 73 | 75 | 81 | 82 | 83 | 84 | 86 | 87 | 90 | 91 | 92 | -------------------------------------------------------------------------------- /ios/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreviewsEnabled 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /ios/Runner/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | import UIKit 2 | import Flutter 3 | 4 | @UIApplicationMain 5 | @objc class AppDelegate: FlutterAppDelegate { 6 | override func application( 7 | _ application: UIApplication, 8 | didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? 9 | ) -> Bool { 10 | GeneratedPluginRegistrant.register(with: self) 11 | return super.application(application, didFinishLaunchingWithOptions: launchOptions) 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "size" : "20x20", 5 | "idiom" : "iphone", 6 | "filename" : "Icon-App-20x20@2x.png", 7 | "scale" : "2x" 8 | }, 9 | { 10 | "size" : "20x20", 11 | "idiom" : "iphone", 12 | "filename" : "Icon-App-20x20@3x.png", 13 | "scale" : "3x" 14 | }, 15 | { 16 | "size" : "29x29", 17 | "idiom" : "iphone", 18 | "filename" : "Icon-App-29x29@1x.png", 19 | "scale" : "1x" 20 | }, 21 | { 22 | "size" : "29x29", 23 | "idiom" : "iphone", 24 | "filename" : "Icon-App-29x29@2x.png", 25 | "scale" : "2x" 26 | }, 27 | { 28 | "size" : "29x29", 29 | "idiom" : "iphone", 30 | "filename" : "Icon-App-29x29@3x.png", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "size" : "40x40", 35 | "idiom" : "iphone", 36 | "filename" : "Icon-App-40x40@2x.png", 37 | "scale" : "2x" 38 | }, 39 | { 40 | "size" : "40x40", 41 | "idiom" : "iphone", 42 | "filename" : "Icon-App-40x40@3x.png", 43 | "scale" : "3x" 44 | }, 45 | { 46 | "size" : "60x60", 47 | "idiom" : "iphone", 48 | "filename" : "Icon-App-60x60@2x.png", 49 | "scale" : "2x" 50 | }, 51 | { 52 | "size" : "60x60", 53 | "idiom" : "iphone", 54 | "filename" : "Icon-App-60x60@3x.png", 55 | "scale" : "3x" 56 | }, 57 | { 58 | "size" : "20x20", 59 | "idiom" : "ipad", 60 | "filename" : "Icon-App-20x20@1x.png", 61 | "scale" : "1x" 62 | }, 63 | { 64 | "size" : "20x20", 65 | "idiom" : "ipad", 66 | "filename" : "Icon-App-20x20@2x.png", 67 | "scale" : "2x" 68 | }, 69 | { 70 | "size" : "29x29", 71 | "idiom" : "ipad", 72 | "filename" : "Icon-App-29x29@1x.png", 73 | "scale" : "1x" 74 | }, 75 | { 76 | "size" : "29x29", 77 | "idiom" : "ipad", 78 | "filename" : "Icon-App-29x29@2x.png", 79 | "scale" : "2x" 80 | }, 81 | { 82 | "size" : "40x40", 83 | "idiom" : "ipad", 84 | "filename" : "Icon-App-40x40@1x.png", 85 | "scale" : "1x" 86 | }, 87 | { 88 | "size" : "40x40", 89 | "idiom" : "ipad", 90 | "filename" : "Icon-App-40x40@2x.png", 91 | "scale" : "2x" 92 | }, 93 | { 94 | "size" : "76x76", 95 | "idiom" : "ipad", 96 | "filename" : "Icon-App-76x76@1x.png", 97 | "scale" : "1x" 98 | }, 99 | { 100 | "size" : "76x76", 101 | "idiom" : "ipad", 102 | "filename" : "Icon-App-76x76@2x.png", 103 | "scale" : "2x" 104 | }, 105 | { 106 | "size" : "83.5x83.5", 107 | "idiom" : "ipad", 108 | "filename" : "Icon-App-83.5x83.5@2x.png", 109 | "scale" : "2x" 110 | }, 111 | { 112 | "size" : "1024x1024", 113 | "idiom" : "ios-marketing", 114 | "filename" : "Icon-App-1024x1024@1x.png", 115 | "scale" : "1x" 116 | } 117 | ], 118 | "info" : { 119 | "version" : 1, 120 | "author" : "xcode" 121 | } 122 | } 123 | -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wkl007/flutter_trip/5436b2c1e74e6c5ef6100bb347ca115026fcc0d5/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wkl007/flutter_trip/5436b2c1e74e6c5ef6100bb347ca115026fcc0d5/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/wkl007/flutter_trip/5436b2c1e74e6c5ef6100bb347ca115026fcc0d5/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/wkl007/flutter_trip/5436b2c1e74e6c5ef6100bb347ca115026fcc0d5/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/wkl007/flutter_trip/5436b2c1e74e6c5ef6100bb347ca115026fcc0d5/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/wkl007/flutter_trip/5436b2c1e74e6c5ef6100bb347ca115026fcc0d5/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/wkl007/flutter_trip/5436b2c1e74e6c5ef6100bb347ca115026fcc0d5/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/wkl007/flutter_trip/5436b2c1e74e6c5ef6100bb347ca115026fcc0d5/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/wkl007/flutter_trip/5436b2c1e74e6c5ef6100bb347ca115026fcc0d5/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/wkl007/flutter_trip/5436b2c1e74e6c5ef6100bb347ca115026fcc0d5/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/wkl007/flutter_trip/5436b2c1e74e6c5ef6100bb347ca115026fcc0d5/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/wkl007/flutter_trip/5436b2c1e74e6c5ef6100bb347ca115026fcc0d5/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/wkl007/flutter_trip/5436b2c1e74e6c5ef6100bb347ca115026fcc0d5/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/wkl007/flutter_trip/5436b2c1e74e6c5ef6100bb347ca115026fcc0d5/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wkl007/flutter_trip/5436b2c1e74e6c5ef6100bb347ca115026fcc0d5/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "LaunchImage.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "LaunchImage@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "filename" : "LaunchImage@3x.png", 16 | "scale" : "3x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wkl007/flutter_trip/5436b2c1e74e6c5ef6100bb347ca115026fcc0d5/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wkl007/flutter_trip/5436b2c1e74e6c5ef6100bb347ca115026fcc0d5/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wkl007/flutter_trip/5436b2c1e74e6c5ef6100bb347ca115026fcc0d5/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md: -------------------------------------------------------------------------------- 1 | # Launch Screen Assets 2 | 3 | You can customize the launch screen with your own desired assets by replacing the image files in this directory. 4 | 5 | You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images. -------------------------------------------------------------------------------- /ios/Runner/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /ios/Runner/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /ios/Runner/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | flutter_trip 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/Runner-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | #import "GeneratedPluginRegistrant.h" 2 | -------------------------------------------------------------------------------- /lib/dao/home_dao.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | 3 | import 'package:dio/dio.dart'; 4 | import 'package:flutter_trip/model/home_model.dart'; 5 | 6 | const HOME_URL = 7 | 'https://apk-1256738511.cos.ap-chengdu.myqcloud.com/FlutterTrip/data/home_page.json'; 8 | 9 | /// 首页接口 10 | class HomeDao { 11 | static Future fetch() async { 12 | Response response = await Dio().get(HOME_URL); 13 | if (response.statusCode == 200) { 14 | return HomeModel.fromJson(response.data); 15 | } else { 16 | throw Exception('Failed to load home_page.json'); 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /lib/dao/search_dao.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | 3 | import 'package:dio/dio.dart'; 4 | import 'package:flutter_trip/model/search_model.dart'; 5 | 6 | const SEARCH_URL = 7 | 'https://m.ctrip.com/restapi/h5api/searchapp/search?source=mobileweb&action=autocomplete&contentType=json&keyword='; 8 | 9 | /// 搜索接口 10 | class SearchDao { 11 | static Future fetch(String keyword) async { 12 | Response response = await Dio().get(SEARCH_URL + keyword); 13 | if (response.statusCode == 200) { 14 | // 只有当输入的内容与服务端返回的内容一致时才渲染 15 | SearchModel model = SearchModel.fromJson(response.data); 16 | model.keyword = keyword; 17 | return model; 18 | } else { 19 | throw Exception('Failed to load search'); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /lib/dao/travel_dao.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | 3 | import 'package:dio/dio.dart'; 4 | import 'package:flutter_trip/model/travel_model.dart'; 5 | 6 | const TRAVEL_URL = 7 | 'https://m.ctrip.com/restapi/soa2/16189/json/searchTripShootListForHomePageV2?_fxpcqlniredt=09031010211161114530&__gw_appid=99999999&__gw_ver=1.0&__gw_from=10650013707&__gw_platform=H5'; 8 | 9 | var params = { 10 | "districtId": -1, 11 | "groupChannelCode": "tourphoto_global1", 12 | "type": null, 13 | "lat": 34.2317081, 14 | "lon": 108.928918, 15 | "locatedDistrictId": 7, 16 | "pagePara": { 17 | "pageIndex": 1, 18 | "pageSize": 10, 19 | "sortType": 9, 20 | "sortDirection": 0 21 | }, 22 | "imageCutType": 1, 23 | "head": { 24 | "cid": "09031010211161114530", 25 | "ctok": "", 26 | "cver": "1.0", 27 | "lang": "01", 28 | "sid": "8888", 29 | "syscode": "09", 30 | "auth": null, 31 | "extension": [ 32 | {"name": "protocal", "value": "https"} 33 | ] 34 | }, 35 | "contentType": "json" 36 | }; 37 | 38 | /// 旅拍类别接口 39 | class TravelDao { 40 | static Future fetch( 41 | String url, 42 | Map params, 43 | String groupChannelCode, 44 | int type, 45 | int pageIndex, 46 | int pageSize, 47 | ) async { 48 | Map paramsMap = params['pagePara']; 49 | paramsMap['pageIndex'] = pageIndex; 50 | paramsMap['pageSize'] = pageSize; 51 | params['groupChannelCode'] = groupChannelCode; 52 | params['type'] = type; 53 | 54 | Response response = await Dio().post(url, data: params); 55 | 56 | if (response.statusCode == 200) { 57 | return TravelModel.fromJson(response.data); 58 | } else { 59 | throw Exception('Failed to load travel_page.json'); 60 | } 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /lib/dao/travel_tab_dao.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | 3 | import 'package:dio/dio.dart'; 4 | import 'package:flutter_trip/model/travel_tab_model.dart'; 5 | 6 | const TRAVEL_TAB_URL = 7 | 'https://apk-1256738511.cos.ap-chengdu.myqcloud.com/FlutterTrip/data/travel_page.json'; 8 | 9 | /// 旅拍类别接口 10 | class TravelTabDao { 11 | static Future fetch() async { 12 | Response response = await Dio().get(TRAVEL_TAB_URL); 13 | if (response.statusCode == 200) { 14 | return TravelTabModel.fromJson(response.data); 15 | } else { 16 | throw Exception('Failed to load travel_page.json'); 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /lib/main.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_trip/navigator/tab_navigator.dart'; 3 | 4 | void main() => runApp(MyApp()); 5 | 6 | class MyApp extends StatelessWidget { 7 | @override 8 | Widget build(BuildContext context) { 9 | return MaterialApp( 10 | title: 'Flutter之旅', 11 | theme: ThemeData( 12 | primarySwatch: Colors.blue, 13 | ), 14 | home: TabNavigator(), 15 | ); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /lib/model/home_model.dart: -------------------------------------------------------------------------------- 1 | import 'dart:convert'; 2 | 3 | import 'package:flutter_trip/util/index.dart'; 4 | 5 | class HomeModel { 6 | HomeModel({ 7 | required this.config, 8 | required this.bannerList, 9 | required this.localNavList, 10 | required this.gridNav, 11 | required this.subNavList, 12 | required this.salesBox, 13 | }); 14 | 15 | factory HomeModel.fromJson(Map jsonRes) { 16 | final List? bannerList = 17 | jsonRes['bannerList'] is List ? [] : null; 18 | if (bannerList != null) { 19 | for (final dynamic item in jsonRes['bannerList']!) { 20 | if (item != null) { 21 | bannerList 22 | .add(CommonModel.fromJson(asT>(item)!)); 23 | } 24 | } 25 | } 26 | 27 | final List? localNavList = 28 | jsonRes['localNavList'] is List ? [] : null; 29 | if (localNavList != null) { 30 | for (final dynamic item in jsonRes['localNavList']!) { 31 | if (item != null) { 32 | localNavList 33 | .add(CommonModel.fromJson(asT>(item)!)); 34 | } 35 | } 36 | } 37 | 38 | final List? subNavList = 39 | jsonRes['subNavList'] is List ? [] : null; 40 | if (subNavList != null) { 41 | for (final dynamic item in jsonRes['subNavList']!) { 42 | if (item != null) { 43 | subNavList 44 | .add(CommonModel.fromJson(asT>(item)!)); 45 | } 46 | } 47 | } 48 | 49 | return HomeModel( 50 | config: Config.fromJson(asT>(jsonRes['config'])!), 51 | bannerList: bannerList!, 52 | localNavList: localNavList!, 53 | gridNav: 54 | GridNavModel.fromJson(asT>(jsonRes['gridNav'])!), 55 | subNavList: subNavList!, 56 | salesBox: SalesBoxModel.fromJson( 57 | asT>(jsonRes['salesBox'])!), 58 | ); 59 | } 60 | 61 | Config config; 62 | List bannerList; 63 | List localNavList; 64 | GridNavModel gridNav; 65 | List subNavList; 66 | SalesBoxModel salesBox; 67 | 68 | @override 69 | String toString() { 70 | return jsonEncode(this); 71 | } 72 | 73 | Map toJson() => { 74 | 'config': config, 75 | 'bannerList': bannerList, 76 | 'localNavList': localNavList, 77 | 'gridNav': gridNav, 78 | 'subNavList': subNavList, 79 | 'salesBox': salesBox, 80 | }; 81 | 82 | HomeModel clone() => HomeModel.fromJson( 83 | asT>(jsonDecode(jsonEncode(this)))!); 84 | } 85 | 86 | class Config { 87 | Config({ 88 | required this.searchUrl, 89 | }); 90 | 91 | factory Config.fromJson(Map jsonRes) => Config( 92 | searchUrl: asT(jsonRes['searchUrl'])!, 93 | ); 94 | 95 | String searchUrl; 96 | 97 | @override 98 | String toString() { 99 | return jsonEncode(this); 100 | } 101 | 102 | Map toJson() => { 103 | 'searchUrl': searchUrl, 104 | }; 105 | 106 | Config clone() => 107 | Config.fromJson(asT>(jsonDecode(jsonEncode(this)))!); 108 | } 109 | 110 | class GridNavModel { 111 | GridNavModel({ 112 | required this.hotel, 113 | required this.flight, 114 | required this.travel, 115 | }); 116 | 117 | factory GridNavModel.fromJson(Map jsonRes) => GridNavModel( 118 | hotel: 119 | GridNavItem.fromJson(asT>(jsonRes['hotel'])!), 120 | flight: 121 | GridNavItem.fromJson(asT>(jsonRes['flight'])!), 122 | travel: 123 | GridNavItem.fromJson(asT>(jsonRes['travel'])!), 124 | ); 125 | 126 | GridNavItem hotel; 127 | GridNavItem flight; 128 | GridNavItem travel; 129 | 130 | @override 131 | String toString() { 132 | return jsonEncode(this); 133 | } 134 | 135 | Map toJson() => { 136 | 'hotel': hotel, 137 | 'flight': flight, 138 | 'travel': travel, 139 | }; 140 | 141 | GridNavModel clone() => GridNavModel.fromJson( 142 | asT>(jsonDecode(jsonEncode(this)))!); 143 | } 144 | 145 | class CommonModel { 146 | CommonModel({ 147 | required this.icon, 148 | required this.url, 149 | this.title, 150 | this.hideAppBar, 151 | this.statusBarColor, 152 | }); 153 | 154 | factory CommonModel.fromJson(Map jsonRes) => CommonModel( 155 | title: jsonRes['title'] ?? '', 156 | icon: jsonRes['icon'] ?? '', 157 | url: jsonRes['url'] ?? '', 158 | hideAppBar: jsonRes['hideAppBar'] ?? false, 159 | statusBarColor: jsonRes['statusBarColor'] ?? '', 160 | ); 161 | 162 | String icon; 163 | String url; 164 | String? title; 165 | bool? hideAppBar; 166 | String? statusBarColor; 167 | 168 | @override 169 | String toString() { 170 | return jsonEncode(this); 171 | } 172 | 173 | Map toJson() => { 174 | 'title': title, 175 | 'icon': icon, 176 | 'url': url, 177 | 'hideAppBar': hideAppBar, 178 | 'statusBarColor': statusBarColor, 179 | }; 180 | 181 | CommonModel clone() => CommonModel.fromJson( 182 | asT>(jsonDecode(jsonEncode(this)))!); 183 | } 184 | 185 | class GridNavItem { 186 | GridNavItem({ 187 | required this.startColor, 188 | required this.endColor, 189 | required this.mainItem, 190 | required this.item1, 191 | required this.item2, 192 | required this.item3, 193 | required this.item4, 194 | }); 195 | 196 | factory GridNavItem.fromJson(Map jsonRes) => GridNavItem( 197 | startColor: asT(jsonRes['startColor'])!, 198 | endColor: asT(jsonRes['endColor'])!, 199 | mainItem: CommonModel.fromJson( 200 | asT>(jsonRes['mainItem'])!), 201 | item1: 202 | CommonModel.fromJson(asT>(jsonRes['item1'])!), 203 | item2: 204 | CommonModel.fromJson(asT>(jsonRes['item2'])!), 205 | item3: 206 | CommonModel.fromJson(asT>(jsonRes['item3'])!), 207 | item4: 208 | CommonModel.fromJson(asT>(jsonRes['item4'])!), 209 | ); 210 | 211 | String startColor; 212 | String endColor; 213 | CommonModel mainItem; 214 | CommonModel item1; 215 | CommonModel item2; 216 | CommonModel item3; 217 | CommonModel item4; 218 | 219 | @override 220 | String toString() { 221 | return jsonEncode(this); 222 | } 223 | 224 | Map toJson() => { 225 | 'startColor': startColor, 226 | 'endColor': endColor, 227 | 'mainItem': mainItem, 228 | 'item1': item1, 229 | 'item2': item2, 230 | 'item3': item3, 231 | 'item4': item4, 232 | }; 233 | 234 | GridNavItem clone() => GridNavItem.fromJson( 235 | asT>(jsonDecode(jsonEncode(this)))!); 236 | } 237 | 238 | class SalesBoxModel { 239 | SalesBoxModel({ 240 | required this.icon, 241 | required this.moreUrl, 242 | required this.bigCard1, 243 | required this.bigCard2, 244 | required this.smallCard1, 245 | required this.smallCard2, 246 | required this.smallCard3, 247 | required this.smallCard4, 248 | }); 249 | 250 | factory SalesBoxModel.fromJson(Map jsonRes) => SalesBoxModel( 251 | icon: asT(jsonRes['icon'])!, 252 | moreUrl: asT(jsonRes['moreUrl'])!, 253 | bigCard1: CommonModel.fromJson( 254 | asT>(jsonRes['bigCard1'])!), 255 | bigCard2: CommonModel.fromJson( 256 | asT>(jsonRes['bigCard2'])!), 257 | smallCard1: CommonModel.fromJson( 258 | asT>(jsonRes['smallCard1'])!), 259 | smallCard2: CommonModel.fromJson( 260 | asT>(jsonRes['smallCard2'])!), 261 | smallCard3: CommonModel.fromJson( 262 | asT>(jsonRes['smallCard3'])!), 263 | smallCard4: CommonModel.fromJson( 264 | asT>(jsonRes['smallCard4'])!), 265 | ); 266 | 267 | String icon; 268 | String moreUrl; 269 | CommonModel bigCard1; 270 | CommonModel bigCard2; 271 | CommonModel smallCard1; 272 | CommonModel smallCard2; 273 | CommonModel smallCard3; 274 | CommonModel smallCard4; 275 | 276 | @override 277 | String toString() { 278 | return jsonEncode(this); 279 | } 280 | 281 | Map toJson() => { 282 | 'icon': icon, 283 | 'moreUrl': moreUrl, 284 | 'bigCard1': bigCard1, 285 | 'bigCard2': bigCard2, 286 | 'smallCard1': smallCard1, 287 | 'smallCard2': smallCard2, 288 | 'smallCard3': smallCard3, 289 | 'smallCard4': smallCard4, 290 | }; 291 | 292 | SalesBoxModel clone() => SalesBoxModel.fromJson( 293 | asT>(jsonDecode(jsonEncode(this)))!); 294 | } 295 | -------------------------------------------------------------------------------- /lib/model/search_model.dart: -------------------------------------------------------------------------------- 1 | import 'dart:convert'; 2 | 3 | import 'package:flutter_trip/util/index.dart'; 4 | 5 | class SearchModel { 6 | SearchModel({ 7 | required this.keyword, 8 | required this.data, 9 | }); 10 | 11 | factory SearchModel.fromJson(Map jsonRes) { 12 | final List? data = 13 | jsonRes['data'] is List ? [] : null; 14 | if (data != null) { 15 | for (final dynamic item in jsonRes['data']!) { 16 | if (item != null) { 17 | data.add(SearchItem.fromJson(asT>(item)!)); 18 | } 19 | } 20 | } 21 | 22 | return SearchModel( 23 | keyword: jsonRes['keyword'] ?? '', 24 | data: data!, 25 | ); 26 | } 27 | 28 | String keyword; 29 | List data; 30 | 31 | @override 32 | String toString() { 33 | return jsonEncode(this); 34 | } 35 | 36 | Map toJson() => { 37 | 'keyword': keyword, 38 | 'data': data, 39 | }; 40 | 41 | SearchModel clone() => SearchModel.fromJson( 42 | asT>(jsonDecode(jsonEncode(this)))!); 43 | } 44 | 45 | class SearchItem { 46 | SearchItem({ 47 | required this.word, 48 | required this.url, 49 | this.type, 50 | this.price, 51 | this.star, 52 | this.zonename, 53 | this.districtname, 54 | }); 55 | 56 | factory SearchItem.fromJson(Map jsonRes) => SearchItem( 57 | word: asT(jsonRes['word'])!, 58 | url: asT(jsonRes['url'])!, 59 | type: asT(jsonRes['type']), 60 | price: asT(jsonRes['price']), 61 | star: asT(jsonRes['star']), 62 | zonename: asT(jsonRes['zonename']), 63 | districtname: asT(jsonRes['districtname']), 64 | ); 65 | 66 | String word; 67 | String? type; 68 | String? price; 69 | String? star; 70 | String? zonename; 71 | String? districtname; 72 | String url; 73 | 74 | @override 75 | String toString() { 76 | return jsonEncode(this); 77 | } 78 | 79 | Map toJson() => { 80 | 'word': word, 81 | 'type': type, 82 | 'price': price, 83 | 'star': star, 84 | 'zonename': zonename, 85 | 'districtname': districtname, 86 | 'url': url, 87 | }; 88 | 89 | SearchItem clone() => SearchItem.fromJson( 90 | asT>(jsonDecode(jsonEncode(this)))!); 91 | } 92 | -------------------------------------------------------------------------------- /lib/model/travel_model.dart: -------------------------------------------------------------------------------- 1 | import 'dart:convert'; 2 | 3 | import 'package:flutter_trip/util/index.dart'; 4 | 5 | /// 旅拍页模型 6 | class TravelModel { 7 | int totalCount; 8 | List resultList; 9 | 10 | TravelModel({ 11 | required this.totalCount, 12 | required this.resultList, 13 | }); 14 | 15 | factory TravelModel.fromJson(Map jsonRes) { 16 | final List? resultList = 17 | jsonRes['resultList'] is List ? [] : null; 18 | if (resultList != null) { 19 | for (final dynamic item in jsonRes['resultList']!) { 20 | if (item != null) { 21 | resultList.add(TravelItem.fromJson(asT>(item)!)); 22 | } 23 | } 24 | } 25 | return TravelModel( 26 | totalCount: asT(jsonRes['totalCount'])!, 27 | resultList: resultList!, 28 | ); 29 | } 30 | 31 | @override 32 | String toString() { 33 | return jsonEncode(this); 34 | } 35 | 36 | Map toJson() => { 37 | 'totalCount': totalCount, 38 | 'resultList': resultList, 39 | }; 40 | 41 | TravelModel clone() => TravelModel.fromJson( 42 | asT>(jsonDecode(jsonEncode(this)))!); 43 | } 44 | 45 | class TravelItem { 46 | int type; 47 | Article article; 48 | 49 | TravelItem({ 50 | required this.type, 51 | required this.article, 52 | }); 53 | 54 | factory TravelItem.fromJson(Map jsonRes) => TravelItem( 55 | type: asT(jsonRes['type'])!, 56 | article: 57 | Article.fromJson(asT>(jsonRes['article'])!), 58 | ); 59 | 60 | @override 61 | String toString() { 62 | return jsonEncode(this); 63 | } 64 | 65 | Map toJson() => { 66 | 'type': type, 67 | 'article': article, 68 | }; 69 | 70 | TravelItem clone() => TravelItem.fromJson( 71 | asT>(jsonDecode(jsonEncode(this)))!); 72 | } 73 | 74 | class Article { 75 | int articleId; 76 | int productType; 77 | int sourceType; 78 | String articleTitle; 79 | Author author; 80 | List images; 81 | bool hasVideo; 82 | int readCount; 83 | int likeCount; 84 | int commentCount; 85 | List urls; 86 | List tags; 87 | List topics; 88 | List pois; 89 | String publishTime; 90 | String publishTimeDisplay; 91 | String shootTime; 92 | String shootTimeDisplay; 93 | int level; 94 | String distanceText; 95 | bool isLike; 96 | int imageCounts; 97 | bool isCollected; 98 | int collectCount; 99 | int articleStatus; 100 | String poiName; 101 | 102 | Article({ 103 | required this.articleId, 104 | required this.productType, 105 | required this.sourceType, 106 | required this.articleTitle, 107 | required this.author, 108 | required this.images, 109 | required this.hasVideo, 110 | required this.readCount, 111 | required this.likeCount, 112 | required this.commentCount, 113 | required this.urls, 114 | required this.tags, 115 | required this.topics, 116 | required this.pois, 117 | required this.publishTime, 118 | required this.publishTimeDisplay, 119 | required this.shootTime, 120 | required this.shootTimeDisplay, 121 | required this.level, 122 | required this.distanceText, 123 | required this.isLike, 124 | required this.imageCounts, 125 | required this.isCollected, 126 | required this.collectCount, 127 | required this.articleStatus, 128 | required this.poiName, 129 | }); 130 | 131 | factory Article.fromJson(Map jsonRes) { 132 | final List? images = jsonRes['images'] is List ? [] : null; 133 | if (images != null) { 134 | for (final dynamic item in jsonRes['images']!) { 135 | if (item != null) { 136 | images.add(Images.fromJson(asT>(item)!)); 137 | } 138 | } 139 | } 140 | 141 | final List? urls = jsonRes['urls'] is List ? [] : null; 142 | if (urls != null) { 143 | for (final dynamic item in jsonRes['urls']!) { 144 | if (item != null) { 145 | urls.add(Urls.fromJson(asT>(item)!)); 146 | } 147 | } 148 | } 149 | 150 | final List? tags = jsonRes['tags'] is List ? [] : null; 151 | if (tags != null) { 152 | for (final dynamic item in jsonRes['tags']!) { 153 | if (item != null) { 154 | tags.add(Tags.fromJson(asT>(item)!)); 155 | } 156 | } 157 | } 158 | 159 | final List? topics = jsonRes['topics'] is List ? [] : null; 160 | if (topics != null) { 161 | for (final dynamic item in jsonRes['topics']!) { 162 | if (item != null) { 163 | topics.add(Topics.fromJson(asT>(item)!)); 164 | } 165 | } 166 | } 167 | 168 | final List? pois = jsonRes['pois'] is List ? [] : null; 169 | if (pois != null) { 170 | for (final dynamic item in jsonRes['pois']!) { 171 | if (item != null) { 172 | pois.add(Pois.fromJson(asT>(item)!)); 173 | } 174 | } 175 | } 176 | 177 | return Article( 178 | articleId: asT(jsonRes['articleId'])!, 179 | productType: asT(jsonRes['productType'])!, 180 | sourceType: asT(jsonRes['sourceType'])!, 181 | articleTitle: asT(jsonRes['articleTitle'])!, 182 | author: Author.fromJson(asT>(jsonRes['author'])!), 183 | images: images!, 184 | hasVideo: asT(jsonRes['hasVideo'])!, 185 | readCount: asT(jsonRes['readCount'])!, 186 | likeCount: asT(jsonRes['likeCount'])!, 187 | commentCount: asT(jsonRes['commentCount'])!, 188 | urls: urls!, 189 | tags: tags!, 190 | topics: topics!, 191 | pois: pois!, 192 | publishTime: asT(jsonRes['publishTime'])!, 193 | publishTimeDisplay: asT(jsonRes['publishTimeDisplay'])!, 194 | shootTime: asT(jsonRes['shootTime'])!, 195 | shootTimeDisplay: asT(jsonRes['shootTimeDisplay'])!, 196 | level: asT(jsonRes['level'])!, 197 | distanceText: asT(jsonRes['distanceText'])!, 198 | isLike: asT(jsonRes['isLike'])!, 199 | imageCounts: asT(jsonRes['imageCounts'])!, 200 | isCollected: asT(jsonRes['isCollected'])!, 201 | collectCount: asT(jsonRes['collectCount'])!, 202 | articleStatus: asT(jsonRes['articleStatus'])!, 203 | poiName: asT(jsonRes['poiName'])!, 204 | ); 205 | } 206 | 207 | @override 208 | String toString() { 209 | return jsonEncode(this); 210 | } 211 | 212 | Map toJson() => { 213 | 'articleId': articleId, 214 | 'productType': productType, 215 | 'sourceType': sourceType, 216 | 'articleTitle': articleTitle, 217 | 'author': author, 218 | 'images': images, 219 | 'hasVideo': hasVideo, 220 | 'readCount': readCount, 221 | 'likeCount': likeCount, 222 | 'commentCount': commentCount, 223 | 'urls': urls, 224 | 'tags': tags, 225 | 'topics': topics, 226 | 'pois': pois, 227 | 'publishTime': publishTime, 228 | 'publishTimeDisplay': publishTimeDisplay, 229 | 'shootTime': shootTime, 230 | 'shootTimeDisplay': shootTimeDisplay, 231 | 'level': level, 232 | 'distanceText': distanceText, 233 | 'isLike': isLike, 234 | 'imageCounts': imageCounts, 235 | 'isCollected': isCollected, 236 | 'collectCount': collectCount, 237 | 'articleStatus': articleStatus, 238 | 'poiName': poiName, 239 | }; 240 | 241 | Article clone() => Article.fromJson( 242 | asT>(jsonDecode(jsonEncode(this)))!); 243 | } 244 | 245 | class Author { 246 | int authorId; 247 | String nickName; 248 | String clientAuth; 249 | String jumpUrl; 250 | CoverImage coverImage; 251 | 252 | Author({ 253 | required this.authorId, 254 | required this.nickName, 255 | required this.clientAuth, 256 | required this.jumpUrl, 257 | required this.coverImage, 258 | }); 259 | 260 | factory Author.fromJson(Map jsonRes) { 261 | return Author( 262 | authorId: asT(jsonRes['authorId'])!, 263 | nickName: asT(jsonRes['nickName'])!, 264 | clientAuth: asT(jsonRes['clientAuth'])!, 265 | jumpUrl: asT(jsonRes['jumpUrl'])!, 266 | coverImage: CoverImage.fromJson( 267 | asT>(jsonRes['coverImage'])!), 268 | ); 269 | } 270 | 271 | @override 272 | String toString() { 273 | return jsonEncode(this); 274 | } 275 | 276 | Map toJson() => { 277 | 'authorId': authorId, 278 | 'nickName': nickName, 279 | 'clientAuth': clientAuth, 280 | 'jumpUrl': jumpUrl, 281 | 'coverImage': coverImage, 282 | }; 283 | 284 | Author clone() => 285 | Author.fromJson(asT>(jsonDecode(jsonEncode(this)))!); 286 | } 287 | 288 | class CoverImage { 289 | String dynamicUrl; 290 | String originalUrl; 291 | 292 | CoverImage({ 293 | required this.dynamicUrl, 294 | required this.originalUrl, 295 | }); 296 | 297 | factory CoverImage.fromJson(Map jsonRes) => CoverImage( 298 | dynamicUrl: asT(jsonRes['dynamicUrl'])!, 299 | originalUrl: asT(jsonRes['originalUrl'])!, 300 | ); 301 | 302 | @override 303 | String toString() { 304 | return jsonEncode(this); 305 | } 306 | 307 | Map toJson() => { 308 | 'dynamicUrl': dynamicUrl, 309 | 'originalUrl': originalUrl, 310 | }; 311 | 312 | CoverImage clone() => CoverImage.fromJson( 313 | asT>(jsonDecode(jsonEncode(this)))!); 314 | } 315 | 316 | class Images { 317 | int imageId; 318 | String dynamicUrl; 319 | String originalUrl; 320 | double width; 321 | double height; 322 | int mediaType; 323 | double lat; 324 | double lon; 325 | 326 | Images({ 327 | required this.imageId, 328 | required this.dynamicUrl, 329 | required this.originalUrl, 330 | required this.width, 331 | required this.height, 332 | required this.mediaType, 333 | required this.lat, 334 | required this.lon, 335 | }); 336 | 337 | factory Images.fromJson(Map jsonRes) => Images( 338 | imageId: asT(jsonRes['imageId'])!, 339 | dynamicUrl: asT(jsonRes['dynamicUrl'])!, 340 | originalUrl: asT(jsonRes['originalUrl'])!, 341 | width: asT(jsonRes['width'])!, 342 | height: asT(jsonRes['height'])!, 343 | mediaType: asT(jsonRes['mediaType'])!, 344 | lat: asT(jsonRes['lat'])!, 345 | lon: asT(jsonRes['lon'])!, 346 | ); 347 | 348 | @override 349 | String toString() { 350 | return jsonEncode(this); 351 | } 352 | 353 | Map toJson() => { 354 | 'imageId': imageId, 355 | 'dynamicUrl': dynamicUrl, 356 | 'originalUrl': originalUrl, 357 | 'width': width, 358 | 'height': height, 359 | 'mediaType': mediaType, 360 | 'lat': lat, 361 | 'lon': lon, 362 | }; 363 | 364 | Images clone() => 365 | Images.fromJson(asT>(jsonDecode(jsonEncode(this)))!); 366 | } 367 | 368 | class Urls { 369 | String version; 370 | String appUrl; 371 | String h5Url; 372 | String wxUrl; 373 | 374 | Urls({ 375 | required this.version, 376 | required this.appUrl, 377 | required this.h5Url, 378 | required this.wxUrl, 379 | }); 380 | 381 | factory Urls.fromJson(Map jsonRes) => Urls( 382 | version: asT(jsonRes['version'])!, 383 | appUrl: asT(jsonRes['appUrl'])!, 384 | h5Url: asT(jsonRes['h5Url'])!, 385 | wxUrl: asT(jsonRes['wxUrl'])!, 386 | ); 387 | 388 | @override 389 | String toString() { 390 | return jsonEncode(this); 391 | } 392 | 393 | Map toJson() => { 394 | 'version': version, 395 | 'appUrl': appUrl, 396 | 'h5Url': h5Url, 397 | 'wxUrl': wxUrl, 398 | }; 399 | 400 | Urls clone() => 401 | Urls.fromJson(asT>(jsonDecode(jsonEncode(this)))!); 402 | } 403 | 404 | class Tags { 405 | int tagId; 406 | String tagName; 407 | int tagLevel; 408 | int parentTagId; 409 | int source; 410 | int sortIndex; 411 | 412 | Tags({ 413 | required this.tagId, 414 | required this.tagName, 415 | required this.tagLevel, 416 | required this.parentTagId, 417 | required this.source, 418 | required this.sortIndex, 419 | }); 420 | 421 | factory Tags.fromJson(Map jsonRes) => Tags( 422 | tagId: asT(jsonRes['tagId'])!, 423 | tagName: asT(jsonRes['tagName'])!, 424 | tagLevel: asT(jsonRes['tagLevel'])!, 425 | parentTagId: asT(jsonRes['parentTagId'])!, 426 | source: asT(jsonRes['source'])!, 427 | sortIndex: asT(jsonRes['sortIndex'])!, 428 | ); 429 | 430 | @override 431 | String toString() { 432 | return jsonEncode(this); 433 | } 434 | 435 | Map toJson() => { 436 | 'tagId': tagId, 437 | 'tagName': tagName, 438 | 'tagLevel': tagLevel, 439 | 'parentTagId': parentTagId, 440 | 'source': source, 441 | 'sortIndex': sortIndex, 442 | }; 443 | 444 | Tags clone() => 445 | Tags.fromJson(asT>(jsonDecode(jsonEncode(this)))!); 446 | } 447 | 448 | class Topics { 449 | int topicId; 450 | String topicName; 451 | int level; 452 | 453 | Topics({ 454 | required this.topicId, 455 | required this.topicName, 456 | required this.level, 457 | }); 458 | 459 | factory Topics.fromJson(Map jsonRes) => Topics( 460 | topicId: asT(jsonRes['topicId'])!, 461 | topicName: asT(jsonRes['topicName'])!, 462 | level: asT(jsonRes['level'])!, 463 | ); 464 | 465 | @override 466 | String toString() { 467 | return jsonEncode(this); 468 | } 469 | 470 | Map toJson() => { 471 | 'topicId': topicId, 472 | 'topicName': topicName, 473 | 'level': level, 474 | }; 475 | 476 | Topics clone() => 477 | Topics.fromJson(asT>(jsonDecode(jsonEncode(this)))!); 478 | } 479 | 480 | class Pois { 481 | int poiType; 482 | int poiId; 483 | String poiName; 484 | int districtId; 485 | String districtName; 486 | PoiExt poiExt; 487 | int source; 488 | int isMain; 489 | bool isInChina; 490 | 491 | Pois({ 492 | required this.poiType, 493 | required this.poiId, 494 | required this.poiName, 495 | required this.districtId, 496 | required this.districtName, 497 | required this.poiExt, 498 | required this.source, 499 | required this.isMain, 500 | required this.isInChina, 501 | }); 502 | 503 | factory Pois.fromJson(Map jsonRes) { 504 | return Pois( 505 | poiType: asT(jsonRes['poiType'])!, 506 | poiId: asT(jsonRes['poiId'])!, 507 | poiName: asT(jsonRes['poiName'])!, 508 | districtId: asT(jsonRes['districtId'])!, 509 | districtName: asT(jsonRes['districtName'])!, 510 | poiExt: PoiExt.fromJson(asT>(jsonRes['poiExt'])!), 511 | source: asT(jsonRes['source'])!, 512 | isMain: asT(jsonRes['isMain'])!, 513 | isInChina: asT(jsonRes['isInChina'])!, 514 | ); 515 | } 516 | 517 | @override 518 | String toString() { 519 | return jsonEncode(this); 520 | } 521 | 522 | Map toJson() => { 523 | 'poiType': poiType, 524 | 'poiId': poiId, 525 | 'poiName': poiName, 526 | 'districtId': districtId, 527 | 'districtName': districtName, 528 | 'poiExt': poiExt, 529 | 'source': source, 530 | 'isMain': isMain, 531 | 'isInChina': isInChina, 532 | }; 533 | 534 | Pois clone() => 535 | Pois.fromJson(asT>(jsonDecode(jsonEncode(this)))!); 536 | } 537 | 538 | class PoiExt { 539 | String h5Url; 540 | String appUrl; 541 | 542 | PoiExt({ 543 | required this.h5Url, 544 | required this.appUrl, 545 | }); 546 | 547 | factory PoiExt.fromJson(Map jsonRes) { 548 | return PoiExt( 549 | h5Url: asT(jsonRes['h5Url'])!, 550 | appUrl: asT(jsonRes['appUrl'])!, 551 | ); 552 | } 553 | 554 | @override 555 | String toString() { 556 | return jsonEncode(this); 557 | } 558 | 559 | Map toJson() => { 560 | 'h5Url': h5Url, 561 | 'appUrl': appUrl, 562 | }; 563 | 564 | PoiExt clone() => 565 | PoiExt.fromJson(asT>(jsonDecode(jsonEncode(this)))!); 566 | } 567 | -------------------------------------------------------------------------------- /lib/model/travel_tab_model.dart: -------------------------------------------------------------------------------- 1 | import 'dart:convert'; 2 | 3 | import 'package:flutter_trip/util/index.dart'; 4 | 5 | /// 旅拍类别模型 6 | class TravelTabModel { 7 | String url; 8 | Map params; 9 | List tabs; 10 | 11 | TravelTabModel({ 12 | required this.url, 13 | required this.params, 14 | required this.tabs, 15 | }); 16 | 17 | factory TravelTabModel.fromJson(Map jsonRes) { 18 | final List? tabs = 19 | jsonRes['tabs'] is List ? [] : null; 20 | if (tabs != null) { 21 | for (final dynamic item in jsonRes['tabs']!) { 22 | if (item != null) { 23 | tabs.add(TravelTab.fromJson(asT>(item)!)); 24 | } 25 | } 26 | } 27 | return TravelTabModel( 28 | url: asT(jsonRes['url'])!, 29 | params: asT(jsonRes['params'])!, 30 | tabs: tabs!, 31 | ); 32 | } 33 | 34 | @override 35 | String toString() { 36 | return jsonEncode(this); 37 | } 38 | 39 | Map toJson() => { 40 | 'url': url, 41 | 'params': params, 42 | 'tabs': tabs, 43 | }; 44 | 45 | TravelTabModel clone() => TravelTabModel.fromJson( 46 | asT>(jsonDecode(jsonEncode(this)))!); 47 | } 48 | 49 | class Params { 50 | int districtId; 51 | String groupChannelCode; 52 | Object? type; 53 | double lat; 54 | double lon; 55 | int locatedDistrictId; 56 | PagePara pagePara; 57 | int imageCutType; 58 | Head head; 59 | String contentType; 60 | 61 | Params({ 62 | required this.districtId, 63 | required this.groupChannelCode, 64 | this.type, 65 | required this.lat, 66 | required this.lon, 67 | required this.locatedDistrictId, 68 | required this.pagePara, 69 | required this.imageCutType, 70 | required this.head, 71 | required this.contentType, 72 | }); 73 | 74 | factory Params.fromJson(Map jsonRes) => Params( 75 | districtId: asT(jsonRes['districtId'])!, 76 | groupChannelCode: asT(jsonRes['groupChannelCode'])!, 77 | type: asT(jsonRes['type']), 78 | lat: asT(jsonRes['lat'])!, 79 | lon: asT(jsonRes['lon'])!, 80 | locatedDistrictId: asT(jsonRes['locatedDistrictId'])!, 81 | pagePara: 82 | PagePara.fromJson(asT>(jsonRes['pagePara'])!), 83 | imageCutType: asT(jsonRes['imageCutType'])!, 84 | head: Head.fromJson(asT>(jsonRes['head'])!), 85 | contentType: asT(jsonRes['contentType'])!, 86 | ); 87 | 88 | @override 89 | String toString() { 90 | return jsonEncode(this); 91 | } 92 | 93 | Map toJson() => { 94 | 'districtId': districtId, 95 | 'groupChannelCode': groupChannelCode, 96 | 'type': type, 97 | 'lat': lat, 98 | 'lon': lon, 99 | 'locatedDistrictId': locatedDistrictId, 100 | 'pagePara': pagePara, 101 | 'imageCutType': imageCutType, 102 | 'head': head, 103 | 'contentType': contentType, 104 | }; 105 | 106 | Params clone() => 107 | Params.fromJson(asT>(jsonDecode(jsonEncode(this)))!); 108 | } 109 | 110 | class PagePara { 111 | int pageIndex; 112 | int pageSize; 113 | int sortType; 114 | int sortDirection; 115 | 116 | PagePara({ 117 | required this.pageIndex, 118 | required this.pageSize, 119 | required this.sortType, 120 | required this.sortDirection, 121 | }); 122 | 123 | factory PagePara.fromJson(Map jsonRes) => PagePara( 124 | pageIndex: asT(jsonRes['pageIndex'])!, 125 | pageSize: asT(jsonRes['pageSize'])!, 126 | sortType: asT(jsonRes['sortType'])!, 127 | sortDirection: asT(jsonRes['sortDirection'])!, 128 | ); 129 | 130 | @override 131 | String toString() { 132 | return jsonEncode(this); 133 | } 134 | 135 | Map toJson() => { 136 | 'pageIndex': pageIndex, 137 | 'pageSize': pageSize, 138 | 'sortType': sortType, 139 | 'sortDirection': sortDirection, 140 | }; 141 | 142 | PagePara clone() => PagePara.fromJson( 143 | asT>(jsonDecode(jsonEncode(this)))!); 144 | } 145 | 146 | class Head { 147 | String cid; 148 | String ctok; 149 | String cver; 150 | String lang; 151 | String sid; 152 | String syscode; 153 | Object? auth; 154 | List extension; 155 | 156 | Head({ 157 | required this.cid, 158 | required this.ctok, 159 | required this.cver, 160 | required this.lang, 161 | required this.sid, 162 | required this.syscode, 163 | this.auth, 164 | required this.extension, 165 | }); 166 | 167 | factory Head.fromJson(Map jsonRes) { 168 | final List? extension = 169 | jsonRes['extension'] is List ? [] : null; 170 | if (extension != null) { 171 | for (final dynamic item in jsonRes['extension']!) { 172 | if (item != null) { 173 | extension.add(Extension.fromJson(asT>(item)!)); 174 | } 175 | } 176 | } 177 | return Head( 178 | cid: asT(jsonRes['cid'])!, 179 | ctok: asT(jsonRes['ctok'])!, 180 | cver: asT(jsonRes['cver'])!, 181 | lang: asT(jsonRes['lang'])!, 182 | sid: asT(jsonRes['sid'])!, 183 | syscode: asT(jsonRes['syscode'])!, 184 | auth: asT(jsonRes['auth']), 185 | extension: extension!, 186 | ); 187 | } 188 | 189 | @override 190 | String toString() { 191 | return jsonEncode(this); 192 | } 193 | 194 | Map toJson() => { 195 | 'cid': cid, 196 | 'ctok': ctok, 197 | 'cver': cver, 198 | 'lang': lang, 199 | 'sid': sid, 200 | 'syscode': syscode, 201 | 'auth': auth, 202 | 'extension': extension, 203 | }; 204 | 205 | Head clone() => 206 | Head.fromJson(asT>(jsonDecode(jsonEncode(this)))!); 207 | } 208 | 209 | class Extension { 210 | String name; 211 | String value; 212 | 213 | Extension({ 214 | required this.name, 215 | required this.value, 216 | }); 217 | 218 | factory Extension.fromJson(Map jsonRes) => Extension( 219 | name: asT(jsonRes['name'])!, 220 | value: asT(jsonRes['value'])!, 221 | ); 222 | 223 | @override 224 | String toString() { 225 | return jsonEncode(this); 226 | } 227 | 228 | Map toJson() => { 229 | 'name': name, 230 | 'value': value, 231 | }; 232 | 233 | Extension clone() => Extension.fromJson( 234 | asT>(jsonDecode(jsonEncode(this)))!); 235 | } 236 | 237 | class TravelTab { 238 | String labelName; 239 | String groupChannelCode; 240 | int type; 241 | 242 | TravelTab({ 243 | required this.labelName, 244 | required this.groupChannelCode, 245 | required this.type, 246 | }); 247 | 248 | factory TravelTab.fromJson(Map jsonRes) => TravelTab( 249 | labelName: asT(jsonRes['labelName'])!, 250 | groupChannelCode: asT(jsonRes['groupChannelCode'])!, 251 | type: asT(jsonRes['type'])!, 252 | ); 253 | 254 | @override 255 | String toString() { 256 | return jsonEncode(this); 257 | } 258 | 259 | Map toJson() => { 260 | 'labelName': labelName, 261 | 'groupChannelCode': groupChannelCode, 262 | 'type': type, 263 | }; 264 | 265 | TravelTab clone() => TravelTab.fromJson( 266 | asT>(jsonDecode(jsonEncode(this)))!); 267 | } 268 | -------------------------------------------------------------------------------- /lib/navigator/tab_navigator.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_trip/pages/home_page.dart'; 3 | import 'package:flutter_trip/pages/my_page.dart'; 4 | import 'package:flutter_trip/pages/search_page.dart'; 5 | import 'package:flutter_trip/pages/travel_page.dart'; 6 | import 'package:fluttertoast/fluttertoast.dart'; 7 | import 'package:package_info/package_info.dart'; 8 | 9 | class TabNavigator extends StatefulWidget { 10 | const TabNavigator({Key? key}) : super(key: key); 11 | 12 | @override 13 | _TabNavigatorState createState() => _TabNavigatorState(); 14 | } 15 | 16 | class _TabNavigatorState extends State { 17 | PageController _controller = PageController(initialPage: 0); // 页面控制器 18 | Color _defaultColor = Colors.grey; // 默认颜色 19 | Color _activeColor = Colors.blue; // 激活态颜色 20 | int _currentIndex = 0; // 当前索引 21 | DateTime? _lastPressedAt; // 上次点击时间 22 | 23 | @override 24 | void initState() { 25 | super.initState(); 26 | getPackageInfo(); 27 | } 28 | 29 | @override 30 | void dispose() { 31 | _controller.dispose(); 32 | super.dispose(); 33 | } 34 | 35 | // 获取 packageInfo 36 | void getPackageInfo() async { 37 | PackageInfo packageInfo = await PackageInfo.fromPlatform(); 38 | String appName = packageInfo.appName; 39 | String packageName = packageInfo.packageName; 40 | String version = packageInfo.version; 41 | String buildNumber = packageInfo.buildNumber; 42 | print( 43 | 'appName:$appName,packageName:$packageName,version:$version,buildNumber:$buildNumber}'); 44 | } 45 | 46 | // 退出app 47 | Future exitApp() async { 48 | if (_lastPressedAt == null || 49 | DateTime.now().difference(_lastPressedAt!) > Duration(seconds: 2)) { 50 | Fluttertoast.showToast( 51 | msg: "再按一次退出应用", 52 | backgroundColor: Colors.grey, 53 | toastLength: Toast.LENGTH_SHORT, 54 | fontSize: 14); 55 | //两次点击间隔超过2秒则重新计时 56 | _lastPressedAt = DateTime.now(); 57 | return Future.value(false); 58 | } 59 | return Future.value(true); 60 | /*return showDialog( 61 | context: context, 62 | builder: (context) => new AlertDialog( 63 | content: new Text("是否退出"), 64 | actions: [ 65 | new FlatButton( 66 | onPressed: () => Navigator.of(context).pop(false), 67 | child: new Text("取消")), 68 | new FlatButton( 69 | onPressed: () { 70 | Navigator.of(context).pop(true); 71 | }, 72 | child: new Text("确定")) 73 | ], 74 | ));*/ 75 | } 76 | 77 | // 底部导航item 78 | BottomNavigationBarItem _bottomItem(IconData icon, String label, int index) { 79 | return BottomNavigationBarItem( 80 | icon: Icon(icon, color: _defaultColor), 81 | activeIcon: Icon(icon, color: _activeColor), 82 | label: label, 83 | ); 84 | } 85 | 86 | @override 87 | Widget build(BuildContext context) { 88 | return Scaffold( 89 | body: WillPopScope( 90 | onWillPop: exitApp, 91 | child: PageView( 92 | physics: NeverScrollableScrollPhysics(), 93 | controller: _controller, 94 | children: [ 95 | HomePage(), 96 | SearchPage(hideLeft: true), 97 | TravelPage(), 98 | MyPage() 99 | ], 100 | ), 101 | ), 102 | bottomNavigationBar: BottomNavigationBar( 103 | selectedFontSize: 12, 104 | unselectedFontSize: 12, 105 | selectedLabelStyle: TextStyle(color: _activeColor), 106 | unselectedLabelStyle: TextStyle(color: _defaultColor), 107 | currentIndex: _currentIndex, 108 | type: BottomNavigationBarType.fixed, 109 | onTap: (index) { 110 | _controller.jumpToPage(index); 111 | setState(() { 112 | _currentIndex = index; 113 | }); 114 | }, 115 | items: [ 116 | _bottomItem(Icons.home, '首页', 0), 117 | _bottomItem(Icons.search, '搜索', 1), 118 | _bottomItem(Icons.camera_alt, '旅拍', 2), 119 | _bottomItem(Icons.account_circle, '我的', 3), 120 | ], 121 | ), 122 | ); 123 | } 124 | } 125 | -------------------------------------------------------------------------------- /lib/pages/city_page.dart: -------------------------------------------------------------------------------- 1 | import 'dart:convert'; 2 | 3 | import 'package:azlistview/azlistview.dart'; 4 | import 'package:flutter/material.dart'; 5 | import 'package:flutter/services.dart'; 6 | import 'package:lpinyin/lpinyin.dart'; 7 | 8 | class CityPage extends StatefulWidget { 9 | final String city; 10 | 11 | const CityPage({Key? key, required this.city}) : super(key: key); 12 | 13 | @override 14 | _CityPageState createState() => _CityPageState(); 15 | } 16 | 17 | const CITY_NAME_LIST = ['北京市', '广州市', '成都市', '深圳市', '杭州市', '武汉市']; 18 | 19 | class _CityPageState extends State { 20 | List cityList = []; 21 | List _hotCityList = []; 22 | 23 | @override 24 | void initState() { 25 | super.initState(); 26 | CITY_NAME_LIST.forEach((value) { 27 | _hotCityList.add(CityModel(name: value, tagIndex: '★')); 28 | }); 29 | cityList.addAll(_hotCityList); 30 | SuspensionUtil.setShowSuspensionStatus(cityList); 31 | Future.delayed(Duration(milliseconds: 16), () { 32 | loadData(); 33 | }); 34 | } 35 | 36 | void loadData() { 37 | rootBundle.loadString('assets/data/china.json').then((value) { 38 | cityList.clear(); 39 | Map countyMap = json.decode(value); 40 | List list = countyMap['china']; 41 | list.forEach((v) { 42 | cityList.add(CityModel.fromJson(v)); 43 | }); 44 | _handleList(cityList); 45 | }); 46 | } 47 | 48 | void _handleList(List list) { 49 | if (list.isEmpty) return; 50 | for (int i = 0, length = list.length; i < length; i++) { 51 | String pinyin = PinyinHelper.getPinyinE(list[i].name); 52 | String tag = pinyin.substring(0, 1).toUpperCase(); 53 | list[i].namePinyin = pinyin; 54 | if (RegExp("[A-Z]").hasMatch(tag)) { 55 | list[i].tagIndex = tag; 56 | } else { 57 | list[i].tagIndex = "#"; 58 | } 59 | } 60 | 61 | // A-Z sort. 62 | SuspensionUtil.sortListBySuspensionTag(list); 63 | 64 | // add hotCityList. 65 | cityList.insertAll(0, _hotCityList); 66 | 67 | // show sus tag. 68 | SuspensionUtil.setShowSuspensionStatus(cityList); 69 | 70 | setState(() {}); 71 | } 72 | 73 | Widget header() { 74 | return Container( 75 | color: Colors.white, 76 | height: 44.0, 77 | child: Row( 78 | children: [ 79 | Expanded( 80 | child: TextField( 81 | autofocus: false, 82 | decoration: InputDecoration( 83 | contentPadding: EdgeInsets.only(left: 10, right: 10), 84 | border: InputBorder.none, 85 | labelStyle: TextStyle(fontSize: 14, color: Color(0xFF333333)), 86 | hintText: '城市中文名或拼音', 87 | hintStyle: TextStyle( 88 | fontSize: 14, 89 | color: Color(0xFFCCCCCC), 90 | ), 91 | ), 92 | ), 93 | ), 94 | Container( 95 | width: 0.33, 96 | height: 14.0, 97 | color: Color(0xFFEFEFEF), 98 | ), 99 | InkWell( 100 | onTap: () { 101 | Navigator.pop(context, widget.city); 102 | }, 103 | child: Padding( 104 | padding: const EdgeInsets.all(10.0), 105 | child: Text( 106 | "取消", 107 | style: TextStyle(color: Color(0xFF999999), fontSize: 14), 108 | ), 109 | ), 110 | ), 111 | ], 112 | ), 113 | ); 114 | } 115 | 116 | @override 117 | Widget build(BuildContext context) { 118 | return Scaffold( 119 | resizeToAvoidBottomInset: false, 120 | body: SafeArea( 121 | child: Column( 122 | children: [ 123 | header(), 124 | Expanded( 125 | child: Material( 126 | color: Color(0x80000000), 127 | child: Card( 128 | clipBehavior: Clip.hardEdge, 129 | margin: const EdgeInsets.only(left: 8, top: 8, right: 8), 130 | shape: const RoundedRectangleBorder( 131 | borderRadius: const BorderRadius.only( 132 | topLeft: Radius.circular(4.0), 133 | topRight: Radius.circular(4.0), 134 | ), 135 | ), 136 | child: Column( 137 | children: [ 138 | Container( 139 | alignment: Alignment.centerLeft, 140 | padding: const EdgeInsets.only(left: 15.0), 141 | height: 50.0, 142 | child: Text("当前城市: ${widget.city}"), 143 | ), 144 | Expanded( 145 | child: AzListView( 146 | data: cityList, 147 | itemCount: cityList.length, 148 | itemBuilder: (BuildContext context, int index) { 149 | CityModel model = cityList[index]; 150 | return Utils.getListItem(context, model); 151 | }, 152 | padding: EdgeInsets.zero, 153 | susItemBuilder: (BuildContext context, int index) { 154 | CityModel model = cityList[index]; 155 | String tag = model.getSuspensionTag(); 156 | return Utils.getSusItem(context, tag); 157 | }, 158 | indexBarData: ['★', ...kIndexBarData], 159 | ), 160 | ), 161 | ], 162 | ), 163 | ), 164 | ), 165 | ), 166 | ], 167 | ), 168 | ), 169 | ); 170 | } 171 | } 172 | 173 | class CityModel extends ISuspensionBean { 174 | String name; 175 | String? tagIndex; 176 | String? namePinyin; 177 | 178 | CityModel({ 179 | required this.name, 180 | this.tagIndex, 181 | this.namePinyin, 182 | }); 183 | 184 | CityModel.fromJson(Map json) : name = json['name']; 185 | 186 | Map toJson() => { 187 | 'name': name, 188 | }; 189 | 190 | @override 191 | String getSuspensionTag() => tagIndex!; 192 | 193 | @override 194 | String toString() => json.encode(this); 195 | } 196 | 197 | class Utils { 198 | static Widget getSusItem(BuildContext context, String tag, 199 | {double susHeight = 40}) { 200 | if (tag == '★') { 201 | tag = '★ 热门城市'; 202 | } 203 | return Container( 204 | height: susHeight, 205 | width: MediaQuery.of(context).size.width, 206 | padding: EdgeInsets.only(left: 16.0), 207 | color: Color(0xFFF3F4F5), 208 | alignment: Alignment.centerLeft, 209 | child: Text( 210 | '$tag', 211 | softWrap: false, 212 | style: TextStyle( 213 | fontSize: 14.0, 214 | color: Color(0xFF666666), 215 | ), 216 | ), 217 | ); 218 | } 219 | 220 | static Widget getListItem(BuildContext context, CityModel model, 221 | {double susHeight = 40}) { 222 | return ListTile( 223 | title: Text(model.name), 224 | onTap: () { 225 | Navigator.pop(context, model.name); 226 | }, 227 | ); 228 | } 229 | } 230 | -------------------------------------------------------------------------------- /lib/pages/home_page.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_card_swipper/flutter_card_swiper.dart'; 3 | import 'package:flutter_trip/dao/home_dao.dart'; 4 | import 'package:flutter_trip/model/home_model.dart'; 5 | import 'package:flutter_trip/pages/city_page.dart'; 6 | import 'package:flutter_trip/pages/search_page.dart'; 7 | import 'package:flutter_trip/pages/speak_page.dart'; 8 | import 'package:flutter_trip/util/navigator_util.dart'; 9 | import 'package:flutter_trip/widgets/cached_image.dart'; 10 | import 'package:flutter_trip/widgets/grid_nav.dart'; 11 | import 'package:flutter_trip/widgets/loading_container.dart'; 12 | import 'package:flutter_trip/widgets/local_nav.dart'; 13 | import 'package:flutter_trip/widgets/sales_box.dart'; 14 | import 'package:flutter_trip/widgets/search_bar.dart'; 15 | import 'package:flutter_trip/widgets/sub_nav.dart'; 16 | import 'package:flutter_trip/widgets/webview.dart'; 17 | 18 | const APPBAR_SCROLL_OFFSET = 100; 19 | const SEARCH_BAR_DEFAULT_TEXT = '网红打卡地 景点 酒店 美食'; 20 | 21 | /// 首页 22 | class HomePage extends StatefulWidget { 23 | const HomePage({Key? key}) : super(key: key); 24 | 25 | @override 26 | _HomePageState createState() => _HomePageState(); 27 | } 28 | 29 | class _HomePageState extends State 30 | with AutomaticKeepAliveClientMixin { 31 | double appBarAlpha = 0; 32 | List bannerList = []; // 轮播图列表 33 | List localNavList = []; // local导航 34 | GridNavModel? gridNav; // 网格卡片 35 | List subNavList = []; // 活动导航 36 | SalesBoxModel? salesBox; // salesBox数据 37 | bool _loading = true; // 页面加载状态 38 | String city = '西安市'; 39 | 40 | // 缓存页面 41 | @override 42 | bool get wantKeepAlive => true; 43 | 44 | @override 45 | void initState() { 46 | super.initState(); 47 | _handleRefresh(); 48 | } 49 | 50 | // 判断滚动改变透明度 51 | void _onScroll(offset) { 52 | double alpha = offset / APPBAR_SCROLL_OFFSET; 53 | if (alpha < 0) { 54 | alpha = 0; 55 | } else if (alpha > 1) { 56 | alpha = 1; 57 | } 58 | setState(() { 59 | appBarAlpha = alpha; 60 | }); 61 | } 62 | 63 | // 加载首页数据 64 | Future _handleRefresh() async { 65 | try { 66 | HomeModel model = await HomeDao.fetch(); 67 | setState(() { 68 | bannerList = model.bannerList; 69 | localNavList = model.localNavList; 70 | gridNav = model.gridNav; 71 | subNavList = model.subNavList; 72 | salesBox = model.salesBox; 73 | _loading = false; 74 | }); 75 | } catch (e) { 76 | print(e); 77 | setState(() { 78 | _loading = false; 79 | }); 80 | } 81 | } 82 | 83 | // 跳转到城市列表 84 | void _jumpToCity() async { 85 | String result = await NavigatorUtil.push(context, CityPage(city: city)); 86 | setState(() { 87 | city = result; 88 | }); 89 | } 90 | 91 | // 跳转搜索页面 92 | void _jumpToSearch() { 93 | NavigatorUtil.push(context, SearchPage(hint: SEARCH_BAR_DEFAULT_TEXT)); 94 | } 95 | 96 | // 跳转语音识别页面 97 | void _jumpToSpeak() { 98 | NavigatorUtil.push(context, SpeakPage()); 99 | } 100 | 101 | // 自定义appBar 102 | Widget get _appBar { 103 | return Column( 104 | children: [ 105 | Container( 106 | decoration: BoxDecoration( 107 | gradient: LinearGradient( 108 | colors: [Color(0x66000000), Colors.transparent], 109 | begin: Alignment.topCenter, 110 | end: Alignment.bottomCenter, 111 | ), 112 | ), 113 | child: Container( 114 | padding: EdgeInsets.fromLTRB(0, 20, 0, 0), 115 | height: 80, 116 | decoration: BoxDecoration( 117 | color: 118 | Color.fromARGB((appBarAlpha * 255).toInt(), 255, 255, 255)), 119 | child: SearchBar( 120 | city: city, 121 | searchBarType: appBarAlpha > 0.2 122 | ? SearchBarType.homeLight 123 | : SearchBarType.home, 124 | inputBoxClick: _jumpToSearch, 125 | speakClick: _jumpToSpeak, 126 | defaultText: SEARCH_BAR_DEFAULT_TEXT, 127 | leftButtonClick: _jumpToCity, 128 | rightButtonClick: () {}, 129 | onChanged: (String value) {}, 130 | ), 131 | ), 132 | ), 133 | Container( 134 | height: appBarAlpha > 0.2 ? 0.5 : 0, 135 | decoration: BoxDecoration( 136 | boxShadow: [ 137 | BoxShadow(color: Colors.black12, blurRadius: 0.5), 138 | ], 139 | ), 140 | ) 141 | ], 142 | ); 143 | } 144 | 145 | // banner 轮播图 146 | Widget get _banner { 147 | return Container( 148 | height: 160, 149 | child: Swiper( 150 | autoplay: true, 151 | loop: true, 152 | pagination: SwiperPagination(), 153 | itemCount: bannerList.length, 154 | itemBuilder: (BuildContext context, int index) { 155 | return CachedImage( 156 | imageUrl: bannerList[index].icon, 157 | fit: BoxFit.fill, 158 | ); 159 | }, 160 | onTap: (index) { 161 | NavigatorUtil.push( 162 | context, 163 | Webview( 164 | initialUrl: bannerList[index].url, 165 | hideAppBar: bannerList[index].hideAppBar, 166 | title: bannerList[index].title, 167 | ), 168 | ); 169 | }, 170 | ), 171 | ); 172 | } 173 | 174 | // listView列表 175 | Widget get _listView { 176 | return ListView( 177 | children: [ 178 | /*轮播图*/ 179 | _banner, 180 | /*local导航*/ 181 | Padding( 182 | padding: EdgeInsets.fromLTRB(7, 4, 7, 4), 183 | child: LocalNav(localNavList: localNavList), 184 | ), 185 | /*网格卡片*/ 186 | Padding( 187 | padding: EdgeInsets.fromLTRB(7, 0, 7, 4), 188 | child: GridNav(gridNav: gridNav), 189 | ), 190 | /*活动导航*/ 191 | Padding( 192 | padding: EdgeInsets.fromLTRB(7, 0, 7, 4), 193 | child: SubNav(subNavList: subNavList), 194 | ), 195 | /*底部卡片*/ 196 | Padding( 197 | padding: EdgeInsets.fromLTRB(7, 0, 7, 4), 198 | child: SalesBox(salesBox: salesBox), 199 | ), 200 | ], 201 | ); 202 | } 203 | 204 | @override 205 | Widget build(BuildContext context) { 206 | return Scaffold( 207 | backgroundColor: Color(0xfff2f2f2), 208 | body: LoadingContainer( 209 | isLoading: _loading, 210 | child: Stack( 211 | children: [ 212 | MediaQuery.removePadding( 213 | removeTop: true, 214 | context: context, 215 | child: RefreshIndicator( 216 | onRefresh: _handleRefresh, 217 | child: NotificationListener( 218 | onNotification: (scrollNotification) { 219 | if (scrollNotification is ScrollUpdateNotification && 220 | scrollNotification.depth == 0) { 221 | //滚动并且是列表滚动的时候 222 | _onScroll(scrollNotification.metrics.pixels); 223 | } 224 | return false; 225 | }, 226 | child: _listView, 227 | ), 228 | ), 229 | ), 230 | _appBar 231 | ], 232 | ), 233 | ), 234 | ); 235 | } 236 | } 237 | -------------------------------------------------------------------------------- /lib/pages/my_page.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_trip/widgets/webview.dart'; 3 | 4 | /// 个人中心页面 5 | class MyPage extends StatefulWidget { 6 | const MyPage({Key? key}) : super(key: key); 7 | 8 | @override 9 | _MyPageState createState() => _MyPageState(); 10 | } 11 | 12 | class _MyPageState extends State with AutomaticKeepAliveClientMixin { 13 | // 缓存页面 14 | @override 15 | bool get wantKeepAlive => true; 16 | 17 | @override 18 | Widget build(BuildContext context) { 19 | return Scaffold( 20 | body: Webview( 21 | initialUrl: 'https://m.ctrip.com/webapp/myctrip/', 22 | hideAppBar: true, 23 | backForbid: true, 24 | statusBarColor: '4c5bca', 25 | ), 26 | ); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /lib/pages/search_page.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_trip/dao/search_dao.dart'; 3 | import 'package:flutter_trip/model/search_model.dart'; 4 | import 'package:flutter_trip/pages/speak_page.dart'; 5 | import 'package:flutter_trip/util/navigator_util.dart'; 6 | import 'package:flutter_trip/widgets/search_bar.dart'; 7 | import 'package:flutter_trip/widgets/webview.dart'; 8 | 9 | const TYPES = [ 10 | 'channelgroup', 11 | 'gs', 12 | 'plane', 13 | 'train', 14 | 'cruise', 15 | 'district', 16 | 'food', 17 | 'hotel', 18 | 'huodong', 19 | 'shop', 20 | 'sight', 21 | 'ticket', 22 | 'travelgroup' 23 | ]; 24 | const SEARCH_BAR_DEFAULT_TEXT = '网红打卡地 景点 酒店 美食'; 25 | 26 | class SearchPage extends StatefulWidget { 27 | final bool? hideLeft; 28 | final String? searchUrl; 29 | final String? keyword; 30 | final String? hint; 31 | 32 | const SearchPage({ 33 | Key? key, 34 | this.hideLeft, 35 | this.searchUrl, 36 | this.keyword, 37 | this.hint, 38 | }) : super(key: key); 39 | 40 | @override 41 | _SearchPageState createState() => _SearchPageState(); 42 | } 43 | 44 | class _SearchPageState extends State { 45 | SearchModel? searchModel; 46 | String? keyword; 47 | 48 | @override 49 | void initState() { 50 | super.initState(); 51 | if (widget.keyword != null) { 52 | _onTextChange(widget.keyword as String); 53 | } 54 | } 55 | 56 | //输入框文本更改 57 | void _onTextChange(String text) async { 58 | keyword = text; 59 | if (text.length == 0) { 60 | setState(() { 61 | searchModel = null; 62 | }); 63 | return; 64 | } 65 | try { 66 | SearchModel model = await SearchDao.fetch(keyword!); 67 | // 只有当当前输入的内容和服务端返回的内容一致时才渲染 68 | if (model.keyword == keyword) { 69 | setState(() { 70 | searchModel = model; 71 | }); 72 | } 73 | } catch (e) { 74 | print(e); 75 | } 76 | } 77 | 78 | // 跳转语音识别页面 79 | void _jumpToSpeak() { 80 | NavigatorUtil.push(context, SpeakPage()); 81 | } 82 | 83 | // 自定义导航 84 | Widget get _appBar { 85 | return Column( 86 | children: [ 87 | Container( 88 | decoration: BoxDecoration( 89 | gradient: LinearGradient( 90 | colors: [Color(0x66000000), Colors.transparent], 91 | begin: Alignment.topCenter, 92 | end: Alignment.bottomCenter, 93 | ), 94 | ), 95 | child: Container( 96 | padding: EdgeInsets.only(top: 20), 97 | height: 80, 98 | decoration: BoxDecoration(color: Colors.white), 99 | child: SearchBar( 100 | city: '', 101 | hideLeft: widget.hideLeft, 102 | defaultText: widget.keyword ?? '', 103 | hint: widget.hint ?? SEARCH_BAR_DEFAULT_TEXT, 104 | leftButtonClick: () { 105 | Navigator.pop(context); 106 | }, 107 | onChanged: _onTextChange, 108 | speakClick: _jumpToSpeak, 109 | inputBoxClick: () {}, 110 | rightButtonClick: () {}, 111 | ), 112 | ), 113 | ), 114 | ], 115 | ); 116 | } 117 | 118 | // 搜索item结果 119 | Widget? _item(int position) { 120 | if (searchModel == null) return null; 121 | SearchItem item = searchModel!.data[position]; 122 | return GestureDetector( 123 | onTap: () { 124 | NavigatorUtil.push( 125 | context, 126 | Webview( 127 | initialUrl: item.url.replaceAll('http', 'https'), 128 | title: '详情', 129 | ), 130 | ); 131 | }, 132 | child: Container( 133 | padding: EdgeInsets.all(10), 134 | decoration: BoxDecoration( 135 | border: Border(bottom: BorderSide(width: 0.3, color: Colors.grey))), 136 | child: Row( 137 | children: [ 138 | Container( 139 | margin: EdgeInsets.all(1), 140 | child: Image( 141 | height: 26, 142 | width: 26, 143 | image: AssetImage(_typeImage(item.type)), 144 | ), 145 | ), 146 | Column( 147 | children: [ 148 | Container( 149 | width: 300, 150 | child: _title(item), 151 | ), 152 | Container( 153 | width: 300, 154 | margin: EdgeInsets.only(top: 5), 155 | child: _subTitle(item), 156 | ) 157 | ], 158 | ) 159 | ], 160 | ), 161 | ), 162 | ); 163 | } 164 | 165 | //搜索结果图片 166 | String _typeImage(String? type) { 167 | if (type == null) return 'assets/images/type_travelgroup.png'; 168 | String path = 'travelgroup'; 169 | for (final val in TYPES) { 170 | if (type.contains(val)) { 171 | path = val; 172 | break; 173 | } 174 | } 175 | return 'assets/images/type_$path.png'; 176 | } 177 | 178 | // 搜索标题 179 | Widget? _title(SearchItem? item) { 180 | if (item == null) return null; 181 | List spans = []; 182 | 183 | spans.addAll(_keywordTextSpans(item.word, searchModel!.keyword)); 184 | spans.add( 185 | TextSpan( 186 | text: ' ' + (item.districtname ?? '') + ' ' + (item.zonename ?? ''), 187 | style: TextStyle(fontSize: 12, color: Colors.grey)), 188 | ); 189 | 190 | return RichText(text: TextSpan(children: spans)); 191 | } 192 | 193 | // 搜索副标题 194 | Widget? _subTitle(SearchItem? item) { 195 | if (item == null) return null; 196 | return RichText( 197 | text: TextSpan(children: [ 198 | TextSpan( 199 | text: item.price ?? '', 200 | style: TextStyle(fontSize: 16, color: Colors.orange)), 201 | TextSpan( 202 | text: ' ' + (item.type ?? ''), 203 | style: TextStyle(fontSize: 12, color: Colors.grey)) 204 | ]), 205 | ); 206 | } 207 | 208 | //关键字高亮处理 209 | List _keywordTextSpans(String? word, String keyword) { 210 | List spans = []; 211 | if (word == null || word.length == 0) return spans; 212 | //搜索关键字高亮忽略大小写 213 | String wordL = word.toLowerCase(), keywordL = keyword.toLowerCase(); 214 | List arr = wordL.split(keywordL); 215 | TextStyle normalStyle = TextStyle(fontSize: 16, color: Colors.black87); 216 | TextStyle keywordStyle = TextStyle(fontSize: 16, color: Colors.orange); 217 | //'wordwoc'.split('w') -> [, ord, oc] 218 | int preIndex = 0; 219 | for (int i = 0; i < arr.length; i++) { 220 | if (i != 0) { 221 | //搜索关键字高亮忽略大小写 222 | preIndex = wordL.indexOf(keywordL, preIndex); 223 | spans.add( 224 | TextSpan( 225 | text: word.substring(preIndex, preIndex + keyword.length), 226 | style: keywordStyle), 227 | ); 228 | } 229 | String val = arr[i]; 230 | if (val.length > 0) { 231 | spans.add(TextSpan(text: val, style: normalStyle)); 232 | } 233 | } 234 | return spans; 235 | } 236 | 237 | @override 238 | Widget build(BuildContext context) { 239 | return Scaffold( 240 | body: Column( 241 | children: [ 242 | _appBar, 243 | MediaQuery.removePadding( 244 | removeTop: true, 245 | context: context, 246 | child: Expanded( 247 | flex: 1, 248 | child: ListView.builder( 249 | itemCount: searchModel?.data.length ?? 0, 250 | itemBuilder: (BuildContext context, int position) { 251 | return _item(position) as Widget; 252 | }, 253 | ), 254 | ), 255 | ) 256 | ], 257 | ), 258 | ); 259 | } 260 | } 261 | -------------------------------------------------------------------------------- /lib/pages/speak_page.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | /// 语音识别 4 | class SpeakPage extends StatefulWidget { 5 | const SpeakPage({Key? key}) : super(key: key); 6 | 7 | @override 8 | _SpeakPageState createState() => _SpeakPageState(); 9 | } 10 | 11 | class _SpeakPageState extends State 12 | with SingleTickerProviderStateMixin { 13 | String speakTips = '长按说话'; 14 | String speakResult = ''; 15 | late Animation animation; 16 | late AnimationController _controller; 17 | 18 | @override 19 | void initState() { 20 | super.initState(); 21 | _controller = AnimationController( 22 | vsync: this, duration: Duration(milliseconds: 1000)); 23 | animation = CurvedAnimation(parent: _controller, curve: Curves.easeIn) 24 | ..addStatusListener((status) { 25 | if (status == AnimationStatus.completed) { 26 | _controller.reverse(); 27 | } else if (status == AnimationStatus.dismissed) { 28 | _controller.forward(); 29 | } 30 | }); 31 | } 32 | 33 | @override 34 | void dispose() { 35 | _controller.dispose(); 36 | super.dispose(); 37 | } 38 | 39 | // 开始录音 40 | void _speakStart() { 41 | _controller.forward(); 42 | setState(() { 43 | speakTips = '识别中...'; 44 | }); 45 | } 46 | 47 | //结束录音 48 | void _speakStop() { 49 | setState(() { 50 | speakTips = '长按说话'; 51 | }); 52 | _controller.reset(); 53 | _controller.stop(); 54 | } 55 | 56 | // 顶部 item 57 | Widget get _topItem { 58 | return Column( 59 | children: [ 60 | Padding( 61 | padding: EdgeInsets.fromLTRB(0, 30, 0, 30), 62 | child: Text( 63 | '你可以这样说', 64 | style: TextStyle(fontSize: 16, color: Colors.black54), 65 | ), 66 | ), 67 | Text('故宫门票\n北京一日游\n迪士尼乐园', 68 | textAlign: TextAlign.center, 69 | style: TextStyle( 70 | fontSize: 15, 71 | color: Colors.grey, 72 | )), 73 | Padding( 74 | padding: EdgeInsets.all(20), 75 | child: Text( 76 | speakResult, 77 | style: TextStyle(color: Colors.blue), 78 | ), 79 | ) 80 | ], 81 | ); 82 | } 83 | 84 | // 底部 item 85 | Widget get _bottomItem { 86 | return FractionallySizedBox( 87 | widthFactor: 1, 88 | child: Stack( 89 | children: [ 90 | GestureDetector( 91 | onTapDown: (e) { 92 | _speakStart(); 93 | }, 94 | onTapUp: (e) { 95 | _speakStop(); 96 | }, 97 | onTapCancel: () { 98 | _speakStop(); 99 | }, 100 | child: Center( 101 | child: Column( 102 | children: [ 103 | Padding( 104 | padding: EdgeInsets.all(10), 105 | child: Text( 106 | speakTips, 107 | style: TextStyle(color: Colors.blue, fontSize: 12), 108 | ), 109 | ), 110 | Stack( 111 | children: [ 112 | Container( 113 | //占坑,避免动画执行过程中导致父布局大小变得 114 | height: MIC_SIZE, 115 | width: MIC_SIZE, 116 | ), 117 | Center( 118 | child: AnimatedMic( 119 | animation: animation, 120 | ), 121 | ) 122 | ], 123 | ) 124 | ], 125 | ), 126 | ), 127 | ), 128 | Positioned( 129 | right: 0, 130 | bottom: 20, 131 | child: GestureDetector( 132 | onTap: () { 133 | Navigator.pop(context); 134 | }, 135 | child: Icon( 136 | Icons.close, 137 | size: 30, 138 | color: Colors.grey, 139 | ), 140 | ), 141 | ) 142 | ], 143 | ), 144 | ); 145 | } 146 | 147 | @override 148 | Widget build(BuildContext context) { 149 | return Scaffold( 150 | body: Container( 151 | padding: EdgeInsets.all(30), 152 | child: Center( 153 | child: Column( 154 | mainAxisAlignment: MainAxisAlignment.spaceBetween, 155 | children: [ 156 | _topItem, 157 | _bottomItem, 158 | ], 159 | ), 160 | ), 161 | ), 162 | ); 163 | } 164 | } 165 | 166 | const double MIC_SIZE = 80; 167 | 168 | /// 圆球动画 169 | class AnimatedMic extends AnimatedWidget { 170 | static final _operatyTween = Tween(begin: 1, end: 0.5); 171 | static final _sizeTween = Tween(begin: MIC_SIZE, end: MIC_SIZE - 20); 172 | 173 | AnimatedMic({ 174 | Key? key, 175 | required Animation animation, 176 | }) : super(key: key, listenable: animation); 177 | 178 | @override 179 | Widget build(BuildContext context) { 180 | final animation = listenable as Animation; 181 | 182 | return Opacity( 183 | opacity: _operatyTween.evaluate(animation), 184 | child: Container( 185 | height: _sizeTween.evaluate(animation), 186 | width: _sizeTween.evaluate(animation), 187 | decoration: BoxDecoration( 188 | color: Colors.blue, 189 | borderRadius: BorderRadius.circular(MIC_SIZE / 2)), 190 | child: Icon( 191 | Icons.mic, 192 | color: Colors.white, 193 | size: 30, 194 | ), 195 | ), 196 | ); 197 | } 198 | } 199 | -------------------------------------------------------------------------------- /lib/pages/travel_page.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_trip/dao/travel_tab_dao.dart'; 3 | import 'package:flutter_trip/model/travel_tab_model.dart'; 4 | import 'package:flutter_trip/pages/travel_tab_page.dart'; 5 | 6 | /// 旅拍页面 7 | class TravelPage extends StatefulWidget { 8 | const TravelPage({Key? key}) : super(key: key); 9 | 10 | @override 11 | _TravelPageState createState() => _TravelPageState(); 12 | } 13 | 14 | class _TravelPageState extends State with TickerProviderStateMixin { 15 | late TabController _controller; 16 | List tabs = []; 17 | TravelTabModel? travelTabModel; 18 | 19 | @override 20 | void initState() { 21 | super.initState(); 22 | _loadData(); 23 | } 24 | 25 | @override 26 | void dispose() { 27 | _controller.dispose(); 28 | super.dispose(); 29 | } 30 | 31 | //初始化tab数据 32 | void _loadData() async { 33 | _controller = TabController(length: 0, vsync: this); 34 | try { 35 | TravelTabModel model = await TravelTabDao.fetch(); 36 | _controller = TabController( 37 | length: model.tabs.length, vsync: this); // fix tab label 空白问题 38 | setState(() { 39 | tabs = model.tabs; 40 | travelTabModel = model; 41 | }); 42 | } catch (e) { 43 | print(e); 44 | } 45 | } 46 | 47 | @override 48 | Widget build(BuildContext context) { 49 | return Scaffold( 50 | body: Column( 51 | children: [ 52 | Container( 53 | color: Colors.white, 54 | padding: EdgeInsets.only(top: 30), 55 | child: TabBar( 56 | controller: _controller, 57 | isScrollable: true, 58 | labelColor: Colors.black, 59 | labelPadding: EdgeInsets.fromLTRB(20, 0, 20, 5), 60 | indicator: UnderlineTabIndicator( 61 | borderSide: BorderSide(color: Color(0xff1fcfbb), width: 3), 62 | insets: EdgeInsets.only(bottom: 10), 63 | ), 64 | tabs: tabs.map( 65 | (TravelTab tab) { 66 | return Tab( 67 | text: tab.labelName, 68 | ); 69 | }, 70 | ).toList(), 71 | ), 72 | ), 73 | Flexible( 74 | child: TabBarView( 75 | controller: _controller, 76 | children: tabs.map((TravelTab tab) { 77 | return TravelTabPage( 78 | travelUrl: travelTabModel!.url, 79 | params: travelTabModel!.params, 80 | groupChannelCode: tab.groupChannelCode, 81 | type: tab.type, 82 | ); 83 | }).toList(), 84 | )), 85 | ], 86 | ), 87 | ); 88 | } 89 | } 90 | -------------------------------------------------------------------------------- /lib/pages/travel_tab_page.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_staggered_grid_view/flutter_staggered_grid_view.dart'; 3 | import 'package:flutter_trip/dao/travel_dao.dart'; 4 | import 'package:flutter_trip/model/travel_model.dart'; 5 | import 'package:flutter_trip/util/navigator_util.dart'; 6 | import 'package:flutter_trip/widgets/cached_image.dart'; 7 | import 'package:flutter_trip/widgets/loading_container.dart'; 8 | import 'package:flutter_trip/widgets/webview.dart'; 9 | 10 | const TRAVEL_URL = 11 | 'https://m.ctrip.com/restapi/soa2/16189/json/searchTripShootListForHomePageV2?_fxpcqlniredt=09031014111431397988&__gw_appid=99999999&__gw_ver=1.0&__gw_from=10650013707&__gw_platform=H5'; 12 | const PAGE_SIZE = 10; 13 | 14 | /// 旅拍tab页面 15 | class TravelTabPage extends StatefulWidget { 16 | final String travelUrl; 17 | final Map params; 18 | final String groupChannelCode; 19 | final int type; 20 | 21 | const TravelTabPage({ 22 | Key? key, 23 | required this.travelUrl, 24 | required this.params, 25 | required this.groupChannelCode, 26 | required this.type, 27 | }) : super(key: key); 28 | 29 | @override 30 | _TravelTabPageState createState() => _TravelTabPageState(); 31 | } 32 | 33 | class _TravelTabPageState extends State 34 | with AutomaticKeepAliveClientMixin { 35 | List? travelItems; 36 | int pageIndex = 1; 37 | bool _loading = true; 38 | ScrollController _scrollController = ScrollController(); 39 | 40 | // 缓存页面 41 | @override 42 | bool get wantKeepAlive => true; 43 | 44 | @override 45 | void initState() { 46 | super.initState(); 47 | _loadData(); 48 | _scrollController.addListener(() { 49 | if (_scrollController.position.pixels == 50 | _scrollController.position.maxScrollExtent) { 51 | _loadData(loadMore: true); 52 | } 53 | }); 54 | } 55 | 56 | @override 57 | void dispose() { 58 | _scrollController.dispose(); 59 | super.dispose(); 60 | } 61 | 62 | // 获取数据 63 | void _loadData({loadMore = false}) async { 64 | if (loadMore) { 65 | pageIndex++; 66 | } else { 67 | pageIndex = 1; 68 | } 69 | try { 70 | TravelModel model = await TravelDao.fetch(widget.travelUrl, widget.params, 71 | widget.groupChannelCode, widget.type, pageIndex, PAGE_SIZE); 72 | setState(() { 73 | print(model.totalCount); 74 | List items = _filterItems(model.resultList); 75 | if (travelItems != null) { 76 | travelItems!.addAll(items); 77 | } else { 78 | travelItems = items; 79 | } 80 | _loading = false; 81 | }); 82 | } catch (e) { 83 | print(e); 84 | setState(() { 85 | _loading = false; 86 | }); 87 | } 88 | } 89 | 90 | // 下拉刷新 91 | Future _handleRefresh() async { 92 | _loadData(); 93 | } 94 | 95 | //数据过滤 96 | List _filterItems(List? resultList) { 97 | if (resultList == null) return []; 98 | List filterItems = []; 99 | resultList.forEach((item) { 100 | filterItems.add(item); 101 | }); 102 | return filterItems; 103 | } 104 | 105 | @override 106 | Widget build(BuildContext context) { 107 | return Scaffold( 108 | body: LoadingContainer( 109 | isLoading: _loading, 110 | child: RefreshIndicator( 111 | onRefresh: _handleRefresh, 112 | child: MediaQuery.removePadding( 113 | removeTop: true, 114 | context: context, 115 | child: StaggeredGridView.countBuilder( 116 | controller: _scrollController, 117 | crossAxisCount: 2, 118 | itemCount: travelItems?.length ?? 0, 119 | itemBuilder: (BuildContext context, int index) => 120 | _TravelItem(index: index, item: travelItems![index]), 121 | staggeredTileBuilder: (int index) => StaggeredTile.fit(1), 122 | ), 123 | ), 124 | ), 125 | ), 126 | ); 127 | } 128 | } 129 | 130 | class _TravelItem extends StatelessWidget { 131 | final TravelItem item; 132 | final int index; 133 | 134 | const _TravelItem({ 135 | Key? key, 136 | required this.item, 137 | required this.index, 138 | }) : super(key: key); 139 | 140 | String _poiName() { 141 | return item.article.pois.length == 0 ? '未知' : item.article.pois[0].poiName; 142 | } 143 | 144 | Widget get _itemImage { 145 | return Stack( 146 | children: [ 147 | CachedImage( 148 | imageUrl: item.article.images[0].dynamicUrl, 149 | ), 150 | Positioned( 151 | bottom: 8, 152 | left: 8, 153 | child: Container( 154 | padding: EdgeInsets.fromLTRB(5, 1, 5, 1), 155 | decoration: BoxDecoration( 156 | color: Colors.black54, 157 | borderRadius: BorderRadius.circular(10), 158 | ), 159 | child: Row( 160 | children: [ 161 | Padding( 162 | padding: EdgeInsets.only(right: 3), 163 | child: Icon( 164 | Icons.location_on, 165 | color: Colors.white, 166 | size: 12, 167 | ), 168 | ), 169 | LimitedBox( 170 | maxWidth: 130, 171 | child: Text( 172 | _poiName(), 173 | maxLines: 1, 174 | overflow: TextOverflow.ellipsis, 175 | style: TextStyle(fontSize: 12, color: Colors.white), 176 | ), 177 | ), 178 | ], 179 | ), 180 | ), 181 | ), 182 | ], 183 | ); 184 | } 185 | 186 | Widget get _infoText { 187 | return Container( 188 | padding: EdgeInsets.fromLTRB(6, 0, 6, 10), 189 | child: Row( 190 | mainAxisAlignment: MainAxisAlignment.spaceBetween, 191 | children: [ 192 | Row( 193 | children: [ 194 | PhysicalModel( 195 | color: Colors.transparent, 196 | clipBehavior: Clip.antiAlias, 197 | borderRadius: BorderRadius.circular(12), 198 | child: CachedImage( 199 | imageUrl: item.article.author.coverImage.dynamicUrl, 200 | width: 24, 201 | height: 24, 202 | ), 203 | ), 204 | Container( 205 | padding: EdgeInsets.all(5), 206 | width: 90, 207 | child: Text( 208 | item.article.author.nickName, 209 | maxLines: 1, 210 | overflow: TextOverflow.ellipsis, 211 | style: TextStyle(fontSize: 12), 212 | ), 213 | ), 214 | ], 215 | ), 216 | Row( 217 | children: [ 218 | Icon( 219 | Icons.thumb_up, 220 | size: 14, 221 | color: Colors.grey, 222 | ), 223 | Padding( 224 | padding: EdgeInsets.only(left: 3), 225 | child: Text( 226 | item.article.likeCount.toString(), 227 | style: TextStyle(fontSize: 10), 228 | ), 229 | ), 230 | ], 231 | ), 232 | ], 233 | ), 234 | ); 235 | } 236 | 237 | @override 238 | Widget build(BuildContext context) { 239 | return GestureDetector( 240 | onTap: () { 241 | if (item.article.urls.length > 0) { 242 | NavigatorUtil.push( 243 | context, 244 | Webview( 245 | initialUrl: item.article.urls[0].h5Url, 246 | title: '详情', 247 | ), 248 | ); 249 | } 250 | }, 251 | child: Card( 252 | child: PhysicalModel( 253 | color: Colors.transparent, 254 | clipBehavior: Clip.antiAlias, 255 | borderRadius: BorderRadius.circular(5), 256 | child: Column( 257 | crossAxisAlignment: CrossAxisAlignment.start, 258 | children: [ 259 | _itemImage, 260 | Container( 261 | padding: EdgeInsets.all(4), 262 | child: Text( 263 | item.article.articleTitle, 264 | maxLines: 2, 265 | overflow: TextOverflow.ellipsis, 266 | style: TextStyle(fontSize: 14, color: Colors.black87), 267 | ), 268 | ), 269 | _infoText, 270 | ], 271 | ), 272 | ), 273 | ), 274 | ); 275 | } 276 | } 277 | -------------------------------------------------------------------------------- /lib/util/index.dart: -------------------------------------------------------------------------------- 1 | /// 保护方法 2 | T? asT(dynamic value) { 3 | if (value is T) { 4 | return value; 5 | } 6 | return null; 7 | } 8 | -------------------------------------------------------------------------------- /lib/util/navigator_util.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter/widgets.dart'; 3 | 4 | class NavigatorUtil { 5 | //跳转页面 6 | static push(BuildContext context, Widget page) async { 7 | final result = await Navigator.push( 8 | context, MaterialPageRoute(builder: (context) => page)); 9 | return result; 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /lib/widgets/cached_image.dart: -------------------------------------------------------------------------------- 1 | import 'package:cached_network_image/cached_network_image.dart'; 2 | import 'package:flutter/material.dart'; 3 | 4 | /// 图片缓存组件 5 | class CachedImage extends StatelessWidget { 6 | final String imageUrl; 7 | final Alignment alignment; 8 | final BoxFit? fit; 9 | final double? width; 10 | final double? height; 11 | 12 | const CachedImage({ 13 | Key? key, 14 | required this.imageUrl, 15 | this.alignment = Alignment.center, 16 | this.fit, 17 | this.width, 18 | this.height, 19 | }) : super(key: key); 20 | 21 | @override 22 | Widget build(BuildContext context) { 23 | return CachedNetworkImage( 24 | imageUrl: imageUrl, 25 | alignment: alignment, 26 | fit: fit, 27 | width: width, 28 | height: height, 29 | ); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /lib/widgets/grid_nav.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_trip/model/home_model.dart'; 3 | import 'package:flutter_trip/util/navigator_util.dart'; 4 | import 'package:flutter_trip/widgets/cached_image.dart'; 5 | import 'package:flutter_trip/widgets/webview.dart'; 6 | 7 | class GridNav extends StatelessWidget { 8 | final GridNavModel? gridNav; 9 | 10 | const GridNav({Key? key, this.gridNav}) : super(key: key); 11 | 12 | List _gridNavItems(BuildContext context) { 13 | List items = []; 14 | if (gridNav?.hotel != null) { 15 | items.add(_gridNavItem(context, gridNav!.hotel, true)); 16 | } 17 | if (gridNav?.flight != null) { 18 | items.add(_gridNavItem(context, gridNav!.flight, false)); 19 | } 20 | if (gridNav?.travel != null) { 21 | items.add(_gridNavItem(context, gridNav!.travel, false)); 22 | } 23 | 24 | return items; 25 | } 26 | 27 | Widget _gridNavItem( 28 | BuildContext context, GridNavItem gridNavItem, bool first) { 29 | List items = []; 30 | List expandItems = []; 31 | Color startColor = Color(int.parse('0xff${gridNavItem.startColor}')); 32 | Color endColor = Color(int.parse('0xff${gridNavItem.endColor}')); 33 | 34 | items.add(_mainItem(context, gridNavItem.mainItem)); 35 | items.add(_doubleItem(context, gridNavItem.item1, gridNavItem.item2)); 36 | items.add(_doubleItem(context, gridNavItem.item3, gridNavItem.item4)); 37 | 38 | items.forEach((item) { 39 | expandItems.add(Expanded( 40 | child: item, 41 | flex: 1, 42 | )); 43 | }); 44 | 45 | return Container( 46 | height: 88, 47 | margin: first ? null : EdgeInsets.only(top: 3), 48 | decoration: BoxDecoration( 49 | //渐变 50 | gradient: LinearGradient( 51 | colors: [startColor, endColor], 52 | ), 53 | ), 54 | child: Row( 55 | children: expandItems, 56 | ), 57 | ); 58 | } 59 | 60 | Widget _mainItem(BuildContext context, CommonModel model) { 61 | return _wrapGesture( 62 | context, 63 | Stack( 64 | alignment: AlignmentDirectional.topCenter, 65 | children: [ 66 | CachedImage( 67 | imageUrl: model.icon, 68 | fit: BoxFit.contain, 69 | height: 88, 70 | width: 121, 71 | alignment: Alignment.bottomCenter, 72 | ), 73 | Container( 74 | margin: EdgeInsets.only(top: 11), 75 | child: Text( 76 | model.title ?? '', 77 | style: TextStyle(fontSize: 14, color: Colors.white), 78 | ), 79 | ), 80 | ], 81 | ), 82 | model, 83 | ); 84 | } 85 | 86 | Widget _doubleItem( 87 | BuildContext context, CommonModel topItem, CommonModel bottomItem) { 88 | return Column( 89 | children: [ 90 | Expanded( 91 | child: _item( 92 | context, 93 | topItem, 94 | true, 95 | ), 96 | ), 97 | Expanded( 98 | child: _item( 99 | context, 100 | bottomItem, 101 | false, 102 | ), 103 | ), 104 | ], 105 | ); 106 | } 107 | 108 | Widget _item(BuildContext context, CommonModel item, bool first) { 109 | BorderSide borderSide = BorderSide(width: 0.8, color: Colors.white); 110 | 111 | return FractionallySizedBox( 112 | //撑满宽度 113 | widthFactor: 1, 114 | child: Container( 115 | decoration: BoxDecoration( 116 | border: Border( 117 | left: borderSide, 118 | bottom: first ? borderSide : BorderSide.none, 119 | ), 120 | ), 121 | child: _wrapGesture( 122 | context, 123 | Center( 124 | child: Text( 125 | item.title ?? '', 126 | textAlign: TextAlign.center, 127 | style: TextStyle( 128 | fontSize: 14, 129 | color: Colors.white, 130 | ), 131 | ), 132 | ), 133 | item, 134 | ), 135 | ), 136 | ); 137 | } 138 | 139 | Widget _wrapGesture(BuildContext context, Widget widget, CommonModel model) { 140 | return GestureDetector( 141 | onTap: () { 142 | NavigatorUtil.push( 143 | context, 144 | Webview( 145 | initialUrl: model.url, 146 | statusBarColor: model.statusBarColor, 147 | hideAppBar: model.hideAppBar, 148 | title: model.title, 149 | ), 150 | ); 151 | }, 152 | child: widget, 153 | ); 154 | } 155 | 156 | @override 157 | Widget build(BuildContext context) { 158 | return PhysicalModel( 159 | color: Colors.transparent, 160 | borderRadius: BorderRadius.circular(6), 161 | clipBehavior: Clip.antiAlias, 162 | child: Column( 163 | children: _gridNavItems(context), 164 | ), 165 | ); 166 | } 167 | } 168 | -------------------------------------------------------------------------------- /lib/widgets/loading_container.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | /// 进度条组件 4 | class LoadingContainer extends StatelessWidget { 5 | final Widget child; 6 | final bool isLoading; 7 | final bool cover; 8 | 9 | const LoadingContainer({ 10 | Key? key, 11 | required this.isLoading, 12 | required this.child, 13 | this.cover = false, 14 | }) : super(key: key); 15 | 16 | Widget get _loadingView { 17 | return Center( 18 | child: CircularProgressIndicator(), 19 | ); 20 | } 21 | 22 | @override 23 | Widget build(BuildContext context) { 24 | return !cover 25 | ? !isLoading 26 | ? child 27 | : _loadingView 28 | : Stack( 29 | children: [ 30 | child, 31 | isLoading ? _loadingView : null as Widget, 32 | ], 33 | ); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /lib/widgets/local_nav.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_trip/model/home_model.dart'; 3 | import 'package:flutter_trip/util/navigator_util.dart'; 4 | import 'package:flutter_trip/widgets/cached_image.dart'; 5 | import 'package:flutter_trip/widgets/webview.dart'; 6 | 7 | class LocalNav extends StatelessWidget { 8 | final List localNavList; 9 | 10 | const LocalNav({ 11 | Key? key, 12 | required this.localNavList, 13 | }) : super(key: key); 14 | 15 | Widget _items(BuildContext context) { 16 | List items = []; 17 | 18 | localNavList.forEach((model) { 19 | items.add(_item(context, model)); 20 | }); 21 | 22 | return Row( 23 | mainAxisAlignment: MainAxisAlignment.spaceBetween, 24 | children: items, 25 | ); 26 | } 27 | 28 | Widget _item(BuildContext context, CommonModel model) { 29 | return GestureDetector( 30 | onTap: () { 31 | NavigatorUtil.push( 32 | context, 33 | Webview( 34 | initialUrl: model.url, 35 | statusBarColor: model.statusBarColor, 36 | hideAppBar: model.hideAppBar, 37 | title: model.title, 38 | ), 39 | ); 40 | }, 41 | child: Column( 42 | children: [ 43 | CachedImage( 44 | imageUrl: model.icon, 45 | width: 32, 46 | height: 32, 47 | ), 48 | Text( 49 | model.title ?? '', 50 | style: TextStyle(fontSize: 12), 51 | ) 52 | ], 53 | ), 54 | ); 55 | } 56 | 57 | @override 58 | Widget build(BuildContext context) { 59 | return Container( 60 | height: 64, 61 | decoration: BoxDecoration( 62 | color: Colors.white, 63 | borderRadius: BorderRadius.circular(6), 64 | ), 65 | child: Padding( 66 | padding: EdgeInsets.all(7), 67 | child: _items(context), 68 | ), 69 | ); 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /lib/widgets/sales_box.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_trip/model/home_model.dart'; 3 | import 'package:flutter_trip/util/navigator_util.dart'; 4 | import 'package:flutter_trip/widgets/cached_image.dart'; 5 | import 'package:flutter_trip/widgets/webview.dart'; 6 | 7 | class SalesBox extends StatelessWidget { 8 | final SalesBoxModel? salesBox; 9 | 10 | const SalesBox({ 11 | Key? key, 12 | this.salesBox, 13 | }) : super(key: key); 14 | 15 | Widget _items(BuildContext context) { 16 | List items = []; 17 | items.add( 18 | _doubleItem( 19 | context, 20 | salesBox!.bigCard1, 21 | salesBox!.bigCard2, 22 | true, 23 | false, 24 | ), 25 | ); 26 | items.add( 27 | _doubleItem( 28 | context, 29 | salesBox!.smallCard1, 30 | salesBox!.smallCard2, 31 | false, 32 | false, 33 | ), 34 | ); 35 | items.add( 36 | _doubleItem( 37 | context, 38 | salesBox!.smallCard3, 39 | salesBox!.smallCard4, 40 | false, 41 | true, 42 | ), 43 | ); 44 | return Column( 45 | children: [ 46 | Container( 47 | height: 44, 48 | margin: EdgeInsets.only(left: 10), 49 | decoration: BoxDecoration( 50 | border: Border( 51 | bottom: BorderSide(width: 1, color: Color(0xfff2f2f2)))), 52 | child: Row( 53 | mainAxisAlignment: MainAxisAlignment.spaceBetween, 54 | children: [ 55 | CachedImage( 56 | imageUrl: salesBox!.icon, 57 | height: 15, 58 | fit: BoxFit.fill, 59 | ), 60 | Container( 61 | padding: EdgeInsets.fromLTRB(10, 1, 8, 1), 62 | margin: EdgeInsets.only(right: 7), 63 | decoration: BoxDecoration( 64 | borderRadius: BorderRadius.circular(12), 65 | gradient: LinearGradient( 66 | colors: [ 67 | Color(0xffff4e63), 68 | Color(0xffff6cc9), 69 | ], 70 | begin: Alignment.centerLeft, 71 | end: Alignment.centerRight)), 72 | child: GestureDetector( 73 | onTap: () { 74 | NavigatorUtil.push( 75 | context, 76 | Webview( 77 | initialUrl: salesBox!.moreUrl, 78 | title: '更多活动', 79 | ), 80 | ); 81 | }, 82 | child: Text( 83 | '获取更多福利 >', 84 | style: TextStyle( 85 | color: Colors.white, 86 | fontSize: 12, 87 | ), 88 | ), 89 | ), 90 | ) 91 | ], 92 | ), 93 | ), 94 | Row( 95 | mainAxisAlignment: MainAxisAlignment.center, 96 | children: items.sublist(0, 1), 97 | ), 98 | Row( 99 | mainAxisAlignment: MainAxisAlignment.center, 100 | children: items.sublist(1, 2), 101 | ), 102 | Row( 103 | mainAxisAlignment: MainAxisAlignment.center, 104 | children: items.sublist(2, 3), 105 | ) 106 | ], 107 | ); 108 | } 109 | 110 | Widget _doubleItem(BuildContext context, CommonModel leftCard, 111 | CommonModel rightCard, bool isBig, bool isLast) { 112 | return Row( 113 | mainAxisAlignment: MainAxisAlignment.spaceBetween, 114 | children: [ 115 | _item(context, leftCard, isBig, true, isLast), 116 | _item(context, rightCard, isBig, false, isLast), 117 | ], 118 | ); 119 | } 120 | 121 | Widget _item(BuildContext context, CommonModel model, bool isBig, bool isLeft, 122 | bool isLast) { 123 | BorderSide borderSide = BorderSide(width: 0.8, color: Color(0xfff2f2f2)); 124 | 125 | return GestureDetector( 126 | onTap: () { 127 | NavigatorUtil.push( 128 | context, 129 | Webview( 130 | initialUrl: model.url, 131 | statusBarColor: model.statusBarColor, 132 | hideAppBar: model.hideAppBar, 133 | title: model.title, 134 | ), 135 | ); 136 | }, 137 | child: Container( 138 | decoration: BoxDecoration( 139 | border: Border( 140 | right: isLeft ? borderSide : BorderSide.none, 141 | bottom: isLast ? BorderSide.none : borderSide, 142 | ), 143 | ), 144 | child: CachedImage( 145 | imageUrl: model.icon, 146 | fit: BoxFit.fill, 147 | width: MediaQuery.of(context).size.width / 2 - 8, 148 | height: isBig ? 129 : 80, 149 | ), 150 | ), 151 | ); 152 | } 153 | 154 | @override 155 | Widget build(BuildContext context) { 156 | return Container( 157 | decoration: BoxDecoration( 158 | color: Colors.white, 159 | ), 160 | child: _items(context), 161 | ); 162 | } 163 | } 164 | -------------------------------------------------------------------------------- /lib/widgets/search_bar.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | enum SearchBarType { home, normal, homeLight } 4 | 5 | class SearchBar extends StatefulWidget { 6 | final String city; 7 | final bool enabled; 8 | final bool? hideLeft; 9 | final bool autofocus; 10 | final SearchBarType? searchBarType; 11 | final String? hint; // 默认提示文案 12 | final String defaultText; 13 | final void Function() leftButtonClick; 14 | final void Function() rightButtonClick; 15 | final void Function() speakClick; 16 | final void Function() inputBoxClick; 17 | final ValueChanged onChanged; 18 | 19 | const SearchBar({ 20 | Key? key, 21 | required this.city, 22 | this.enabled = true, 23 | this.hideLeft, 24 | this.autofocus = false, 25 | this.searchBarType = SearchBarType.normal, 26 | this.hint, 27 | required this.defaultText, 28 | required this.leftButtonClick, 29 | required this.rightButtonClick, 30 | required this.speakClick, 31 | required this.inputBoxClick, 32 | required this.onChanged, 33 | }) : super(key: key); 34 | 35 | @override 36 | _SearchBarState createState() => _SearchBarState(); 37 | } 38 | 39 | class _SearchBarState extends State { 40 | bool showClear = false; 41 | final TextEditingController _controller = TextEditingController(); 42 | 43 | @override 44 | void initState() { 45 | super.initState(); 46 | _controller.text = widget.defaultText; 47 | } 48 | 49 | Color get _homeFontColor { 50 | return widget.searchBarType == SearchBarType.homeLight 51 | ? Colors.black54 52 | : Colors.white; 53 | } 54 | 55 | // 输入框内容改变 56 | void _onChanged(String text) { 57 | if (text.length > 0) { 58 | setState(() { 59 | showClear = true; 60 | }); 61 | } else { 62 | setState(() { 63 | showClear = false; 64 | }); 65 | } 66 | widget.onChanged(text); 67 | } 68 | 69 | Widget get _genNormalSearch { 70 | return Container( 71 | child: Row( 72 | children: [ 73 | _wrapTap( 74 | Container( 75 | padding: EdgeInsets.fromLTRB(6, 5, 10, 5), 76 | child: widget.hideLeft ?? false 77 | ? null 78 | : Icon( 79 | Icons.arrow_back_ios, 80 | color: Colors.grey, 81 | size: 26, 82 | ), 83 | ), 84 | widget.leftButtonClick, 85 | ), 86 | Expanded( 87 | flex: 1, 88 | child: _inputBox, 89 | ), 90 | _wrapTap( 91 | Container( 92 | padding: EdgeInsets.fromLTRB(10, 5, 10, 5), 93 | child: Text( 94 | '搜索', 95 | style: TextStyle( 96 | color: Colors.blue, 97 | fontSize: 17, 98 | ), 99 | ), 100 | ), 101 | widget.rightButtonClick), 102 | ], 103 | ), 104 | ); 105 | } 106 | 107 | Widget get _genHomeSearch { 108 | return Container( 109 | child: Row( 110 | children: [ 111 | _wrapTap( 112 | Container( 113 | padding: EdgeInsets.fromLTRB(6, 5, 5, 5), 114 | child: Row( 115 | children: [ 116 | Text( 117 | widget.city, 118 | style: TextStyle( 119 | color: _homeFontColor, 120 | fontSize: 14, 121 | ), 122 | ), 123 | Icon( 124 | Icons.expand_more, 125 | color: _homeFontColor, 126 | size: 22, 127 | ), 128 | ], 129 | ), 130 | ), 131 | widget.leftButtonClick, 132 | ), 133 | Expanded( 134 | flex: 1, 135 | child: _inputBox, 136 | ), 137 | _wrapTap( 138 | Container( 139 | padding: EdgeInsets.fromLTRB(10, 5, 10, 5), 140 | child: Icon( 141 | Icons.comment, 142 | color: _homeFontColor, 143 | size: 26, 144 | ), 145 | ), 146 | widget.rightButtonClick, 147 | ), 148 | ], 149 | ), 150 | ); 151 | } 152 | 153 | Widget _wrapTap(Widget child, void Function() callback) { 154 | return GestureDetector( 155 | onTap: () { 156 | callback(); 157 | }, 158 | child: child, 159 | ); 160 | } 161 | 162 | Widget get _inputBox { 163 | Color inputBoxColor; 164 | if (widget.searchBarType == SearchBarType.home) { 165 | inputBoxColor = Colors.white; 166 | } else { 167 | inputBoxColor = Color(int.parse('0xffEDEDED')); 168 | } 169 | return Container( 170 | height: 30, 171 | padding: EdgeInsets.fromLTRB(10, 0, 10, 0), 172 | decoration: BoxDecoration( 173 | color: inputBoxColor, 174 | borderRadius: BorderRadius.circular( 175 | widget.searchBarType == SearchBarType.normal ? 5 : 15), 176 | ), 177 | child: Row( 178 | children: [ 179 | Icon( 180 | Icons.search, 181 | size: 20, 182 | color: widget.searchBarType == SearchBarType.normal 183 | ? Color(0xffa9a9a9) 184 | : Colors.blue, 185 | ), 186 | Expanded( 187 | flex: 1, 188 | child: widget.searchBarType == SearchBarType.normal 189 | ? TextField( 190 | controller: _controller, 191 | onChanged: _onChanged, 192 | autofocus: widget.autofocus, 193 | style: TextStyle( 194 | fontSize: 18, 195 | color: Colors.black, 196 | fontWeight: FontWeight.w300, 197 | ), 198 | decoration: InputDecoration( 199 | contentPadding: EdgeInsets.only( 200 | left: 5, 201 | bottom: 14, 202 | right: 5, 203 | ), 204 | border: InputBorder.none, 205 | hintText: widget.hint ?? '', 206 | hintStyle: TextStyle(fontSize: 15), 207 | ), 208 | ) 209 | : _wrapTap( 210 | Container( 211 | child: Text( 212 | widget.defaultText, 213 | style: TextStyle(fontSize: 13, color: Colors.grey), 214 | ), 215 | ), 216 | widget.inputBoxClick, 217 | ), 218 | ), 219 | !showClear 220 | ? _wrapTap( 221 | Icon( 222 | Icons.mic, 223 | size: 22, 224 | color: widget.searchBarType == SearchBarType.normal 225 | ? Colors.blue 226 | : Colors.grey, 227 | ), 228 | widget.speakClick, 229 | ) 230 | : _wrapTap( 231 | Icon( 232 | Icons.clear, 233 | size: 22, 234 | color: Colors.grey, 235 | ), 236 | () { 237 | setState(() { 238 | _controller.clear(); 239 | }); 240 | _onChanged(''); 241 | }, 242 | ), 243 | ], 244 | ), 245 | ); 246 | } 247 | 248 | @override 249 | Widget build(BuildContext context) { 250 | return widget.searchBarType == SearchBarType.normal 251 | ? _genNormalSearch 252 | : _genHomeSearch; 253 | } 254 | } 255 | -------------------------------------------------------------------------------- /lib/widgets/sub_nav.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:flutter_trip/model/home_model.dart'; 3 | import 'package:flutter_trip/util/navigator_util.dart'; 4 | import 'package:flutter_trip/widgets/cached_image.dart'; 5 | import 'package:flutter_trip/widgets/webview.dart'; 6 | 7 | class SubNav extends StatelessWidget { 8 | final List subNavList; 9 | 10 | const SubNav({ 11 | Key? key, 12 | required this.subNavList, 13 | }) : super(key: key); 14 | 15 | Widget _items(BuildContext context) { 16 | List items = []; 17 | 18 | subNavList.forEach((model) { 19 | items.add(_item(context, model)); 20 | }); 21 | 22 | //计算出第一行显示的数量 23 | int separate = (subNavList.length / 2 + 0.5).toInt(); 24 | 25 | return Column( 26 | children: [ 27 | Row( 28 | mainAxisAlignment: MainAxisAlignment.spaceBetween, 29 | children: items.sublist(0, separate), 30 | ), 31 | Padding( 32 | padding: EdgeInsets.only(top: 10), 33 | child: Row( 34 | mainAxisAlignment: MainAxisAlignment.spaceBetween, 35 | children: items.sublist(separate, subNavList.length), 36 | ), 37 | ) 38 | ], 39 | ); 40 | } 41 | 42 | Widget _item(BuildContext context, CommonModel model) { 43 | return Expanded( 44 | flex: 1, 45 | child: GestureDetector( 46 | onTap: () { 47 | NavigatorUtil.push( 48 | context, 49 | Webview( 50 | initialUrl: model.url, 51 | statusBarColor: model.statusBarColor, 52 | hideAppBar: model.hideAppBar, 53 | title: model.title, 54 | ), 55 | ); 56 | }, 57 | child: Column( 58 | children: [ 59 | CachedImage( 60 | imageUrl: model.icon, 61 | width: 18, 62 | height: 18, 63 | ), 64 | Padding( 65 | padding: EdgeInsets.only(top: 3), 66 | child: Text( 67 | model.title ?? '', 68 | style: TextStyle(fontSize: 12), 69 | ), 70 | ), 71 | ], 72 | ), 73 | ), 74 | ); 75 | } 76 | 77 | @override 78 | Widget build(BuildContext context) { 79 | return Container( 80 | decoration: BoxDecoration( 81 | color: Colors.white, 82 | borderRadius: BorderRadius.circular(6), 83 | ), 84 | child: Padding( 85 | padding: EdgeInsets.all(7), 86 | child: _items(context), 87 | ), 88 | ); 89 | } 90 | } 91 | -------------------------------------------------------------------------------- /lib/widgets/webview.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | import 'dart:io'; 3 | import 'package:flutter/material.dart'; 4 | import 'package:webview_flutter/webview_flutter.dart'; 5 | 6 | const CATCH_URLS = ['m.ctrip.com/', 'm.ctrip.com/html5/', 'm.ctrip.com/html5']; 7 | 8 | class Webview extends StatefulWidget { 9 | late final String initialUrl; 10 | final String? statusBarColor; 11 | final String? title; 12 | final bool? hideAppBar; 13 | final bool backForbid; 14 | 15 | Webview({ 16 | Key? key, 17 | required this.initialUrl, 18 | this.statusBarColor, 19 | this.title, 20 | this.hideAppBar, 21 | this.backForbid = false, 22 | }): super(key: key); 23 | 24 | @override 25 | _WebviewState createState() => _WebviewState(); 26 | } 27 | 28 | class _WebviewState extends State { 29 | final Completer _controller = 30 | Completer(); 31 | 32 | @override 33 | void initState() { 34 | super.initState(); 35 | if (Platform.isAndroid) WebView.platform = SurfaceAndroidWebView(); 36 | } 37 | 38 | // 判断url是否是首页 39 | bool _isToMain(String url) { 40 | bool contain = false; 41 | for (final value in CATCH_URLS) { 42 | if (url.endsWith(value)) { 43 | contain = true; 44 | break; 45 | } 46 | } 47 | return contain; 48 | } 49 | 50 | // 自定义 appBar 51 | Widget _appBar(Color backgroundColor, Color backButtonColor) { 52 | if (widget.hideAppBar ?? false) { 53 | return Container( 54 | color: backButtonColor, 55 | height: 25, 56 | ); 57 | } 58 | return Container( 59 | color: backgroundColor, 60 | padding: EdgeInsets.fromLTRB(0, 40, 0, 10), 61 | child: FractionallySizedBox( 62 | widthFactor: 1, 63 | child: Stack( 64 | children: [ 65 | GestureDetector( 66 | onTap: () { 67 | Navigator.pop(context); 68 | }, 69 | child: Container( 70 | margin: EdgeInsets.only(left: 10), 71 | child: Icon( 72 | Icons.close, 73 | color: backButtonColor, 74 | size: 26, 75 | ), 76 | ), 77 | ), 78 | Positioned( 79 | left: 0, 80 | right: 0, 81 | child: Center( 82 | child: Text( 83 | widget.title ?? '', 84 | style: TextStyle( 85 | color: backButtonColor, 86 | fontSize: 20, 87 | ), 88 | ), 89 | ), 90 | ) 91 | ], 92 | ), 93 | ), 94 | ); 95 | } 96 | 97 | @override 98 | Widget build(BuildContext context) { 99 | String statusBarColorStr = widget.statusBarColor ?? 'ffffff'; 100 | Color backButtonColor; 101 | if (statusBarColorStr == 'ffffff') { 102 | backButtonColor = Colors.black; 103 | } else { 104 | backButtonColor = Colors.white; 105 | } 106 | 107 | return Scaffold( 108 | body: Column( 109 | children: [ 110 | _appBar( 111 | Color(int.parse('0xff' + statusBarColorStr)), 112 | backButtonColor, 113 | ), 114 | Expanded( 115 | child: WebView( 116 | initialUrl: widget.initialUrl, 117 | javascriptMode: JavascriptMode.unrestricted, 118 | gestureNavigationEnabled: true, 119 | onWebViewCreated: (WebViewController webViewController) { 120 | _controller.complete(webViewController); 121 | }, 122 | onProgress: (int progress) { 123 | print("WebView is loading (progress : $progress%)"); 124 | }, 125 | navigationDelegate: (NavigationRequest request) { 126 | return NavigationDecision.navigate; 127 | }, 128 | onPageStarted: (String url) { 129 | print('Page started loading: $url'); 130 | }, 131 | onPageFinished: (String url) { 132 | print('Page finished loading: $url'); 133 | }, 134 | ), 135 | ) 136 | ], 137 | ), 138 | ); 139 | } 140 | } 141 | -------------------------------------------------------------------------------- /pubspec.lock: -------------------------------------------------------------------------------- 1 | # Generated by pub 2 | # See https://dart.dev/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.8.2" 11 | azlistview: 12 | dependency: "direct main" 13 | description: 14 | name: azlistview 15 | url: "https://pub.flutter-io.cn" 16 | source: hosted 17 | version: "2.0.0-nullsafety.0" 18 | boolean_selector: 19 | dependency: transitive 20 | description: 21 | name: boolean_selector 22 | url: "https://pub.flutter-io.cn" 23 | source: hosted 24 | version: "2.1.0" 25 | cached_network_image: 26 | dependency: "direct main" 27 | description: 28 | name: cached_network_image 29 | url: "https://pub.flutter-io.cn" 30 | source: hosted 31 | version: "3.2.0" 32 | cached_network_image_platform_interface: 33 | dependency: transitive 34 | description: 35 | name: cached_network_image_platform_interface 36 | url: "https://pub.flutter-io.cn" 37 | source: hosted 38 | version: "1.0.0" 39 | cached_network_image_web: 40 | dependency: transitive 41 | description: 42 | name: cached_network_image_web 43 | url: "https://pub.flutter-io.cn" 44 | source: hosted 45 | version: "1.0.1" 46 | characters: 47 | dependency: transitive 48 | description: 49 | name: characters 50 | url: "https://pub.flutter-io.cn" 51 | source: hosted 52 | version: "1.2.0" 53 | charcode: 54 | dependency: transitive 55 | description: 56 | name: charcode 57 | url: "https://pub.flutter-io.cn" 58 | source: hosted 59 | version: "1.3.1" 60 | clock: 61 | dependency: transitive 62 | description: 63 | name: clock 64 | url: "https://pub.flutter-io.cn" 65 | source: hosted 66 | version: "1.1.0" 67 | collection: 68 | dependency: transitive 69 | description: 70 | name: collection 71 | url: "https://pub.flutter-io.cn" 72 | source: hosted 73 | version: "1.15.0" 74 | crypto: 75 | dependency: transitive 76 | description: 77 | name: crypto 78 | url: "https://pub.flutter-io.cn" 79 | source: hosted 80 | version: "3.0.1" 81 | cupertino_icons: 82 | dependency: "direct main" 83 | description: 84 | name: cupertino_icons 85 | url: "https://pub.flutter-io.cn" 86 | source: hosted 87 | version: "1.0.4" 88 | dio: 89 | dependency: "direct main" 90 | description: 91 | name: dio 92 | url: "https://pub.flutter-io.cn" 93 | source: hosted 94 | version: "4.0.4" 95 | fake_async: 96 | dependency: transitive 97 | description: 98 | name: fake_async 99 | url: "https://pub.flutter-io.cn" 100 | source: hosted 101 | version: "1.2.0" 102 | ffi: 103 | dependency: transitive 104 | description: 105 | name: ffi 106 | url: "https://pub.flutter-io.cn" 107 | source: hosted 108 | version: "1.1.2" 109 | file: 110 | dependency: transitive 111 | description: 112 | name: file 113 | url: "https://pub.flutter-io.cn" 114 | source: hosted 115 | version: "6.1.1" 116 | flutter: 117 | dependency: "direct main" 118 | description: flutter 119 | source: sdk 120 | version: "0.0.0" 121 | flutter_blurhash: 122 | dependency: transitive 123 | description: 124 | name: flutter_blurhash 125 | url: "https://pub.flutter-io.cn" 126 | source: hosted 127 | version: "0.6.0" 128 | flutter_cache_manager: 129 | dependency: transitive 130 | description: 131 | name: flutter_cache_manager 132 | url: "https://pub.flutter-io.cn" 133 | source: hosted 134 | version: "3.3.0" 135 | flutter_card_swipper: 136 | dependency: "direct main" 137 | description: 138 | name: flutter_card_swipper 139 | url: "https://pub.flutter-io.cn" 140 | source: hosted 141 | version: "0.4.0" 142 | flutter_staggered_grid_view: 143 | dependency: "direct main" 144 | description: 145 | name: flutter_staggered_grid_view 146 | url: "https://pub.flutter-io.cn" 147 | source: hosted 148 | version: "0.4.1" 149 | flutter_test: 150 | dependency: "direct dev" 151 | description: flutter 152 | source: sdk 153 | version: "0.0.0" 154 | flutter_web_plugins: 155 | dependency: transitive 156 | description: flutter 157 | source: sdk 158 | version: "0.0.0" 159 | fluttertoast: 160 | dependency: "direct main" 161 | description: 162 | name: fluttertoast 163 | url: "https://pub.flutter-io.cn" 164 | source: hosted 165 | version: "8.0.8" 166 | http: 167 | dependency: transitive 168 | description: 169 | name: http 170 | url: "https://pub.flutter-io.cn" 171 | source: hosted 172 | version: "0.13.3" 173 | http_parser: 174 | dependency: transitive 175 | description: 176 | name: http_parser 177 | url: "https://pub.flutter-io.cn" 178 | source: hosted 179 | version: "4.0.0" 180 | js: 181 | dependency: transitive 182 | description: 183 | name: js 184 | url: "https://pub.flutter-io.cn" 185 | source: hosted 186 | version: "0.6.3" 187 | lpinyin: 188 | dependency: "direct main" 189 | description: 190 | name: lpinyin 191 | url: "https://pub.flutter-io.cn" 192 | source: hosted 193 | version: "2.0.3" 194 | matcher: 195 | dependency: transitive 196 | description: 197 | name: matcher 198 | url: "https://pub.flutter-io.cn" 199 | source: hosted 200 | version: "0.12.11" 201 | meta: 202 | dependency: transitive 203 | description: 204 | name: meta 205 | url: "https://pub.flutter-io.cn" 206 | source: hosted 207 | version: "1.7.0" 208 | octo_image: 209 | dependency: transitive 210 | description: 211 | name: octo_image 212 | url: "https://pub.flutter-io.cn" 213 | source: hosted 214 | version: "1.0.0+1" 215 | package_info: 216 | dependency: "direct main" 217 | description: 218 | name: package_info 219 | url: "https://pub.flutter-io.cn" 220 | source: hosted 221 | version: "2.0.2" 222 | path: 223 | dependency: transitive 224 | description: 225 | name: path 226 | url: "https://pub.flutter-io.cn" 227 | source: hosted 228 | version: "1.8.0" 229 | path_provider: 230 | dependency: transitive 231 | description: 232 | name: path_provider 233 | url: "https://pub.flutter-io.cn" 234 | source: hosted 235 | version: "2.0.2" 236 | path_provider_linux: 237 | dependency: transitive 238 | description: 239 | name: path_provider_linux 240 | url: "https://pub.flutter-io.cn" 241 | source: hosted 242 | version: "2.0.0" 243 | path_provider_macos: 244 | dependency: transitive 245 | description: 246 | name: path_provider_macos 247 | url: "https://pub.flutter-io.cn" 248 | source: hosted 249 | version: "2.0.0" 250 | path_provider_platform_interface: 251 | dependency: transitive 252 | description: 253 | name: path_provider_platform_interface 254 | url: "https://pub.flutter-io.cn" 255 | source: hosted 256 | version: "2.0.1" 257 | path_provider_windows: 258 | dependency: transitive 259 | description: 260 | name: path_provider_windows 261 | url: "https://pub.flutter-io.cn" 262 | source: hosted 263 | version: "2.0.1" 264 | pedantic: 265 | dependency: transitive 266 | description: 267 | name: pedantic 268 | url: "https://pub.flutter-io.cn" 269 | source: hosted 270 | version: "1.11.0" 271 | platform: 272 | dependency: transitive 273 | description: 274 | name: platform 275 | url: "https://pub.flutter-io.cn" 276 | source: hosted 277 | version: "3.0.0" 278 | plugin_platform_interface: 279 | dependency: transitive 280 | description: 281 | name: plugin_platform_interface 282 | url: "https://pub.flutter-io.cn" 283 | source: hosted 284 | version: "2.0.0" 285 | process: 286 | dependency: transitive 287 | description: 288 | name: process 289 | url: "https://pub.flutter-io.cn" 290 | source: hosted 291 | version: "4.2.1" 292 | rxdart: 293 | dependency: transitive 294 | description: 295 | name: rxdart 296 | url: "https://pub.flutter-io.cn" 297 | source: hosted 298 | version: "0.27.1" 299 | scrollable_positioned_list: 300 | dependency: transitive 301 | description: 302 | name: scrollable_positioned_list 303 | url: "https://pub.flutter-io.cn" 304 | source: hosted 305 | version: "0.2.0-nullsafety.0" 306 | sky_engine: 307 | dependency: transitive 308 | description: flutter 309 | source: sdk 310 | version: "0.0.99" 311 | source_span: 312 | dependency: transitive 313 | description: 314 | name: source_span 315 | url: "https://pub.flutter-io.cn" 316 | source: hosted 317 | version: "1.8.1" 318 | sqflite: 319 | dependency: transitive 320 | description: 321 | name: sqflite 322 | url: "https://pub.flutter-io.cn" 323 | source: hosted 324 | version: "2.0.0+3" 325 | sqflite_common: 326 | dependency: transitive 327 | description: 328 | name: sqflite_common 329 | url: "https://pub.flutter-io.cn" 330 | source: hosted 331 | version: "2.0.0+2" 332 | stack_trace: 333 | dependency: transitive 334 | description: 335 | name: stack_trace 336 | url: "https://pub.flutter-io.cn" 337 | source: hosted 338 | version: "1.10.0" 339 | stream_channel: 340 | dependency: transitive 341 | description: 342 | name: stream_channel 343 | url: "https://pub.flutter-io.cn" 344 | source: hosted 345 | version: "2.1.0" 346 | string_scanner: 347 | dependency: transitive 348 | description: 349 | name: string_scanner 350 | url: "https://pub.flutter-io.cn" 351 | source: hosted 352 | version: "1.1.0" 353 | synchronized: 354 | dependency: transitive 355 | description: 356 | name: synchronized 357 | url: "https://pub.flutter-io.cn" 358 | source: hosted 359 | version: "3.0.0" 360 | term_glyph: 361 | dependency: transitive 362 | description: 363 | name: term_glyph 364 | url: "https://pub.flutter-io.cn" 365 | source: hosted 366 | version: "1.2.0" 367 | test_api: 368 | dependency: transitive 369 | description: 370 | name: test_api 371 | url: "https://pub.flutter-io.cn" 372 | source: hosted 373 | version: "0.4.3" 374 | typed_data: 375 | dependency: transitive 376 | description: 377 | name: typed_data 378 | url: "https://pub.flutter-io.cn" 379 | source: hosted 380 | version: "1.3.0" 381 | umeng_common_sdk: 382 | dependency: "direct main" 383 | description: 384 | name: umeng_common_sdk 385 | url: "https://pub.flutter-io.cn" 386 | source: hosted 387 | version: "1.2.4" 388 | uuid: 389 | dependency: transitive 390 | description: 391 | name: uuid 392 | url: "https://pub.flutter-io.cn" 393 | source: hosted 394 | version: "3.0.4" 395 | vector_math: 396 | dependency: transitive 397 | description: 398 | name: vector_math 399 | url: "https://pub.flutter-io.cn" 400 | source: hosted 401 | version: "2.1.1" 402 | webview_flutter: 403 | dependency: "direct main" 404 | description: 405 | name: webview_flutter 406 | url: "https://pub.flutter-io.cn" 407 | source: hosted 408 | version: "3.0.0" 409 | webview_flutter_android: 410 | dependency: transitive 411 | description: 412 | name: webview_flutter_android 413 | url: "https://pub.flutter-io.cn" 414 | source: hosted 415 | version: "2.8.2" 416 | webview_flutter_platform_interface: 417 | dependency: transitive 418 | description: 419 | name: webview_flutter_platform_interface 420 | url: "https://pub.flutter-io.cn" 421 | source: hosted 422 | version: "1.8.0" 423 | webview_flutter_wkwebview: 424 | dependency: transitive 425 | description: 426 | name: webview_flutter_wkwebview 427 | url: "https://pub.flutter-io.cn" 428 | source: hosted 429 | version: "2.7.1" 430 | win32: 431 | dependency: transitive 432 | description: 433 | name: win32 434 | url: "https://pub.flutter-io.cn" 435 | source: hosted 436 | version: "2.1.5" 437 | xdg_directories: 438 | dependency: transitive 439 | description: 440 | name: xdg_directories 441 | url: "https://pub.flutter-io.cn" 442 | source: hosted 443 | version: "0.2.0" 444 | sdks: 445 | dart: ">=2.14.0 <3.0.0" 446 | flutter: ">=2.5.0" 447 | -------------------------------------------------------------------------------- /pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: flutter_trip 2 | description: Flutter 仿携程网App 3 | 4 | # The following line prevents the package from being accidentally published to 5 | # pub.dev using `pub publish`. This is preferred for private packages. 6 | publish_to: 'none' # Remove this line if you wish to publish to pub.dev 7 | 8 | # The following defines the version and build number for your application. 9 | # A version number is three numbers separated by dots, like 1.2.43 10 | # followed by an optional build number separated by a +. 11 | # Both the version and the builder number may be overridden in flutter 12 | # build by specifying --build-name and --build-number, respectively. 13 | # In Android, build-name is used as versionName while build-number used as versionCode. 14 | # Read more about Android versioning at https://developer.android.com/studio/publish/versioning 15 | # In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion. 16 | # Read more about iOS versioning at 17 | # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html 18 | version: 1.1.0+5 19 | 20 | environment: 21 | sdk: ">=2.12.0 <3.0.0" 22 | 23 | dependencies: 24 | flutter: 25 | sdk: flutter 26 | 27 | 28 | # The following adds the Cupertino Icons font to your application. 29 | # Use with the CupertinoIcons class for iOS style icons. 30 | azlistview: ^2.0.0-nullsafety.0 31 | cupertino_icons: ^1.0.4 32 | cached_network_image: ^3.2.0 33 | dio: ^4.0.4 34 | flutter_card_swipper: ^0.4.0 35 | flutter_staggered_grid_view: ^0.4.1 36 | fluttertoast: ^8.0.8 37 | webview_flutter: ^3.0.0 38 | lpinyin: ^2.0.3 39 | package_info: ^2.0.2 40 | umeng_common_sdk: ^1.2.4 41 | 42 | dev_dependencies: 43 | flutter_test: 44 | sdk: flutter 45 | 46 | # For information on the generic Dart part of this file, see the 47 | # following page: https://dart.dev/tools/pub/pubspec 48 | 49 | # The following section is specific to Flutter. 50 | flutter: 51 | 52 | # The following line ensures that the Material Icons font is 53 | # included with your application, so that you can use the icons in 54 | # the material Icons class. 55 | uses-material-design: true 56 | 57 | # To add assets to your application, add an assets section, like this: 58 | assets: 59 | - assets/data/ 60 | - assets/images/ 61 | 62 | # An image asset can refer to one or more resolution-specific "variants", see 63 | # https://flutter.dev/assets-and-images/#resolution-aware. 64 | 65 | # For details regarding adding assets from package dependencies, see 66 | # https://flutter.dev/assets-and-images/#from-packages 67 | 68 | # To add custom fonts to your application, add a fonts section here, 69 | # in this "flutter" section. Each entry in this list should have a 70 | # "family" key with the font family name, and a "fonts" key with a 71 | # list giving the asset and other descriptors for the font. For 72 | # example: 73 | # fonts: 74 | # - family: Schyler 75 | # fonts: 76 | # - asset: fonts/Schyler-Regular.ttf 77 | # - asset: fonts/Schyler-Italic.ttf 78 | # style: italic 79 | # - family: Trajan Pro 80 | # fonts: 81 | # - asset: fonts/TrajanPro.ttf 82 | # - asset: fonts/TrajanPro_Bold.ttf 83 | # weight: 700 84 | # 85 | # For details regarding fonts from package dependencies, 86 | # see https://flutter.dev/custom-fonts/#from-packages 87 | -------------------------------------------------------------------------------- /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_trip/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 | --------------------------------------------------------------------------------