Commit db777d3082c5a3ed041c09986583542ff55c47f6

Authored by gaiyaguang
0 parents

OneKey-debug-v1.0.2

Showing 158 changed files with 8198 additions and 0 deletions
# Miscellaneous
*.class
*.log
*.pyc
*.swp
.DS_Store
.atom/
.buildlog/
.history
.svn/
# IntelliJ related
*.iml
*.ipr
*.iws
.idea/
# The .vscode folder contains launch configuration and tasks you configure in
# VS Code which you may wish to be included in version control, so this line
# is commented out by default.
#.vscode/
# Flutter/Dart/Pub related
**/doc/api/
.dart_tool/
.flutter-plugins
.flutter-plugins-dependencies
.packages
.pub-cache/
.pub/
/build/
# Web related
lib/generated_plugin_registrant.dart
# Exceptions to above rules.
!/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages
... ...
# This file tracks properties of this Flutter project.
# Used by Flutter tool to assess capabilities and perform upgrades etc.
#
# This file should be version controlled and should not be manually edited.
version:
revision: 27321ebbad34b0a3fafe99fac037102196d655ff
channel: stable
project_type: app
... ...
# one_key
A new Flutter application.
## Getting Started
This project is a starting point for a Flutter application.
A few resources to get you started if this is your first Flutter project:
- [Lab: Write your first Flutter app](https://flutter.dev/docs/get-started/codelab)
- [Cookbook: Useful Flutter samples](https://flutter.dev/docs/cookbook)
For help getting started with Flutter, view our
[online documentation](https://flutter.dev/docs), which offers tutorials,
samples, guidance on mobile development, and a full API reference.
... ...
gradle-wrapper.jar
/.gradle
/captures/
/gradlew
/gradlew.bat
/local.properties
GeneratedPluginRegistrant.java
... ...
{
"client":{
"cp_id":"260086000252264275",
"product_id":"9105385871708598142",
"client_id":"326681575729136832",
"client_secret":"A8D20078A192C1BD87C6B3EB5B597EF654901AE981E64701D66131A4E56A3AE9",
"app_id":"101934783",
"package_name":"com.naji.one_key",
"api_key":"CV6kBSEh4lAr9VF9v+geTdQebNtGEGQ4HcgN1igodItOCuGghaF1do+cxeVplpcEpe3pf3nwbkChLzCvkxtHvQOaPkTs"
},
"configuration_version":"1.0"
}
\ No newline at end of file
... ...
def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
localPropertiesFile.withReader('UTF-8') { reader ->
localProperties.load(reader)
}
}
def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
flutterVersionCode = '1'
}
def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
flutterVersionName = '1.0'
}
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
apply plugin: 'com.huawei.agconnect'
android {
compileSdkVersion 28
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
lintOptions {
disable 'InvalidPackage'
}
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.naji.one_key"
minSdkVersion 17
targetSdkVersion 28
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
ndk {
//选择要添加的对应 cpu 类型的 .so 库。
abiFilters 'armeabi', 'armeabi-v7a', 'x86', 'x86_64', 'mips', 'mips64', 'arm64-v8a'
}
manifestPlaceholders = [
JPUSH_PKGNAME : applicationId,
JPUSH_APPKEY : "27ceb79c44af41ad99202f7a", // NOTE: JPush 上注册的包名对应的 Appkey.
JPUSH_CHANNEL : "developer-default", //暂时填写默认值即可.
HUAWEI_APPID:"101934783",//华为平台注册的appid
XIAOMI_APPKEY : "5811835841457", // 小米平台注册的appkey
XIAOMI_APPID : "2882303761518358457", // 小米平台注册的appid
OPPO_APPKEY : "94d77d10e7bb4c60bcf18a84c8ca8bdd", // OPPO平台注册的appkey
OPPO_APPID : "30260281", // OPPO平台注册的appid
OPPO_APPSECRET: "9b7e372f93794593953f93f118619570",//OPPO平台注册的appsecret
// VIVO_APPKEY : "5811835841457", // VIVO平台注册的appkey
// VIVO_APPID : "2882303761518358457", // VIVO平台注册的appid
]
}
signingConfigs {
release {
storeFile file("./src/main/assets/xiaotao.jks")
storePassword "xt123456"
keyAlias "key0"
keyPassword "xt123456"
}
debug {
storeFile file("./src/main/assets/xiaotao.jks")
storePassword "xt123456"
keyAlias "key0"
keyPassword "xt123456"
}
}
buildTypes {
release {
minifyEnabled true
proguardFiles 'proguard-rules.pro'
signingConfig signingConfigs.release
}
debug{
minifyEnabled false
signingConfig signingConfigs.debug
}
}
}
flutter {
source '../..'
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
//华为推送
implementation 'cn.jiguang.sdk.plugin:huawei:3.5.4'
implementation 'com.huawei.hms:push:3.0.3.301'
//小米推送
implementation 'cn.jiguang.sdk.plugin:xiaomi:3.5.4'
// //OPPO推送
// implementation 'cn.jiguang.sdk.plugin:oppo:3.4.0'
//
// //vivo推送
// implementation 'cn.jiguang.sdk.plugin:vivo:3.5.4'
}
... ...
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.naji.one_key">
<!-- Flutter needs it to communicate with the running application
to allow setting breakpoints, to provide hot reload, etc.
-->
<uses-permission android:name="android.permission.INTERNET"/>
</manifest>
... ...
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.naji.one_key">
<!-- io.flutter.app.FlutterApplication is an android.app.Application that
calls FlutterMain.startInitialization(this); in its onCreate method.
In most cases you can leave this as-is, but you if you want to provide
additional functionality it is fine to subclass or reimplement
FlutterApplication and put your custom class here. -->
<application
android:name="io.flutter.app.FlutterApplication"
android:label="一键订"
android:icon="@mipmap/ic_launcher">
<activity
android:name=".MainActivity"
android:launchMode="singleTop"
android:theme="@style/LaunchTheme"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
android:hardwareAccelerated="true"
android:windowSoftInputMode="adjustResize"
android:exported="true"
>
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.DEFAULT"/>
</intent-filter>
</activity>
<service
android:name="cn.jpush.android.service.PluginHuaweiPlatformsService"
android:exported="false">
<intent-filter>
<action android:name="com.huawei.push.action.MESSAGING_EVENT" />
</intent-filter>
</service>
<!-- Don't delete the meta-data below.
This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
<meta-data
android:name="flutterEmbedding"
android:value="2" />
</application>
</manifest>
... ...
No preview for this file type
package com.naji.one_key
import android.os.Bundle
import android.os.PersistableBundle
import android.util.Log
import androidx.annotation.NonNull;
import io.flutter.embedding.android.FlutterActivity
import io.flutter.embedding.engine.FlutterEngine
import io.flutter.plugins.GeneratedPluginRegistrant
class MainActivity: FlutterActivity() {
override fun onCreate(savedInstanceState: Bundle?, persistentState: PersistableBundle?) {
super.onCreate(savedInstanceState, persistentState)
Log.d("Push-Data",this.intent.data.toString());
}
override fun configureFlutterEngine(@NonNull flutterEngine: FlutterEngine) {
GeneratedPluginRegistrant.registerWith(flutterEngine);
}
}
... ...
<?xml version="1.0" encoding="utf-8"?>
<!-- Modify this file to customize your launch splash screen -->
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@android:color/white" />
<!-- You can insert your own image assets here -->
<!-- <item>
<bitmap
android:gravity="center"
android:src="@mipmap/launch_image" />
</item> -->
</layer-list>
... ...
No preview for this file type
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="LaunchTheme" parent="@android:style/Theme.Black.NoTitleBar">
<!-- Show a splash screen on the activity. Automatically removed when
Flutter draws its first frame -->
<item name="android:windowBackground">@drawable/launch_background</item>
</style>
</resources>
... ...
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.naji.one_key">
<!-- Flutter needs it to communicate with the running application
to allow setting breakpoints, to provide hot reload, etc.
-->
<uses-permission android:name="android.permission.INTERNET"/>
</manifest>
... ...
buildscript {
ext.kotlin_version = '1.3.50'
repositories {
google()
jcenter()
maven {url 'http://developer.huawei.com/repo/'}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.huawei.agconnect:agcp:1.0.0.300'
}
}
allprojects {
repositories {
google()
jcenter()
maven {url 'http://developer.huawei.com/repo/'}
}
}
rootProject.buildDir = '../build'
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
project.evaluationDependsOn(':app')
}
task clean(type: Delete) {
delete rootProject.buildDir
}
... ...
org.gradle.jvmargs=-Xmx1536M
android.enableR8=true
android.useAndroidX=true
android.enableJetifier=true
... ...
#Fri Jun 23 08:50:38 CEST 2017
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-all.zip
... ...
include ':app'
def flutterProjectRoot = rootProject.projectDir.parentFile.toPath()
def plugins = new Properties()
def pluginsFile = new File(flutterProjectRoot.toFile(), '.flutter-plugins')
if (pluginsFile.exists()) {
pluginsFile.withReader('UTF-8') { reader -> plugins.load(reader) }
}
plugins.each { name, path ->
def pluginDirectory = flutterProjectRoot.resolve(path).resolve('android').toFile()
include ":$name"
project(":$name").projectDir = pluginDirectory
}
... ...
No preview for this file type
*.mode1v3
*.mode2v3
*.moved-aside
*.pbxuser
*.perspectivev3
**/*sync/
.sconsign.dblite
.tags*
**/.vagrant/
**/DerivedData/
Icon?
**/Pods/
**/.symlinks/
profile
xcuserdata
**/.generated/
Flutter/App.framework
Flutter/Flutter.framework
Flutter/Flutter.podspec
Flutter/Generated.xcconfig
Flutter/app.flx
Flutter/app.zip
Flutter/flutter_assets/
Flutter/flutter_export_environment.sh
ServiceDefinitions.json
Runner/GeneratedPluginRegistrant.*
# Exceptions to above rules.
!default.mode1v3
!default.mode2v3
!default.pbxuser
!default.perspectivev3
... ...
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleExecutable</key>
<string>App</string>
<key>CFBundleIdentifier</key>
<string>io.flutter.flutter.app</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>App</string>
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1.0</string>
<key>MinimumOSVersion</key>
<string>8.0</string>
</dict>
</plist>
... ...
#include "Generated.xcconfig"
... ...
#include "Generated.xcconfig"
... ...
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 46;
objects = {
/* Begin PBXBuildFile section */
1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; };
3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; };
3B80C3941E831B6300D905FE /* App.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; };
3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; };
9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; };
9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; };
97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; };
97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; };
/* End PBXBuildFile section */
/* Begin PBXCopyFilesBuildPhase section */
9705A1C41CF9048500538489 /* Embed Frameworks */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 2147483647;
dstPath = "";
dstSubfolderSpec = 10;
files = (
3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */,
9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */,
);
name = "Embed Frameworks";
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */
1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = "<group>"; };
1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = "<group>"; };
3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = "<group>"; };
3B80C3931E831B6300D905FE /* App.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = App.framework; path = Flutter/App.framework; sourceTree = "<group>"; };
74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = "<group>"; };
74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = "<group>"; };
9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = "<group>"; };
9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = "<group>"; };
9740EEBA1CF902C7004384FC /* Flutter.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Flutter.framework; path = Flutter/Flutter.framework; sourceTree = "<group>"; };
97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; };
97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
97C146EB1CF9000F007C117D /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */,
3B80C3941E831B6300D905FE /* App.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
9740EEB11CF90186004384FC /* Flutter */ = {
isa = PBXGroup;
children = (
3B80C3931E831B6300D905FE /* App.framework */,
3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */,
9740EEBA1CF902C7004384FC /* Flutter.framework */,
9740EEB21CF90195004384FC /* Debug.xcconfig */,
7AFA3C8E1D35360C0083082E /* Release.xcconfig */,
9740EEB31CF90195004384FC /* Generated.xcconfig */,
);
name = Flutter;
sourceTree = "<group>";
};
97C146E51CF9000F007C117D = {
isa = PBXGroup;
children = (
9740EEB11CF90186004384FC /* Flutter */,
97C146F01CF9000F007C117D /* Runner */,
97C146EF1CF9000F007C117D /* Products */,
);
sourceTree = "<group>";
};
97C146EF1CF9000F007C117D /* Products */ = {
isa = PBXGroup;
children = (
97C146EE1CF9000F007C117D /* Runner.app */,
);
name = Products;
sourceTree = "<group>";
};
97C146F01CF9000F007C117D /* Runner */ = {
isa = PBXGroup;
children = (
97C146FA1CF9000F007C117D /* Main.storyboard */,
97C146FD1CF9000F007C117D /* Assets.xcassets */,
97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */,
97C147021CF9000F007C117D /* Info.plist */,
97C146F11CF9000F007C117D /* Supporting Files */,
1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */,
1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */,
74858FAE1ED2DC5600515810 /* AppDelegate.swift */,
74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */,
);
path = Runner;
sourceTree = "<group>";
};
97C146F11CF9000F007C117D /* Supporting Files */ = {
isa = PBXGroup;
children = (
);
name = "Supporting Files";
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
97C146ED1CF9000F007C117D /* Runner */ = {
isa = PBXNativeTarget;
buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */;
buildPhases = (
9740EEB61CF901F6004384FC /* Run Script */,
97C146EA1CF9000F007C117D /* Sources */,
97C146EB1CF9000F007C117D /* Frameworks */,
97C146EC1CF9000F007C117D /* Resources */,
9705A1C41CF9048500538489 /* Embed Frameworks */,
3B06AD1E1E4923F5004D2608 /* Thin Binary */,
);
buildRules = (
);
dependencies = (
);
name = Runner;
productName = Runner;
productReference = 97C146EE1CF9000F007C117D /* Runner.app */;
productType = "com.apple.product-type.application";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
97C146E61CF9000F007C117D /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 1020;
ORGANIZATIONNAME = "The Chromium Authors";
TargetAttributes = {
97C146ED1CF9000F007C117D = {
CreatedOnToolsVersion = 7.3.1;
LastSwiftMigration = 1100;
};
};
};
buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */;
compatibilityVersion = "Xcode 3.2";
developmentRegion = en;
hasScannedForEncodings = 0;
knownRegions = (
en,
Base,
);
mainGroup = 97C146E51CF9000F007C117D;
productRefGroup = 97C146EF1CF9000F007C117D /* Products */;
projectDirPath = "";
projectRoot = "";
targets = (
97C146ED1CF9000F007C117D /* Runner */,
);
};
/* End PBXProject section */
/* Begin PBXResourcesBuildPhase section */
97C146EC1CF9000F007C117D /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */,
3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */,
97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */,
97C146FC1CF9000F007C117D /* Main.storyboard in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */
/* Begin PBXShellScriptBuildPhase section */
3B06AD1E1E4923F5004D2608 /* Thin Binary */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "Thin Binary";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" thin";
};
9740EEB61CF901F6004384FC /* Run Script */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "Run Script";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build";
};
/* End PBXShellScriptBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
97C146EA1CF9000F007C117D /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */,
1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin PBXVariantGroup section */
97C146FA1CF9000F007C117D /* Main.storyboard */ = {
isa = PBXVariantGroup;
children = (
97C146FB1CF9000F007C117D /* Base */,
);
name = Main.storyboard;
sourceTree = "<group>";
};
97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */ = {
isa = PBXVariantGroup;
children = (
97C147001CF9000F007C117D /* Base */,
);
name = LaunchScreen.storyboard;
sourceTree = "<group>";
};
/* End PBXVariantGroup section */
/* Begin XCBuildConfiguration section */
249021D3217E4FDB00AE95B9 /* Profile */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_NO_COMMON_BLOCKS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SUPPORTED_PLATFORMS = iphoneos;
TARGETED_DEVICE_FAMILY = "1,2";
VALIDATE_PRODUCT = YES;
};
name = Profile;
};
249021D4217E4FDB00AE95B9 /* Profile */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
ENABLE_BITCODE = NO;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/Flutter",
);
INFOPLIST_FILE = Runner/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/Flutter",
);
PRODUCT_BUNDLE_IDENTIFIER = com.naji.oneKey;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
SWIFT_VERSION = 5.0;
VERSIONING_SYSTEM = "apple-generic";
};
name = Profile;
};
97C147031CF9000F007C117D /* Debug */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = dwarf;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_DYNAMIC_NO_PIC = NO;
GCC_NO_COMMON_BLOCKS = YES;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
);
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Debug;
};
97C147041CF9000F007C117D /* Release */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_NO_COMMON_BLOCKS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SUPPORTED_PLATFORMS = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
TARGETED_DEVICE_FAMILY = "1,2";
VALIDATE_PRODUCT = YES;
};
name = Release;
};
97C147061CF9000F007C117D /* Debug */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
ENABLE_BITCODE = NO;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/Flutter",
);
INFOPLIST_FILE = Runner/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/Flutter",
);
PRODUCT_BUNDLE_IDENTIFIER = com.naji.oneKey;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 5.0;
VERSIONING_SYSTEM = "apple-generic";
};
name = Debug;
};
97C147071CF9000F007C117D /* Release */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
ENABLE_BITCODE = NO;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/Flutter",
);
INFOPLIST_FILE = Runner/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/Flutter",
);
PRODUCT_BUNDLE_IDENTIFIER = com.naji.oneKey;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
SWIFT_VERSION = 5.0;
VERSIONING_SYSTEM = "apple-generic";
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = {
isa = XCConfigurationList;
buildConfigurations = (
97C147031CF9000F007C117D /* Debug */,
97C147041CF9000F007C117D /* Release */,
249021D3217E4FDB00AE95B9 /* Profile */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */ = {
isa = XCConfigurationList;
buildConfigurations = (
97C147061CF9000F007C117D /* Debug */,
97C147071CF9000F007C117D /* Release */,
249021D4217E4FDB00AE95B9 /* Profile */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
rootObject = 97C146E61CF9000F007C117D /* Project object */;
}
... ...
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "group:Runner.xcodeproj">
</FileRef>
</Workspace>
... ...
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1020"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "97C146ED1CF9000F007C117D"
BuildableName = "Runner.app"
BlueprintName = "Runner"
ReferencedContainer = "container:Runner.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "97C146ED1CF9000F007C117D"
BuildableName = "Runner.app"
BlueprintName = "Runner"
ReferencedContainer = "container:Runner.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "97C146ED1CF9000F007C117D"
BuildableName = "Runner.app"
BlueprintName = "Runner"
ReferencedContainer = "container:Runner.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Profile"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "97C146ED1CF9000F007C117D"
BuildableName = "Runner.app"
BlueprintName = "Runner"
ReferencedContainer = "container:Runner.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
... ...
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "group:Runner.xcodeproj">
</FileRef>
</Workspace>
... ...
import UIKit
import Flutter
@UIApplicationMain
@objc class AppDelegate: FlutterAppDelegate {
override func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
) -> Bool {
GeneratedPluginRegistrant.register(with: self)
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
}
}
... ...
{
"images" : [
{
"size" : "20x20",
"idiom" : "iphone",
"filename" : "Icon-App-20x20@2x.png",
"scale" : "2x"
},
{
"size" : "20x20",
"idiom" : "iphone",
"filename" : "Icon-App-20x20@3x.png",
"scale" : "3x"
},
{
"size" : "29x29",
"idiom" : "iphone",
"filename" : "Icon-App-29x29@1x.png",
"scale" : "1x"
},
{
"size" : "29x29",
"idiom" : "iphone",
"filename" : "Icon-App-29x29@2x.png",
"scale" : "2x"
},
{
"size" : "29x29",
"idiom" : "iphone",
"filename" : "Icon-App-29x29@3x.png",
"scale" : "3x"
},
{
"size" : "40x40",
"idiom" : "iphone",
"filename" : "Icon-App-40x40@2x.png",
"scale" : "2x"
},
{
"size" : "40x40",
"idiom" : "iphone",
"filename" : "Icon-App-40x40@3x.png",
"scale" : "3x"
},
{
"size" : "60x60",
"idiom" : "iphone",
"filename" : "Icon-App-60x60@2x.png",
"scale" : "2x"
},
{
"size" : "60x60",
"idiom" : "iphone",
"filename" : "Icon-App-60x60@3x.png",
"scale" : "3x"
},
{
"size" : "20x20",
"idiom" : "ipad",
"filename" : "Icon-App-20x20@1x.png",
"scale" : "1x"
},
{
"size" : "20x20",
"idiom" : "ipad",
"filename" : "Icon-App-20x20@2x.png",
"scale" : "2x"
},
{
"size" : "29x29",
"idiom" : "ipad",
"filename" : "Icon-App-29x29@1x.png",
"scale" : "1x"
},
{
"size" : "29x29",
"idiom" : "ipad",
"filename" : "Icon-App-29x29@2x.png",
"scale" : "2x"
},
{
"size" : "40x40",
"idiom" : "ipad",
"filename" : "Icon-App-40x40@1x.png",
"scale" : "1x"
},
{
"size" : "40x40",
"idiom" : "ipad",
"filename" : "Icon-App-40x40@2x.png",
"scale" : "2x"
},
{
"size" : "76x76",
"idiom" : "ipad",
"filename" : "Icon-App-76x76@1x.png",
"scale" : "1x"
},
{
"size" : "76x76",
"idiom" : "ipad",
"filename" : "Icon-App-76x76@2x.png",
"scale" : "2x"
},
{
"size" : "83.5x83.5",
"idiom" : "ipad",
"filename" : "Icon-App-83.5x83.5@2x.png",
"scale" : "2x"
},
{
"size" : "1024x1024",
"idiom" : "ios-marketing",
"filename" : "Icon-App-1024x1024@1x.png",
"scale" : "1x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
... ...
{
"images" : [
{
"idiom" : "universal",
"filename" : "LaunchImage.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "LaunchImage@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "LaunchImage@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
... ...
# Launch Screen Assets
You can customize the launch screen with your own desired assets by replacing the image files in this directory.
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.
\ No newline at end of file
... ...
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="12121" systemVersion="16G29" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" colorMatched="YES" initialViewController="01J-lp-oVM">
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="12089"/>
</dependencies>
<scenes>
<!--View Controller-->
<scene sceneID="EHf-IW-A2E">
<objects>
<viewController id="01J-lp-oVM" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="Ydg-fD-yQy"/>
<viewControllerLayoutGuide type="bottom" id="xbc-2k-c8Z"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<imageView opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" image="LaunchImage" translatesAutoresizingMaskIntoConstraints="NO" id="YRO-k0-Ey4">
</imageView>
</subviews>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstItem="YRO-k0-Ey4" firstAttribute="centerX" secondItem="Ze5-6b-2t3" secondAttribute="centerX" id="1a2-6s-vTC"/>
<constraint firstItem="YRO-k0-Ey4" firstAttribute="centerY" secondItem="Ze5-6b-2t3" secondAttribute="centerY" id="4X2-HB-R7a"/>
</constraints>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="53" y="375"/>
</scene>
</scenes>
<resources>
<image name="LaunchImage" width="168" height="185"/>
</resources>
</document>
... ...
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="10117" systemVersion="15F34" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="BYZ-38-t0r">
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="10085"/>
</dependencies>
<scenes>
<!--Flutter View Controller-->
<scene sceneID="tne-QT-ifu">
<objects>
<viewController id="BYZ-38-t0r" customClass="FlutterViewController" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="y3c-jy-aDJ"/>
<viewControllerLayoutGuide type="bottom" id="wfy-db-euE"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="8bC-Xf-vdC">
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
</objects>
</scene>
</scenes>
</document>
... ...
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>一键订</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>$(FLUTTER_BUILD_NAME)</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>$(FLUTTER_BUILD_NUMBER)</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIMainStoryboardFile</key>
<string>Main</string>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
</dict>
</plist>
... ...
#import "GeneratedPluginRegistrant.h"
\ No newline at end of file
... ...
{
"role_name":"无",
"id":0,
"sellerid":0,
"openid":"",
"receipt_code":"",
"user_name":"无",
"user_phone":null,
"user_wechat":null,
"photo":null,
"cdate":"",
"status":0,
"qrcode":null,
"is_first":0,
"disting":0,
"add_soucre":null,
"code":0,
"uid":0,
"seat_openid":null,
"nick_name":"无"
}
\ No newline at end of file
... ...
import 'package:fluro/fluro.dart';
import 'package:flutter/material.dart';
import 'package:get_it/get_it.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'route/navigate_service.dart';
class App{
static Router router;
static GlobalKey<NavigatorState> key = GlobalKey();
static SharedPreferences sp;
static double screenWidth;
static double screenHeight;
static double statusBarHeight;
static double bottomBarHeight;
static GetIt getIt = GetIt.instance;
static initSp() async{
sp = await SharedPreferences.getInstance();
}
static setupLocator(){
getIt.registerSingleton(NavigateService());
}
}
\ No newline at end of file
... ...
//基本常量
class Constant{
static const int status_success = 200;//服务器返回成功
}
\ No newline at end of file
... ...
import 'package:dio/dio.dart';
import 'package:fluro/fluro.dart';
import 'package:flutter/material.dart';
import 'package:flutter_easyrefresh/ball_pulse_footer.dart';
import 'package:flutter_easyrefresh/easy_refresh.dart';
import 'package:flutter_easyrefresh/material_header.dart';
import 'package:fluwx/fluwx.dart';
import 'package:one_key/provider/message_dialog_model.dart';
import 'package:intl/date_symbol_data_local.dart';
import 'package:one_key/utils/utils.dart';
import 'package:provider/provider.dart';
import 'app.dart';
import 'net/dio_util.dart';
import 'net/http_url.dart';
import 'pages/login/login_page.dart';
import 'provider/user_model.dart';
import 'route/navigate_service.dart';
import 'route/routes.dart';
import 'utils/log_util.dart';
import 'package:flutter/services.dart';
Future<void> main() async {
Router router = Router();
Routes.configureRoutes(router);
App.router = router;
App.setupLocator();
LogUtil.init(isDebug: true, tag: 'ONE_KEY');
Provider.debugCheckInvalidValueType = null;
await initializeDateFormatting();
runApp(MultiProvider(
providers: [
ChangeNotifierProvider<UserModel>(
create: (_) => UserModel(),
),
ChangeNotifierProvider<MessageDialogModel>(
create: (_) => MessageDialogModel()..init(),
)
],
child: MyApp(),
));
}
class MyApp extends StatefulWidget {
@override
State<StatefulWidget> createState() {
// TODO: implement createState
return new MyAppState();
}
}
class MyAppState extends State<MyApp>{
@override
void initState() {
// TODO: implement initState
super.initState();
initDio();
_initFluwx();
Utils.changeStatusColor();
// 设置EasyRefresh的默认样式
EasyRefresh.defaultHeader = MaterialHeader();
EasyRefresh.defaultFooter = BallPulseFooter();
}
//初始化微信SDK
_initFluwx() async {
await registerWxApi(
appId: "wx85aa3cdd0f791e65",
doOnAndroid: true,
doOnIOS: true,
universalLink: "https://your.univerallink.com/link/");
var result = await isWeChatInstalled;
LogUtil.v("is installed $result");
}
initDio() {
DioUtil.openDebug();
Options options = DioUtil.getDefOptions();
options.baseUrl = HttpUrl.server_address;
HttpConfig config = new HttpConfig(
options: options, status: "ret", code: "ret", msg: "msg", data: "data");
DioUtil().setConfig(config);
}
@override
Widget build(BuildContext context) {
// TODO: implement build
return MaterialApp(
debugShowCheckedModeBanner: false,
title: '一键订',
navigatorKey: App.getIt<NavigateService>().key,
theme: ThemeData(
brightness: Brightness.light,
primaryColor: Colors.white,
splashColor: Colors.transparent,
textTheme: TextTheme(overline: TextStyle(decoration: TextDecoration.none)),
tooltipTheme: TooltipThemeData(verticalOffset: -100000)),
home: LoginPage(),
onGenerateRoute: App.router.generator,
);
}
}
... ...
///桌位区域
class Area{
String name;
int count;
Area();
factory Area.fromJson(Map<String,dynamic> json)=>Area()..name=json["name"]..count=json["count"];
Map<String,dynamic> toJson()=><String,dynamic>{"name":name,"count":count};
}
\ No newline at end of file
... ...
class Manager{
dynamic id;
String role_name;
String user_name;
String nick_name;
String user_phone;
String user_wechat;
Manager();
String get roleUserName{
return "[$role_name]--$userName";
}
String get userName{
return nick_name.isEmpty?user_name:nick_name;
}
factory Manager.fromJson(Map<String,dynamic> json)=>
Manager()
..id=json["id"]
..role_name=json["role_name"]
..user_name=json["user_name"]
..nick_name=json["nick_name"]
..user_phone=json["user_phone"]
..user_wechat=json["user_wechat"];
Map<String,dynamic> toJson()=><String,dynamic>
{
"id":id,
"role_name":role_name,
"user_name":user_name,
"nick_name":nick_name,
"user_phone":user_phone,
"user_wechat":user_wechat,
};
}
\ No newline at end of file
... ...
import 'package:json_annotation/json_annotation.dart';
part 'message.g.dart';
@JsonSerializable()
class Message {
Message();
String id;
String message_type;
String handle_time;//10在线预订 11取消预订
String read_time;
String is_read;
String is_handle;
String ddate;
String rname;
dynamic sex;
dynamic cdate;
dynamic rid;
String room_demand;
String ddate_solt;
dynamic ddate_long;
String status;
String room_info;
String get rnameStr{
switch(sex.toString()){
case "1"://先生
return rname+"先生";
case "2"://女士
return rname+"女士";
case "3"://公司
return rname+"公司";
}
}
String get cdateStr{
DateTime dateTime=DateTime.fromMillisecondsSinceEpoch(int.parse(cdate.toString())*1000);
if((DateTime.now().difference(dateTime)).inMilliseconds<60000){
return "刚刚";
}else{
return dateTime.year.toString()+"/"+(dateTime.month<10?"0"+dateTime.month.toString():dateTime.month.toString())+"/"+(dateTime.day<10?"0"+dateTime.day.toString():dateTime.day.toString());
}
}
factory Message.fromJson(Map<String,dynamic> json) => _$MessageFromJson(json);
Map<String, dynamic> toJson() => _$MessageToJson(this);
}
... ...
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'message.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
Message _$MessageFromJson(Map<String, dynamic> json) {
return Message()
..id = json['id'] as String
..message_type = json['message_type'] as String
..handle_time = json['handle_time'] as String
..read_time = json['read_time'] as String
..is_read = json['is_read'] as String
..is_handle = json['is_handle'] as String
..ddate = json['ddate'] as String
..rname = json['rname'] as String
..sex = json['sex']
..cdate = json['cdate']
..rid = json['rid']
..room_demand = json['room_demand'] as String
..ddate_solt = json['ddate_solt'] as String
..ddate_long = json['ddate_long']
..status = json['status'] as String
..room_info = json['room_info'] as String;
}
Map<String, dynamic> _$MessageToJson(Message instance) => <String, dynamic>{
'id': instance.id,
'message_type': instance.message_type,
'handle_time': instance.handle_time,
'read_time': instance.read_time,
'is_read': instance.is_read,
'is_handle': instance.is_handle,
'ddate': instance.ddate,
'rname': instance.rname,
'sex': instance.sex,
'cdate': instance.cdate,
'rid': instance.rid,
'room_demand': instance.room_demand,
'ddate_solt': instance.ddate_solt,
'ddate_long': instance.ddate_long,
'status': instance.status,
'room_info': instance.room_info
};
... ...
import 'dart:convert';
import 'package:json_annotation/json_annotation.dart';
import 'package:one_key/utils/log_util.dart';
import 'package:one_key/utils/utils.dart';
part 'notebook.g.dart';
@JsonSerializable()
class Notebook {
Notebook();
String id;
String orderid;
String openid;
String sid;
String room_demand;
String tid;
String pnum;
String pnum_str;
String rname;
String sex;
String phone;
String cusdem;
String cusman;
String cusman_openid;
String cusman_id;
String cusman_phone;
String cusman_account;
String rdate;
String edate;
String vdate;
String ddate;
String is_set_ddate;
String topic;
String ddate_solt;
String status;//订单状态 0:待确认,1:已定座,2:确认到店,3:用餐完成,4:取消预订,5:安排包间,6拒绝订单
String cause;
String abolition;
String action;
String type;
String code;
String note_openid;
String note_name;
String operator_openid;
String channel;
String cdate;
String name;
String get tableinfoStr{
return name+ "\n"+(tid.split(",").length>=2?('等'+tid.split(",").length.toString()+'桌'):'');
}
String get rnameStr{
if(rname.isEmpty)return "";
switch(sex){
case "1"://先生
return rname+"先生";
case "2"://女士
return rname+"女士";
case "3"://公司
return rname+"公司";
}
}
String get ddateStr{
String ddateStr;
if (type=="1"&&is_set_ddate=="0"){//在线预订,没有设置到店时间
switch (ddate_solt){
case "1":
ddateStr="早餐";
break;
case "2":
ddateStr="午餐";
break;
case "3":
ddateStr="晚餐";
break;
default:
ddateStr="";
break;
}
}else{
DateTime dateTime=DateTime.fromMillisecondsSinceEpoch(int.parse(ddate)*1000);
ddateStr=Utils.addZeroNumber(dateTime.hour)+":"+Utils.addZeroNumber(dateTime.minute);
}
return ddateStr;
}
String get phoneStr{
return phone.isNotEmpty?(phone.length==11?phone.replaceRange(3,7,"**"):phone):"";
}
String get operationText{
switch(status){//订单状态 0:待确认,1:已定座,2:确认到店,3:用餐完成,4:取消预订
case "1":
return "通知客户";
case "2":
return "已到店";
case "3":
return "已完成";
case "4":
return "已取消";
case "6":
return "已拒绝";
default:
return "通知客户";
}
}
factory Notebook.fromJson(Map<String,dynamic> json) => _$NotebookFromJson(json);
Map<String, dynamic> toJson() => _$NotebookToJson(this);
}
... ...
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'notebook.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
Notebook _$NotebookFromJson(Map<String, dynamic> json) {
return Notebook()
..id = json['id'] as String
..orderid = json['orderid'] as String
..openid = json['openid'] as String
..sid = json['sid'] as String
..room_demand = json['room_demand'] as String
..tid = json['tid'] as String
..pnum = json['pnum'] as String
..pnum_str = json['pnum_str'] as String
..rname = json['rname'] as String
..sex = json['sex'] as String
..phone = json['phone'] as String
..cusdem = json['cusdem'] as String
..cusman = json['cusman'] as String
..cusman_openid = json['cusman_openid'] as String
..cusman_id = json['cusman_id'] as String
..cusman_phone = json['cusman_phone'] as String
..cusman_account = json['cusman_account'] as String
..rdate = json['rdate'] as String
..edate = json['edate'] as String
..vdate = json['vdate'] as String
..ddate = json['ddate'] as String
..is_set_ddate = json['is_set_ddate'] as String
..topic = json['topic'] as String
..ddate_solt = json['ddate_solt'] as String
..status = json['status'] as String
..cause = json['cause'] as String
..abolition = json['abolition'] as String
..action = json['action'] as String
..type = json['type'] as String
..code = json['code'] as String
..note_openid = json['note_openid'] as String
..note_name = json['note_name'] as String
..operator_openid = json['operator_openid'] as String
..channel = json['channel'] as String
..cdate = json['cdate'] as String
..name = json['name'] as String;
}
Map<String, dynamic> _$NotebookToJson(Notebook instance) => <String, dynamic>{
'id': instance.id,
'orderid': instance.orderid,
'openid': instance.openid,
'sid': instance.sid,
'room_demand': instance.room_demand,
'tid': instance.tid,
'pnum': instance.pnum,
'pnum_str': instance.pnum_str,
'rname': instance.rname,
'sex': instance.sex,
'phone': instance.phone,
'cusdem': instance.cusdem,
'cusman': instance.cusman,
'cusman_openid': instance.cusman_openid,
'cusman_id': instance.cusman_id,
'cusman_phone': instance.cusman_phone,
'cusman_account': instance.cusman_account,
'rdate': instance.rdate,
'edate': instance.edate,
'vdate': instance.vdate,
'ddate': instance.ddate,
'is_set_ddate': instance.is_set_ddate,
'topic': instance.topic,
'ddate_solt': instance.ddate_solt,
'status': instance.status,
'cause': instance.cause,
'abolition': instance.abolition,
'action': instance.action,
'type': instance.type,
'code': instance.code,
'note_openid': instance.note_openid,
'note_name': instance.note_name,
'operator_openid': instance.operator_openid,
'channel': instance.channel,
'cdate': instance.cdate,
'name': instance.name
};
... ...
import 'package:json_annotation/json_annotation.dart';
import 'package:one_key/utils/utils.dart';
import 'dart:convert';
import "table.dart";
part 'notebook_detail.g.dart';
@JsonSerializable()
class NotebookDetail {
NotebookDetail();
String id;
String tableinfo;
String pnum;
String rname;
String sex;
String phone;
String cusdem;
String cusman;//客户经理
String ddate;
String is_set_ddate;
String ddate_solt;
String status="0";//订单状态 0:待确认,1:已定座,2:确认到店,3:用餐完成,4:取消预订,5:安排包间,6拒绝订单
String action;
String type;//0 内部订单 1 在线预订
String note_name;
String channel;
String cdate;
List<Table> demands;//需求桌位
List<Table> tables;//预订桌位
Cancel cancel;
String get statuImgAssets{
switch(status){
case "0":
return "assets/status_undeal.png";
case "1":
case "5":
return "assets/statu_booked.png";
case "2":
return "assets/statu_reached.png";
case "3":
return "assets/statu_finished.png";
case "4":
return "assets/statu_canceled.png";
case "6":
return "assets/statu_refuse.png";
}
}
String get ddateMd{
DateTime dateTime=DateTime.fromMillisecondsSinceEpoch(int.parse(ddate)*1000);
String md=Utils.addZeroNumber(dateTime.month)+"月"+Utils.addZeroNumber(dateTime.day)+"日";
switch (ddate_solt){
case "1":
md+=" 早餐";
break;
case "2":
md+=" 午餐";
break;
case "3":
md+=" 晚餐";
break;
}
return md;
}
String get ddateHm{
if(type=="0"||(type=="1"&&is_set_ddate=="1")){
DateTime dateTime=DateTime.fromMillisecondsSinceEpoch(int.parse(ddate)*1000);
String Hm=Utils.addZeroNumber(dateTime.hour)+":"+Utils.addZeroNumber(dateTime.minute);
return Hm;
}else{
return "";
}
}
String get ddateStr{
String ddateStr;
if (type=="1"&&is_set_ddate=="0"){//在线预订,没有设置到店时间
switch (ddate_solt){
case "1":
ddateStr="早餐";
break;
case "2":
ddateStr="午餐";
break;
case "3":
ddateStr="晚餐";
break;
default:
ddateStr="";
break;
}
}else{
DateTime dateTime=DateTime.fromMillisecondsSinceEpoch(int.parse(ddate)*1000);
ddateStr=Utils.addZeroNumber(dateTime.hour)+":"+Utils.addZeroNumber(dateTime.minute);
}
return ddateStr;
}
String get rnameStr{
if(rname.isEmpty)return "";
switch(sex){
case "1"://先生
return rname+"先生";
case "2"://女士
return rname+"女士";
case "3"://公司
return rname+"公司";
}
}
String get tableinfoStr{
return tables[0].name+ "\n"+(tables.length>=2?('等'+tables.length.toString()+'桌'):'');
}
factory NotebookDetail.fromJson(Map<String,dynamic> json) => _$NotebookDetailFromJson(json);
Map<String, dynamic> toJson() => _$NotebookDetailToJson(this);
}
@JsonSerializable()
class Cancel {
Cancel();
String uname;
String desc;
String cdate;
String get cdateStr{
DateTime dateTime=DateTime.fromMillisecondsSinceEpoch(int.parse(cdate)*1000);
return dateTime.year.toString()+"/"+Utils.addZeroNumber(dateTime.month)+"/"+Utils.addZeroNumber(dateTime.day)+" "+Utils.addZeroNumber(dateTime.hour)+":"+Utils.addZeroNumber(dateTime.minute);
}
factory Cancel.fromJson(Map<String,dynamic> json) => _$CancelFromJson(json);
Map<String, dynamic> toJson() => _$CancelToJson(this);
}
... ...
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'notebook_detail.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
NotebookDetail _$NotebookDetailFromJson(Map<String, dynamic> json) {
return NotebookDetail()
..id = json['id'] as String
..tableinfo = json['tableinfo'] as String
..pnum = json['pnum'] as String
..rname = json['rname'] as String
..sex = json['sex'] as String
..phone = json['phone'] as String
..cusdem = json['cusdem'] as String
..cusman = json['cusman'] as String
..ddate = json['ddate'] as String
..is_set_ddate = json['is_set_ddate'] as String
..ddate_solt = json['ddate_solt'] as String
..status = json['status'] as String
..action = json['action'] as String
..type = json['type'] as String
..note_name = json['note_name'] as String
..channel = json['channel'] as String
..cdate = json['cdate'] as String
..demands = (json['demands'] as List)
?.map(
(e) => e == null ? null : Table.fromJson(e as Map<String, dynamic>))
?.toList()
..tables = (json['tables'] as List)
?.map(
(e) => e == null ? null : Table.fromJson(e as Map<String, dynamic>))
?.toList()
..cancel = json['cancel'] == null
? null
: Cancel.fromJson(json['cancel'] as Map<String, dynamic>);
}
Map<String, dynamic> _$NotebookDetailToJson(NotebookDetail instance) =>
<String, dynamic>{
'id': instance.id,
'tableinfo': instance.tableinfo,
'pnum': instance.pnum,
'rname': instance.rname,
'sex': instance.sex,
'phone': instance.phone,
'cusdem': instance.cusdem,
'cusman': instance.cusman,
'ddate': instance.ddate,
'is_set_ddate': instance.is_set_ddate,
'ddate_solt': instance.ddate_solt,
'status': instance.status,
'action': instance.action,
'type': instance.type,
'note_name': instance.note_name,
'channel': instance.channel,
'cdate': instance.cdate,
'demands': instance.demands,
'tables': instance.tables,
'cancel': instance.cancel
};
Cancel _$CancelFromJson(Map<String, dynamic> json) {
return Cancel()
..uname = json['uname'] as String
..desc = json['desc'] as String
..cdate = json['cdate'] as String;
}
Map<String, dynamic> _$CancelToJson(Cancel instance) => <String, dynamic>{
'uname': instance.uname,
'desc': instance.desc,
'cdate': instance.cdate
};
... ...
import 'package:json_annotation/json_annotation.dart';
part 'table.g.dart';
@JsonSerializable()
class Table {
Table();
String id;//主键id
String rid;//关联区域id
String tid;//桌位类型 1散座 2包间 3卡座
String name;//桌位名称
String table_pnum;//桌位最少可做人数
String most_pnum;//桌位最多可做人数
String order_o;//桌位排序编号
String status;//桌位状态 0未使用 1使用中 2已删除
String tablestatus;//桌位状态 0未使用 1使用中 2已删除
String enable;//0禁用 1启用
String spell;//1拼桌
String rname;//关联区域名称
String max;//最多可做人数
String low;//最低消费
String sign;//标签 桌位状态 0:待确认,1:已定座,2:确认到店,3:用餐完成,4:取消预订,5:安排包间,6拒绝订单
String reserver;//订餐人
String notebookId;//桌位对应的预订id
bool selected;//是否选中
//获取桌位类型
String get tidStr{
switch(tid){
case "1":
return "散座";
case "2":
return "包间";
case "3":
return "卡座";
}
}
//获取桌位可坐人数
String get tableNum{
if(max!=null){
return "最多可坐$max人";
}else if(table_pnum==null){
return "";
}else{
if(table_pnum==most_pnum){
return "$table_pnum人";
}else{
return "$table_pnum-$most_pnum人";
}
}
}
//获取最低消费
String get lowStr{
return low==null?"":"最低消费$low元";
}
String get signStr{
if(enable=="0")return "已停用";
if(sign!=null){
switch(sign){
case "1"://已预订
case "5"://已安排包间
return "已预订";
case "2"://用餐中
return "用餐中";
default:
return "";
}
}
return "";
}
factory Table.fromJson(Map<String,dynamic> json) => _$TableFromJson(json);
Map<String, dynamic> toJson() => _$TableToJson(this);
@override
String toString() {
return 'Table{id: $id, rid: $rid, tid: $tid, name: $name, table_pnum: $table_pnum, most_pnum: $most_pnum, order_o: $order_o, status: $status, tablestatus: $tablestatus, enable: $enable, spell: $spell, rname: $rname, max: $max, low: $low}';
}
}
... ...
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'table.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
Table _$TableFromJson(Map<String, dynamic> json) {
return Table()
..id = json['id'] as String
..rid = json['rid'] as String
..tid = json['tid'] as String
..name = json['name'] as String
..table_pnum = json['table_pnum'] as String
..most_pnum = json['most_pnum'] as String
..order_o = json['order_o'] as String
..status = json['status'] as String
..tablestatus = json['tablestatus'] as String
..enable = json['enable'] as String
..spell = json['spell'] as String
..rname = json['rname'] as String
..max = json['max'] as String
..low = json['low'] as String
..sign=json['sign'] as String
..reserver=json['reserver'] as String
..notebookId=json['notebookId'] as String
..selected=json["selected"] as bool;
}
Map<String, dynamic> _$TableToJson(Table instance) => <String, dynamic>{
'id': instance.id,
'rid': instance.rid,
'tid': instance.tid,
'name': instance.name,
'table_pnum': instance.table_pnum,
'most_pnum': instance.most_pnum,
'order_o': instance.order_o,
'status': instance.status,
'tablestatus': instance.tablestatus,
'enable': instance.enable,
'spell': instance.spell,
'rname': instance.rname,
'max': instance.max,
'low': instance.low,
'sign':instance.sign,
'reserver':instance.reserver,
'notebookId':instance.notebookId,
'selected':instance.selected
};
... ...
import 'package:one_key/models/table.dart';
class TableOuter{
String name;
List<Table> list;
TableOuter();
factory TableOuter.fromJson(Map<String,dynamic> json)=>TableOuter()..name=json["name"]..list=json["list"] ;
Map<String,dynamic> toJson()=>{"name":name,"list":list};
@override
String toString() {
return 'TableOuter{name: $name, list: $list}';
}
}
\ No newline at end of file
... ...
import 'package:json_annotation/json_annotation.dart';
part 'user.g.dart';
//User实体类
@JsonSerializable()
class User{
String openid;//商户openid
String account;//账号
String role_name;//角色名称
String sellerid;//商户id
String sellercode;//商户编号
String sellername;//商户名称
String sellerphone;//商户电话
String sellerAddr;//商户地址
int scatter;//是否有散座 0无 1有
int room;//是否有包间 0无 1有
int cassette;//是否有卡座 0无 1有
String morning;//早市时间段
String noon;//午市时间段
String night;//晚市时间段
User(this.openid, this.account, this.role_name, this.sellerid,
this.sellercode, this.sellername, this.sellerphone, this.sellerAddr,
this.scatter, this.room, this.cassette, this.morning, this.noon,
this.night);
factory User.fromJson(Map<String,dynamic> json) => _$UserFromJson(json);
Map<String,dynamic> toJson() => _$UserToJson(this);
@override
String toString() {
return 'User{openid: $openid, account: $account, role_name: $role_name, sellerid: $sellerid, sellercode: $sellercode, sellername: $sellername, sellerphone: $sellerphone, sellerAddr: $sellerAddr, scatter: $scatter, room: $room, cassette: $cassette, morning: $morning, noon: $noon, night: $night}';
}
}
\ No newline at end of file
... ...
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'user.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
User _$UserFromJson(Map<String, dynamic> json) {
return User(
json['openid'] as String,
json['account'] as String,
json['role_name'] as String,
json['sellerid'] as String,
json['sellercode'] as String,
json['sellername'] as String,
json['sellerphone'] as String,
json['sellerAddr'] as String,
json['scatter'] as int,
json['room'] as int,
json['cassette'] as int,
json['morning'] as String,
json['noon'] as String,
json['night'] as String);
}
Map<String, dynamic> _$UserToJson(User instance) => <String, dynamic>{
'openid': instance.openid,
'account': instance.account,
'role_name': instance.role_name,
'sellerid': instance.sellerid,
'sellercode': instance.sellercode,
'sellername': instance.sellername,
'sellerphone': instance.sellerphone,
'sellerAddr': instance.sellerAddr,
'scatter': instance.scatter,
'room': instance.room,
'cassette': instance.cassette,
'morning': instance.morning,
'noon': instance.noon,
'night': instance.night
};
... ...
import 'package:dio/dio.dart';
/// <BaseResp<T> 返回 status code msg data.
class BaseResp<T> {
String status;
int code;
String msg;
T data;
BaseResp(this.status, this.code, this.msg, this.data);
@override
String toString() {
StringBuffer sb = new StringBuffer('{');
sb.write("\"status\":\"$status\"");
sb.write(",\"code\":$code");
sb.write(",\"msg\":\"$msg\"");
sb.write(",\"data\":\"$data\"");
sb.write('}');
return sb.toString();
}
}
/// <BaseRespR<T> 返回 status code msg data Response.
class BaseRespR<T> {
String status;
int code;
String msg;
T data;
Response response;
BaseRespR(this.status, this.code, this.msg, this.data, this.response);
@override
String toString() {
StringBuffer sb = new StringBuffer('{');
sb.write("\"status\":\"$status\"");
sb.write(",\"code\":$code");
sb.write(",\"msg\":\"$msg\"");
sb.write(",\"data\":\"$data\"");
sb.write('}');
return sb.toString();
}
}
... ...
import 'dart:convert';
import 'dart:io';
import 'package:dio/dio.dart';
import 'package:flutter/material.dart';
import 'package:one_key/widgets/loading.dart';
import 'base_resp.dart';
/**
* @Author: thl
* @GitHub: https://github.com/Sky24n
* @JianShu: https://www.jianshu.com/u/cbf2ad25d33a
* @Email: 863764940@qq.com
* @Description: Dio Util.
* @Date: 2018/12/19
*/
/// 请求方法.
class Method {
static final String get = "GET";
static final String post = "POST";
static final String put = "PUT";
static final String head = "HEAD";
static final String delete = "DELETE";
static final String patch = "PATCH";
}
///Http配置.
class HttpConfig {
/// constructor.
HttpConfig({
this.status,
this.code,
this.msg,
this.data,
this.options,
this.pem,
this.pKCSPath,
this.pKCSPwd,
});
/// BaseResp [String status]字段 key, 默认:status.
String status;
/// BaseResp [int code]字段 key, 默认:errorCode.
String code;
/// BaseResp [String msg]字段 key, 默认:errorMsg.
String msg;
/// BaseResp [T data]字段 key, 默认:data.
String data;
/// Options.
Options options;
/// 详细使用请查看dio官网 https://github.com/flutterchina/dio/blob/flutter/README-ZH.md#Https证书校验.
/// PEM证书内容.
String pem;
/// 详细使用请查看dio官网 https://github.com/flutterchina/dio/blob/flutter/README-ZH.md#Https证书校验.
/// PKCS12 证书路径.
String pKCSPath;
/// 详细使用请查看dio官网 https://github.com/flutterchina/dio/blob/flutter/README-ZH.md#Https证书校验.
/// PKCS12 证书密码.
String pKCSPwd;
}
/// 单例 DioUtil.
/// debug模式下可以打印请求日志. DioUtil.openDebug().
/// dio详细使用请查看dio官网(https://github.com/flutterchina/dio).
class DioUtil {
static final DioUtil _singleton = DioUtil._init();
static Dio _dio;
/// BaseResp [String status]字段 key, 默认:status.
String _statusKey = "status";
/// BaseResp [int code]字段 key, 默认:errorCode.
String _codeKey = "errorCode";
/// BaseResp [String msg]字段 key, 默认:errorMsg.
String _msgKey = "errorMsg";
/// BaseResp [T data]字段 key, 默认:data.
String _dataKey = "data";
/// Options.
Options _options = getDefOptions();
/// PEM证书内容.
String _pem;
/// PKCS12 证书路径.
String _pKCSPath;
/// PKCS12 证书密码.
String _pKCSPwd;
/// 是否是debug模式.
static bool _isDebug = false;
static DioUtil getInstance() {
return _singleton;
}
factory DioUtil() {
return _singleton;
}
DioUtil._init() {
_dio = new Dio(_options);
}
/// 打开debug模式.
static void openDebug() {
_isDebug = true;
}
void setCookie(String cookie) {
Map<String, dynamic> _headers = new Map();
_headers["Cookie"] = cookie;
_dio.options.headers.addAll(_headers);
}
/// set Config.
void setConfig(HttpConfig config) {
_statusKey = config.status ?? _statusKey;
_codeKey = config.code ?? _codeKey;
_msgKey = config.msg ?? _msgKey;
_dataKey = config.data ?? _dataKey;
_mergeOption(config.options);
_pem = config.pem ?? _pem;
if (_dio != null) {
_dio.options = _options;
if (_pem != null) {
_dio.onHttpClientCreate = (HttpClient client) {
client.badCertificateCallback =
(X509Certificate cert, String host, int port) {
if (cert.pem == _pem) {
// 证书一致,则放行
return true;
}
return false;
};
};
}
if (_pKCSPath != null) {
_dio.onHttpClientCreate = (HttpClient client) {
SecurityContext sc = new SecurityContext();
//file为证书路径
sc.setTrustedCertificates(_pKCSPath, password: _pKCSPwd);
HttpClient httpClient = new HttpClient(context: sc);
return httpClient;
};
}
}
}
/// Make http request with options.
/// [method] The request method.
/// [path] The url path.
/// [data] The request data
/// [options] The request options.
/// <BaseResp<T> 返回 status code msg data .
Future<BaseResp<T>> request<T>(BuildContext context,String method, String path,
{data, Options options, CancelToken cancelToken,bool showLoading=true}) async {
if(showLoading)Loading.showLoading(context);
Response response = await _dio.request(path,
data: data,
options: _checkOptions(method, options),
cancelToken: cancelToken);
_printHttpLog(response);
String _status;
int _code;
String _msg;
T _data;
if (response.statusCode == HttpStatus.ok ||
response.statusCode == HttpStatus.created) {
try {
if (response.data is Map) {
_status = (response.data[_statusKey] is int)
? response.data[_statusKey].toString()
: response.data[_statusKey];
_code = (response.data[_codeKey] is String)
? int.tryParse(response.data[_codeKey])
: response.data[_codeKey];
_msg = response.data[_msgKey];
_data = response.data[_dataKey];
} else {
Map<String, dynamic> _dataMap = _decodeData(response);
_status = (_dataMap[_statusKey] is int)
? _dataMap[_statusKey].toString()
: _dataMap[_statusKey];
_code = (_dataMap[_codeKey] is String)
? int.tryParse(_dataMap[_codeKey])
: _dataMap[_codeKey];
_msg = _dataMap[_msgKey];
_data = _dataMap[_dataKey];
}
Loading.hideLoading(context);
return new BaseResp(_status, _code, _msg, _data);
} catch (e) {
Loading.hideLoading(context);
return new Future.error(new DioError(
response: response,
message: "data parsing exception...",
type: DioErrorType.RESPONSE,
));
}
}
Loading.hideLoading(context);
return new Future.error(new DioError(
response: response,
message: "statusCode: $response.statusCode, service error",
type: DioErrorType.RESPONSE,
));
}
/// Make http request with options.
/// [method] The request method.
/// [path] The url path.
/// [data] The request data
/// [options] The request options.
/// <BaseRespR<T> 返回 status code msg data Response.
Future<BaseRespR<T>> requestR<T>(String method, String path,
{data, Options options, CancelToken cancelToken}) async {
Response response = await _dio.request(path,
data: data,
options: _checkOptions(method, options),
cancelToken: cancelToken);
_printHttpLog(response);
String _status;
int _code;
String _msg;
T _data;
if (response.statusCode == HttpStatus.ok ||
response.statusCode == HttpStatus.created) {
try {
if (response.data is Map) {
_status = (response.data[_statusKey] is int)
? response.data[_statusKey].toString()
: response.data[_statusKey];
_code = (response.data[_codeKey] is String)
? int.tryParse(response.data[_codeKey])
: response.data[_codeKey];
_msg = response.data[_msgKey];
_data = response.data[_dataKey];
} else {
Map<String, dynamic> _dataMap = _decodeData(response);
_status = (_dataMap[_statusKey] is int)
? _dataMap[_statusKey].toString()
: _dataMap[_statusKey];
_code = (_dataMap[_codeKey] is String)
? int.tryParse(_dataMap[_codeKey])
: _dataMap[_codeKey];
_msg = _dataMap[_msgKey];
_data = _dataMap[_dataKey];
}
return new BaseRespR(_status, _code, _msg, _data, response);
} catch (e) {
return new Future.error(new DioError(
response: response,
message: "data parsing exception...",
type: DioErrorType.RESPONSE,
));
}
}
return new Future.error(new DioError(
response: response,
message: "statusCode: $response.statusCode, service error",
type: DioErrorType.RESPONSE,
));
}
/// Download the file and save it in local. The default http method is "GET",you can custom it by [Options.method].
/// [urlPath]: The file url.
/// [savePath]: The path to save the downloading file later.
/// [onProgress]: The callback to listen downloading progress.please refer to [OnDownloadProgress].
Future<Response> download(
String urlPath,
savePath, {
OnDownloadProgress onProgress,
CancelToken cancelToken,
data,
Options options,
}) {
return _dio.download(urlPath, savePath,
onProgress: onProgress,
cancelToken: cancelToken,
data: data,
options: options);
}
/// decode response data.
Map<String, dynamic> _decodeData(Response response) {
if (response == null ||
response.data == null ||
response.data.toString().isEmpty) {
return new Map();
}
return json.decode(response.data.toString());
}
/// check Options.
Options _checkOptions(method, options) {
if (options == null) {
options = new Options();
}
options.method = method;
return options;
}
/// merge Option.
void _mergeOption(Options opt) {
_options.method = opt.method ?? _options.method;
_options.headers = (new Map.from(_options.headers))..addAll(opt.headers);
_options.baseUrl = opt.baseUrl ?? _options.baseUrl;
_options.connectTimeout = opt.connectTimeout ?? _options.connectTimeout;
_options.receiveTimeout = opt.receiveTimeout ?? _options.receiveTimeout;
_options.responseType = opt.responseType ?? _options.responseType;
_options.data = opt.data ?? _options.data;
_options.extra = (new Map.from(_options.extra))..addAll(opt.extra);
_options.contentType = opt.contentType ?? _options.contentType;
_options.validateStatus = opt.validateStatus ?? _options.validateStatus;
_options.followRedirects = opt.followRedirects ?? _options.followRedirects;
}
/// print Http Log.
void _printHttpLog(Response response) {
if (!_isDebug) {
return;
}
try {
print("----------------Http Log----------------" +
"\n[statusCode]: " +
response.statusCode.toString() +
"\n[request ]: " +
_getOptionsStr(response.request));
_printDataStr("reqdata ", response.request.data);
_printDataStr("response", response.data);
} catch (ex) {
print("Http Log" + " error......");
}
}
/// get Options Str.
String _getOptionsStr(Options request) {
return "method: " +
request.method +
" baseUrl: " +
request.baseUrl +
" path: " +
request.path;
}
/// print Data Str.
void _printDataStr(String tag, Object value) {
String da = value.toString();
while (da.isNotEmpty) {
if (da.length > 512) {
print("[$tag ]: " + da.substring(0, 512));
da = da.substring(512, da.length);
} else {
print("[$tag ]: " + da);
da = "";
}
}
}
/// get dio.
Dio getDio() {
return _dio;
}
/// create new dio.
static Dio createNewDio([Options options]) {
options = options ?? getDefOptions();
Dio dio = new Dio(options);
return dio;
}
/// get Def Options.
static Options getDefOptions() {
Options options = new Options();
options.contentType =
ContentType.parse("application/x-www-form-urlencoded");
options.connectTimeout = 1000 * 30;
options.receiveTimeout = 1000 * 30;
return options;
}
}
... ...
class HttpUrl{
static const String server_address = "https://xt04.colorcun.com/";//服务端请求地址
static const String app_user_login="?service=Android.User.AppUserLogin";//登录地址
static const String user_token_init="?service=Android.User.UserTokenInit";//初始化推送token
static const String sellerinfo="?service=Android.Reserve.SellerInfo";//获取商家信息
static const String login_out="?service=Android.User.AppLoginOut";//退出登录
static const String get_message_list="?service=Android.Reserve.GetMessageList";//获取消息列表
static const String get_reserve_list="?service=Android.Reserve.NewGetReserveList";//获取已预订列表
static const String reserve_count_day="?service=Android.Reserve.NewReservesCountDay";//获取一天订单统计数目
static const String reserve_detail="?service=Android.Reserve.Detail";//订单详情
static const String set_reserve_cusman="?service=Android.Reserve.SetReserveCusman";//设置客户经理
static const String table_list="?service=Android.Tables.GetTableListsBySellerId";//桌位列表
static const String set_reserve_status="?service=Android.Customer.SetReserveStatus";//设置订单状态
static const String set_message_status="?service=Android.Advance.SetMessageStatus";//设置消息状态
static const String get_sms_content="?service=App.SendSMS.GetSmsContent";//获取短信内容
static const String send_sms="?service=App.SendSMS.NewMessage";//发送短信
}
\ No newline at end of file
... ...
import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:one_key/models/manager.dart';
import 'package:one_key/models/notebook_detail.dart';
import 'package:one_key/provider/notebook_detail_model.dart';
import 'package:one_key/provider/user_model.dart';
import 'package:one_key/res/colors.dart';
import 'package:one_key/utils/dialog_util.dart';
import 'package:one_key/utils/navigator_util.dart';
import 'package:one_key/utils/utils.dart';
import 'package:one_key/widgets/MyDivider.dart';
import 'package:one_key/widgets/app_bar.dart';
import 'package:one_key/widgets/common_button.dart';
import 'package:one_key/widgets/row_multi_text.dart';
import 'package:one_key/widgets/table_item.dart';
import 'package:one_key/models/table.dart' as t;
import 'package:one_key/widgets/v_empty_view.dart';
import 'package:provider/provider.dart';
class HandleOnlinePage extends StatefulWidget {
final String rid;
final String mid;
HandleOnlinePage(this.rid,this.mid);
@override
State<StatefulWidget> createState() {
// TODO: implement createState
return new HandleOnlinePageState();
}
}
class HandleOnlinePageState extends State<HandleOnlinePage> {
NotebookDetailModel detailModel= NotebookDetailModel();
NotebookDetail detailEntity;
String cusmanText="";
List<Manager> managers=[];//客户经理
Manager manager=Manager();
@override
void initState() {
// TODO: implement initState
super.initState();
WidgetsBinding.instance.addPostFrameCallback((_) async {
detailEntity=await detailModel.getReserveDetail(context, {
"rid":widget.rid,
});
if(detailEntity.status!="0"){//已处理
setMessageStatus();
NavigatorUtil.goNotebookDetailPage(context, detailEntity.id,replace: true);
}else{
setState(() {//未处理
cusmanText=detailEntity.cusman.isEmpty?"请选择":detailEntity.cusman;
});
managers=await detailModel.getManagers(context);
}
});
}
//设置当前客户经理
_setCurrManager(){
manager=managers.firstWhere((manager)=>manager.userName==cusmanText,orElse: ()=>Manager());
if(manager.id==null||manager.id.toString().isEmpty)return;
Map<String,String> params={
"rid":detailEntity.id,
"cusman_id":manager.id.toString(),
"cusman":manager.userName
};
detailModel.setReserveCusmnan(context, params);
}
//拒绝订单弹框
_showRefuseDialog(){
showDialog(context: context,builder: (context){
return AlertDialog(
title: Text("确定拒绝订单吗?\n拒绝后无法联系客户"),
titleTextStyle: TextStyle(color: MyColours.color_353535,fontSize: ScreenUtil().setSp(26)),
content: Text("如果包间类型订满,请及时停用"),
contentTextStyle:TextStyle(color: MyColours.color_828282,fontSize: ScreenUtil().setSp(22)),
actions: <Widget>[
FlatButton(
child: Text("拒绝订单"),
onPressed: (){
Navigator.of(context).pop();
setReserveStatus("6");
},
),
FlatButton(
child: Text("去安排"),
onPressed: () async {
Navigator.of(context).pop();
String tid=await NavigatorUtil.goSelectTablePage(context,widget.rid,DateTime.fromMillisecondsSinceEpoch(int.parse(detailEntity.ddate)*1000),detailEntity.ddate_solt);
setReserveStatus("5",tid:tid);
},
)
],
);
});
}
//处理在线预订
setReserveStatus(String status,{String tid=""}){
UserModel userModel=Provider.of<UserModel>(context,listen: false);
Map<String,String> causeMap={
"uid":userModel.user.openid,
"uname":userModel.user.account,
"desc":"",
};
Map<String,String> params={
"rid":widget.rid,
"status":status,//5安排包间 6 拒绝订单
"tid":tid,
"mid":widget.mid,
"cause":json.encode(causeMap)
};
detailModel.setReserveStatus(context, params);
}
//处理在线预订
setMessageStatus(){
Map<String,String> params={
"sid":Provider.of<UserModel>(context,listen: false).user.sellerid,
"id":widget.mid,
"status":"is_handle"
};
detailModel.setMessageStatus(context, params);
}
@override
Widget build(BuildContext context) {
// TODO: implement build
return detailEntity==null?Container():SafeArea(
child: Column(
children: <Widget>[
MyAppBar(
"在线预订详情",
showBack: true,
),
Expanded(
child: DefaultTextStyle(style: TextStyle(decoration: TextDecoration.none), child: Container(
color: MyColours.color_ffffff,
child: SingleChildScrollView(
child: Container(
color: MyColours.color_ffffff,
padding:
EdgeInsets.symmetric(horizontal: ScreenUtil().setWidth(43)),
child: Column(
children: <Widget>[
RowMultiText("用餐时段", detailEntity.ddateMd),
Stack(
alignment: Alignment.center,
children: <Widget>[
Column(
children: <Widget>[
RowMultiText("用餐时间", detailEntity.ddateHm),
Offstage(
offstage: detailEntity.type=="0"?false:true,
child: RowMultiText("用餐人数", detailEntity.pnum),
)
],
),
Image.asset(detailEntity.statuImgAssets,width: ScreenUtil().setWidth(100),height: ScreenUtil().setWidth(30),)
],
),
RowMultiText("包间需求", (detailEntity.demands.length.toString()+"个")??""),
Align(
alignment: Alignment.centerRight,
child: Row(
mainAxisSize: MainAxisSize.min,
children: detailEntity.demands.map((table){
return TableItem(table);
}).toList(),
),
),
RowMultiText("客户姓名", detailEntity.rnameStr),
RowMultiText("客户电话", detailEntity.phone),
MyDivider(double.infinity, ScreenUtil().setHeight(2)),
Container(
color: MyColours.color_ffffff,
width: double.infinity,
height: ScreenUtil().setHeight(80),
padding: EdgeInsets.symmetric(
vertical: ScreenUtil().setHeight(26)),
child: Stack(
alignment: Alignment.center,
children: <Widget>[
Positioned(
left: 0,
child: Text(
"客户经理",
style: TextStyle(
color: MyColours.color_828282,
fontSize: ScreenUtil().setSp(22)),
),
),
Positioned(
right: 0,
child: GestureDetector(
onTap: () async {
List<String> list=[];
for(Manager manager in managers){
list.add(manager.roleUserName);
}
DialogUtil.showSelectCusmanDialog(context,list).then((value){
setState(() {
cusmanText=managers[value.first].userName;
});
_setCurrManager();
});
},
child: Text(
cusmanText,
style: TextStyle(
color: MyColours.color_353535,
fontSize: ScreenUtil().setSp(26),
decoration: TextDecoration.underline,
),
),
),
)
],
),
),
MyDivider(double.infinity, ScreenUtil().setHeight(2)),
Container(
margin: EdgeInsets.only(top: ScreenUtil().setHeight(206)),
child: Column(
children: <Widget>[
CommonButton(
content: "安排包间",
width: 669,
height: 76,
fontSize: 26,
onPress: () async {
String tid=await NavigatorUtil.goSelectTablePage(context,widget.rid,DateTime.fromMillisecondsSinceEpoch(int.parse(detailEntity.ddate)*1000),detailEntity.ddate_solt);
if(tid!=null){
setReserveStatus("5",tid:tid);
}
},
),
VEmptyView(20),
Container(
width: ScreenUtil().setWidth(669),
height: ScreenUtil().setHeight(76),
decoration: BoxDecoration(
border: Border.all(color: MyColours.color_199095),
borderRadius: BorderRadius.circular(
ScreenUtil().setWidth(5)),
),
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Expanded(
child: GestureDetector(
child: Center(
child: Text(
"拒绝订单",
style: TextStyle(
color: MyColours.color_199095,
fontSize: ScreenUtil().setSp(26)),
),
),
onTap: () {
_showRefuseDialog();
},
)),
MyDivider(
ScreenUtil().setWidth(1),
ScreenUtil().setHeight(52),
color: MyColours.color_199095,
),
Expanded(
child: GestureDetector(
child: Center(
child: Text(
"联系顾客",
style: TextStyle(
color: MyColours.color_199095,
fontSize: ScreenUtil().setSp(26)),
),
),
onTap: () {
if(detailEntity.phone!=null&&detailEntity.phone.isNotEmpty){
Utils.goPhone(detailEntity.phone);
}else{
Utils.showToast("没有客户电话!");
}
},
)),
],
),
)
],
),
)
],
)),
),
)),
)
],
),
);
}
}
... ...
import 'package:flutter/material.dart';
import 'package:flutter_picker/flutter_picker.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:one_key/models/manager.dart';
import 'package:one_key/models/notebook_detail.dart';
import 'package:one_key/provider/notebook_detail_model.dart';
import 'package:one_key/provider/user_model.dart';
import 'package:one_key/res/colors.dart';
import 'package:one_key/utils/dialog_util.dart';
import 'package:one_key/utils/log_util.dart';
import 'package:one_key/utils/navigator_util.dart';
import 'package:one_key/utils/utils.dart';
import 'package:one_key/widgets/MyDivider.dart';
import 'package:one_key/widgets/app_bar.dart';
import 'package:one_key/widgets/common_button.dart';
import 'package:one_key/widgets/row_multi_text.dart';
import 'package:one_key/widgets/table_item.dart';
import 'package:one_key/models/table.dart' as t;
import 'package:one_key/widgets/v_empty_view.dart';
import 'package:provider/provider.dart';
class NotebookDetailPage extends StatefulWidget {
final String rid;
NotebookDetailPage(this.rid);
@override
State<StatefulWidget> createState() {
// TODO: implement createState
return new NotebookDetailPageState();
}
}
class NotebookDetailPageState extends State<NotebookDetailPage> {
NotebookDetailModel detailModel= NotebookDetailModel();
NotebookDetail detailEntity;
String cusmanText="";
List<Manager> managers=[];//客户经理
Manager manager=Manager();
@override
void initState() {
// TODO: implement initState
super.initState();
WidgetsBinding.instance.addPostFrameCallback((_) async {
detailEntity=await detailModel.getReserveDetail(context, {
"rid":widget.rid,
});
setState(() {
cusmanText=detailEntity.cusman.isEmpty?"请选择":detailEntity.cusman;
});
managers=await detailModel.getManagers(context);
});
}
//设置当前客户经理
_setCurrManager(){
manager=managers.firstWhere((manager)=>manager.userName==cusmanText,orElse: ()=>Manager());
if(manager.id==null||manager.id.toString().isEmpty)return;
Map<String,String> params={
"rid":detailEntity.id,
"cusman_id":manager.id.toString(),
"cusman":manager.userName
};
detailModel.setReserveCusmnan(context, params);
}
@override
Widget build(BuildContext context) {
// TODO: implement build
return detailEntity==null?Container():SafeArea(
child: Container(
color: MyColours.color_ffffff,
child: Column(
children: <Widget>[
MyAppBar(
"订座详情",
showBack: true,
),
Expanded(
child: DefaultTextStyle(style: TextStyle(decoration: TextDecoration.none), child: Container(
color: MyColours.color_ffffff,
child: SingleChildScrollView(
child: Container(
color: MyColours.color_ffffff,
padding:
EdgeInsets.symmetric(horizontal: ScreenUtil().setWidth(43)),
child: Column(
children: <Widget>[
RowMultiText("用餐时段", detailEntity.ddateMd),
Stack(
alignment: Alignment.center,
children: <Widget>[
Column(
children: <Widget>[
RowMultiText("用餐时间", detailEntity.ddateHm),
Offstage(
offstage: detailEntity.type=="0"?false:true,
child: RowMultiText("用餐人数", detailEntity.pnum),
)
],
),
Image.asset(detailEntity.statuImgAssets,width: ScreenUtil().setWidth(100),height: ScreenUtil().setWidth(30),)
],
),
Offstage(
offstage: detailEntity.demands.length<=0?true:false,
child: Column(
children: <Widget>[
RowMultiText("包间需求", (detailEntity.demands.length.toString()+"个")??""),
Align(
alignment: Alignment.centerRight,
child: Row(
mainAxisSize: MainAxisSize.min,
children: detailEntity.demands.map((table){
return TableItem(table);
}).toList(),
),
)
],
),
),
RowMultiText("预订桌位", (detailEntity.tables.length.toString()+"个")),
Align(
alignment: Alignment.centerRight,
child: Row(
mainAxisSize: MainAxisSize.min,
children: detailEntity.tables.map((table){
return TableItem(table);
}).toList(),
),
),
RowMultiText("客户姓名", detailEntity.rnameStr),
RowMultiText("客户电话", detailEntity.phone),
MyDivider(double.infinity, ScreenUtil().setHeight(2)),
Container(
color: MyColours.color_ffffff,
width: double.infinity,
height: ScreenUtil().setHeight(80),
padding: EdgeInsets.symmetric(
vertical: ScreenUtil().setHeight(26)),
child: Stack(
alignment: Alignment.center,
children: <Widget>[
Positioned(
left: 0,
child: Text(
"客户经理",
style: TextStyle(
color: MyColours.color_828282,
fontSize: ScreenUtil().setSp(22)),
),
),
Positioned(
right: 0,
child: GestureDetector(
onTap: () async {
List<String> list=[];
for(Manager manager in managers){
list.add(manager.roleUserName);
}
DialogUtil.showSelectCusmanDialog(context,list).then((value){
setState(() {
cusmanText=managers[value.first].userName;
});
_setCurrManager();
});
},
child: Text(
cusmanText,
style: TextStyle(
color: MyColours.color_353535,
fontSize: ScreenUtil().setSp(26),
decoration: TextDecoration.underline,
),
),
),
)
],
),
),
RowMultiText("记录人", detailEntity.note_name??""),
Offstage(
offstage: (detailEntity.status=="4"&&detailEntity.cancel!=null)?false:true,
child: Column(
children: <Widget>[
MyDivider(double.infinity, ScreenUtil().setHeight(2)),
RowMultiText("取消原因", detailEntity.cancel?.desc??""),
RowMultiText("取消时间", detailEntity.cancel?.cdateStr),
RowMultiText("操作人", detailEntity.cancel?.uname??""),
],
),
),
],
)),
),
)),
),
Offstage(
offstage: (detailEntity.status=="3"||detailEntity.status=="4"||detailEntity.status=="6")?true:false,
child: Container(
width: double.infinity,
decoration: BoxDecoration(
color: MyColours.color_ffffff,
border: Border(top:BorderSide(color: MyColours.color_dbe3e3,width: ScreenUtil().setWidth(2)))
),
padding: EdgeInsets.symmetric(vertical: ScreenUtil().setHeight(20),horizontal: ScreenUtil().setHeight(36)),
child:CommonButton(
content: "通知顾客",
width: 669,
height: 76,
fontSize: 26,
onPress: () {
DialogUtil.showShareDialog(context)?.then((value){
switch(value){
case 1://微信
NavigatorUtil.goInvicationPage(context,detailEntity.id,detailEntity.tableinfoStr,detailEntity.ddate,detailEntity.ddateStr);
break;
case 2://短信
NavigatorUtil.goSmsPage(context, detailEntity.id);
break;
case 3://电话
if(detailEntity.phone!=null&&detailEntity.phone.isNotEmpty){
Utils.goPhone(detailEntity.phone);
}else{
Utils.showToast("没有客户电话!");
}
break;
}
});
},
),
),
)
],
),
),
);
}
}
... ...
import 'dart:async';
import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:jpush_flutter/jpush_flutter.dart';
import 'package:one_key/app.dart';
import 'package:one_key/models/message.dart';
import 'package:one_key/pages/message/message_page.dart';
import 'package:one_key/pages/my/my_page.dart';
import 'package:one_key/pages/notebook/notebook_page.dart';
import 'package:one_key/provider/message_dialog_model.dart';
import 'package:one_key/provider/message_model.dart';
import 'package:one_key/provider/my_model.dart';
import 'package:one_key/provider/notebook_model.dart';
import 'package:one_key/provider/user_model.dart';
import 'package:one_key/res/colors.dart';
import 'package:one_key/route/navigate_service.dart';
import 'package:one_key/utils/log_util.dart';
import 'package:one_key/utils/utils.dart';
import 'package:provider/provider.dart';
import 'package:flutter/services.dart';
class HomePage extends StatefulWidget{
final int initialIndex;//初始tab
HomePage({this.initialIndex=1});
@override
State<StatefulWidget> createState() {
// TODO: implement createState
return new HomePageState();
}
}
class HomePageState extends State<HomePage>{
final JPush jpush = new JPush();
List<Widget> pages = List<Widget>();
int _currIndex = 1;
Color _activeColor = MyColours.color_2bb5b7;
Color _defaultColor = MyColours.color_bfbfbf;
@override
void initState() {
// TODO: implement initState
super.initState();
LogUtil.v("home_initState");
_currIndex=widget.initialIndex;
pages
..add(ChangeNotifierProvider<MessageModel>(
create: (_)=>MessageModel(),
child: MessagePage(),
))
..add(ChangeNotifierProvider<NoteBookModel>(
create: (_)=>NoteBookModel(),
child: NoteBookPage(),
))
..add(ChangeNotifierProvider<MyModel>(
create: (_)=>MyModel(),
child: MyPage(),
));
initJPush();
WidgetsBinding.instance.addPostFrameCallback((_){
if(widget.initialIndex==0)return;
getUntreatedMessage();
});
}
Future<void> initJPush() async {
try {
jpush.resumePush();
jpush.addEventHandler(
onReceiveNotification: (Map<String, dynamic> message) async {
LogUtil.v("flutter onReceiveNotification: $message");
Map<String,dynamic> messageMap=(json.decode(message["extras"]["cn.jpush.android.EXTRA"]) as Map<String,dynamic>)["extras"];
Provider.of<MessageDialogModel>(context,listen: false).addMessage(context,Message.fromJson(messageMap));
}, onOpenNotification: (Map<String, dynamic> message) async {
LogUtil.v("flutter onOpenNotification: $message");
}, onReceiveMessage: (Map<String, dynamic> message) async {
LogUtil.v("flutter onReceiveMessage: $message");
}, onReceiveNotificationAuthorization:
(Map<String, dynamic> message) async {
LogUtil.v("flutter onReceiveNotificationAuthorization: $message");
});
} on PlatformException {}
jpush.setup(
appKey: "27ceb79c44af41ad99202f7a", //你自己应用的 AppKey
channel: "theChannel",
production: false,
debug: true,
);
jpush.applyPushAuthority(
new NotificationSettingsIOS(sound: true, alert: true, badge: true));
// Platform messages may fail, so we use a try/catch PlatformException.
jpush.getRegistrationID().then((rid) {
LogUtil.v("flutter get registration id : $rid");
userTokenInit(rid);
});
jpush.isNotificationEnabled().then((bool value) {
if (!value) {
//没有打开通知
jpush.openSettingsForNotification();
}
});
}
//初始化推送token
userTokenInit(String registrationId){
UserModel userModel=Provider.of<UserModel>(context,listen: false);
userModel.registrationId=registrationId;
Map<String,String> params={
"sid":userModel.user.sellerid,
"account":userModel.user.account,
"registrationId":registrationId
};
userModel.userTokenInit(context, params);
}
//获取未处理在线预订消息
getUntreatedMessage(){
UserModel userModel=Provider.of<UserModel>(context,listen: false);
Map<String,String> params={
"sid":userModel.user.sellerid,
"type_id":"10",
"status":"0",
"offset":"0",
"limit":"100",
};
MessageDialogModel messageModel=Provider.of<MessageDialogModel>(context,listen: false);
messageModel.getUntreatedMsg(context, params);
}
@override
Widget build(BuildContext context) {
// TODO: implement build
return new Scaffold(
bottomNavigationBar: BottomNavigationBar(
backgroundColor: MyColours.color_ffffff,
items: [
BottomNavigationBarItem(
icon: Image(
image: AssetImage("assets/message_default.png"),
width: ScreenUtil().setWidth(60),
height: ScreenUtil().setWidth(60),
),
activeIcon: Image(
image: AssetImage("assets/message_selected.png"),
width: ScreenUtil().setWidth(60),
height: ScreenUtil().setWidth(60),
),
title: Text(
"消息中心",
style: TextStyle(
color: _currIndex == 0 ? _activeColor : _defaultColor,fontSize: ScreenUtil().setSp(16)),
),
),
BottomNavigationBarItem(
icon: Image(
image: AssetImage("assets/notebook_default.png"),
width: ScreenUtil().setWidth(60),
height: ScreenUtil().setWidth(60),
),
activeIcon: Image(
image: AssetImage("assets/notebook_selected.png"),
width: ScreenUtil().setWidth(60),
height: ScreenUtil().setWidth(60),
),
title: Text(
"预定本",
style: TextStyle(
color: _currIndex == 1 ? _activeColor : _defaultColor,fontSize: ScreenUtil().setSp(16)),
),
),
BottomNavigationBarItem(
icon: Image(
image: AssetImage("assets/my_default.png"),
width: ScreenUtil().setWidth(60),
height: ScreenUtil().setWidth(60),
),
activeIcon: Image(
image: AssetImage("assets/my_selected.png"),
width: ScreenUtil().setWidth(60),
height: ScreenUtil().setWidth(60),
),
title: Text(
"我的",
style: TextStyle(
color: _currIndex == 2 ? _activeColor : _defaultColor,fontSize: ScreenUtil().setSp(16)),
),
),
],
type: BottomNavigationBarType.fixed,
currentIndex: _currIndex,
onTap: (int index) {
if (_currIndex != index) {
setState(() {
_currIndex = index;
});
if(_currIndex==2){
Utils.changeStatusColor(color: MyColours.color_2bb5b7);
}else{
Utils.changeStatusColor(color: MyColours.color_ffffff);
}
}
},
),
body: SafeArea(child: pages[_currIndex]),
);
}
@override
void dispose() {
// TODO: implement dispose
super.dispose();
LogUtil.v("home_dispose");
jpush.stopPush();
}
}
\ No newline at end of file
... ...
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:one_key/models/user.dart';
import 'package:one_key/provider/user_model.dart';
import 'package:one_key/res/colors.dart';
import 'package:one_key/utils/navigator_util.dart';
import 'package:one_key/utils/utils.dart';
import 'package:one_key/widgets/v_empty_view.dart';
import 'package:provider/provider.dart';
class InvicationPage extends StatefulWidget{
final String rid;//预订订单id
final String tableInfo;//桌位信息
final String ddate;
final String ddateStr;
InvicationPage(this.rid,this.tableInfo,this.ddate,this.ddateStr);
@override
State<StatefulWidget> createState() {
// TODO: implement createState
return new InvicationPageState();
}
}
class InvicationPageState extends State<InvicationPage>{
User user;
DateTime dateTime;
String dateTimeStr="";
@override
void initState() {
// TODO: implement initState
super.initState();
dateTime=DateTime.fromMillisecondsSinceEpoch(int.parse(widget.ddate)*1000);
user=Provider.of<UserModel>(context,listen:false).user;
dateTimeStr="${dateTime.year}/${Utils.addZeroNumber(dateTime.month)}/${Utils.addZeroNumber(dateTime.day)} 星期${Utils.formatWeekDayNum(dateTime.weekday)} ${widget.ddateStr}";
}
//中间内容显示组件
Widget _middleWidget(String title,String content){
return Column(
children: <Widget>[
VEmptyView(38),
Row(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Image.asset("assets/invication_line_left.png",width: ScreenUtil().setWidth(44),height: ScreenUtil().setWidth(4),),
Container(
margin: EdgeInsets.symmetric(horizontal: ScreenUtil().setWidth(13)),
child: Text(title,style: TextStyle(color: MyColours.color_eadab9,fontSize: ScreenUtil().setSp(22),fontWeight: FontWeight.bold)),
),
Image.asset("assets/invication_line_right.png",width: ScreenUtil().setWidth(44),height: ScreenUtil().setWidth(4),)
],
),
Container(
margin: EdgeInsets.only(top: ScreenUtil().setHeight(20)),
child: Text(content,style: TextStyle(color: MyColours.color_ffffff,fontSize: ScreenUtil().setSp(26)),),
)
],
);
}
@override
Widget build(BuildContext context) {
// TODO: implement build
return SafeArea(
child: Container(
width: double.infinity,
height: double.infinity,
decoration: BoxDecoration(
image: DecorationImage(image: AssetImage("assets/bg_invication.png"),fit: BoxFit.cover),
),
child: DefaultTextStyle(style: TextStyle(decoration: TextDecoration.none), child: Column(
children: <Widget>[
GestureDetector(
onTap: (){
Navigator.of(context).pop();
},
child: Container(
width: double.infinity,
alignment: Alignment.centerLeft,
padding: EdgeInsets.symmetric(vertical: ScreenUtil().setHeight(30)),
child: Padding(
padding: EdgeInsets.symmetric(
horizontal: ScreenUtil().setWidth(40),
vertical: ScreenUtil().setHeight(15)),
child: Image.asset(
"assets/invication_back.png",
width: ScreenUtil().setWidth(20),
height: ScreenUtil().setHeight(31),
)
),
),
),
Expanded(
child: Center(
child: Column(
children: <Widget>[
Image.asset("assets/img_ydap.png",width: ScreenUtil().setWidth(444),height: ScreenUtil().setHeight(234),),
VEmptyView(69),
Row(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Container(
width: ScreenUtil().setWidth(108),
height: ScreenUtil().setHeight(2),
color: MyColours.color_ffffff,
),
Container(
width: ScreenUtil().setWidth(442),
height: ScreenUtil().setHeight(43),
alignment: Alignment.center,
decoration: BoxDecoration(
border: Border.all(color: MyColours.color_ffffff,width: ScreenUtil().setWidth(2)),
borderRadius: BorderRadius.all(Radius.circular(ScreenUtil().setWidth(18)))
),
child: Text("订包间,用周到安排",style: TextStyle(color: MyColours.color_ffffff,fontSize: ScreenUtil().setSp(22),fontWeight: FontWeight.bold),),
),
Container(
width: ScreenUtil().setWidth(108),
height: ScreenUtil().setHeight(2),
color: MyColours.color_ffffff,
),
],
),
_middleWidget("餐厅", user.sellername),
_middleWidget("包间", widget.tableInfo.replaceAll("\n","")),
_middleWidget("时间", dateTimeStr),
VEmptyView(38),
Column(
children: <Widget>[
Row(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Image.asset("assets/invication_map.png",width: ScreenUtil().setWidth(22),height: ScreenUtil().setWidth(28),),
Container(
margin: EdgeInsets.symmetric(horizontal: ScreenUtil().setWidth(13)),
child: Text("地址导航",style: TextStyle(color: MyColours.color_eadab9,fontSize: ScreenUtil().setSp(22),fontWeight: FontWeight.bold)),
),
Image.asset("assets/invication_arrow_right.png",width: ScreenUtil().setWidth(14),height: ScreenUtil().setWidth(22),),
],
),
Container(
margin: EdgeInsets.only(top: ScreenUtil().setHeight(20)),
child: Text(user.sellerAddr,style: TextStyle(color: MyColours.color_ffffff,fontSize: ScreenUtil().setSp(26)),),
)
],
)
],
),
),
),
Container(
width: double.infinity,
height: ScreenUtil().setHeight(99),
child: Row(
children: <Widget>[
GestureDetector(
onTap: (){
NavigatorUtil.goSmsPage(context, widget.rid);
},
child: Container(
width: ScreenUtil().setWidth(232),
height: double.infinity,
color: MyColours.color_000000,
alignment: Alignment.center,
child: Text("发短信",style: TextStyle(color: MyColours.color_eadab9,fontSize: ScreenUtil().setSp(30)),),
),
),
Expanded(
child:
GestureDetector(
onTap: (){
Utils.goShareInvicationToWeChat(widget.rid);
},
child:Container(
width: double.infinity,
height: double.infinity,
color: MyColours.color_e3d2ac,
alignment: Alignment.center,
child: Text("通知客户",style: TextStyle(color: MyColours.color_83734d,fontSize: ScreenUtil().setSp(30)),),
),
),
)
],
),
)
],
)),
),
);
}
}
\ No newline at end of file
... ...
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:one_key/app.dart';
import 'package:one_key/provider/user_model.dart';
import 'package:one_key/res/colors.dart';
import 'package:one_key/utils/navigator_util.dart';
import 'package:one_key/widgets/h_empty_view.dart';
import 'package:one_key/widgets/v_empty_view.dart';
import 'package:provider/provider.dart';
class LoginPage extends StatefulWidget {
@override
State<StatefulWidget> createState() {
// TODO: implement createState
return new LoginState();
}
}
class LoginState extends State<LoginPage> with WidgetsBindingObserver{
TextEditingController _sellerCodeController=TextEditingController();
TextEditingController _accountController = TextEditingController();
final TextEditingController _pwdController = TextEditingController();
final ScrollController _scrollController=new ScrollController();
final FocusNode _sellerCodeFocusNode=new FocusNode();
final FocusNode _accountFocusNode=new FocusNode();
final FocusNode _pwdFocusNode=new FocusNode();
bool obscureText=true;//是否隐藏密码
bool isActivate=false;//是否激活登录
String errorText="";//错误提示
@override
void initState(){
// TODO: implement initState
WidgetsBinding.instance.addObserver(this);
super.initState();
isLogin();
}
handlePostFrame(_){
_scrollController.jumpTo(_scrollController.position.maxScrollExtent);
}
@override
void didChangeMetrics() {
// TODO: implement didChangeMetrics
WidgetsBinding.instance.addPostFrameCallback(handlePostFrame);
super.didChangeDependencies();
}
@override
void dispose() {
// TODO: implement dispose
WidgetsBinding.instance.removeObserver(this);
super.dispose();
}
//监听输入框,设置登录按钮状态
setActivate(){
if(_sellerCodeController.text.isNotEmpty&&_accountController.text.isNotEmpty&&_pwdController.text.isNotEmpty){
setState(() {
errorText="";
isActivate=true;
});
}else{
setState(() {
errorText="";
isActivate=false;
});
}
}
//判断是否登录
void isLogin()async{
await App.initSp();
UserModel userModel=Provider.of<UserModel>(context,listen: false);
userModel.initUser();
if(App.sp.getBool("isLogin")??false){
NavigatorUtil.goHomePage(context);
}
}
@override
Widget build(BuildContext context) {
// TODO: implement build
ScreenUtil.init(context,width: 750,height: 1334);
final Size size=MediaQuery.of(context).size;
App.screenWidth=size.width;
App.screenHeight=size.height;
App.statusBarHeight=MediaQuery.of(context).padding.top;
App.bottomBarHeight=MediaQuery.of(context).padding.bottom;
final UserModel userModel=Provider.of<UserModel>(context);
if(userModel!=null&&userModel.user!=null){
// _sellerCodeController.text=userModel.user.sellercode;
_accountController.text=userModel.user.account;
_sellerCodeController=TextEditingController.fromValue(TextEditingValue(text:userModel.user.sellercode,selection: TextSelection.fromPosition(TextPosition(affinity: TextAffinity.downstream,offset: userModel.user.sellercode.length))));
}
final double prefixIconWidth=ScreenUtil().setWidth(24);
return Scaffold(
backgroundColor: MyColours.color_ffffff,
body: Container(
width: double.infinity,
height: double.infinity,
child: SingleChildScrollView(
controller: _scrollController,
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
VEmptyView(218-App.statusBarHeight),
Image.asset("assets/logo.png",width: ScreenUtil().setWidth(217),height: ScreenUtil().setWidth(206),),
VEmptyView(121),
Container(
height: ScreenUtil().setHeight(84),
width: ScreenUtil().setWidth(611),
padding: EdgeInsets.only(left: ScreenUtil().setWidth(20)),
alignment: Alignment.center,
decoration: BoxDecoration(
border: Border.all(color: MyColours.color_bff6f7,width: ScreenUtil().setWidth(2)),
borderRadius: BorderRadius.circular(ScreenUtil().setWidth(8))
),
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Image.asset("assets/icon_sellercode.png",width: prefixIconWidth,),
HEmptyView(26),
Text("商户编号",style: TextStyle(color: MyColours.color_353535,fontSize: ScreenUtil().setSp(26)),),
Expanded(
child: TextField(
controller: _sellerCodeController,
focusNode: _sellerCodeFocusNode,
autofocus: _sellerCodeController.text.isEmpty,
decoration: InputDecoration(
hintText: "请输入6位商户编码",
hintStyle: TextStyle(color: MyColours.color_c1c1c1,fontSize: ScreenUtil().setSp(26)),
border: InputBorder.none,
contentPadding: EdgeInsets.all(10)
),
onChanged: (_){
setActivate();
},
keyboardType: TextInputType.number,
),
)
],
)
),
Container(
height: ScreenUtil().setHeight(84),
width: ScreenUtil().setWidth(611),
padding: EdgeInsets.only(left: ScreenUtil().setWidth(20)),
margin: EdgeInsets.only(top: ScreenUtil().setHeight(8)),
alignment: Alignment.center,
decoration: BoxDecoration(
border: Border.all(color: MyColours.color_bff6f7,width: ScreenUtil().setWidth(2)),
borderRadius: BorderRadius.circular(ScreenUtil().setWidth(8))
),
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Image.asset("assets/icon_account.png",width: prefixIconWidth,),
HEmptyView(26),
Text("工 号",style: TextStyle(color: MyColours.color_353535,fontSize: ScreenUtil().setSp(26)),),
Expanded(
child: TextField(
controller: _accountController,
focusNode: _accountFocusNode,
decoration: InputDecoration(
hintText: "请输入4位工号",
hintStyle: TextStyle(color: MyColours.color_c1c1c1,fontSize: ScreenUtil().setSp(26)),
border: InputBorder.none,
contentPadding: EdgeInsets.all(10)
),
onChanged: (_){
setActivate();
},
keyboardType: TextInputType.number,
),
)
],
)
),
Container(
height: ScreenUtil().setHeight(84),
width: ScreenUtil().setWidth(611),
padding: EdgeInsets.only(left: ScreenUtil().setWidth(20),right: ScreenUtil().setWidth(27)),
margin: EdgeInsets.only(top: ScreenUtil().setHeight(8)),
alignment: Alignment.center,
decoration: BoxDecoration(
border: Border.all(color: MyColours.color_bff6f7,width: ScreenUtil().setWidth(2)),
borderRadius: BorderRadius.circular(ScreenUtil().setWidth(8))
),
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Image.asset("assets/icon_pwd.png",width: prefixIconWidth,),
HEmptyView(26),
Text("密 码",style: TextStyle(color: MyColours.color_353535,fontSize: ScreenUtil().setSp(26)),),
Expanded(
child: TextField(
controller: _pwdController,
focusNode: _pwdFocusNode,
autofocus: _sellerCodeController.text.isNotEmpty&&_accountController.text.isNotEmpty&&_pwdController.text.isEmpty,
decoration: InputDecoration(
hintText: "请输入密码",
hintStyle: TextStyle(color: MyColours.color_c1c1c1,fontSize: ScreenUtil().setSp(26)),
border: InputBorder.none,
contentPadding: EdgeInsets.all(10)
),
onChanged: (_){
setActivate();
},
obscureText: obscureText,
keyboardType: TextInputType.text,
),
),
GestureDetector(
child: Padding(padding: EdgeInsets.all(ScreenUtil().setWidth(10)),child: Image.asset(obscureText?"assets/icon_pwd_show.png":"assets/icon_pwd_hide.png",width: ScreenUtil().setWidth(35),height: ScreenUtil().setHeight(24),),),
onTap: (){
setState(() {
obscureText=!obscureText;
});
},
)
],
)
),
Container(
width: ScreenUtil().setWidth(611),
margin: EdgeInsets.only(top: ScreenUtil().setHeight(16)),
alignment: Alignment.centerLeft,
child: Text(errorText,style: TextStyle(color: MyColours.color_d93535,fontSize: ScreenUtil().setSp(16)),),
),
Consumer<UserModel>(
builder: (BuildContext context,UserModel value,Widget child){
return GestureDetector(
onTap: (){
if(!isActivate)return;
Map<String,String> params={
"seller_code":"${_sellerCodeController.text}",
"alias":"ssahdahgdafgahjkhakjgh",
"account":"${_accountController.text}",
"password":"${_pwdController.text}"
};
value.login(context, params).then((value){
setState(() {
errorText=value??"";
});
});
},
child: Container(
height: ScreenUtil().setHeight(84),
width: ScreenUtil().setWidth(611),
margin: EdgeInsets.only(top: ScreenUtil().setHeight(56)),
alignment: Alignment.center,
decoration: BoxDecoration(
color: isActivate?MyColours.color_2bb5b7:MyColours.color_2bb5b7,
boxShadow: [
BoxShadow(color: MyColours.color_26000000,offset: Offset(0,ScreenUtil().setWidth(4)),)
],
borderRadius: BorderRadius.all(Radius.circular(ScreenUtil().setWidth(8)))
),
child: Text("登录",style: TextStyle(color: MyColours.color_ffffff,fontSize: ScreenUtil().setSp(30)),),
),
);
},
)
],
),
),
)
);
}
}
... ...
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:one_key/models/message.dart';
import 'package:one_key/provider/message_dialog_model.dart';
import 'package:one_key/res/colors.dart';
import 'package:one_key/utils/navigator_util.dart';
import 'package:one_key/widgets/common_button.dart';
import 'package:one_key/widgets/h_empty_view.dart';
import 'package:one_key/widgets/v_empty_view.dart';
import 'package:provider/provider.dart';
class MessageDialogItem extends StatelessWidget {
final Message message;
final bool isTreated;
final VoidCallback callback;
MessageDialogItem(this.message,{this.isTreated=false,this.callback});
@override
Widget build(BuildContext context) {
// TODO: implement build
Color textColor=isTreated?MyColours.color_999999:MyColours.color_353535;
MessageDialogModel messageDialogModel=Provider.of<MessageDialogModel>(context,listen: false);
return GestureDetector(
onTap: (){
if(isTreated){
NavigatorUtil.goNotebookDetailPage(context,message.rid.toString());
}
},
child: Container(
margin: EdgeInsets.symmetric(horizontal: ScreenUtil().setWidth(22),vertical: ScreenUtil().setWidth(11)),
padding: EdgeInsets.fromLTRB(
ScreenUtil().setWidth(17),
ScreenUtil().setWidth(45),
ScreenUtil().setWidth(12),
ScreenUtil().setWidth(34)),
decoration: BoxDecoration(
color: MyColours.color_fefefe,
borderRadius:
BorderRadius.all(Radius.circular(ScreenUtil().setWidth(8)))),
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Text(
"在线预订",
style: TextStyle(
color: textColor,
fontSize: ScreenUtil().setSp(26)),
),
Spacer(),
Text(
message.cdateStr,
style: TextStyle(
color: MyColours.color_999999,
fontSize: ScreenUtil().setSp(22)),
),
],
),
VEmptyView(20),
Text(
"包间需求:${message.room_demand}",
style: TextStyle(
color: textColor,
fontSize: ScreenUtil().setSp(26)),
),
VEmptyView(10),
Text(
"就餐时间:${message.ddate}",
style: TextStyle(
color: textColor,
fontSize: ScreenUtil().setSp(26)),
),
VEmptyView(10),
Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Text(
"预订人:${message.rnameStr}",
style: TextStyle(
color: textColor,
fontSize: ScreenUtil().setSp(26)),
),
Spacer(),
Offstage(
offstage: isTreated?true:false,
child: CommonButton(
width: 160,
height: 48,
fontSize: 26,
content: "立即处理",
state: 1,
onPress: () {
messageDialogModel.removeMessage(message);
NavigatorUtil.goHandleOnlinePage(context,message.rid.toString(),message.id,replace: messageDialogModel.messages.isEmpty);
},
),
)
],
)
],
),
),
);
}
}
... ...
import 'package:flutter/material.dart';
import 'package:flutter_easyrefresh/easy_refresh.dart';
import 'package:one_key/provider/message_model.dart';
import 'package:one_key/provider/user_model.dart';
import 'package:one_key/utils/log_util.dart';
import 'package:provider/provider.dart';
import 'message_dialog_item.dart';
class MessageLeftPage extends StatefulWidget {
@override
State<StatefulWidget> createState() {
// TODO: implement createState
return new MessageLeftPageState();
}
}
class MessageLeftPageState extends State<MessageLeftPage> {
EasyRefreshController _controller;
@override
void initState() {
// TODO: implement initState
super.initState();
_controller=EasyRefreshController();
WidgetsBinding.instance.addPostFrameCallback((_){
getUntreatedMessage();
});
}
//获取未处理在线预订消息
getUntreatedMessage(){
UserModel userModel=Provider.of<UserModel>(context,listen: false);
Map<String,String> params={
"sid":userModel.user.sellerid,
"type_id":"10",
"status":"0",
"offset":"0",
"limit":"100",
};
MessageModel messageModel=Provider.of<MessageModel>(context,listen: false);
messageModel.getUntreatedMsg(context, params);
}
@override
Widget build(BuildContext context) {
// TODO: implement build
return Selector<MessageModel,List>(
selector: (context,model)=>model.untreatedMsgs,
builder: (context,messages,child){
return EasyRefresh.custom(
controller: _controller,
slivers: [
SliverList(
delegate:
SliverChildBuilderDelegate((BuildContext context, int index) {
return MessageDialogItem(messages[index]);
},childCount: messages.length),
)
],onRefresh: () async {
getUntreatedMessage();
},);
},
);
}
}
... ...
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:one_key/res/colors.dart';
import 'package:one_key/widgets/app_bar.dart';
import 'package:one_key/widgets/v_empty_view.dart';
import 'message_left_page.dart';
import 'message_right_page.dart';
class MessagePage extends StatefulWidget{
@override
State<StatefulWidget> createState() {
// TODO: implement createState
return new MessagePageState();
}
}
class MessagePageState extends State<MessagePage>{
@override
Widget build(BuildContext context) {
// TODO: implement build
return Container(
width: double.infinity,
height: double.infinity,
color: MyColours.color_f5f5f5,
child: Column(
children: <Widget>[
MyAppBar("消息中心",showBack: false,),
Expanded(
child: DefaultTabController(length: 2, child: Column(
children: <Widget>[
Material(
color: MyColours.color_ffffff,
child: SizedBox(
width: double.infinity,
height: ScreenUtil().setHeight(76),
child: TabBar(tabs:[
Tab(text: "未处理",),
Tab(text: "已处理",)
],
indicatorColor: MyColours.color_2bb5b7,
indicatorSize: TabBarIndicatorSize.label,
indicatorWeight: ScreenUtil().setHeight(4.0),
labelColor: MyColours.color_2bb5b7,
unselectedLabelColor: MyColours.color_353535,
labelStyle: TextStyle(fontSize: ScreenUtil().setSp(32),fontWeight: FontWeight.bold),
),
),
),
VEmptyView(11),
Expanded(
flex: 1,
child: TabBarView(children: [
MessageLeftPage(),
MessageRightPage()
]),
)
],
)),
)
],
),
);
}
}
\ No newline at end of file
... ...
import 'package:flutter/material.dart';
import 'package:flutter_easyrefresh/easy_refresh.dart';
import 'package:one_key/provider/message_model.dart';
import 'package:one_key/provider/user_model.dart';
import 'package:one_key/utils/log_util.dart';
import 'package:provider/provider.dart';
import 'message_dialog_item.dart';
class MessageRightPage extends StatefulWidget{
@override
State<StatefulWidget> createState() {
// TODO: implement createState
return new MessageRightPageState();
}
}
class MessageRightPageState extends State<MessageRightPage>{
EasyRefreshController _controller;
int offset=0;//当前页数
@override
void initState() {
// TODO: implement initState
super.initState();
_controller=EasyRefreshController();
WidgetsBinding.instance.addPostFrameCallback((_){
getTreatedMessage();
});
}
//获取未处理在线预订消息
getTreatedMessage(){
UserModel userModel=Provider.of<UserModel>(context,listen: false);
Map<String,String> params={
"sid":userModel.user.sellerid,
"type_id":"10",
"status":"1",
"offset":offset.toString(),
"limit":"10",
};
MessageModel messageModel=Provider.of<MessageModel>(context,listen: false);
messageModel.getTreatedMsg(context, params);
}
@override
Widget build(BuildContext context) {
// TODO: implement build
return Selector<MessageModel,List>(
selector: (context,model)=>model.treatedMsgs,
shouldRebuild: (pre,next)=>true,
builder: (context,messages,child){
return EasyRefresh.custom(
controller: _controller,
slivers: [
SliverList(
delegate:
SliverChildBuilderDelegate((BuildContext context, int index) {
return MessageDialogItem(messages[index],isTreated: true,);
},childCount: messages.length),
)
],onRefresh: () async {
offset=1;
getTreatedMessage();
},onLoad: () async {
offset++;
getTreatedMessage();
},);
},
);
}
}
\ No newline at end of file
... ...
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:one_key/provider/user_model.dart';
import 'package:one_key/res/colors.dart';
import 'package:one_key/widgets/app_bar.dart';
import 'package:one_key/widgets/h_empty_view.dart';
import 'package:one_key/widgets/v_empty_view.dart';
import 'package:provider/provider.dart';
class MyPage extends StatefulWidget{
@override
State<StatefulWidget> createState() {
// TODO: implement createState
return new MyPageState();
}
}
class MyPageState extends State<MyPage>{
@override
Widget build(BuildContext context) {
// TODO: implement build
return Container(
width: double.infinity,
height: double.infinity,
color: MyColours.color_f5f5f5,
child: Column(
children: <Widget>[
MyAppBar("我的",showBack: false,backgroundColor: MyColours.color_2bb5b7,fontColor: MyColours.color_fefefe,),
Container(
width: double.infinity,
height: ScreenUtil().setHeight(396),
decoration: BoxDecoration(
color: MyColours.color_2bb5b7,
boxShadow: [BoxShadow(color: MyColours.color_2e000000,offset: Offset(.0,2.0))],
borderRadius: BorderRadius.only(bottomLeft: Radius.circular(ScreenUtil().setWidth(350)),bottomRight: Radius.circular(ScreenUtil().setWidth(350)))
),
child: Consumer<UserModel>(builder: (BuildContext context,UserModel model,Widget child){
return Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
VEmptyView(25),
Image.asset("assets/my_logo.png",width: ScreenUtil().setWidth(228),height: ScreenUtil().setWidth(228),),
VEmptyView(30),
Text(model.user.sellername,style: TextStyle(color: MyColours.color_ffffff,fontSize: ScreenUtil().setSp(26)),),
VEmptyView(12),
Text(model.user.account+" | "+model.user.role_name,style: TextStyle(color: MyColours.color_ffffff,fontSize: ScreenUtil().setSp(24)),)
],
);
},)
),
Consumer<UserModel>(builder: (BuildContext context,UserModel model,Widget child){
return GestureDetector(
onTap: (){
model.loginOut(context, {"seller_code":model.user.sellercode,"account":model.user.account});
},
child: Container(
height: ScreenUtil().setHeight(106),
margin: EdgeInsets.symmetric(horizontal: ScreenUtil().setWidth(20),vertical: ScreenUtil().setHeight(40)),
decoration: BoxDecoration(
color: MyColours.color_ffffff,
borderRadius: BorderRadius.all(Radius.circular(ScreenUtil().setWidth(8))),
boxShadow: [BoxShadow(color: MyColours.color_14000000,offset: Offset(.0, 1.0))]
),
child: Center(
child: Row(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Image.asset("assets/icon_exist.png",width: ScreenUtil().setWidth(25),height: ScreenUtil().setWidth(25),),
HEmptyView(18),
Text("退出登录",style: TextStyle(color: MyColours.color_353535,fontSize: ScreenUtil().setSp(30)))
],
),
),
),
);
},)
],
),
);
}
}
\ No newline at end of file
... ...
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:one_key/models/notebook.dart';
import 'package:one_key/res/colors.dart';
import 'package:one_key/utils/navigator_util.dart';
import 'package:one_key/widgets/MyDivider.dart';
import 'package:one_key/widgets/v_empty_view.dart';
class NoteBookItem extends StatefulWidget {
final num index;
final Notebook notebook;
NoteBookItem(this.notebook,this.index);
@override
State<StatefulWidget> createState() {
// TODO: implement createState
return new NotebookItemState();
}
}
class NotebookItemState extends State<NoteBookItem>{
_onOperateClick(){
if(widget.notebook.operationText=="通知客户"){
NavigatorUtil.goInvicationPage(context, widget.notebook.id,widget.notebook.tableinfoStr,widget.notebook.ddate,widget.notebook.ddateStr);
}
}
@override
Widget build(BuildContext context) {
// TODO: implement build
Notebook notebook=widget.notebook;
Color textColor=(notebook.status=="3"||notebook.status=="4"||notebook.status=="6")?MyColours.color_bfbfbf:MyColours.color_353535;
return GestureDetector(
onTap: (){
NavigatorUtil.goNotebookDetailPage(context,notebook.id);
},
child: Container(
width: double.infinity,
height: ScreenUtil().setHeight(112),
color: (widget.index % 2 == 0) ? MyColours.color_f7fdfd : MyColours.color_ffffff,
child: Row(
children: <Widget>[
Container(
width: ScreenUtil().setWidth(144),
alignment: Alignment.center,
child: Text(
notebook.tableinfoStr,
style: TextStyle(
color: textColor,
fontSize: ScreenUtil().setSp(26)),
),
),
MyDivider(
ScreenUtil().setWidth(1),
ScreenUtil().setHeight(90),
color: MyColours.color_ededed,
),
Container(
width: ScreenUtil().setWidth(195),
alignment: Alignment.center,
child: Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Text(notebook.rnameStr,style: TextStyle(color: textColor,fontSize: ScreenUtil().setSp(26)),),
VEmptyView(18),
Text(notebook.phoneStr,style: TextStyle(color: textColor,fontSize: ScreenUtil().setSp(22)),)
],
),
),
MyDivider(
ScreenUtil().setWidth(1),
ScreenUtil().setHeight(90),
color: MyColours.color_ededed,
),
Container(
width: ScreenUtil().setWidth(195),
alignment: Alignment.center,
child: Text(
notebook.ddateStr,
style: TextStyle(
color: textColor,
fontSize: ScreenUtil().setSp(26)),
),
),
MyDivider(
ScreenUtil().setWidth(1),
ScreenUtil().setHeight(90),
color: MyColours.color_ededed,
),
GestureDetector(
onTap: _onOperateClick,
child: Container(
width: ScreenUtil().setWidth(209),
alignment: Alignment.center,
child: Text(
notebook.operationText,
style: TextStyle(
color: (notebook.status=="3"||notebook.status=="4"||notebook.status=="6")?MyColours.color_bfbfbf:MyColours.color_2bb5b7,
fontSize: ScreenUtil().setSp(26)),
),
),
),
],
),
),
);
}
}
... ...
import 'package:flutter/material.dart';
import 'package:flutter_easyrefresh/easy_refresh.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:one_key/pages/notebook/notebook_item_widget.dart';
import 'package:one_key/provider/notebook_model.dart';
import 'package:one_key/provider/user_model.dart';
import 'package:one_key/res/colors.dart';
import 'package:one_key/utils/dialog_util.dart';
import 'package:one_key/utils/log_util.dart';
import 'package:one_key/utils/utils.dart';
import 'package:one_key/widgets/MyDivider.dart';
import 'package:one_key/widgets/app_bar.dart';
import 'package:one_key/widgets/common_button.dart';
import 'package:provider/provider.dart';
class NoteBookPage extends StatefulWidget {
@override
State<StatefulWidget> createState() {
// TODO: implement createState
return new NoteBookPageState();
}
}
class NoteBookPageState extends State<NoteBookPage> {
EasyRefreshController _controller;
String dateText = ""; //当前显示日期时间
int currTimeIndex = 1; //当前选中时间段
String morning; //早市时间段
String noon; //午市时间段
String night; //晚市时间段
DateTime dateTime; //当前日期
UserModel userModel;
@override
void initState() {
// TODO: implement initState
super.initState();
userModel = Provider.of<UserModel>(context, listen: false);
_controller = EasyRefreshController();
_initTime();
WidgetsBinding.instance.addPostFrameCallback((_) {
_getReserveList();
_reserveCountDay();
});
}
//初始化时间
_initTime() {
dateTime = DateTime.now();
dateText = Utils.addZeroNumber(dateTime.month) +
"-" +
Utils.addZeroNumber(dateTime.day) +
" 今天";
morning =
userModel.user.morning.isEmpty ? "00:00-00:00" : userModel.user.morning;
noon = userModel.user.noon.isEmpty ? "00:00-00:00" : userModel.user.noon;
night = userModel.user.night.isEmpty ? "00:00-00:00" : userModel.user.night;
if (dateTime.isBefore(DateTime.parse(dateTime.year.toString() +
"-" +
Utils.addZeroNumber(dateTime.month) +
"-" +
Utils.addZeroNumber(dateTime.day) +
" " +
morning.split("-")[1] +
":00"))) {
//未过早市
currTimeIndex = 1;
} else if (dateTime.isAfter(DateTime.parse(dateTime.year.toString() +
"-" +
Utils.addZeroNumber(dateTime.month) +
"-" +
Utils.addZeroNumber(dateTime.day) +
" " +
morning.split("-")[1] +
":00")) &&
dateTime.isBefore(DateTime.parse(dateTime.year.toString() +
"-" +
Utils.addZeroNumber(dateTime.month) +
"-" +
Utils.addZeroNumber(dateTime.day) +
" " +
noon.split("-")[1] +
":00"))) {
//过了早市,未过午市
currTimeIndex = 2;
} else if (dateTime.isAfter(DateTime.parse(dateTime.year.toString() +
"-" +
Utils.addZeroNumber(dateTime.month) +
"-" +
Utils.addZeroNumber(dateTime.day) +
" " +
noon.split("-")[1] +
":00")) &&
dateTime.isBefore(DateTime.parse(dateTime.year.toString() +
"-" +
Utils.addZeroNumber(dateTime.month) +
"-" +
Utils.addZeroNumber(dateTime.day) +
" " +
night.split("-")[1] +
":00"))) {
//过了午市,未过晚市
currTimeIndex = 3;
} else {
//过了晚市
currTimeIndex = 3;
}
}
//获取已预订列表
_getReserveList() {
NoteBookModel model = Provider.of<NoteBookModel>(context, listen: false);
Map<String, String> params = {
"sid": userModel.user.sellerid,
"rdate": _getRdate(),
"ddate_solt": currTimeIndex.toString(),
"y": "200",
"x": "1",
"keywords": "",
"sort": "1"
};
model.getReserveList(context, params);
}
//获取一天开始-结束时间字符串
String _getRdate() {
//一天开始时间
double startDay = (DateTime.parse((dateTime.year.toString() +
"-" +
Utils.addZeroNumber(dateTime.month) +
"-" +
Utils.addZeroNumber(dateTime.day) +
" 00:00:00"))
.millisecondsSinceEpoch) /
1000;
//一天结束时间
double endDay = (DateTime.parse((dateTime.year.toString() +
"-" +
Utils.addZeroNumber(dateTime.month) +
"-" +
Utils.addZeroNumber(dateTime.day) +
" 23:59:59"))
.millisecondsSinceEpoch) /
1000;
return startDay.floor().toString() + "-" + endDay.floor().toString();
}
//获取订单统计数目
_reserveCountDay() {
NoteBookModel model = Provider.of<NoteBookModel>(context, listen: false);
Map<String, String> params = {
"sid": userModel.user.sellerid,
"day": dateTime.year.toString() +
(dateTime.month < 10
? "0" + dateTime.month.toString()
: dateTime.month.toString()) +
(dateTime.day < 10
? "0" + dateTime.day.toString()
: dateTime.day.toString())
};
model.getReserveCountDay(context, params);
}
//构建List表头
Widget _buildListTitle() {
return Container(
width: double.infinity,
height: ScreenUtil().setHeight(75),
color: MyColours.color_ffffff,
child: Row(
children: <Widget>[
Container(
width: ScreenUtil().setWidth(144),
alignment: Alignment.center,
child: Text(
"桌号",
style: TextStyle(
color: MyColours.color_353535,
fontSize: ScreenUtil().setSp(22)),
),
),
MyDivider(
ScreenUtil().setWidth(1),
ScreenUtil().setHeight(65),
color: MyColours.color_ededed,
),
Container(
width: ScreenUtil().setWidth(195),
alignment: Alignment.center,
child: Text(
"用户姓名",
style: TextStyle(
color: MyColours.color_353535,
fontSize: ScreenUtil().setSp(22)),
),
),
MyDivider(
ScreenUtil().setWidth(1),
ScreenUtil().setHeight(90),
color: MyColours.color_ededed,
),
Container(
width: ScreenUtil().setWidth(195),
alignment: Alignment.center,
child: Text(
"时间",
style: TextStyle(
color: MyColours.color_353535,
fontSize: ScreenUtil().setSp(22)),
),
),
MyDivider(
ScreenUtil().setWidth(1),
ScreenUtil().setHeight(90),
color: MyColours.color_ededed,
),
Container(
width: ScreenUtil().setWidth(209),
alignment: Alignment.center,
child: Text(
"操作",
style: TextStyle(
color: MyColours.color_2bb5b7,
fontSize: ScreenUtil().setSp(22)),
),
),
],
),
);
}
//生成日期文本
_createDateText(DateTime day) {
if (Utils.isOneDay(day, dateTime)) return; //日期没变
setState(() {
DateTime dateNow = DateTime.now();
if (Utils.isOneDay(day, dateNow)) {
dateText = Utils.addZeroNumber(dateNow.month) +
"-" +
Utils.addZeroNumber(dateNow.day) +
" 今天";
} else {
dateText =
Utils.addZeroNumber(day.month) + "-" + Utils.addZeroNumber(day.day);
}
dateTime = day;
});
_getReserveList();
_reserveCountDay();
}
@override
Widget build(BuildContext context) {
// TODO: implement build
return Container(
width: double.infinity,
height: double.infinity,
color: MyColours.color_f5f5f5,
child: Column(
children: <Widget>[
MyAppBar(
"已预订",
showBack: false,
),
Container(
color: MyColours.color_ffffff,
width: double.infinity,
padding: EdgeInsets.symmetric(vertical: ScreenUtil().setHeight(11)),
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Expanded(
child: Center(
child: GestureDetector(
onTap: () {
DialogUtil.showCalendarDialog(context,dateTime).then((day) {
_createDateText(day);
});
},
child: Text(
dateText,
style: TextStyle(
color: MyColours.color_2bb5b7,
fontSize: ScreenUtil().setSp(26)),
),
),
),
),
MyDivider(
ScreenUtil().setWidth(2),
ScreenUtil().setHeight(72),
color: MyColours.color_ededed,
),
Expanded(
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Offstage(
offstage: morning == "00:00-00:00" ? true : false,
child: GestureDetector(
onTap: () {
if (currTimeIndex == 1) return;
setState(() {
currTimeIndex = 1;
});
_getReserveList();
},
child: Padding(
padding: EdgeInsets.symmetric(
horizontal: ScreenUtil().setWidth(7)),
child: CommonButton(
content: "早市",
state: currTimeIndex == 1 ? 1 : 0,
width: ScreenUtil().setWidth(85),
height: ScreenUtil().setHeight(47),
fontSize: ScreenUtil().setSp(26),
)),
),
),
Offstage(
offstage: noon == "00:00-00:00" ? true : false,
child: GestureDetector(
onTap: () {
if (currTimeIndex == 2) return;
setState(() {
currTimeIndex = 2;
});
_getReserveList();
},
child: Padding(
padding: EdgeInsets.symmetric(
horizontal: ScreenUtil().setWidth(7)),
child: CommonButton(
content: "午市",
state: currTimeIndex == 2 ? 1 : 0,
width: ScreenUtil().setWidth(85),
height: ScreenUtil().setHeight(47),
fontSize: ScreenUtil().setSp(26),
)),
)),
Offstage(
offstage: night == "00:00-00:00" ? true : false,
child: GestureDetector(
onTap: () {
if (currTimeIndex == 3) return;
setState(() {
currTimeIndex = 3;
});
_getReserveList();
},
child: Padding(
padding: EdgeInsets.symmetric(
horizontal: ScreenUtil().setWidth(7)),
child: CommonButton(
content: "晚市",
state: currTimeIndex == 3 ? 1 : 0,
width: ScreenUtil().setWidth(85),
height: ScreenUtil().setHeight(47),
fontSize: ScreenUtil().setSp(26),
)),
)),
],
),
)
],
),
),
Selector<NoteBookModel, String>(
selector: (context, model) => model.total,
builder: (context, total, child) {
return Container(
width: double.infinity,
alignment: Alignment.centerLeft,
padding: EdgeInsets.only(left: ScreenUtil().setWidth(38)),
height: ScreenUtil().setHeight(72),
color: MyColours.color_f5f5f5,
child: Text(
total,
style: TextStyle(
color: MyColours.color_131313,
fontSize: ScreenUtil().setSp(18)),
),
);
},
),
_buildListTitle(),
Expanded(
child: Selector<NoteBookModel, List>(
selector: (context, model) => model.notebooks,
builder: (context, notebooks, child) {
return EasyRefresh.custom(
controller: _controller,
slivers: [
SliverFixedExtentList(
delegate: SliverChildBuilderDelegate(
(BuildContext context, int index) {
return NoteBookItem(notebooks[index], index);
}, childCount: notebooks.length),
itemExtent: ScreenUtil().setHeight(112),
)
],
onRefresh: () async {
_getReserveList();
},
);
},
))
],
),
);
}
}
... ...
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:one_key/models/notebook.dart';
import 'package:one_key/provider/SmsModel.dart';
import 'package:one_key/provider/user_model.dart';
import 'package:one_key/res/colors.dart';
import 'package:one_key/utils/utils.dart';
import 'package:one_key/widgets/app_bar.dart';
import 'package:one_key/widgets/common_button.dart';
import 'package:one_key/widgets/v_empty_view.dart';
import 'package:provider/provider.dart';
import 'package:flutter/services.dart';
class SmsPage extends StatefulWidget{
final String rid;//预订订单id
SmsPage(this.rid);
@override
State<StatefulWidget> createState() {
// TODO: implement createState
return new SmsPageState();
}
}
class SmsPageState extends State<SmsPage>{
SmsModel smsModel=new SmsModel();
UserModel userModel;
String smsContent="";//短信内容
@override
void initState() {
// TODO: implement initState
super.initState();
userModel=Provider.of<UserModel>(context,listen: false);
WidgetsBinding.instance.addPostFrameCallback((_){
_getSmsContent();
});
}
//获取短信内容
_getSmsContent() async {
Map<String,String> params={
"rid":widget.rid,
"sid":userModel.user.sellerid
};
String sms=await smsModel.getSmsContent(context, params);
setState(() {
smsContent=sms;
});
}
//发送短信
_sendSms(){
Map<String,String> params={
"rid":widget.rid,
"sid":userModel.user.sellerid
};
smsModel.sendSms(context, params);
}
@override
Widget build(BuildContext context) {
// TODO: implement build
return SafeArea(
child: DefaultTextStyle(style: TextStyle(decoration: TextDecoration.none), child: Container(
color: MyColours.color_ffffff,
child: Column(
children: <Widget>[
MyAppBar("发短信"),
Container(
alignment: Alignment.centerLeft,
margin: EdgeInsets.only(top: ScreenUtil().setHeight(30),left: ScreenUtil().setWidth(38)),
child: Text("已自动生成短信通知,可直接发送",style: TextStyle(color: MyColours.color_353535,fontSize: ScreenUtil().setSp(22)),),
),
Container(
width: ScreenUtil().setWidth(673),
margin: EdgeInsets.only(left:ScreenUtil().setWidth(38), right:ScreenUtil().setWidth(38), top:ScreenUtil().setWidth(38)),
padding: EdgeInsets.symmetric(horizontal: ScreenUtil().setWidth(23),vertical: ScreenUtil().setHeight(36)),
decoration: BoxDecoration(
border: Border.all(color: MyColours.color_dbe3e3,width: ScreenUtil().setWidth(2)),
borderRadius: BorderRadius.all(Radius.circular(ScreenUtil().setWidth(8))),
),
child: Text(smsContent,style: TextStyle(color: MyColours.color_353535,fontSize: ScreenUtil().setSp(26),))
),
Container(
margin: EdgeInsets.only(top: ScreenUtil().setHeight(143)),
child: Column(
children: <Widget>[
CommonButton(
width: 672,
height: 76,
fontSize: 26,
content: "直接发送",
state: 1,
onPress: (){
_sendSms();
},
),
VEmptyView(20),
CommonButton(
width: 672,
height: 76,
fontSize: 26,
content: "复制短信",
state: 0,
onPress: () async {
await Clipboard.setData(ClipboardData(text: smsContent));
Utils.showToast("复制成功!");
},
)
],
),
)
],
),
)),
);
}
}
\ No newline at end of file
... ...
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:one_key/models/area.dart';
import 'package:one_key/models/notebook.dart';
import 'package:one_key/models/tableOuter.dart';
import 'package:one_key/provider/notebook_model.dart';
import 'package:one_key/provider/select_table_model.dart';
import 'package:one_key/provider/user_model.dart';
import 'package:one_key/res/colors.dart';
import 'package:one_key/utils/utils.dart';
import 'package:one_key/widgets/app_bar.dart';
import 'package:one_key/widgets/area_item.dart';
import 'package:one_key/widgets/common_button.dart';
import 'package:one_key/widgets/table_item.dart';
import 'package:one_key/models/table.dart' as t;
import 'package:provider/provider.dart';
class SelectTablePage extends StatefulWidget{
final String rid;//预订id
final DateTime dateTime;//日期
final String ddate_slot;//时段
SelectTablePage(this.rid,this.dateTime,this.ddate_slot);
@override
State<StatefulWidget> createState() {
// TODO: implement createState
return new SelectTablePageState();
}
}
class SelectTablePageState extends State<SelectTablePage>{
List<Area> areas=[];//区域列表
List<t.Table> selectTables=[];//选择的桌位
List<TableOuter> tableOuterList=[];//区域-桌位列表
Map<String,List<t.Table>> areaTableMap={};//区域-桌位Map
SelectTableModel selectTableModel=new SelectTableModel();
Map<String,Notebook> tableMap={};//记录已预订桌位对应的订单
String currentArea;//当前选中区域
@override
void initState() {
// TODO: implement initState
super.initState();
WidgetsBinding.instance.addPostFrameCallback((_){
getTableList();
});
}
//获取桌位列表
getTableList() async {
UserModel userModel=Provider.of<UserModel>(context,listen:false);
Map<String,String> params={
"sellerid":userModel.user.sellerid
};
tableOuterList= await selectTableModel.getTableList(context, params);
_getReserveList(userModel.user.sellerid);
}
//获取已预订列表
_getReserveList(String sid) async {
NoteBookModel model = new NoteBookModel();
Map<String, String> params = {
"sid": sid,
"rdate": _getRdate(),
"ddate_solt": widget.ddate_slot,
"y": "200",
"x": "1",
"keywords": "",
"sort": "1"
};
List<Notebook> noteBooks=await model.getReserveList(context, params);
for(Notebook notebook in noteBooks){
if(notebook.tid.isEmpty)continue;
if(notebook.status=="1"||notebook.status=="2"||notebook.status=="5"){//已预订,用餐中,已安排
List<String> tids=notebook.tid.split(",");
for(String tid in tids){
tableMap["$tid"]=notebook;
}
}
}
initData();
}
//初始桌位数据
initData(){
for(TableOuter outer in tableOuterList){
int count=0;
for(t.Table table in outer.list){
if(table.tablestatus=="0"){//没有用餐中
if(tableMap["${table.id}"]!=null){
Notebook notebook=tableMap["${table.id}"];
table.sign=notebook.status;
table.notebookId=notebook.id;
table.reserver=notebook.rnameStr;
}else{
table.sign="";
table.notebookId="";
if(table.enable=="1"){
count++;
}
}
}else{
table.sign="2";
table.notebookId="";
}
}
areaTableMap["${outer.name}"]=outer.list;
Area area=Area();
area.name=outer.name;
area.count=count;
areas.add(area);
}
currentArea=areaTableMap.keys.first;
setState(() {
});
}
//获取一天开始-结束时间字符串
String _getRdate() {
//一天开始时间
double startDay = (DateTime.parse((widget.dateTime.year.toString() +
"-" +
Utils.addZeroNumber(widget.dateTime.month) +
"-" +
Utils.addZeroNumber(widget.dateTime.day) +
" 00:00:00"))
.millisecondsSinceEpoch) /
1000;
//一天结束时间
double endDay = (DateTime.parse((widget.dateTime.year.toString() +
"-" +
Utils.addZeroNumber(widget.dateTime.month) +
"-" +
Utils.addZeroNumber(widget.dateTime.day) +
" 23:59:59"))
.millisecondsSinceEpoch) /
1000;
return startDay.floor().toString() + "-" + endDay.floor().toString();
}
@override
Widget build(BuildContext context) {
// TODO: implement build
return areaTableMap.isEmpty?Container():SafeArea(
child: Column(
children: <Widget>[
MyAppBar(
"选择桌位",
showBack: true,
),
Expanded(
child: Container(
color: MyColours.color_ffffff,
child: Row(
children: <Widget>[
Container(
width: ScreenUtil().setWidth(189),
height: double.infinity,
color: MyColours.color_f1f1f1,
child: ListView.builder(itemBuilder: (context,index){
return AreaItem(areas[index],currentArea,(area){
setState(() {
currentArea=(area as Area).name;
});
});
},itemExtent: ScreenUtil().setHeight(207),itemCount: areas.length,),
),
Expanded(
child: Padding(padding: EdgeInsets.symmetric(vertical: ScreenUtil().setHeight(10),horizontal: ScreenUtil().setWidth(9)),child: GridView.builder(gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 3,childAspectRatio: 0.8),itemBuilder: (context,index){
return TableItem(areaTableMap[currentArea][index],onSelected:(table){
if((table as t.Table).selected){
selectTables.add(table);
}else{
selectTables.removeWhere((t)=>t.id==table.id);
}
},canSelected: true,);
},itemCount: areaTableMap[currentArea].length,),),
)
],
),
),
),
Container(
width: double.infinity,
height: ScreenUtil().setHeight(100),
alignment: Alignment.center,
decoration: BoxDecoration(
color: MyColours.color_ffffff,
border: Border(top: BorderSide(color: MyColours.color_bfbfbf,width: ScreenUtil().setHeight(1)))
),
child: CommonButton(
content: "确定",
width: 600,
height: 76,
fontSize: 26,
state: 1,
onPress: (){
if(selectTables.length>0){
String tid="";
for(t.Table table in selectTables){
tid+=table.id+",";
}
tid=tid.substring(0,tid.length-1);
Navigator.of(context).pop(tid);
}
},
)
)
],
),
);
}
}
\ No newline at end of file
... ...
import 'package:flutter/material.dart';
import 'package:one_key/constant/constant.dart';
import 'package:one_key/net/base_resp.dart';
import 'package:one_key/net/dio_util.dart';
import 'package:one_key/net/http_url.dart';
import 'package:one_key/utils/utils.dart';
class SmsModel with ChangeNotifier {
//获取短信内容
Future<String> getSmsContent(
BuildContext context, Map<String, String> params) async {
BaseResp<Map<String, dynamic>> baseResp = await DioUtil()
.request<Map<String, dynamic>>(
context, Method.get, HttpUrl.get_sms_content,
data: params)
.catchError((error) {
print(error.toString());
});
if (baseResp.code == Constant.status_success) {
return baseResp.data["content"];
}else{
Utils.showToast(baseResp.msg??"");
}
return "";
}
//发送短信
sendSms(BuildContext context, Map<String, String> params) async {
BaseResp<Map<String, dynamic>> baseResp = await DioUtil()
.request<Map<String, dynamic>>(context, Method.get, HttpUrl.send_sms,
data: params)
.catchError((error) {
print(error.toString());
});
if (baseResp.code == Constant.status_success) {
Utils.showToast("短信发送成功");
} else {
Utils.showToast(baseResp.msg ?? "");
}
}
}
... ...
import 'package:flutter/material.dart';
import 'package:one_key/constant/constant.dart';
import 'package:one_key/models/message.dart';
import 'package:one_key/net/base_resp.dart';
import 'package:one_key/net/dio_util.dart';
import 'package:one_key/net/http_url.dart';
import 'package:one_key/utils/dialog_util.dart';
import 'package:audioplayers/audio_cache.dart';
import 'package:one_key/utils/log_util.dart';
class MessageDialogModel extends ChangeNotifier{
final _player = AudioCache();
bool showMessageDialog=false;
List<Message> messages=[];
void init() {
_player.load("tts_online.mp3");
}
/// 播放
void play() {
_player.play("tts_online.mp3");
}
//添加一条信息
addMessage(BuildContext context,Message message){
LogUtil.v(message.toString());
play();
messages.add(message);
if(!showMessageDialog){
DialogUtil.showMessageDialog(context);
}else{
notifyListeners();
}
}
//添加一条信息
removeMessage(Message message){
messages.remove(message);
notifyListeners();
}
//获取未处理在线预订消息
getUntreatedMsg(BuildContext context,Map<String,String> params) async {
BaseResp<List> baseResp = await DioUtil()
.request<List>(context, Method.get, HttpUrl.get_message_list,
data: params)
.catchError((error) {
print(error.toString());
});
if (baseResp.code == Constant.status_success) {
messages=baseResp.data.map<Message>((value){
return Message.fromJson(value);
}).toList();
messages.removeWhere((message)=>message.message_type!="10");
if(messages.isNotEmpty){
play();
if(!showMessageDialog){
DialogUtil.showMessageDialog(context);
}else{
notifyListeners();
}
}
}
}
}
\ No newline at end of file
... ...
import 'package:flutter/material.dart';
import 'package:one_key/constant/constant.dart';
import 'package:one_key/models/message.dart';
import 'package:one_key/net/base_resp.dart';
import 'package:one_key/net/dio_util.dart';
import 'package:one_key/net/http_url.dart';
import 'package:one_key/utils/log_util.dart';
class MessageModel extends ChangeNotifier{
List<Message> untreatedMsgs=[];//未处理在线预订消息
List<Message> treatedMsgs=[];//已处理在线预订消息
//获取未处理在线预订消息
getUntreatedMsg(BuildContext context,Map<String,String> params) async {
BaseResp<List> baseResp = await DioUtil()
.request<List>(context, Method.get, HttpUrl.get_message_list,
data: params)
.catchError((error) {
print(error.toString());
});
if (baseResp.code == Constant.status_success) {
untreatedMsgs=baseResp.data.map<Message>((value){
return Message.fromJson(value);
}).toList();
untreatedMsgs.removeWhere((message)=>message.message_type!="10");
notifyListeners();
}
}
//获取未处理在线预订消息
getTreatedMsg(BuildContext context,Map<String,String> params) async {
BaseResp<List> baseResp = await DioUtil()
.request<List>(context, Method.get, HttpUrl.get_message_list,
data: params)
.catchError((error) {
print(error.toString());
});
if (baseResp.code == Constant.status_success) {
if(params["offset"]=="0"){//第一页
treatedMsgs=baseResp.data.map<Message>((value){
return Message.fromJson(value);
}).toList();
}else{
treatedMsgs.addAll(baseResp.data.map<Message>((value){
return Message.fromJson(value);
}).toList());
}
treatedMsgs.removeWhere((message)=>message.message_type!="10");
notifyListeners();
}
}
}
\ No newline at end of file
... ...
import 'package:flutter/material.dart';
class MyModel extends ChangeNotifier{
}
\ No newline at end of file
... ...
import 'package:flutter/material.dart';
import 'package:one_key/constant/constant.dart';
import 'package:one_key/models/manager.dart';
import 'package:one_key/models/notebook_detail.dart';
import 'package:one_key/net/base_resp.dart';
import 'package:one_key/net/dio_util.dart';
import 'package:one_key/net/http_url.dart';
import 'package:one_key/provider/user_model.dart';
import 'package:one_key/utils/navigator_util.dart';
import 'package:one_key/utils/utils.dart';
import 'package:provider/provider.dart';
class NotebookDetailModel extends ChangeNotifier{
///获取已预订订单
Future<NotebookDetail> getReserveDetail(BuildContext context,Map<String,String> params) async {
BaseResp<Map<String,dynamic>> baseResp = await DioUtil()
.request<Map<String,dynamic>>(context, Method.get, HttpUrl.reserve_detail,
data: params)
.catchError((error) {
print(error.toString());
});
if (baseResp.code == Constant.status_success) {
return NotebookDetail.fromJson(baseResp.data);
}
}
///获取商家信息
Future<List<Manager>> getManagers(BuildContext context) async {
UserModel userModel=Provider.of<UserModel>(context,listen: false);
Map<String,String> params={"seller_id": userModel.user.sellerid, "seller_openid": userModel.user.openid};
BaseResp<Map<String, dynamic>> baseResp = await DioUtil()
.request<Map<String, dynamic>>(context, Method.get, HttpUrl.sellerinfo,
data: params)
.catchError((error) {
print(error.toString());
});
if (baseResp.code == Constant.status_success) {
return (baseResp.data["manager"] as List).map((value)=>Manager.fromJson(value as Map<String,dynamic>)).toList();
}
}
///设置客户经理
setReserveCusmnan(BuildContext context,Map<String,String> params) async {
BaseResp<String> baseResp = await DioUtil()
.request<String>(context, Method.get, HttpUrl.set_reserve_cusman,
data: params)
.catchError((error) {
print(error.toString());
});
if (baseResp.code == Constant.status_success) {
}else{
Utils.showToast(baseResp.msg??"");
}
}
//安排在线预订
setReserveStatus(BuildContext context,Map<String,String> params) async {
BaseResp<Map<String,dynamic>> baseResp = await DioUtil()
.request<Map<String,dynamic>>(context, Method.get, HttpUrl.set_reserve_status,
data: params,showLoading: false)
.catchError((error) {
print(error.toString());
});
if(baseResp.code==Constant.status_success){
NavigatorUtil.goNotebookDetailPage(context, params["rid"],replace: true);
}else{
Utils.showToast(baseResp.msg);
}
}
//设置消息状态
setMessageStatus(BuildContext context,Map<String,String> params) async {
BaseResp<dynamic> baseResp = await DioUtil()
.request<dynamic>(context, Method.get, HttpUrl.set_message_status,
data: params,showLoading: false)
.catchError((error) {
print(error.toString());
});
if(baseResp.code==Constant.status_success){
}else{
Utils.showToast(baseResp.msg);
}
}
}
\ No newline at end of file
... ...
import 'package:flutter/material.dart';
import 'package:one_key/constant/constant.dart';
import 'package:one_key/models/notebook.dart';
import 'package:one_key/net/base_resp.dart';
import 'package:one_key/net/dio_util.dart';
import 'package:one_key/net/http_url.dart';
import 'package:one_key/provider/user_model.dart';
import 'package:one_key/utils/utils.dart';
import 'package:provider/provider.dart';
class NoteBookModel extends ChangeNotifier{
List<Notebook> notebooks=[];//订单列表
String total="";//一天统计
//获取已预订订单
Future<List<Notebook>> getReserveList(BuildContext context,Map<String,String> params) async {
BaseResp<List> baseResp = await DioUtil()
.request<List>(context, Method.get, HttpUrl.get_reserve_list,
data: params,showLoading: false)
.catchError((error) {
print(error.toString());
});
notebooks=[];
if (baseResp.code == Constant.status_success) {
notebooks=baseResp.data.map<Notebook>((value){
return Notebook.fromJson(value);
}).toList();
}else{
Utils.showToast(baseResp.msg??"");
}
notifyListeners();
return notebooks;
}
//获取订单统计数目
getReserveCountDay(BuildContext context,Map<String,String> params) async {
BaseResp<Map<String,dynamic>> baseResp = await DioUtil()
.request<Map<String,dynamic>>(context, Method.get, HttpUrl.reserve_count_day,
data: params,showLoading: false)
.catchError((error) {
print(error.toString());
});
if (baseResp.code == Constant.status_success) {
int morning=int.parse(baseResp.data["morning"].toString());
int noon=int.parse(baseResp.data["noon"].toString());
int night=int.parse(baseResp.data["night"].toString());
UserModel userModel=Provider.of<UserModel>(context,listen: false);
total="已订"+(morning+noon+night).toString();
if(userModel.user.morning.isNotEmpty){
total+=" 早市"+morning.toString();
}
if(userModel.user.noon.isNotEmpty){
total+=" 午市"+noon.toString();
}
if(userModel.user.night.isNotEmpty){
total+=" 晚市"+night.toString();
}
notifyListeners();
}
}
}
\ No newline at end of file
... ...
import 'package:flutter/material.dart';
import 'package:one_key/constant/constant.dart';
import 'package:one_key/models/tableOuter.dart';
import 'package:one_key/net/base_resp.dart';
import 'package:one_key/net/dio_util.dart';
import 'package:one_key/net/http_url.dart';
import 'package:one_key/models/table.dart' as t;
import 'package:one_key/utils/navigator_util.dart';
import 'package:one_key/utils/utils.dart';
class SelectTableModel{
//获取桌位数据
Future<List<TableOuter>> getTableList(BuildContext context,Map<String,String> params) async {
BaseResp<List> baseResp = await DioUtil()
.request<List>(context, Method.get, HttpUrl.table_list,
data: params,showLoading: false)
.catchError((error) {
print(error.toString());
});
if(baseResp.code==Constant.status_success){
return (baseResp.data[0] as List).map((value){
TableOuter tableOuter=TableOuter();
tableOuter.name=value["name"];
tableOuter.list=(value["list"] as List).map((table){
return t.Table.fromJson(table as Map<String,dynamic>);
}).toList();
return tableOuter;
}).toList();
}
return [];
}
}
\ No newline at end of file
... ...
import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:one_key/constant/constant.dart';
import 'package:one_key/models/user.dart';
import 'package:one_key/net/base_resp.dart';
import 'package:one_key/net/dio_util.dart';
import 'package:one_key/net/http_url.dart';
import 'package:one_key/utils/log_util.dart';
import 'package:one_key/utils/navigator_util.dart';
import 'package:one_key/utils/utils.dart';
import '../app.dart';
class UserModel with ChangeNotifier {
User _user;
String _registrationId;//极光推送registrationId
User get user => _user;
set registrationId(String registrationId)=>_registrationId=registrationId;
String get registrationId =>_registrationId;
/// 初始化 User
void initUser() {
if (App.sp.containsKey('user')) {
String s = App.sp.getString('user');
_user = User.fromJson(json.decode(s));
}
}
/// 登录
Future<String> login(BuildContext context, Map<String, String> params) async {
BaseResp<List> baseResp = await DioUtil()
.request<List>(context, Method.get, HttpUrl.app_user_login,
data: params)
.catchError((error) {
print(error.toString());
});
if (baseResp.code != Constant.status_success) {
return baseResp.msg ?? '登录失败,请检查账号密码';
} else {
Map<String, dynamic> seller = baseResp.data[0]["seller"];
Map<String, dynamic> user = baseResp.data[0]["user"];
Map<String, dynamic> userMap = {
"openid": seller['openid'],
"account": user['account'],
"role_name": user['role_name'],
"sellerid": seller['id'],
"sellercode": params['seller_code'],
"sellername": seller['sellername'],
"sellerphone": seller['seller_tel'],
"sellerAddr": '',
"scatter": 0,
"room": 0,
"cassette": 0,
"morning": "",
"noon": "",
"night": "",
};
_saveUserInfo(User.fromJson(userMap));
return getSellerInfo(
context,
{"seller_id": seller['id'], "seller_openid": seller['openid']},
userMap);
}
}
///获取商家信息
Future<String> getSellerInfo(BuildContext context, Map<String, String> params,
Map<String, dynamic> userMap) async {
BaseResp<Map<String, dynamic>> baseResp = await DioUtil()
.request<Map<String, dynamic>>(context, Method.get, HttpUrl.sellerinfo,
data: params)
.catchError((error) {
print(error.toString());
});
if (baseResp.code != Constant.status_success) {
return baseResp.msg ?? '登录失败,请检查账号密码';
} else {
Map<String, dynamic> seller = baseResp.data['seller'];
Map<String, dynamic> daily = baseResp.data["daily"];
Map<String, dynamic> user = Map.of(userMap);
user['sellerAddr'] = seller['real_address'] ?? seller['map_address'];
user['scatter'] = baseResp.data['scatter'];
user['room'] = baseResp.data['room'];
user['cassette'] = baseResp.data['cassette'];
user['morning'] = daily['morning'];
user['noon'] = daily['noon'];
user['night'] = daily['night'];
_saveUserInfo(User.fromJson(user));
App.sp.setBool("isLogin", true);
NavigatorUtil.goHomePage(context);
return null;
}
}
///初始化推送token
userTokenInit(BuildContext context, Map<String, String> params) async {
BaseResp<dynamic> baseResp = await DioUtil()
.request<dynamic>(context, Method.get, HttpUrl.user_token_init,
data: params)
.catchError((error) {
print(error.toString());
});
if (baseResp.code == Constant.status_success) {
}
}
///退出登录
loginOut(BuildContext context, Map<String, String> params) async {
BaseResp<int> baseResp = await DioUtil()
.request<int>(context, Method.get, HttpUrl.login_out, data: params)
.catchError((error) {
print(error.toString());
});
if (baseResp.code != Constant.status_success) {
Utils.showToast(baseResp.msg ?? "退出登录失败,请稍后重试");
} else {
App.sp.setBool("isLogin", false);
NavigatorUtil.goLoginPage(context);
}
}
/// 保存用户信息到 sp
_saveUserInfo(User user) {
_user = user;
App.sp.setString('user', json.encode(user.toJson()));
}
}
... ...
import 'package:flutter/material.dart';
class MyColours {
static const Color app_main = Color(0xFF24A4A8);
static const Color color_ffffff=Color(0xffffffff);
static const Color color_fefefe=Color(0xfffefefe);
static const Color color_f5f5f5=Color(0xfff5f5f5);
static const Color color_199095=Color(0xff199095);
static const Color color_999999=Color(0xff999999);
static const Color color_353535=Color(0xff353535);
static const Color color_d8d8d8=Color(0xffD8D8D8);
static const Color color_bff6f7=Color(0xffBFF6F7);
static const Color color_c1c1c1=Color(0xffC1C1C1);
static const Color color_2bb5b7=Color(0xff2BB5B7);
static const Color color_26000000=Color(0x26000000);
static const Color color_d93535=Color(0xffD93535);
static const Color color_131313=Color(0xff131313);
static const Color color_2e000000=Color(0x2e000000);
static const Color color_14000000=Color(0x14000000);
static const Color color_bfbfbf=Color(0xffBFBFBF);
static const Color color_828282=Color(0xff828282);
static const Color color_a8e2e4=Color(0xffA8E2E4);
static const Color color_63a6d1=Color(0xff63A6D1);
static const Color color_777777=Color(0xff777777);
static const Color color_ea5750=Color(0xffEA5750);
static const Color color_89c0b7=Color(0xff89C0B7);
static const Color color_ededed=Color(0xffededed);
static const Color color_f7fdfd=Color(0xffF7FDFD);
static const Color color_dbe3e3=Color(0xffdbe3e3);
static const Color color_f49a5e=Color(0xffF49A5E);
static const Color color_ff0000=Color(0xffff0000);
static const Color color_000000=Color(0xff000000);
static const Color color_97e9ea=Color(0xff97E9EA);
static const Color color_f1f1f1=Color(0xfff1f1f1);
static const Color color_eadab9=Color(0xffeadab9);
static const Color color_e3d2ac=Color(0xffe3d2ac);
static const Color color_83734d=Color(0xff83734d);
static const Color color_dfdfdf=Color(0xffdfdfdf);
}
... ...
class Dimens {
static const double font_sp10 = 10;
static const double font_sp12 = 12;
static const double font_sp14 = 14;
static const double font_sp16 = 16;
static const double font_sp18 = 18;
static const double font_sp22 = 22;
static const double font_sp24 = 24;
static const double gap_dp5 = 5;
static const double gap_dp10 = 10;
static const double gap_dp12 = 12;
static const double gap_dp15 = 15;
static const double gap_dp16 = 16;
}
... ...
class Ids {
static const String titleHome = 'title_home';
static const String titleEvents = 'title_events';
static const String titleRepos = 'title_repos';
static const String titleSystem = 'title_system';
static const String titleBookmarks = 'title_bookmarks';
static const String titleCollection = 'title_collection';
static const String titleSetting = 'title_setting';
static const String titleAbout = 'title_about';
static const String titleShare = 'title_share';
static const String titleSignOut = 'title_signout';
static const String titleLanguage = 'title_language';
static const String titleTheme = 'title_theme';
static const String titleAuthor = 'title_author';
static const String titleOther = 'title_other';
static const String languageAuto = 'language_auto';
static const String languageZH = 'language_zh';
static const String languageTW = 'language_tw';
static const String languageHK = 'language_hk';
static const String languageEN = 'language_en';
static const String save = 'save';
static const String more = 'more';
static const String recRepos = 'rec_repos';
static const String recWxArticle = 'rec_wxarticle';
static const String titleReposTree = 'title_repos_tree';
static const String titleWxArticleTree = 'title_wxarticle_tree';
static const String titleSystemTree = 'title_system_tree';
static const String user_name = 'user_name';
static const String user_pwd = 'user_pwd';
static const String user_re_pwd = 'user_re_pwd';
static const String user_login = 'user_login';
static const String user_register = 'user_register';
static const String user_forget_pwd = 'user_forget_pwd';
static const String user_new_user_hint = 'user_new_user_hint';
static const String confirm = 'confirm';
static const String cancel = 'cancel';
static const String jump_count = 'jump_count';
}
Map<String, Map<String, String>> localizedSimpleValues = {
'en': {
Ids.titleHome: 'Home',
Ids.titleRepos: 'Repos',
Ids.titleEvents: 'Events',
Ids.titleSystem: 'System',
Ids.titleBookmarks: 'Bookmarks',
Ids.titleSetting: 'Setting',
Ids.titleAbout: 'About',
Ids.titleShare: 'Share',
Ids.titleSignOut: 'Sign Out',
Ids.titleLanguage: 'Language',
Ids.languageAuto: 'Auto',
},
'zh': {
Ids.titleHome: '主页',
Ids.titleRepos: '项目',
Ids.titleEvents: '动态',
Ids.titleSystem: '体系',
Ids.titleBookmarks: '书签',
Ids.titleSetting: '设置',
Ids.titleAbout: '关于',
Ids.titleShare: '分享',
Ids.titleSignOut: '注销',
Ids.titleLanguage: '多语言',
Ids.languageAuto: '跟随系统',
},
};
Map<String, Map<String, Map<String, String>>> localizedValues = {
'en': {
'US': {
Ids.titleHome: 'Home',
Ids.titleRepos: 'Repos',
Ids.titleEvents: 'Events',
Ids.titleSystem: 'System',
Ids.titleBookmarks: 'Bookmarks',
Ids.titleCollection: 'Collection',
Ids.titleSetting: 'Setting',
Ids.titleAbout: 'About',
Ids.titleShare: 'Share',
Ids.titleSignOut: 'Sign Out',
Ids.titleLanguage: 'Language',
Ids.languageAuto: 'Auto',
Ids.save: 'Save',
Ids.more: 'More',
Ids.recRepos: 'Reco Repos',
Ids.recWxArticle: 'Reco WxArticle',
Ids.titleReposTree: 'Repos Tree',
Ids.titleWxArticleTree: 'Wx Article',
Ids.titleTheme: 'Theme',
Ids.user_name: 'user name',
Ids.user_pwd: 'password',
Ids.user_re_pwd: 'confirm password',
Ids.user_login: 'Login',
Ids.user_register: 'Register',
Ids.user_forget_pwd: 'Forget the password?',
Ids.user_new_user_hint: 'New users? ',
Ids.confirm: 'Confirm',
Ids.cancel: 'Cancel',
Ids.jump_count: 'Jump %\$0\$s',
}
},
'zh': {
'CN': {
Ids.titleHome: '主页',
Ids.titleRepos: '项目',
Ids.titleEvents: '动态',
Ids.titleSystem: '体系',
Ids.titleBookmarks: '书签',
Ids.titleCollection: '收藏',
Ids.titleSetting: '设置',
Ids.titleAbout: '关于',
Ids.titleShare: '分享',
Ids.titleSignOut: '注销',
Ids.titleLanguage: '多语言',
Ids.languageAuto: '跟随系统',
Ids.languageZH: '简体中文',
Ids.languageTW: '繁體中文(台灣)',
Ids.languageHK: '繁體中文(香港)',
Ids.languageEN: 'English',
Ids.save: '保存',
Ids.more: '更多',
Ids.recRepos: '推荐项目',
Ids.recWxArticle: '推荐公众号',
Ids.titleReposTree: '项目分类',
Ids.titleWxArticleTree: '公众号',
Ids.titleTheme: '主题',
Ids.user_name: '用户名',
Ids.user_pwd: '密码',
Ids.user_re_pwd: '确认密码',
Ids.user_login: '登录',
Ids.user_register: '注册',
Ids.user_forget_pwd: '忘记密码?',
Ids.user_new_user_hint: '新用户?',
Ids.confirm: '确认',
Ids.cancel: '取消',
Ids.jump_count: '跳过 %\$0\$s',
},
'HK': {
Ids.titleHome: '主頁',
Ids.titleRepos: '項目',
Ids.titleEvents: '動態',
Ids.titleSystem: '體系',
Ids.titleBookmarks: '書簽',
Ids.titleCollection: '收藏',
Ids.titleSetting: '設置',
Ids.titleAbout: '關於',
Ids.titleShare: '分享',
Ids.titleSignOut: '註銷',
Ids.titleLanguage: '語言',
Ids.languageAuto: '與系統同步',
Ids.save: '儲存',
Ids.more: '更多',
Ids.recRepos: '推荐项目',
Ids.recWxArticle: '推荐公众号',
Ids.titleReposTree: '项目分类',
Ids.titleWxArticleTree: '公众号',
Ids.titleTheme: '主題',
Ids.user_name: '用户名',
Ids.user_pwd: '密码',
Ids.user_re_pwd: '确认密码',
Ids.user_login: '登录',
Ids.user_register: '注册',
Ids.user_forget_pwd: '忘记密码?',
Ids.user_new_user_hint: '新用户?',
Ids.confirm: '确认',
Ids.cancel: '取消',
Ids.jump_count: '跳过 %\$0\$s',
},
'TW': {
Ids.titleHome: '主頁',
Ids.titleRepos: '項目',
Ids.titleEvents: '動態',
Ids.titleSystem: '體系',
Ids.titleBookmarks: '書簽',
Ids.titleCollection: '收藏',
Ids.titleSetting: '設置',
Ids.titleAbout: '關於',
Ids.titleShare: '分享',
Ids.titleSignOut: '註銷',
Ids.titleLanguage: '語言',
Ids.languageAuto: '與系統同步',
Ids.save: '儲存',
Ids.more: '更多',
Ids.recRepos: '推荐项目',
Ids.recWxArticle: '推荐公众号',
Ids.titleReposTree: '项目分类',
Ids.titleWxArticleTree: '公众号',
Ids.titleTheme: '主題',
Ids.user_name: '用户名',
Ids.user_pwd: '密码',
Ids.user_re_pwd: '确认密码',
Ids.user_login: '登录',
Ids.user_register: '注册',
Ids.user_forget_pwd: '忘记密码?',
Ids.user_new_user_hint: '新用户?',
Ids.confirm: '确认',
Ids.cancel: '取消',
Ids.jump_count: '跳过 %\$0\$s',
}
}
};
... ...
import 'package:flutter/widgets.dart';
import 'dimens.dart';
class TextStyles {
// static TextStyle listTitle = TextStyle(
// fontSize: Dimens.font_sp16,
// color: MyColours.text_dark,
// fontWeight: FontWeight.bold,
// );
}
class Decorations {
// static Decoration bottom = BoxDecoration(
// border: Border(bottom: BorderSide(width: 0.33, color: MyColours.divider)));
}
/// 间隔
class Gaps {
/// 水平间隔
static Widget hGap5 = new SizedBox(width: Dimens.gap_dp5);
static Widget hGap10 = new SizedBox(width: Dimens.gap_dp10);
static Widget hGap15 = new SizedBox(width: Dimens.gap_dp15);
/// 垂直间隔
static Widget vGap5 = new SizedBox(height: Dimens.gap_dp5);
static Widget vGap10 = new SizedBox(height: Dimens.gap_dp10);
static Widget vGap15 = new SizedBox(height: Dimens.gap_dp15);
}
... ...
import 'package:flutter/material.dart';
class NavigateService {
final GlobalKey<NavigatorState> key = GlobalKey(debugLabel: 'navigate_key');
NavigatorState get navigator => key.currentState;
get pushNamed => navigator.pushNamed;
get push => navigator.push;
get popAndPushNamed => navigator.popAndPushNamed;
}
... ...
import 'package:fluro/fluro.dart';
import 'package:flutter/material.dart';
import 'package:one_key/models/notebook.dart';
import 'package:one_key/pages/home/home_page.dart';
import 'package:one_key/pages/invicate/invitation_page.dart';
import 'package:one_key/pages/login/login_page.dart';
import 'package:one_key/pages/detail/handle_online_page.dart';
import 'package:one_key/pages/detail/notebook_detail_page.dart';
import 'package:one_key/pages/sms/sms_page.dart';
import 'package:one_key/pages/table/select_table_page.dart';
import 'package:one_key/utils/fluro_convert_utils.dart';
import 'package:one_key/utils/log_util.dart';
// 登录页
var loginHandler = new Handler(
handlerFunc: (BuildContext context, Map<String, List<Object>> params) {
return LoginPage();
});
// 跳转到主页
var homeHandler = new Handler(
handlerFunc: (BuildContext context, Map<String, List<Object>> params) {
String initialIndex=params["initialIndex"].first;
return HomePage(initialIndex: int.parse(initialIndex),);
});
// 跳转到处理在线预订
var reserveDetailHandler = new Handler(
handlerFunc: (BuildContext context, Map<String, List<Object>> params) {
String rid=params['rid'].first;
return NotebookDetailPage(rid);
});
// 跳转到处理在线预订
var handleOnlineHandler = new Handler(
handlerFunc: (BuildContext context, Map<String, List<Object>> params) {
String rid=params['rid'].first;
String mid=params["mid"].first;
return HandleOnlinePage(rid,mid);
});
// 跳转到选择桌位
var handleSelectTableHandler = new Handler(
handlerFunc: (BuildContext context, Map<String, List<Object>> params) {
String rid=params['rid'].first;
DateTime dateTime=DateTime.fromMillisecondsSinceEpoch(int.parse(params["dateTime"].first));
String ddate_slot=params["ddate_slot"].first;
return SelectTablePage(rid,dateTime,ddate_slot);
});
// 跳转到邀请函页面
var handleInvicationHandler = new Handler(
handlerFunc: (BuildContext context, Map<String, List<Object>> params) {
String rid=params["rid"].first;
String tableInfo=FluroConvertUtils.fluroCnParamsDecode(params["tableInfo"].first);
String ddate=params["ddate"].first;
String ddateStr=FluroConvertUtils.fluroCnParamsDecode(params["ddateStr"].first);
return InvicationPage(rid,tableInfo,ddate,ddateStr);
});
// 发短信
var handleSmsHandler = new Handler(
handlerFunc: (BuildContext context, Map<String, List<Object>> params) {
String rid=params["rid"].first;
return SmsPage(rid);
});
... ...
import 'package:fluro/fluro.dart';
import 'package:flutter/material.dart';
import 'package:one_key/pages/login/login_page.dart';
import 'route_handles.dart';
class Routes {
static String login = "/";//登录页
static String home = "/home";//主页
static String handle_online_page="/handle_online_page";//处理在线预订
static String reserve_detail="/reserve_detail";//预订详情
static String select_table="/select_table";//选择桌位
static String invication="/invication";//邀请函
static String sms="/sms";//发短信
static void configureRoutes(Router router) {
router.notFoundHandler = new Handler(
handlerFunc: (BuildContext context, Map<String, List<String>> params) {
print("ROUTE WAS NOT FOUND !!!");
return LoginPage();
});
router.define(login, handler: loginHandler);
router.define(home, handler: homeHandler);
router.define(handle_online_page, handler: handleOnlineHandler);
router.define(reserve_detail, handler: reserveDetailHandler);
router.define(select_table, handler: handleSelectTableHandler);
router.define(invication, handler: handleInvicationHandler);
router.define(sms, handler: handleSmsHandler);
}
}
... ...
import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:flutter_picker/flutter_picker.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:one_key/models/message.dart';
import 'package:one_key/models/notebook.dart';
import 'package:one_key/pages/message/message_dialog_item.dart';
import 'package:one_key/provider/message_dialog_model.dart';
import 'package:one_key/provider/message_model.dart';
import 'package:one_key/res/colors.dart';
import 'package:one_key/utils/log_util.dart';
import 'package:one_key/utils/navigator_util.dart';
import 'package:one_key/utils/utils.dart';
import 'package:one_key/widgets/common_button.dart';
import 'package:one_key/widgets/v_empty_view.dart';
import 'package:provider/provider.dart';
import 'package:table_calendar/table_calendar.dart';
class DialogUtil {
//显示消息弹框
static showMessageDialog(BuildContext context) async {
MessageDialogModel messageModel =
Provider.of<MessageDialogModel>(context, listen: false);
if (messageModel.messages.isEmpty) return null;
messageModel.play();
messageModel.showMessageDialog=true;
await showModalBottomSheet<int>(
context: context,
builder: (BuildContext dialogContext) {
Widget widget = Container(
color: MyColours.app_main,
child: Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Consumer<MessageDialogModel>(builder: (BuildContext context,
MessageDialogModel model, Widget child) {
if(messageModel.messages.isEmpty)return Container();
return Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Container(
height: ScreenUtil().setHeight(53),
width: double.infinity,
child: Stack(
alignment: Alignment.center,
children: <Widget>[
Text(
"您有一条新的消息",
style: TextStyle(
color: MyColours.color_ffffff,
fontSize: ScreenUtil().setSp(26)),
),
Positioned(
right: ScreenUtil().setWidth(8),
child: GestureDetector(
onTap: () {
Navigator.of(dialogContext).pop();
},
child: Padding(
padding:
EdgeInsets.all(ScreenUtil().setWidth(12)),
child: Image.asset(
"assets/icon_close.png",
width: ScreenUtil().setWidth(28),
height: ScreenUtil().setWidth(28),
),
),
))
],
)),
model.messages.length>2?Container(
margin: EdgeInsets.symmetric(horizontal: ScreenUtil().setWidth(22),vertical: ScreenUtil().setWidth(11)),
padding: EdgeInsets.fromLTRB(
ScreenUtil().setWidth(16),
ScreenUtil().setWidth(76),
ScreenUtil().setWidth(16),
ScreenUtil().setWidth(41)),
decoration: BoxDecoration(
color: MyColours.color_fefefe,
borderRadius:
BorderRadius.all(Radius.circular(ScreenUtil().setWidth(8)))),
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Text(
"在线预订",
style: TextStyle(
color: MyColours.color_353535,
fontSize: ScreenUtil().setSp(26)),
),
Spacer(),
Text(
"刚刚",
style: TextStyle(
color: MyColours.color_999999,
fontSize: ScreenUtil().setSp(22)),
),
],
),
VEmptyView(20),
Text(
"在线预订:${model.messages.length}个",
style: TextStyle(
color: MyColours.color_353535,
fontSize: ScreenUtil().setSp(26)),
),
Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Spacer(),
CommonButton(
width: 160,
height: 48,
fontSize: 26,
content: "立即处理",
state: 1,
onPress: () {
NavigatorUtil.goHomePage(context,initialIndex: 0);
},
)
],
)
],
),
):ListView.builder(
itemBuilder: (context, index) {
return MessageDialogItem(model.messages[index]);
},
itemCount: model.messages.length,
shrinkWrap: true)
],
);
})
],
),
);
return widget;
});
messageModel.showMessageDialog=false;
}
//显示消息弹框
static Future<DateTime> showCalendarDialog(BuildContext context,DateTime selectDateTime) {
CalendarController _calendarController = CalendarController();
Map<DateTime, List> _events = {};
return showModalBottomSheet<DateTime>(
context: context,
builder: (BuildContext context) {
BuildContext dialogContext = context;
Widget widget = StatefulBuilder(builder: (context, _setState) {
return Stack(
children: <Widget>[
Container(
color: MyColours.color_ffffff,
child: Column(
children: <Widget>[
TableCalendar(
calendarController: _calendarController,
initialSelectedDay: selectDateTime,
onDaySelected: (day, _) {
Navigator.of(dialogContext).pop(day);
},
availableGestures: AvailableGestures.none,
events: _events,
locale: "zh_CN",
initialCalendarFormat: CalendarFormat.month,
headerStyle: HeaderStyle(
decoration: BoxDecoration(
color: MyColours.color_2bb5b7),
formatButtonVisible: false,
centerHeaderTitle: true,
titleTextBuilder: (dateTime, _) {
return dateTime.year.toString() +
"年-" +
Utils.addZeroNumber(dateTime.month) +
"月";
},
titleTextStyle: TextStyle(
color: MyColours.color_ffffff,
fontSize: ScreenUtil().setSp(26)),
leftChevronIcon:
const Icon(Icons.chevron_left, color: Colors.white),
rightChevronIcon:
const Icon(Icons.chevron_right, color: Colors.white),
),
calendarStyle: CalendarStyle(
contentPadding: const EdgeInsets.only(bottom: 4.0),
weekdayStyle: TextStyle(
color: MyColours.color_2bb5b7,
fontSize: ScreenUtil().setSp(26)),
weekendStyle: TextStyle(
color: MyColours.color_f49a5e,
fontSize: ScreenUtil().setSp(26)),
selectedColor: MyColours.color_2bb5b7,
outsideDaysVisible: false,
),
builders: CalendarBuilders(
dowWeekdayBuilder: (context, weekday) {
return Container(
color: MyColours.color_2bb5b7,
alignment: Alignment.center,
padding: EdgeInsets.symmetric(
vertical: ScreenUtil().setHeight(25)),
child: Text(
weekday,
style: TextStyle(
color: MyColours.color_97e9ea,
fontSize: ScreenUtil().setSp(26)),
),
);
},
selectedDayBuilder: (context, date, _) {
return Container(
decoration: BoxDecoration(
shape: BoxShape.circle,
color: MyColours.color_2bb5b7
),
alignment: Alignment.center,
margin: const EdgeInsets.all(6.0),
padding: const EdgeInsets.only(
bottom: 4.0, left: 8.0, right: 8.0, top: 4.0),
child: Text(
date.day == DateTime
.now()
.day ? '今' : date.day.toString(),
style: TextStyle().copyWith(
fontSize: ScreenUtil().setSp(26),
color: MyColours.color_ffffff),
),
);
},
todayDayBuilder: (context, date, _) {
return Container(
decoration: BoxDecoration(
shape: BoxShape.circle,
border: Border.all(
color: MyColours.color_2bb5b7, width: 1)),
alignment: Alignment.center,
margin: const EdgeInsets.all(6.0),
padding: const EdgeInsets.only(
bottom: 4.0, left: 8.0, right: 8.0, top: 4.0),
child: Text(
'今',
style: TextStyle().copyWith(
fontSize: ScreenUtil().setSp(26),
color: MyColours.color_2bb5b7),
),
);
},
singleMarkerBuilder: (context, dateTime, event) {
return Container(
width: ScreenUtil().setWidth(6),
height: ScreenUtil().setWidth(6),
margin: const EdgeInsets.symmetric(
horizontal: 0.3),
decoration: BoxDecoration(
shape: BoxShape.circle,
color: MyColours.color_ff0000,
),
);
},
),
),
],
),
),
Positioned(
bottom: ScreenUtil().setHeight(7),
right: ScreenUtil().setWidth(62),
child: GestureDetector(
onTap: () {
_calendarController.setSelectedDay(DateTime.now());
_setState(() {});
},
child: Container(
child: ClipOval(
child: Container(
width: ScreenUtil().setWidth(95),
height: ScreenUtil().setWidth(95),
alignment: Alignment.center,
color: MyColours.color_2bb5b7,
child: Text(
"回到\n今天",
style: TextStyle(
color: MyColours.color_ffffff,
fontSize: ScreenUtil().setSp(26)),
),
)),
),
),
)
],
);
});
return widget;
});
}
//显示分享弹框
static showShareDialog(BuildContext context) {
return showModalBottomSheet(context: context, builder: (context) {
Widget widget = Container(
width: double.infinity,
height: ScreenUtil().setHeight(233),
color: MyColours.color_dfdfdf,
child: Row(
children: <Widget>[
Expanded(
child: GestureDetector(
onTap: (){
Navigator.of(context).pop(1);
},
behavior: HitTestBehavior.opaque,
child: Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Image.asset(
"assets/icon_wechat.png", width: ScreenUtil().setWidth(126),
height: ScreenUtil().setWidth(126),),
VEmptyView(18),
Text("微信", style: TextStyle(color: MyColours.color_353535,
fontSize: ScreenUtil().setSp(26)),)
],
),
),
),
Expanded(
child: GestureDetector(
onTap: (){
Navigator.of(context).pop(2);
},
behavior: HitTestBehavior.opaque,
child: Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Image.asset(
"assets/icon_sms.png", width: ScreenUtil().setWidth(126),
height: ScreenUtil().setWidth(126),),
VEmptyView(18),
Text("短信", style: TextStyle(color: MyColours.color_353535,
fontSize: ScreenUtil().setSp(26)),)
],
),
),
),
Expanded(
child: GestureDetector(
onTap: (){
Navigator.of(context).pop(3);
},
behavior: HitTestBehavior.opaque,
child: Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Image.asset(
"assets/icon_phone.png", width: ScreenUtil().setWidth(126),
height: ScreenUtil().setWidth(126),),
VEmptyView(18),
Text("电话", style: TextStyle(color: MyColours.color_353535,
fontSize: ScreenUtil().setSp(26)),)
],
),
),
)
],
),
);
return widget;
});
}
//显示选择客户经理弹框
static Future<List<int>> showSelectCusmanDialog(BuildContext context,List<String> data){
return Picker(
adapter: PickerDataAdapter<String>(pickerdata: data),
hideHeader: false,
cancelText: "取消",
cancelTextStyle: TextStyle(color: MyColours.color_828282,fontSize: 20),
confirmText: "确定",
confirmTextStyle: TextStyle(color: MyColours.color_2bb5b7,fontSize: 20),
selectedTextStyle: TextStyle(color: Colors.blue),
onConfirm: (Picker picker, List value) {
print(value.toString());
}
).showModal<List<int>>(context).then((value){
LogUtil.v("value:${value.toString()}");
return value;
});
}
}
... ...
import 'dart:convert';
/// fluro 参数编码解码工具类
class FluroConvertUtils {
/// fluro 传递中文参数前,先转换,fluro 不支持中文传递
static String fluroCnParamsEncode(String originalCn) {
return jsonEncode(Utf8Encoder().convert(originalCn));
}
/// fluro 传递后取出参数,解析
static String fluroCnParamsDecode(String encodeCn) {
var list = List<int>();
///字符串解码
jsonDecode(encodeCn).forEach(list.add);
String value = Utf8Decoder().convert(list);
return value;
}
/// string 转为 int
static int string2int(String str) {
return int.parse(str);
}
/// string 转为 double
static double string2double(String str) {
return double.parse(str);
}
/// string 转为 bool
static bool string2bool(String str) {
if (str == 'true') {
return true;
} else {
return false;
}
}
/// object 转为 string json
static String object2string<T>(T t) {
return fluroCnParamsEncode(jsonEncode(t));
}
/// string json 转为 map
static Map<String, dynamic> string2map(String str) {
return json.decode(fluroCnParamsDecode(str));
}
}
... ...
class LogUtil {
static const String _TAG_DEF = "###common_utils###";
static bool debuggable = false; //是否是debug模式,true: log v 不输出.
static String TAG = _TAG_DEF;
static void init({bool isDebug = false, String tag = _TAG_DEF}) {
debuggable = isDebug;
TAG = tag;
}
static void e(Object object, {String tag}) {
_printLog(tag, ':', object);
}
static void v(Object object, {String tag}) {
if (debuggable) {
_printLog(tag, ':', object);
}
}
static void _printLog(String tag, String stag, Object object) {
String da = object.toString();
String _tag = (tag == null || tag.isEmpty) ? TAG : tag;
while (da.isNotEmpty) {
if (da.length > 1024) {
print("$_tag $stag ${da.substring(0, 1024)}");
da = da.substring(1024, da.length);
} else {
print("$_tag $stag $da");
da = "";
}
}
}
}
\ No newline at end of file
... ...
import 'package:fluro/fluro.dart';
import 'package:flutter/material.dart';
import 'package:one_key/models/notebook.dart';
import 'package:one_key/res/colors.dart';
import 'package:one_key/route/routes.dart';
import 'package:one_key/utils/fluro_convert_utils.dart';
import 'package:one_key/utils/log_util.dart';
import 'package:one_key/utils/utils.dart';
import '../app.dart';
class NavigatorUtil {
static Future _navigateTo(BuildContext context, String path,
{bool replace = false,
bool clearStack = false,
Duration transitionDuration = const Duration(milliseconds: 250),
RouteTransitionsBuilder transitionBuilder}) {
Utils.changeStatusColor(color: MyColours.color_ffffff);
return App.router.navigateTo(context, path,
replace: replace,
clearStack: clearStack,
transitionDuration: transitionDuration,
transitionBuilder: transitionBuilder,
transition: TransitionType.material);
}
/// 登录页
static void goLoginPage(BuildContext context) {
_navigateTo(context, Routes.login, clearStack: true);
}
/// 首页
static void goHomePage(BuildContext context,{int initialIndex=1}) {
_navigateTo(context, "${Routes.home}?initialIndex=$initialIndex", clearStack: true);
}
/// 订单详情
static void goNotebookDetailPage(BuildContext context,String rid,{replace=false}) {
_navigateTo(context,"${Routes.reserve_detail}?rid=$rid",replace: replace);
}
/// 处理在线预订
static void goHandleOnlinePage(BuildContext context,String rid,String mid,{replace=false}) {
_navigateTo(context,"${Routes.handle_online_page}?rid=$rid&mid=$mid",replace: replace);
}
/// 选择桌位
static Future goSelectTablePage(BuildContext context,String rid,DateTime dateTime,String ddate_slot) {
return _navigateTo(context,"${Routes.select_table}?rid=$rid&dateTime=${dateTime.millisecondsSinceEpoch}&ddate_slot=$ddate_slot");
}
/// 邀请函
static void goInvicationPage(BuildContext context,String rid,String tableInfo,String ddate,String ddateStr) {
_navigateTo(context,"${Routes.invication}?rid=$rid&tableInfo=${FluroConvertUtils.fluroCnParamsEncode(tableInfo)}&ddate=$ddate&ddateStr=${FluroConvertUtils.fluroCnParamsEncode(ddateStr)}");
}
/// 发短信
static void goSmsPage(BuildContext context,String rid) {
_navigateTo(context,"${Routes.sms}?rid=$rid");
}
}
... ...
import 'package:extended_image/extended_image.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_statusbarcolor/flutter_statusbarcolor.dart';
import 'package:fluttertoast/fluttertoast.dart';
import 'package:flutter/services.dart';
import 'package:fluwx/fluwx.dart';
import 'package:one_key/utils/log_util.dart';
import 'package:url_launcher/url_launcher.dart';
class Utils {
static void showToast(String msg) {
Fluttertoast.showToast(msg: msg, gravity: ToastGravity.CENTER);
}
//显示网络图片
static Widget showNetImage(String url,
{double width, double height, BoxFit fit}) {
return Image(
image: ExtendedNetworkImageProvider(url, cache: true),
width: width,
height: height,
fit: fit,
);
}
//给数字前面加0
static String addZeroNumber(int num){
return num<10?"0"+num.toString():num.toString();
}
//转换日期数字
static String formatWeekDayNum(int num){
switch(num){
case 1:
return "一";
case 2:
return "二";
case 3:
return "三";
case 4:
return "四";
case 5:
return "五";
case 6:
return "六";
case 7:
return "日";
default:
return "";
}
}
// 改变状态栏背景颜色,默认改变为透明
static changeStatusColor({Color color: Colors.white}) async {
try {
await FlutterStatusbarcolor.setStatusBarColor(color, animate: true);
if (useWhiteForeground(color)) {
FlutterStatusbarcolor.setStatusBarWhiteForeground(true);
} else {
FlutterStatusbarcolor.setStatusBarWhiteForeground(false);
}
} on PlatformException catch (e) {
debugPrint(e.toString());
}
}
//跳转拨打电话页面
static goPhone(String phoneNum) async {
String url="tel:$phoneNum";
if(await canLaunch(url)){
await launch(url);
}else{
LogUtil.e("Could not launch $url");
}
}
//比较两个日期是否同一天
static isOneDay(DateTime one,DateTime two){
if(one.year==two.year&&one.month==two.month&&one.day==two.day)return true;
return false;
}
//分享邀请函
static goShareInvicationToWeChat(String rid){
String _webPageUrl = "http://colorcun.com/";
String _thumbnail =
"http://qn.colorcun.com/reserve/images/%E5%BE%AE%E4%BF%A1%E5%9B%BE%E7%89%87_201911151148572.jpg";
String _title = "用餐已为您安排,点击查看详情";
String _userName = "gh_487873d353b3";
String _path = "pages/customer/index?id=$rid&hasInvitation=1";
String _description = "OneKey";
var model = new WeChatShareMiniProgramModel(
webPageUrl: _webPageUrl,
userName: _userName,
title: _title,
path: _path,
description: _description,
thumbnail: WeChatImage.network(_thumbnail)
);
shareToWeChat(model);
}
}
... ...
import 'package:flutter/material.dart';
import 'package:one_key/res/colors.dart';
class MyDivider extends StatelessWidget{
final num width;
final num height;
final Color color;
MyDivider(this.width, this.height,{this.color=MyColours.color_dbe3e3});
@override
Widget build(BuildContext context) {
// TODO: implement build
return Container(
color: color,
width: width,
height: height,
);
}
}
\ No newline at end of file
... ...
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:one_key/res/colors.dart';
class MyAppBar extends StatelessWidget {
MyAppBar(this.title, {this.showBack = true,this.backgroundColor=MyColours.color_ffffff,this.fontColor=MyColours.color_131313});
final String title;//标题文字
final bool showBack;//是否显示返回按钮
final Color backgroundColor;//背景色
final Color fontColor;//字体颜色
@override
Widget build(BuildContext context) {
// TODO: implement build
return Container(
width: double.infinity,
color: backgroundColor,
padding: EdgeInsets.symmetric(vertical: ScreenUtil().setHeight(30)),
child: Stack(
alignment: Alignment.center,
children: <Widget>[
Positioned(
left: 0,
child: showBack?GestureDetector(
onTap: () {
Navigator.of(context).pop();
},
child: Padding(
padding: EdgeInsets.symmetric(
horizontal: ScreenUtil().setWidth(40),
vertical: ScreenUtil().setHeight(15)),
child: Image.asset(
"assets/icon_back.png",
width: ScreenUtil().setWidth(20),
height: ScreenUtil().setHeight(31),
),
),
):Container(),
),
Center(
child: Text(
title,
style: TextStyle(
color: fontColor,
fontSize: ScreenUtil().setSp(28)),
),
)
],
));
}
}
... ...
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:one_key/models/area.dart';
import 'package:one_key/res/colors.dart';
class AreaItem extends StatefulWidget{
final String currentArea;//当前选中区域名称
final Area area;
final ValueChanged selectCallback;
AreaItem(this.area,this.currentArea,this.selectCallback);
@override
State<StatefulWidget> createState() {
// TODO: implement createState
return new AreaItemState();
}
}
class AreaItemState extends State<AreaItem>{
@override
Widget build(BuildContext context) {
// TODO: implement build
Area area=widget.area;
bool isSelected=area.name==widget.currentArea;
return GestureDetector(
onTap: (){
if(widget.selectCallback!=null){
widget.selectCallback(widget.area);
}
},
child: Stack(
children: <Widget>[
Container(
width: ScreenUtil().setWidth(189),
height: ScreenUtil().setHeight(207),
alignment: Alignment.center,
decoration: BoxDecoration(
color: isSelected?MyColours.color_ffffff:MyColours.color_f1f1f1,
border: Border(bottom: BorderSide(color: MyColours.color_ffffff,width: ScreenUtil().setHeight(1)))
),
child: Text(area.name,style: TextStyle(color: isSelected?MyColours.color_2bb5b7:MyColours.color_828282,fontSize: ScreenUtil().setSp(26),decoration: TextDecoration.none),),
),
Positioned(
left: 0,
top: 0,
child: Container(
width: ScreenUtil().setWidth(73),
height: ScreenUtil().setHeight(37),
alignment: Alignment.center,
decoration: BoxDecoration(
color: MyColours.color_63a6d1,
borderRadius: BorderRadius.only(topRight: Radius.circular(ScreenUtil().setWidth(8)),bottomRight: Radius.circular(ScreenUtil().setWidth(8)))
),
child: Text("余${area.count}",style: TextStyle(color: MyColours.color_ffffff,fontSize: ScreenUtil().setSp(22),decoration: TextDecoration.none)),
),
),
],
),
);
}
}
\ No newline at end of file
... ...
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:one_key/res/colors.dart';
class CommonButton extends StatelessWidget {
final VoidCallback onPress;
final String content;
final double width;
final double height;
final double fontSize;
final int state; //-1 不可用 0 默认 1 选中
CommonButton({
@required this.onPress,
@required this.content,
this.state = 0,
this.width = 250,
this.height = 50,
this.fontSize = 18,
});
@override
Widget build(BuildContext context) {
BoxDecoration boxDecoration;
Color fontColor;
switch (state) {
case -1:
boxDecoration = BoxDecoration(
color: MyColours.color_d8d8d8,
borderRadius: BorderRadius.circular(ScreenUtil().setWidth(5)),
);
fontColor=MyColours.color_ffffff;
break;
case 0:
boxDecoration = BoxDecoration(
border: Border.all(color: MyColours.color_199095),
borderRadius: BorderRadius.circular(ScreenUtil().setWidth(5)),
);
fontColor=MyColours.color_199095;
break;
case 1:
boxDecoration = BoxDecoration(
gradient: LinearGradient(
colors: [Color(0xff199095), Color(0xff36C3C7)],
begin: Alignment.topCenter,
end: Alignment.bottomCenter),
borderRadius: BorderRadius.circular(ScreenUtil().setWidth(5)),
);
fontColor=MyColours.color_fefefe;
break;
default:
boxDecoration = BoxDecoration(
border: Border.all(color: MyColours.color_199095),
borderRadius: BorderRadius.circular(ScreenUtil().setWidth(5)),
);
fontColor=MyColours.color_fefefe;
break;
break;
}
return Material(
child: Ink(
child: InkWell(
onTap: onPress,
child: Container(
width: ScreenUtil().setWidth(width),
height: ScreenUtil().setHeight(height),
decoration:boxDecoration,
child: Align(
alignment: Alignment.center,
child: Text(content, style: TextStyle(color: fontColor,
fontSize: ScreenUtil().setSp(fontSize)),),
),
),
),
),
);
}
}
... ...
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
class HEmptyView extends StatelessWidget {
final double width;
HEmptyView(this.width);
@override
Widget build(BuildContext context) {
return SizedBox(width: ScreenUtil().setWidth(width),);
}
}
... ...
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
class Loading {
static bool isLoading = false;
static void showLoading(BuildContext context) {
if (!isLoading) {
isLoading = true;
showGeneralDialog(
context: context,
barrierDismissible: false,
barrierLabel:
MaterialLocalizations.of(context).modalBarrierDismissLabel,
transitionDuration: const Duration(milliseconds: 150),
pageBuilder: (BuildContext context, Animation animation,
Animation secondaryAnimation) {
return Align(
child: ClipRRect(
borderRadius: BorderRadius.circular(10),
child: Container(
width: 100,
height: 100,
color: Colors.black54,
child: CupertinoActivityIndicator(),
),
),
);
}).then((v) {
isLoading = false;
});
}
}
static void hideLoading(BuildContext context) {
if (isLoading) {
Navigator.of(context).pop();
}
}
}
... ...
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:one_key/res/colors.dart';
class RowMultiText extends StatelessWidget{
final String title;
final String content;
RowMultiText(this.title, this.content);
@override
Widget build(BuildContext context) {
// TODO: implement build
return Container(
color: MyColours.color_ffffff,
width: double.infinity,
height: ScreenUtil().setHeight(74),
padding: EdgeInsets.symmetric(vertical: ScreenUtil().setHeight(26)),
child: Stack(
alignment: Alignment.center,
children: <Widget>[
Positioned(
left: 0,
child: Text(title,style: TextStyle(color: MyColours.color_828282,fontSize: ScreenUtil().setSp(22)),),
),
Positioned(
right: 0,
child: Text(content,style: TextStyle(color: MyColours.color_353535,fontSize: ScreenUtil().setSp(26)),),
)
],
),
);
}
}
\ No newline at end of file
... ...
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:one_key/res/colors.dart';
import 'package:one_key/models/table.dart' as t;
import 'package:one_key/widgets/v_empty_view.dart';
class TableItem extends StatefulWidget{
final t.Table table;
final bool canSelected;//是否能选中
final ValueChanged onSelected;
TableItem(this.table,{this.onSelected,this.canSelected=false});
@override
State<StatefulWidget> createState() {
// TODO: implement createState
return new TableItemState();
}
}
class TableItemState extends State<TableItem>{
@override
Widget build(BuildContext context) {
// TODO: implement build
t.Table table=widget.table;
return GestureDetector(
onTap: (){
if(widget.canSelected&&table.signStr.isEmpty){
setState(() {
table.selected=!(table.selected??false);
});
widget.onSelected(table);
}
},
child: Container(
width: ScreenUtil().setWidth(150),
height: ScreenUtil().setHeight(183),
margin:EdgeInsets.all( ScreenUtil().setWidth(9)),
decoration: BoxDecoration(
color: MyColours.color_a8e2e4,
borderRadius: BorderRadius.all(Radius.circular(ScreenUtil().setWidth(8)))
),
child: Stack(
alignment: Alignment.center,
children: <Widget>[
Positioned(
left: 0,
top: 0,
child: table.tidStr==null?Container():Container(
width: ScreenUtil().setWidth(60),
height: ScreenUtil().setHeight(27),
alignment: Alignment.center,
decoration: BoxDecoration(
color: MyColours.color_63a6d1,
borderRadius: BorderRadius.only(topLeft: Radius.circular(ScreenUtil().setWidth(8)),topRight: Radius.circular(ScreenUtil().setWidth(8)),bottomRight: Radius.circular(ScreenUtil().setWidth(8)))
),
child: Text(table.tidStr,style: TextStyle(color: MyColours.color_ffffff,fontSize: ScreenUtil().setSp(19),decoration: TextDecoration.none)),
),
),
Container(
alignment: Alignment.centerLeft,
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text(table.name,style: TextStyle(color: MyColours.color_131313,fontSize: ScreenUtil().setSp(26),decoration: TextDecoration.none),),
VEmptyView(5),
Text((table.reserver==null||table.reserver.isEmpty)?table.tableNum:table.reserver,style: TextStyle(color: (table.reserver==null||table.reserver.isEmpty)?MyColours.color_777777:MyColours.color_2bb5b7,fontSize: ScreenUtil().setSp(22),decoration: TextDecoration.none),overflow: TextOverflow.ellipsis,),
VEmptyView(5),
Text(table.lowStr,style: TextStyle(color: MyColours.color_777777,fontSize: ScreenUtil().setSp(22),decoration: TextDecoration.none),overflow: TextOverflow.ellipsis,)
],
),
),
Positioned(
bottom: 0,
left: 0,
right: 0,
child: table.signStr.isEmpty?Container():Container(
width: ScreenUtil().setWidth(150),
height: ScreenUtil().setHeight(46),
alignment: Alignment.center,
decoration: BoxDecoration(
color:MyColours.color_89c0b7,
borderRadius: BorderRadius.only(bottomLeft: Radius.circular(ScreenUtil().setWidth(8)),bottomRight: Radius.circular(ScreenUtil().setWidth(8)))
),
child: Text(table.signStr,style: TextStyle(color:MyColours.color_ffffff,fontSize: ScreenUtil().setSp(24),decoration: TextDecoration.none),),
),
),
Positioned(
top: 0,
right: 0,
child: !(table.selected??false)?Container():Image.asset("assets/icon_selected.png",width: ScreenUtil().setWidth(27),height: ScreenUtil().setWidth(27),)
)
],
),
),
);
}
}
\ No newline at end of file
... ...
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
class VEmptyView extends StatelessWidget {
final double height;
VEmptyView(this.height);
@override
Widget build(BuildContext context) {
return SizedBox(
height: ScreenUtil().setWidth(height),
);
}
}
... ...
# Generated by pub
# See https://dart.dev/tools/pub/glossary#lockfile
packages:
analyzer:
dependency: transitive
description:
name: analyzer
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.36.4"
archive:
dependency: transitive
description:
name: archive
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.0.11"
args:
dependency: transitive
description:
name: args
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.5.2"
async:
dependency: transitive
description:
name: async
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.4.0"
audioplayers:
dependency: "direct main"
description:
name: audioplayers
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.14.2"
boolean_selector:
dependency: transitive
description:
name: boolean_selector
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.0.5"
build:
dependency: transitive
description:
name: build
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.1.6"
build_config:
dependency: transitive
description:
name: build_config
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.4.1+1"
build_daemon:
dependency: transitive
description:
name: build_daemon
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.1.3"
build_resolvers:
dependency: transitive
description:
name: build_resolvers
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.2.1"
build_runner:
dependency: "direct dev"
description:
name: build_runner
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.6.9"
build_runner_core:
dependency: transitive
description:
name: build_runner_core
url: "https://pub.flutter-io.cn"
source: hosted
version: "3.1.1"
built_collection:
dependency: transitive
description:
name: built_collection
url: "https://pub.flutter-io.cn"
source: hosted
version: "4.3.2"
built_value:
dependency: transitive
description:
name: built_value
url: "https://pub.flutter-io.cn"
source: hosted
version: "7.0.9"
cached_network_image:
dependency: "direct main"
description:
name: cached_network_image
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.0.0"
charcode:
dependency: transitive
description:
name: charcode
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.1.2"
checked_yaml:
dependency: transitive
description:
name: checked_yaml
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.0.2"
code_builder:
dependency: transitive
description:
name: code_builder
url: "https://pub.flutter-io.cn"
source: hosted
version: "3.2.1"
collection:
dependency: transitive
description:
name: collection
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.14.11"
convert:
dependency: transitive
description:
name: convert
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.1.1"
cookie_jar:
dependency: transitive
description:
name: cookie_jar
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.0.8"
crypto:
dependency: transitive
description:
name: crypto
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.1.3"
csslib:
dependency: transitive
description:
name: csslib
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.16.1"
cupertino_icons:
dependency: "direct main"
description:
name: cupertino_icons
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.1.3"
dart_style:
dependency: transitive
description:
name: dart_style
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.2.9"
dio:
dependency: "direct main"
description:
name: dio
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.0.17"
extended_image:
dependency: "direct main"
description:
name: extended_image
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.7.1"
extended_image_library:
dependency: transitive
description:
name: extended_image_library
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.2.0"
fixnum:
dependency: transitive
description:
name: fixnum
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.10.11"
fluro:
dependency: "direct main"
description:
name: fluro
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.6.1"
flutter:
dependency: "direct main"
description: flutter
source: sdk
version: "0.0.0"
flutter_bugly:
dependency: "direct main"
description:
name: flutter_bugly
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.2.8"
flutter_cache_manager:
dependency: transitive
description:
name: flutter_cache_manager
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.1.3"
flutter_easyrefresh:
dependency: "direct main"
description:
name: flutter_easyrefresh
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.1.0"
flutter_picker:
dependency: "direct main"
description:
name: flutter_picker
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.1.3"
flutter_screenutil:
dependency: "direct main"
description:
name: flutter_screenutil
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.0.2"
flutter_statusbarcolor:
dependency: "direct main"
description:
name: flutter_statusbarcolor
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.2.3"
flutter_test:
dependency: "direct dev"
description: flutter
source: sdk
version: "0.0.0"
flutter_web_plugins:
dependency: transitive
description: flutter
source: sdk
version: "0.0.0"
fluttertoast:
dependency: "direct main"
description:
name: fluttertoast
url: "https://pub.flutter-io.cn"
source: hosted
version: "3.1.3"
fluwx:
dependency: "direct main"
description:
name: fluwx
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.0.7"
front_end:
dependency: transitive
description:
name: front_end
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.1.19"
get_it:
dependency: "direct main"
description:
name: get_it
url: "https://pub.flutter-io.cn"
source: hosted
version: "3.1.0"
glob:
dependency: transitive
description:
name: glob
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.2.0"
graphs:
dependency: transitive
description:
name: graphs
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.2.0"
html:
dependency: transitive
description:
name: html
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.14.0+3"
http:
dependency: transitive
description:
name: http
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.12.0+4"
http_client_helper:
dependency: transitive
description:
name: http_client_helper
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.2.1"
http_multi_server:
dependency: transitive
description:
name: http_multi_server
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.2.0"
http_parser:
dependency: transitive
description:
name: http_parser
url: "https://pub.flutter-io.cn"
source: hosted
version: "3.1.3"
image:
dependency: transitive
description:
name: image
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.1.4"
intl:
dependency: transitive
description:
name: intl
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.16.1"
io:
dependency: transitive
description:
name: io
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.3.3"
jpush_flutter:
dependency: "direct main"
description:
name: jpush_flutter
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.5.3"
js:
dependency: transitive
description:
name: js
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.6.1+1"
json_annotation:
dependency: "direct main"
description:
name: json_annotation
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.3.0"
json_model:
dependency: "direct dev"
description:
name: json_model
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.0.2"
json_serializable:
dependency: "direct dev"
description:
name: json_serializable
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.3.0"
kernel:
dependency: transitive
description:
name: kernel
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.3.19"
logging:
dependency: transitive
description:
name: logging
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.11.4"
matcher:
dependency: transitive
description:
name: matcher
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.12.6"
meta:
dependency: transitive
description:
name: meta
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.1.8"
mime:
dependency: transitive
description:
name: mime
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.9.6+3"
nested:
dependency: transitive
description:
name: nested
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.0.4"
node_interop:
dependency: transitive
description:
name: node_interop
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.0.3"
node_io:
dependency: transitive
description:
name: node_io
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.0.1+2"
package_config:
dependency: transitive
description:
name: package_config
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.9.2"
package_resolver:
dependency: transitive
description:
name: package_resolver
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.0.10"
path:
dependency: transitive
description:
name: path
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.6.4"
path_provider:
dependency: "direct main"
description:
name: path_provider
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.6.5"
path_provider_macos:
dependency: transitive
description:
name: path_provider_macos
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.0.4"
path_provider_platform_interface:
dependency: transitive
description:
name: path_provider_platform_interface
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.0.1"
pedantic:
dependency: transitive
description:
name: pedantic
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.8.0+1"
permission_handler:
dependency: "direct main"
description:
name: permission_handler
url: "https://pub.flutter-io.cn"
source: hosted
version: "4.4.0"
permission_handler_platform_interface:
dependency: transitive
description:
name: permission_handler_platform_interface
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.0.0"
petitparser:
dependency: transitive
description:
name: petitparser
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.4.0"
platform:
dependency: transitive
description:
name: platform
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.2.1"
plugin_platform_interface:
dependency: transitive
description:
name: plugin_platform_interface
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.0.2"
pool:
dependency: transitive
description:
name: pool
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.4.0"
provider:
dependency: "direct main"
description:
name: provider
url: "https://pub.flutter-io.cn"
source: hosted
version: "4.0.4"
pub_semver:
dependency: transitive
description:
name: pub_semver
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.4.4"
pubspec_parse:
dependency: transitive
description:
name: pubspec_parse
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.1.5"
quiver:
dependency: transitive
description:
name: quiver
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.0.5"
shared_preferences:
dependency: "direct main"
description:
name: shared_preferences
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.5.6+3"
shared_preferences_macos:
dependency: transitive
description:
name: shared_preferences_macos
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.0.1+6"
shared_preferences_platform_interface:
dependency: transitive
description:
name: shared_preferences_platform_interface
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.0.3"
shared_preferences_web:
dependency: transitive
description:
name: shared_preferences_web
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.1.2+4"
shelf:
dependency: transitive
description:
name: shelf
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.7.5"
shelf_web_socket:
dependency: transitive
description:
name: shelf_web_socket
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.2.3"
simple_gesture_detector:
dependency: transitive
description:
name: simple_gesture_detector
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.1.4"
sky_engine:
dependency: transitive
description: flutter
source: sdk
version: "0.0.99"
source_gen:
dependency: transitive
description:
name: source_gen
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.9.4+4"
source_span:
dependency: transitive
description:
name: source_span
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.5.5"
sqflite:
dependency: "direct main"
description:
name: sqflite
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.2.2+1"
stack_trace:
dependency: transitive
description:
name: stack_trace
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.9.3"
stream_channel:
dependency: transitive
description:
name: stream_channel
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.0.0"
stream_transform:
dependency: transitive
description:
name: stream_transform
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.0.20"
string_scanner:
dependency: transitive
description:
name: string_scanner
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.0.5"
synchronized:
dependency: transitive
description:
name: synchronized
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.2.0"
table_calendar:
dependency: "direct main"
description:
name: table_calendar
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.2.3"
term_glyph:
dependency: transitive
description:
name: term_glyph
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.1.0"
test_api:
dependency: transitive
description:
name: test_api
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.2.11"
timing:
dependency: transitive
description:
name: timing
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.1.1+2"
typed_data:
dependency: transitive
description:
name: typed_data
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.1.6"
url_launcher:
dependency: "direct main"
description:
name: url_launcher
url: "https://pub.flutter-io.cn"
source: hosted
version: "5.4.2"
url_launcher_macos:
dependency: transitive
description:
name: url_launcher_macos
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.0.1+4"
url_launcher_platform_interface:
dependency: transitive
description:
name: url_launcher_platform_interface
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.0.6"
url_launcher_web:
dependency: transitive
description:
name: url_launcher_web
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.1.1+1"
uuid:
dependency: transitive
description:
name: uuid
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.0.4"
vector_math:
dependency: transitive
description:
name: vector_math
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.0.8"
watcher:
dependency: transitive
description:
name: watcher
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.9.7+14"
web_socket_channel:
dependency: "direct main"
description:
name: web_socket_channel
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.1.0"
xml:
dependency: transitive
description:
name: xml
url: "https://pub.flutter-io.cn"
source: hosted
version: "3.5.0"
yaml:
dependency: transitive
description:
name: yaml
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.2.0"
sdks:
dart: ">=2.7.0 <3.0.0"
flutter: ">=1.12.13+hotfix.4 <1.16.0"
... ...
name: one_key
description: A new Flutter application.
# The following defines the version and build number for your application.
# A version number is three numbers separated by dots, like 1.2.43
# followed by an optional build number separated by a +.
# Both the version and the builder number may be overridden in flutter
# build by specifying --build-name and --build-number, respectively.
# In Android, build-name is used as versionName while build-number used as versionCode.
# Read more about Android versioning at https://developer.android.com/studio/publish/versioning
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
version: 1.0.0+1
environment:
sdk: ">=2.1.0 <3.0.0"
dependencies:
flutter:
sdk: flutter
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^0.1.2
json_annotation: ^2.0.0
# 状态管理
provider: ^4.0.4
# Sp存储
shared_preferences: ^0.5.6+3
# 网络
dio: ^1.0.13
# 屏幕适配
flutter_screenutil: ^1.0.2
# 路由管理
fluro: ^1.6.0
# Toast提示
fluttertoast: ^3.1.3
# 权限管理
permission_handler: ^4.4.0
# 文件系统访问
path_provider: ^1.6.5
# 官方image组件扩展,支持多种图片效果展示
extended_image: ^0.7.1
# 任意位置访问navigator
get_it: ^3.0.1
# 刷新加载
flutter_easyrefresh: ^2.1.0
# 网络图片加载缓存
cached_network_image: ^2.0.0
# websocket
web_socket_channel: ^1.1.0
# sqlite数据库
sqflite: ^1.2.2+1
# 极光推送
jpush_flutter: 0.5.3
# Bugly
flutter_bugly: ^0.2.8
# 设置状态栏颜色
flutter_statusbarcolor: ^0.2.3
# 语音播放器
audioplayers: ^0.14.2
# 日历
table_calendar: ^2.2.1
# 微信SDK
fluwx: ^2.0.7
#网页,短信,电话
url_launcher: ^5.4.2
# 滚轮选择器
flutter_picker: ^1.1.3
dev_dependencies:
flutter_test:
sdk: flutter
json_model: ^0.0.2
build_runner: ^1.0.0
json_serializable: ^2.0.0
# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec
# The following section is specific to Flutter.
flutter:
# The following line ensures that the Material Icons font is
# included with your application, so that you can use the icons in
# the material Icons class.
uses-material-design: true
# To add assets to your application, add an assets section, like this:
assets:
- assets/tts_online.mp3
- assets/icon_sellercode.png
- assets/icon_account.png
- assets/icon_pwd.png
- assets/icon_pwd_show.png
- assets/icon_pwd_hide.png
- assets/icon_pwd_hide.png
- assets/message_default.png
- assets/message_selected.png
- assets/notebook_default.png
- assets/notebook_selected.png
- assets/my_default.png
- assets/my_selected.png
- assets/icon_close.png
- assets/logo.png
- assets/icon_back.png
- assets/icon_selected.png
- assets/statu_booked.png
- assets/statu_canceled.png
- assets/statu_eating.png
- assets/statu_finished.png
- assets/statu_reached.png
- assets/statu_refuse.png
- assets/status_undeal.png
- assets/icon_wechat.png
- assets/icon_sms.png
- assets/icon_phone.png
- assets/bg_invication.png
- assets/invication_line_left.png
- assets/invication_line_right.png
- assets/img_ydap.png
- assets/invication_map.png
- assets/invication_arrow_right.png
- assets/invication_back.png
- assets/icon_exist.png
- assets/my_logo.png
# assets:
# - images/a_dot_burr.jpeg
# - images/a_dot_ham.jpeg
# An image asset can refer to one or more resolution-specific "variants", see
# https://flutter.dev/assets-and-images/#resolution-aware.
# For details regarding adding assets from package dependencies, see
# https://flutter.dev/assets-and-images/#from-packages
# To add custom fonts to your application, add a fonts section here,
# in this "flutter" section. Each entry in this list should have a
# "family" key with the font family name, and a "fonts" key with a
# list giving the asset and other descriptors for the font. For
# example:
# fonts:
# - family: Schyler
# fonts:
# - asset: fonts/Schyler-Regular.ttf
# - asset: fonts/Schyler-Italic.ttf
# style: italic
# - family: Trajan Pro
# fonts:
# - asset: fonts/TrajanPro.ttf
# - asset: fonts/TrajanPro_Bold.ttf
# weight: 700
#
# For details regarding fonts from package dependencies,
# see https://flutter.dev/custom-fonts/#from-packages
... ...
// This is a basic Flutter widget test.
//
// To perform an interaction with a widget in your test, use the WidgetTester
// utility that Flutter provides. For example, you can send tap and scroll
// gestures. You can also use WidgetTester to find child widgets in the widget
// tree, read text, and verify that the values of widget properties are correct.
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:one_key/main.dart';
void main() {
testWidgets('Counter increments smoke test', (WidgetTester tester) async {
// Build our app and trigger a frame.
await tester.pumpWidget(MyApp());
// Verify that our counter starts at 0.
expect(find.text('0'), findsOneWidget);
expect(find.text('1'), findsNothing);
// Tap the '+' icon and trigger a frame.
await tester.tap(find.byIcon(Icons.add));
await tester.pump();
// Verify that our counter has incremented.
expect(find.text('0'), findsNothing);
expect(find.text('1'), findsOneWidget);
});
}
... ...