├── .gitignore ├── .metadata ├── 0002.gif ├── README.md ├── android ├── app │ ├── build.gradle │ └── src │ │ ├── debug │ │ └── AndroidManifest.xml │ │ ├── main │ │ ├── AndroidManifest.xml │ │ ├── java │ │ │ └── com │ │ │ │ └── example │ │ │ │ └── flutter_kline │ │ │ │ └── MainActivity.java │ │ └── res │ │ │ ├── drawable │ │ │ └── launch_background.xml │ │ │ ├── mipmap-hdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-mdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xhdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xxhdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xxxhdpi │ │ │ └── ic_launcher.png │ │ │ └── values │ │ │ └── styles.xml │ │ └── profile │ │ └── AndroidManifest.xml ├── build.gradle ├── gradle.properties ├── gradle │ └── wrapper │ │ └── gradle-wrapper.properties └── settings.gradle ├── ios ├── Flutter │ ├── AppFrameworkInfo.plist │ ├── Debug.xcconfig │ ├── Release.xcconfig │ └── flutter_export_environment.sh ├── Runner.xcodeproj │ └── project.pbxproj ├── Runner.xcworkspace │ └── xcshareddata │ │ └── WorkspaceSettings.xcsettings └── Runner │ ├── AppDelegate.h │ ├── AppDelegate.m │ ├── Assets.xcassets │ ├── AppIcon.appiconset │ │ ├── Contents.json │ │ ├── Icon-App-1024x1024@1x.png │ │ ├── Icon-App-20x20@1x.png │ │ ├── Icon-App-20x20@2x.png │ │ ├── Icon-App-20x20@3x.png │ │ ├── Icon-App-29x29@1x.png │ │ ├── Icon-App-29x29@2x.png │ │ ├── Icon-App-29x29@3x.png │ │ ├── Icon-App-40x40@1x.png │ │ ├── Icon-App-40x40@2x.png │ │ ├── Icon-App-40x40@3x.png │ │ ├── Icon-App-60x60@2x.png │ │ ├── Icon-App-60x60@3x.png │ │ ├── Icon-App-76x76@1x.png │ │ ├── Icon-App-76x76@2x.png │ │ └── Icon-App-83.5x83.5@2x.png │ └── LaunchImage.imageset │ │ ├── Contents.json │ │ ├── LaunchImage.png │ │ ├── LaunchImage@2x.png │ │ ├── LaunchImage@3x.png │ │ └── README.md │ ├── Base.lproj │ ├── LaunchScreen.storyboard │ └── Main.storyboard │ ├── Info.plist │ └── main.m ├── json └── btcusdt.json ├── lib ├── example │ └── kline_data_model.dart ├── main.dart └── packages │ ├── bloc │ ├── klineBloc.dart │ └── klineBlocProvider.dart │ ├── klinePage.dart │ ├── manager │ └── klineDataManager.dart │ ├── model │ ├── klineConstrants.dart │ └── klineModel.dart │ └── view │ ├── grid │ ├── klinePriceGridWidget.dart │ └── klineVolumeGridWidget.dart │ ├── kline │ ├── klineCandleCrossWidget.dart │ ├── klineCandleInfoWidget.dart │ ├── klineCandleWidget.dart │ ├── klineLoadingWidget.dart │ ├── klineMaLineWidget.dart │ ├── klinePeriodSwitch.dart │ └── klineVolumeWidget.dart │ └── klineWidget.dart ├── pubspec.lock ├── pubspec.yaml └── test └── widget_test.dart /.gitignore: -------------------------------------------------------------------------------- 1 | # Miscellaneous 2 | *.class 3 | *.log 4 | *.pyc 5 | *.swp 6 | .DS_Store 7 | .atom/ 8 | .buildlog/ 9 | .history 10 | .svn/ 11 | 12 | # IntelliJ related 13 | *.iml 14 | *.ipr 15 | *.iws 16 | .idea/ 17 | 18 | # Visual Studio Code related 19 | .vscode/ 20 | 21 | # Flutter/Dart/Pub related 22 | **/doc/api/ 23 | .dart_tool/ 24 | .flutter-plugins 25 | .packages 26 | .pub-cache/ 27 | .pub/ 28 | /build/ 29 | 30 | # Android related 31 | **/android/**/gradle-wrapper.jar 32 | **/android/.gradle 33 | **/android/captures/ 34 | **/android/gradlew 35 | **/android/gradlew.bat 36 | **/android/local.properties 37 | **/android/**/GeneratedPluginRegistrant.java 38 | 39 | # iOS/XCode related 40 | **/ios/**/*.mode1v3 41 | **/ios/**/*.mode2v3 42 | **/ios/**/*.moved-aside 43 | **/ios/**/*.pbxuser 44 | **/ios/**/*.perspectivev3 45 | **/ios/**/*sync/ 46 | **/ios/**/.sconsign.dblite 47 | **/ios/**/.tags* 48 | **/ios/**/.vagrant/ 49 | **/ios/**/DerivedData/ 50 | **/ios/**/Icon? 51 | **/ios/**/Pods/ 52 | **/ios/**/.symlinks/ 53 | **/ios/**/profile 54 | **/ios/**/xcuserdata 55 | **/ios/.generated/ 56 | **/ios/Flutter/App.framework 57 | **/ios/Flutter/Flutter.framework 58 | **/ios/Flutter/Generated.xcconfig 59 | **/ios/Flutter/app.flx 60 | **/ios/Flutter/app.zip 61 | **/ios/Flutter/flutter_assets/ 62 | **/ios/ServiceDefinitions.json 63 | **/ios/Runner/GeneratedPluginRegistrant.* 64 | 65 | # Exceptions to above rules. 66 | !**/ios/**/default.mode1v3 67 | !**/ios/**/default.mode2v3 68 | !**/ios/**/default.pbxuser 69 | !**/ios/**/default.perspectivev3 70 | !/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages 71 | -------------------------------------------------------------------------------- /.metadata: -------------------------------------------------------------------------------- 1 | # This file tracks properties of this Flutter project. 2 | # Used by Flutter tool to assess capabilities and perform upgrades etc. 3 | # 4 | # This file should be version controlled and should not be manually edited. 5 | 6 | version: 7 | revision: 8661d8aecd626f7f57ccbcb735553edc05a2e713 8 | channel: stable 9 | 10 | project_type: app 11 | -------------------------------------------------------------------------------- /0002.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhaojijin/flutter_kline/972095efb73bb9cd3f934e48cb2d8c0a467e52be/0002.gif -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # flutter_kline 2 | 3 | ## 效果图 4 | 5 | ![](https://github.com/zhaojijin/flutter_kline/blob/master/0002.gif) 6 | 7 | A new Flutter project. 8 | 9 | ## Getting Started 10 | 11 | This project is a starting point for a Flutter application. 12 | 13 | A few resources to get you started if this is your first Flutter project: 14 | 15 | - [Lab: Write your first Flutter app](https://flutter.io/docs/get-started/codelab) 16 | - [Cookbook: Useful Flutter samples](https://flutter.io/docs/cookbook) 17 | 18 | For help getting started with Flutter, view our 19 | [online documentation](https://flutter.io/docs), which offers tutorials, 20 | samples, guidance on mobile development, and a full API reference. 21 | -------------------------------------------------------------------------------- /android/app/build.gradle: -------------------------------------------------------------------------------- 1 | def localProperties = new Properties() 2 | def localPropertiesFile = rootProject.file('local.properties') 3 | if (localPropertiesFile.exists()) { 4 | localPropertiesFile.withReader('UTF-8') { reader -> 5 | localProperties.load(reader) 6 | } 7 | } 8 | 9 | def flutterRoot = localProperties.getProperty('flutter.sdk') 10 | if (flutterRoot == null) { 11 | throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") 12 | } 13 | 14 | def flutterVersionCode = localProperties.getProperty('flutter.versionCode') 15 | if (flutterVersionCode == null) { 16 | flutterVersionCode = '1' 17 | } 18 | 19 | def flutterVersionName = localProperties.getProperty('flutter.versionName') 20 | if (flutterVersionName == null) { 21 | flutterVersionName = '1.0' 22 | } 23 | 24 | apply plugin: 'com.android.application' 25 | apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" 26 | 27 | android { 28 | compileSdkVersion 28 29 | 30 | lintOptions { 31 | disable 'InvalidPackage' 32 | } 33 | 34 | defaultConfig { 35 | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). 36 | applicationId "com.example.flutter_kline" 37 | minSdkVersion 16 38 | targetSdkVersion 28 39 | versionCode flutterVersionCode.toInteger() 40 | versionName flutterVersionName 41 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 42 | } 43 | 44 | buildTypes { 45 | release { 46 | // TODO: Add your own signing config for the release build. 47 | // Signing with the debug keys for now, so `flutter run --release` works. 48 | signingConfig signingConfigs.debug 49 | } 50 | } 51 | } 52 | 53 | flutter { 54 | source '../..' 55 | } 56 | 57 | dependencies { 58 | testImplementation 'junit:junit:4.12' 59 | androidTestImplementation 'com.android.support.test:runner:1.0.2' 60 | androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2' 61 | } 62 | -------------------------------------------------------------------------------- /android/app/src/debug/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 9 | 13 | 20 | 24 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /android/app/src/main/java/com/example/flutter_kline/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.example.flutter_kline; 2 | 3 | import android.os.Bundle; 4 | import io.flutter.app.FlutterActivity; 5 | import io.flutter.plugins.GeneratedPluginRegistrant; 6 | 7 | public class MainActivity extends FlutterActivity { 8 | @Override 9 | protected void onCreate(Bundle savedInstanceState) { 10 | super.onCreate(savedInstanceState); 11 | GeneratedPluginRegistrant.registerWith(this); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /android/app/src/main/res/drawable/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhaojijin/flutter_kline/972095efb73bb9cd3f934e48cb2d8c0a467e52be/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhaojijin/flutter_kline/972095efb73bb9cd3f934e48cb2d8c0a467e52be/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhaojijin/flutter_kline/972095efb73bb9cd3f934e48cb2d8c0a467e52be/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhaojijin/flutter_kline/972095efb73bb9cd3f934e48cb2d8c0a467e52be/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhaojijin/flutter_kline/972095efb73bb9cd3f934e48cb2d8c0a467e52be/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | -------------------------------------------------------------------------------- /android/app/src/profile/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /android/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | repositories { 3 | google() 4 | jcenter() 5 | } 6 | 7 | dependencies { 8 | classpath 'com.android.tools.build:gradle:3.2.1' 9 | } 10 | } 11 | 12 | allprojects { 13 | repositories { 14 | google() 15 | jcenter() 16 | } 17 | } 18 | 19 | rootProject.buildDir = '../build' 20 | subprojects { 21 | project.buildDir = "${rootProject.buildDir}/${project.name}" 22 | } 23 | subprojects { 24 | project.evaluationDependsOn(':app') 25 | } 26 | 27 | task clean(type: Delete) { 28 | delete rootProject.buildDir 29 | } 30 | -------------------------------------------------------------------------------- /android/gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xmx1536M 2 | -------------------------------------------------------------------------------- /android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Fri Jun 23 08:50:38 CEST 2017 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-all.zip 7 | -------------------------------------------------------------------------------- /android/settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | 3 | def flutterProjectRoot = rootProject.projectDir.parentFile.toPath() 4 | 5 | def plugins = new Properties() 6 | def pluginsFile = new File(flutterProjectRoot.toFile(), '.flutter-plugins') 7 | if (pluginsFile.exists()) { 8 | pluginsFile.withReader('UTF-8') { reader -> plugins.load(reader) } 9 | } 10 | 11 | plugins.each { name, path -> 12 | def pluginDirectory = flutterProjectRoot.resolve(path).resolve('android').toFile() 13 | include ":$name" 14 | project(":$name").projectDir = pluginDirectory 15 | } 16 | -------------------------------------------------------------------------------- /ios/Flutter/AppFrameworkInfo.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | App 9 | CFBundleIdentifier 10 | io.flutter.flutter.app 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | App 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1.0 23 | MinimumOSVersion 24 | 8.0 25 | 26 | 27 | -------------------------------------------------------------------------------- /ios/Flutter/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Generated.xcconfig" 2 | -------------------------------------------------------------------------------- /ios/Flutter/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Generated.xcconfig" 2 | -------------------------------------------------------------------------------- /ios/Flutter/flutter_export_environment.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # This is a generated file; do not edit or check into version control. 3 | export "FLUTTER_ROOT=/Applications/flutter" 4 | export "FLUTTER_APPLICATION_PATH=/Users/zhaojijin/Desktop/学习/Flutter/Project/flutter_kline" 5 | export "FLUTTER_TARGET=/Users/zhaojijin/Desktop/学习/Flutter/Project/flutter_kline/lib/main.dart" 6 | export "FLUTTER_BUILD_DIR=build" 7 | export "SYMROOT=${SOURCE_ROOT}/../build/ios" 8 | export "FLUTTER_FRAMEWORK_DIR=/Applications/flutter/bin/cache/artifacts/engine/ios" 9 | export "FLUTTER_BUILD_NAME=1.0.0" 10 | export "FLUTTER_BUILD_NUMBER=1" 11 | export "TRACK_WIDGET_CREATION=true" 12 | -------------------------------------------------------------------------------- /ios/Runner.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; }; 11 | 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; 12 | 3B80C3941E831B6300D905FE /* App.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; }; 13 | 3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 14 | 9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; }; 15 | 9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 16 | 9740EEB41CF90195004384FC /* Debug.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = 9740EEB21CF90195004384FC /* Debug.xcconfig */; }; 17 | 978B8F6F1D3862AE00F588F7 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */; }; 18 | 97C146F31CF9000F007C117D /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 97C146F21CF9000F007C117D /* main.m */; }; 19 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; 20 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; 21 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; 22 | /* End PBXBuildFile section */ 23 | 24 | /* Begin PBXCopyFilesBuildPhase section */ 25 | 9705A1C41CF9048500538489 /* Embed Frameworks */ = { 26 | isa = PBXCopyFilesBuildPhase; 27 | buildActionMask = 2147483647; 28 | dstPath = ""; 29 | dstSubfolderSpec = 10; 30 | files = ( 31 | 3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */, 32 | 9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */, 33 | ); 34 | name = "Embed Frameworks"; 35 | runOnlyForDeploymentPostprocessing = 0; 36 | }; 37 | /* End PBXCopyFilesBuildPhase section */ 38 | 39 | /* Begin PBXFileReference section */ 40 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; }; 41 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; }; 42 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; 43 | 3B80C3931E831B6300D905FE /* App.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = App.framework; path = Flutter/App.framework; sourceTree = ""; }; 44 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; 45 | 7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 46 | 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 47 | 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; }; 48 | 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; }; 49 | 9740EEBA1CF902C7004384FC /* Flutter.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Flutter.framework; path = Flutter/Flutter.framework; sourceTree = ""; }; 50 | 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; }; 51 | 97C146F21CF9000F007C117D /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 52 | 97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 53 | 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 54 | 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 55 | 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 56 | /* End PBXFileReference section */ 57 | 58 | /* Begin PBXFrameworksBuildPhase section */ 59 | 97C146EB1CF9000F007C117D /* Frameworks */ = { 60 | isa = PBXFrameworksBuildPhase; 61 | buildActionMask = 2147483647; 62 | files = ( 63 | 9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */, 64 | 3B80C3941E831B6300D905FE /* App.framework in Frameworks */, 65 | ); 66 | runOnlyForDeploymentPostprocessing = 0; 67 | }; 68 | /* End PBXFrameworksBuildPhase section */ 69 | 70 | /* Begin PBXGroup section */ 71 | 9740EEB11CF90186004384FC /* Flutter */ = { 72 | isa = PBXGroup; 73 | children = ( 74 | 3B80C3931E831B6300D905FE /* App.framework */, 75 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */, 76 | 9740EEBA1CF902C7004384FC /* Flutter.framework */, 77 | 9740EEB21CF90195004384FC /* Debug.xcconfig */, 78 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */, 79 | 9740EEB31CF90195004384FC /* Generated.xcconfig */, 80 | ); 81 | name = Flutter; 82 | sourceTree = ""; 83 | }; 84 | 97C146E51CF9000F007C117D = { 85 | isa = PBXGroup; 86 | children = ( 87 | 9740EEB11CF90186004384FC /* Flutter */, 88 | 97C146F01CF9000F007C117D /* Runner */, 89 | 97C146EF1CF9000F007C117D /* Products */, 90 | ); 91 | sourceTree = ""; 92 | }; 93 | 97C146EF1CF9000F007C117D /* Products */ = { 94 | isa = PBXGroup; 95 | children = ( 96 | 97C146EE1CF9000F007C117D /* Runner.app */, 97 | ); 98 | name = Products; 99 | sourceTree = ""; 100 | }; 101 | 97C146F01CF9000F007C117D /* Runner */ = { 102 | isa = PBXGroup; 103 | children = ( 104 | 7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */, 105 | 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */, 106 | 97C146FA1CF9000F007C117D /* Main.storyboard */, 107 | 97C146FD1CF9000F007C117D /* Assets.xcassets */, 108 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */, 109 | 97C147021CF9000F007C117D /* Info.plist */, 110 | 97C146F11CF9000F007C117D /* Supporting Files */, 111 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */, 112 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */, 113 | ); 114 | path = Runner; 115 | sourceTree = ""; 116 | }; 117 | 97C146F11CF9000F007C117D /* Supporting Files */ = { 118 | isa = PBXGroup; 119 | children = ( 120 | 97C146F21CF9000F007C117D /* main.m */, 121 | ); 122 | name = "Supporting Files"; 123 | sourceTree = ""; 124 | }; 125 | /* End PBXGroup section */ 126 | 127 | /* Begin PBXNativeTarget section */ 128 | 97C146ED1CF9000F007C117D /* Runner */ = { 129 | isa = PBXNativeTarget; 130 | buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; 131 | buildPhases = ( 132 | 9740EEB61CF901F6004384FC /* Run Script */, 133 | 97C146EA1CF9000F007C117D /* Sources */, 134 | 97C146EB1CF9000F007C117D /* Frameworks */, 135 | 97C146EC1CF9000F007C117D /* Resources */, 136 | 9705A1C41CF9048500538489 /* Embed Frameworks */, 137 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */, 138 | ); 139 | buildRules = ( 140 | ); 141 | dependencies = ( 142 | ); 143 | name = Runner; 144 | productName = Runner; 145 | productReference = 97C146EE1CF9000F007C117D /* Runner.app */; 146 | productType = "com.apple.product-type.application"; 147 | }; 148 | /* End PBXNativeTarget section */ 149 | 150 | /* Begin PBXProject section */ 151 | 97C146E61CF9000F007C117D /* Project object */ = { 152 | isa = PBXProject; 153 | attributes = { 154 | LastUpgradeCheck = 0910; 155 | ORGANIZATIONNAME = "The Chromium Authors"; 156 | TargetAttributes = { 157 | 97C146ED1CF9000F007C117D = { 158 | CreatedOnToolsVersion = 7.3.1; 159 | DevelopmentTeam = 8R8RTYMXAW; 160 | ProvisioningStyle = Manual; 161 | }; 162 | }; 163 | }; 164 | buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */; 165 | compatibilityVersion = "Xcode 3.2"; 166 | developmentRegion = English; 167 | hasScannedForEncodings = 0; 168 | knownRegions = ( 169 | English, 170 | en, 171 | Base, 172 | ); 173 | mainGroup = 97C146E51CF9000F007C117D; 174 | productRefGroup = 97C146EF1CF9000F007C117D /* Products */; 175 | projectDirPath = ""; 176 | projectRoot = ""; 177 | targets = ( 178 | 97C146ED1CF9000F007C117D /* Runner */, 179 | ); 180 | }; 181 | /* End PBXProject section */ 182 | 183 | /* Begin PBXResourcesBuildPhase section */ 184 | 97C146EC1CF9000F007C117D /* Resources */ = { 185 | isa = PBXResourcesBuildPhase; 186 | buildActionMask = 2147483647; 187 | files = ( 188 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */, 189 | 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */, 190 | 9740EEB41CF90195004384FC /* Debug.xcconfig in Resources */, 191 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */, 192 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */, 193 | ); 194 | runOnlyForDeploymentPostprocessing = 0; 195 | }; 196 | /* End PBXResourcesBuildPhase section */ 197 | 198 | /* Begin PBXShellScriptBuildPhase section */ 199 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { 200 | isa = PBXShellScriptBuildPhase; 201 | buildActionMask = 2147483647; 202 | files = ( 203 | ); 204 | inputPaths = ( 205 | ); 206 | name = "Thin Binary"; 207 | outputPaths = ( 208 | ); 209 | runOnlyForDeploymentPostprocessing = 0; 210 | shellPath = /bin/sh; 211 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" thin"; 212 | }; 213 | 9740EEB61CF901F6004384FC /* Run Script */ = { 214 | isa = PBXShellScriptBuildPhase; 215 | buildActionMask = 2147483647; 216 | files = ( 217 | ); 218 | inputPaths = ( 219 | ); 220 | name = "Run Script"; 221 | outputPaths = ( 222 | ); 223 | runOnlyForDeploymentPostprocessing = 0; 224 | shellPath = /bin/sh; 225 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; 226 | }; 227 | /* End PBXShellScriptBuildPhase section */ 228 | 229 | /* Begin PBXSourcesBuildPhase section */ 230 | 97C146EA1CF9000F007C117D /* Sources */ = { 231 | isa = PBXSourcesBuildPhase; 232 | buildActionMask = 2147483647; 233 | files = ( 234 | 978B8F6F1D3862AE00F588F7 /* AppDelegate.m in Sources */, 235 | 97C146F31CF9000F007C117D /* main.m in Sources */, 236 | 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */, 237 | ); 238 | runOnlyForDeploymentPostprocessing = 0; 239 | }; 240 | /* End PBXSourcesBuildPhase section */ 241 | 242 | /* Begin PBXVariantGroup section */ 243 | 97C146FA1CF9000F007C117D /* Main.storyboard */ = { 244 | isa = PBXVariantGroup; 245 | children = ( 246 | 97C146FB1CF9000F007C117D /* Base */, 247 | ); 248 | name = Main.storyboard; 249 | sourceTree = ""; 250 | }; 251 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */ = { 252 | isa = PBXVariantGroup; 253 | children = ( 254 | 97C147001CF9000F007C117D /* Base */, 255 | ); 256 | name = LaunchScreen.storyboard; 257 | sourceTree = ""; 258 | }; 259 | /* End PBXVariantGroup section */ 260 | 261 | /* Begin XCBuildConfiguration section */ 262 | 249021D3217E4FDB00AE95B9 /* Profile */ = { 263 | isa = XCBuildConfiguration; 264 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 265 | buildSettings = { 266 | ALWAYS_SEARCH_USER_PATHS = NO; 267 | CLANG_ANALYZER_NONNULL = YES; 268 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 269 | CLANG_CXX_LIBRARY = "libc++"; 270 | CLANG_ENABLE_MODULES = YES; 271 | CLANG_ENABLE_OBJC_ARC = YES; 272 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 273 | CLANG_WARN_BOOL_CONVERSION = YES; 274 | CLANG_WARN_COMMA = YES; 275 | CLANG_WARN_CONSTANT_CONVERSION = YES; 276 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 277 | CLANG_WARN_EMPTY_BODY = YES; 278 | CLANG_WARN_ENUM_CONVERSION = YES; 279 | CLANG_WARN_INFINITE_RECURSION = YES; 280 | CLANG_WARN_INT_CONVERSION = YES; 281 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 282 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 283 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 284 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 285 | CLANG_WARN_STRICT_PROTOTYPES = YES; 286 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 287 | CLANG_WARN_UNREACHABLE_CODE = YES; 288 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 289 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 290 | COPY_PHASE_STRIP = NO; 291 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 292 | ENABLE_NS_ASSERTIONS = NO; 293 | ENABLE_STRICT_OBJC_MSGSEND = YES; 294 | GCC_C_LANGUAGE_STANDARD = gnu99; 295 | GCC_NO_COMMON_BLOCKS = YES; 296 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 297 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 298 | GCC_WARN_UNDECLARED_SELECTOR = YES; 299 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 300 | GCC_WARN_UNUSED_FUNCTION = YES; 301 | GCC_WARN_UNUSED_VARIABLE = YES; 302 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 303 | MTL_ENABLE_DEBUG_INFO = NO; 304 | SDKROOT = iphoneos; 305 | TARGETED_DEVICE_FAMILY = "1,2"; 306 | VALIDATE_PRODUCT = YES; 307 | }; 308 | name = Profile; 309 | }; 310 | 249021D4217E4FDB00AE95B9 /* Profile */ = { 311 | isa = XCBuildConfiguration; 312 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 313 | buildSettings = { 314 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 315 | CODE_SIGN_IDENTITY = "iPhone Developer"; 316 | CODE_SIGN_STYLE = Manual; 317 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 318 | DEVELOPMENT_TEAM = 8R8RTYMXAW; 319 | ENABLE_BITCODE = NO; 320 | FRAMEWORK_SEARCH_PATHS = ( 321 | "$(inherited)", 322 | "$(PROJECT_DIR)/Flutter", 323 | ); 324 | INFOPLIST_FILE = Runner/Info.plist; 325 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 326 | LIBRARY_SEARCH_PATHS = ( 327 | "$(inherited)", 328 | "$(PROJECT_DIR)/Flutter", 329 | ); 330 | PRODUCT_BUNDLE_IDENTIFIER = com.flutterKline; 331 | PRODUCT_NAME = "$(TARGET_NAME)"; 332 | PROVISIONING_PROFILE_SPECIFIER = SimpleFinance_All_Development; 333 | VERSIONING_SYSTEM = "apple-generic"; 334 | }; 335 | name = Profile; 336 | }; 337 | 97C147031CF9000F007C117D /* Debug */ = { 338 | isa = XCBuildConfiguration; 339 | baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; 340 | buildSettings = { 341 | ALWAYS_SEARCH_USER_PATHS = NO; 342 | CLANG_ANALYZER_NONNULL = YES; 343 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 344 | CLANG_CXX_LIBRARY = "libc++"; 345 | CLANG_ENABLE_MODULES = YES; 346 | CLANG_ENABLE_OBJC_ARC = YES; 347 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 348 | CLANG_WARN_BOOL_CONVERSION = YES; 349 | CLANG_WARN_COMMA = YES; 350 | CLANG_WARN_CONSTANT_CONVERSION = YES; 351 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 352 | CLANG_WARN_EMPTY_BODY = YES; 353 | CLANG_WARN_ENUM_CONVERSION = YES; 354 | CLANG_WARN_INFINITE_RECURSION = YES; 355 | CLANG_WARN_INT_CONVERSION = YES; 356 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 357 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 358 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 359 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 360 | CLANG_WARN_STRICT_PROTOTYPES = YES; 361 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 362 | CLANG_WARN_UNREACHABLE_CODE = YES; 363 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 364 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 365 | COPY_PHASE_STRIP = NO; 366 | DEBUG_INFORMATION_FORMAT = dwarf; 367 | ENABLE_STRICT_OBJC_MSGSEND = YES; 368 | ENABLE_TESTABILITY = YES; 369 | GCC_C_LANGUAGE_STANDARD = gnu99; 370 | GCC_DYNAMIC_NO_PIC = NO; 371 | GCC_NO_COMMON_BLOCKS = YES; 372 | GCC_OPTIMIZATION_LEVEL = 0; 373 | GCC_PREPROCESSOR_DEFINITIONS = ( 374 | "DEBUG=1", 375 | "$(inherited)", 376 | ); 377 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 378 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 379 | GCC_WARN_UNDECLARED_SELECTOR = YES; 380 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 381 | GCC_WARN_UNUSED_FUNCTION = YES; 382 | GCC_WARN_UNUSED_VARIABLE = YES; 383 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 384 | MTL_ENABLE_DEBUG_INFO = YES; 385 | ONLY_ACTIVE_ARCH = YES; 386 | SDKROOT = iphoneos; 387 | TARGETED_DEVICE_FAMILY = "1,2"; 388 | }; 389 | name = Debug; 390 | }; 391 | 97C147041CF9000F007C117D /* Release */ = { 392 | isa = XCBuildConfiguration; 393 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 394 | buildSettings = { 395 | ALWAYS_SEARCH_USER_PATHS = NO; 396 | CLANG_ANALYZER_NONNULL = YES; 397 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 398 | CLANG_CXX_LIBRARY = "libc++"; 399 | CLANG_ENABLE_MODULES = YES; 400 | CLANG_ENABLE_OBJC_ARC = YES; 401 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 402 | CLANG_WARN_BOOL_CONVERSION = YES; 403 | CLANG_WARN_COMMA = YES; 404 | CLANG_WARN_CONSTANT_CONVERSION = YES; 405 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 406 | CLANG_WARN_EMPTY_BODY = YES; 407 | CLANG_WARN_ENUM_CONVERSION = YES; 408 | CLANG_WARN_INFINITE_RECURSION = YES; 409 | CLANG_WARN_INT_CONVERSION = YES; 410 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 411 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 412 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 413 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 414 | CLANG_WARN_STRICT_PROTOTYPES = YES; 415 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 416 | CLANG_WARN_UNREACHABLE_CODE = YES; 417 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 418 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 419 | COPY_PHASE_STRIP = NO; 420 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 421 | ENABLE_NS_ASSERTIONS = NO; 422 | ENABLE_STRICT_OBJC_MSGSEND = YES; 423 | GCC_C_LANGUAGE_STANDARD = gnu99; 424 | GCC_NO_COMMON_BLOCKS = YES; 425 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 426 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 427 | GCC_WARN_UNDECLARED_SELECTOR = YES; 428 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 429 | GCC_WARN_UNUSED_FUNCTION = YES; 430 | GCC_WARN_UNUSED_VARIABLE = YES; 431 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 432 | MTL_ENABLE_DEBUG_INFO = NO; 433 | SDKROOT = iphoneos; 434 | TARGETED_DEVICE_FAMILY = "1,2"; 435 | VALIDATE_PRODUCT = YES; 436 | }; 437 | name = Release; 438 | }; 439 | 97C147061CF9000F007C117D /* Debug */ = { 440 | isa = XCBuildConfiguration; 441 | baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; 442 | buildSettings = { 443 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 444 | CODE_SIGN_IDENTITY = "iPhone Developer"; 445 | CODE_SIGN_STYLE = Manual; 446 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 447 | DEVELOPMENT_TEAM = 8R8RTYMXAW; 448 | ENABLE_BITCODE = NO; 449 | FRAMEWORK_SEARCH_PATHS = ( 450 | "$(inherited)", 451 | "$(PROJECT_DIR)/Flutter", 452 | ); 453 | INFOPLIST_FILE = Runner/Info.plist; 454 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 455 | LIBRARY_SEARCH_PATHS = ( 456 | "$(inherited)", 457 | "$(PROJECT_DIR)/Flutter", 458 | ); 459 | PRODUCT_BUNDLE_IDENTIFIER = com.flutterKline; 460 | PRODUCT_NAME = "$(TARGET_NAME)"; 461 | PROVISIONING_PROFILE_SPECIFIER = SimpleFinance_All_Development; 462 | VERSIONING_SYSTEM = "apple-generic"; 463 | }; 464 | name = Debug; 465 | }; 466 | 97C147071CF9000F007C117D /* Release */ = { 467 | isa = XCBuildConfiguration; 468 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 469 | buildSettings = { 470 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 471 | CODE_SIGN_IDENTITY = "iPhone Developer"; 472 | CODE_SIGN_STYLE = Manual; 473 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 474 | DEVELOPMENT_TEAM = 8R8RTYMXAW; 475 | ENABLE_BITCODE = NO; 476 | FRAMEWORK_SEARCH_PATHS = ( 477 | "$(inherited)", 478 | "$(PROJECT_DIR)/Flutter", 479 | ); 480 | INFOPLIST_FILE = Runner/Info.plist; 481 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 482 | LIBRARY_SEARCH_PATHS = ( 483 | "$(inherited)", 484 | "$(PROJECT_DIR)/Flutter", 485 | ); 486 | PRODUCT_BUNDLE_IDENTIFIER = com.flutterKline; 487 | PRODUCT_NAME = "$(TARGET_NAME)"; 488 | PROVISIONING_PROFILE_SPECIFIER = SimpleFinance_All_Development; 489 | VERSIONING_SYSTEM = "apple-generic"; 490 | }; 491 | name = Release; 492 | }; 493 | /* End XCBuildConfiguration section */ 494 | 495 | /* Begin XCConfigurationList section */ 496 | 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = { 497 | isa = XCConfigurationList; 498 | buildConfigurations = ( 499 | 97C147031CF9000F007C117D /* Debug */, 500 | 97C147041CF9000F007C117D /* Release */, 501 | 249021D3217E4FDB00AE95B9 /* Profile */, 502 | ); 503 | defaultConfigurationIsVisible = 0; 504 | defaultConfigurationName = Release; 505 | }; 506 | 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */ = { 507 | isa = XCConfigurationList; 508 | buildConfigurations = ( 509 | 97C147061CF9000F007C117D /* Debug */, 510 | 97C147071CF9000F007C117D /* Release */, 511 | 249021D4217E4FDB00AE95B9 /* Profile */, 512 | ); 513 | defaultConfigurationIsVisible = 0; 514 | defaultConfigurationName = Release; 515 | }; 516 | /* End XCConfigurationList section */ 517 | }; 518 | rootObject = 97C146E61CF9000F007C117D /* Project object */; 519 | } 520 | -------------------------------------------------------------------------------- /ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | BuildSystemType 6 | Original 7 | 8 | 9 | -------------------------------------------------------------------------------- /ios/Runner/AppDelegate.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | 4 | @interface AppDelegate : FlutterAppDelegate 5 | 6 | @end 7 | -------------------------------------------------------------------------------- /ios/Runner/AppDelegate.m: -------------------------------------------------------------------------------- 1 | #include "AppDelegate.h" 2 | #include "GeneratedPluginRegistrant.h" 3 | 4 | @implementation AppDelegate 5 | 6 | - (BOOL)application:(UIApplication *)application 7 | didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 8 | [GeneratedPluginRegistrant registerWithRegistry:self]; 9 | // Override point for customization after application launch. 10 | return [super application:application didFinishLaunchingWithOptions:launchOptions]; 11 | } 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "size" : "20x20", 5 | "idiom" : "iphone", 6 | "filename" : "Icon-App-20x20@2x.png", 7 | "scale" : "2x" 8 | }, 9 | { 10 | "size" : "20x20", 11 | "idiom" : "iphone", 12 | "filename" : "Icon-App-20x20@3x.png", 13 | "scale" : "3x" 14 | }, 15 | { 16 | "size" : "29x29", 17 | "idiom" : "iphone", 18 | "filename" : "Icon-App-29x29@1x.png", 19 | "scale" : "1x" 20 | }, 21 | { 22 | "size" : "29x29", 23 | "idiom" : "iphone", 24 | "filename" : "Icon-App-29x29@2x.png", 25 | "scale" : "2x" 26 | }, 27 | { 28 | "size" : "29x29", 29 | "idiom" : "iphone", 30 | "filename" : "Icon-App-29x29@3x.png", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "size" : "40x40", 35 | "idiom" : "iphone", 36 | "filename" : "Icon-App-40x40@2x.png", 37 | "scale" : "2x" 38 | }, 39 | { 40 | "size" : "40x40", 41 | "idiom" : "iphone", 42 | "filename" : "Icon-App-40x40@3x.png", 43 | "scale" : "3x" 44 | }, 45 | { 46 | "size" : "60x60", 47 | "idiom" : "iphone", 48 | "filename" : "Icon-App-60x60@2x.png", 49 | "scale" : "2x" 50 | }, 51 | { 52 | "size" : "60x60", 53 | "idiom" : "iphone", 54 | "filename" : "Icon-App-60x60@3x.png", 55 | "scale" : "3x" 56 | }, 57 | { 58 | "size" : "20x20", 59 | "idiom" : "ipad", 60 | "filename" : "Icon-App-20x20@1x.png", 61 | "scale" : "1x" 62 | }, 63 | { 64 | "size" : "20x20", 65 | "idiom" : "ipad", 66 | "filename" : "Icon-App-20x20@2x.png", 67 | "scale" : "2x" 68 | }, 69 | { 70 | "size" : "29x29", 71 | "idiom" : "ipad", 72 | "filename" : "Icon-App-29x29@1x.png", 73 | "scale" : "1x" 74 | }, 75 | { 76 | "size" : "29x29", 77 | "idiom" : "ipad", 78 | "filename" : "Icon-App-29x29@2x.png", 79 | "scale" : "2x" 80 | }, 81 | { 82 | "size" : "40x40", 83 | "idiom" : "ipad", 84 | "filename" : "Icon-App-40x40@1x.png", 85 | "scale" : "1x" 86 | }, 87 | { 88 | "size" : "40x40", 89 | "idiom" : "ipad", 90 | "filename" : "Icon-App-40x40@2x.png", 91 | "scale" : "2x" 92 | }, 93 | { 94 | "size" : "76x76", 95 | "idiom" : "ipad", 96 | "filename" : "Icon-App-76x76@1x.png", 97 | "scale" : "1x" 98 | }, 99 | { 100 | "size" : "76x76", 101 | "idiom" : "ipad", 102 | "filename" : "Icon-App-76x76@2x.png", 103 | "scale" : "2x" 104 | }, 105 | { 106 | "size" : "83.5x83.5", 107 | "idiom" : "ipad", 108 | "filename" : "Icon-App-83.5x83.5@2x.png", 109 | "scale" : "2x" 110 | }, 111 | { 112 | "size" : "1024x1024", 113 | "idiom" : "ios-marketing", 114 | "filename" : "Icon-App-1024x1024@1x.png", 115 | "scale" : "1x" 116 | } 117 | ], 118 | "info" : { 119 | "version" : 1, 120 | "author" : "xcode" 121 | } 122 | } 123 | -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhaojijin/flutter_kline/972095efb73bb9cd3f934e48cb2d8c0a467e52be/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhaojijin/flutter_kline/972095efb73bb9cd3f934e48cb2d8c0a467e52be/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhaojijin/flutter_kline/972095efb73bb9cd3f934e48cb2d8c0a467e52be/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhaojijin/flutter_kline/972095efb73bb9cd3f934e48cb2d8c0a467e52be/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhaojijin/flutter_kline/972095efb73bb9cd3f934e48cb2d8c0a467e52be/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhaojijin/flutter_kline/972095efb73bb9cd3f934e48cb2d8c0a467e52be/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhaojijin/flutter_kline/972095efb73bb9cd3f934e48cb2d8c0a467e52be/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhaojijin/flutter_kline/972095efb73bb9cd3f934e48cb2d8c0a467e52be/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhaojijin/flutter_kline/972095efb73bb9cd3f934e48cb2d8c0a467e52be/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhaojijin/flutter_kline/972095efb73bb9cd3f934e48cb2d8c0a467e52be/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhaojijin/flutter_kline/972095efb73bb9cd3f934e48cb2d8c0a467e52be/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhaojijin/flutter_kline/972095efb73bb9cd3f934e48cb2d8c0a467e52be/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhaojijin/flutter_kline/972095efb73bb9cd3f934e48cb2d8c0a467e52be/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhaojijin/flutter_kline/972095efb73bb9cd3f934e48cb2d8c0a467e52be/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhaojijin/flutter_kline/972095efb73bb9cd3f934e48cb2d8c0a467e52be/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "LaunchImage.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "LaunchImage@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "filename" : "LaunchImage@3x.png", 16 | "scale" : "3x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhaojijin/flutter_kline/972095efb73bb9cd3f934e48cb2d8c0a467e52be/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhaojijin/flutter_kline/972095efb73bb9cd3f934e48cb2d8c0a467e52be/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhaojijin/flutter_kline/972095efb73bb9cd3f934e48cb2d8c0a467e52be/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png -------------------------------------------------------------------------------- /ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md: -------------------------------------------------------------------------------- 1 | # Launch Screen Assets 2 | 3 | You can customize the launch screen with your own desired assets by replacing the image files in this directory. 4 | 5 | You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images. -------------------------------------------------------------------------------- /ios/Runner/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /ios/Runner/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /ios/Runner/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | flutter_kline 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | $(FLUTTER_BUILD_NAME) 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | $(FLUTTER_BUILD_NUMBER) 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UISupportedInterfaceOrientations 30 | 31 | UIInterfaceOrientationPortrait 32 | UIInterfaceOrientationLandscapeLeft 33 | UIInterfaceOrientationLandscapeRight 34 | 35 | UISupportedInterfaceOrientations~ipad 36 | 37 | UIInterfaceOrientationPortrait 38 | UIInterfaceOrientationPortraitUpsideDown 39 | UIInterfaceOrientationLandscapeLeft 40 | UIInterfaceOrientationLandscapeRight 41 | 42 | UIViewControllerBasedStatusBarAppearance 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /ios/Runner/main.m: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | #import "AppDelegate.h" 4 | 5 | int main(int argc, char* argv[]) { 6 | @autoreleasepool { 7 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /lib/example/kline_data_model.dart: -------------------------------------------------------------------------------- 1 | /* 2 | * @Description: 3 | * @Author: zhaojijin 4 | * @LastEditors: Please set LastEditors 5 | * @Date: 2019-04-16 14:55:49 6 | * @LastEditTime: 2019-04-18 12:41:55 7 | */ 8 | 9 | // kline_package:lib/ 10 | import 'package:json_annotation/json_annotation.dart'; 11 | 12 | @JsonSerializable() 13 | class MarketModel { 14 | MarketModel(this.open, this.high, this.low, this.close, this.vol, this.id); 15 | double open; 16 | double high; 17 | double low; 18 | double close; 19 | double vol; 20 | int id; 21 | 22 | //不同的类使用不同的mixin即可 23 | factory MarketModel.fromJson(Map json) => 24 | _marketModelFromJson(json); 25 | Map toJson() => _marketModelToJson(this); 26 | } 27 | 28 | @JsonSerializable() 29 | class MarketData { 30 | MarketData(this.data); 31 | @JsonKey(name: 'data') 32 | List data; 33 | factory MarketData.fromJson(Map json) => 34 | _marketDataFromJson(json); 35 | Map toJson() => _marketDataToJson(this); 36 | } 37 | 38 | MarketModel _marketModelFromJson(Map json) { 39 | return MarketModel( 40 | (json['open'] as num)?.toDouble(), 41 | (json['high'] as num)?.toDouble(), 42 | (json['low'] as num)?.toDouble(), 43 | (json['close'] as num)?.toDouble(), 44 | (json['amount'] as num)?.toDouble(), 45 | (json['id'] as num)?.toInt()); 46 | } 47 | 48 | Map _marketModelToJson(MarketModel model) => { 49 | 'open': model.open, 50 | 'high': model.high, 51 | 'low': model.low, 52 | 'close': model.close, 53 | 'amount': model.vol, 54 | 'id': model.id 55 | }; 56 | 57 | MarketData _marketDataFromJson(Map json) { 58 | return MarketData((json['data'] as List) 59 | ?.map((e) => 60 | e == null ? null : MarketModel.fromJson(e as Map)) 61 | ?.toList()); 62 | } 63 | 64 | Map _marketDataToJson(MarketData instance) => 65 | {'data': instance.data}; 66 | -------------------------------------------------------------------------------- /lib/main.dart: -------------------------------------------------------------------------------- 1 | /* 2 | * @Description: 3 | * @Author: zhaojijin 4 | * @LastEditors: zhaojijin 5 | * @Date: 2019-04-16 10:21:10 6 | * @LastEditTime: 2020-05-11 16:48:45 7 | */ 8 | 9 | import 'package:flutter/cupertino.dart'; 10 | import 'package:flutter/material.dart'; 11 | import 'package:flutter_kline/example/kline_data_model.dart'; 12 | import 'package:flutter_kline/packages/bloc/klineBloc.dart'; 13 | import 'package:flutter_kline/packages/klinePage.dart'; 14 | import 'package:flutter/services.dart' show rootBundle; 15 | import 'package:flutter_kline/packages/model/klineConstrants.dart'; 16 | import 'dart:async'; 17 | import 'dart:convert'; 18 | import 'dart:io'; 19 | import 'package:flutter_kline/packages/model/klineModel.dart'; 20 | 21 | import 'package:http/http.dart' as http; 22 | 23 | void main() => runApp(MyApp()); 24 | 25 | class MyApp extends StatelessWidget { 26 | @override 27 | Widget build(BuildContext context) { 28 | return CupertinoApp( 29 | title: 'Kline Demo', 30 | home: MyHomePage(title: 'Kline Home Page'), 31 | debugShowCheckedModeBanner: false, 32 | ); 33 | } 34 | } 35 | 36 | class MyHomePage extends StatefulWidget { 37 | MyHomePage({Key key, this.title}) : super(key: key); 38 | 39 | final String title; 40 | 41 | @override 42 | _MyHomePageState createState() => _MyHomePageState(); 43 | } 44 | 45 | class _MyHomePageState extends State { 46 | @override 47 | Widget build(BuildContext context) { 48 | KlinePageBloc bloc = KlinePageBloc(); 49 | return Scaffold( 50 | appBar: CupertinoNavigationBar( 51 | middle: Text(widget.title), 52 | ), 53 | body: Center( 54 | child: FloatingActionButton( 55 | child: Icon(Icons.input), 56 | onPressed: () { 57 | Navigator.push(context, CupertinoPageRoute(builder: (context) { 58 | return Scaffold( 59 | appBar: CupertinoNavigationBar( 60 | padding: EdgeInsetsDirectional.only(start: 0), 61 | leading: CupertinoButton( 62 | padding: EdgeInsets.all(0), 63 | child: Icon(Icons.arrow_back,color: Colors.white,), 64 | onPressed: () { 65 | if (Navigator.canPop(context)) { 66 | Navigator.pop(context); 67 | } 68 | }, 69 | ), 70 | middle: Text('BTC-USDT',style: TextStyle(color: Colors.white),), 71 | backgroundColor: kBackgroundColor, 72 | ), 73 | body: Container( 74 | color: kBackgroundColor, 75 | child: ListView( 76 | children: [ 77 | KlinePageWidget(bloc), 78 | Center( 79 | child: Container( 80 | margin: EdgeInsets.only(top: 20), 81 | child: Text( 82 | '财富自由', 83 | style: 84 | TextStyle(fontSize: 12, color: Colors.blueGrey), 85 | ), 86 | )) 87 | ], 88 | ), 89 | )); 90 | })); 91 | }, 92 | ), 93 | )); 94 | } 95 | } 96 | 97 | Future loadAsset() async { 98 | return await rootBundle.loadString('json/btcusdt.json'); 99 | } 100 | 101 | Future getIPAddress(String period) async { 102 | if (period == null) { 103 | period = '1day'; 104 | } 105 | var url = 106 | 'https://api.huobi.me/market/history/kline?period=$period&size=449&symbol=btcusdt'; 107 | String result; 108 | var response = await http.get(url); 109 | if (response.statusCode == HttpStatus.ok) { 110 | result = response.body; 111 | } else { 112 | print('Failed getting IP address'); 113 | } 114 | return result; 115 | } 116 | 117 | class KlinePageBloc extends KlineBloc { 118 | @override 119 | void periodSwitch(String period) { 120 | _getData(period); 121 | super.periodSwitch(period); 122 | } 123 | 124 | @override 125 | void initData() { 126 | _getData('1day'); 127 | super.initData(); 128 | } 129 | 130 | _getData(String period) { 131 | this.showLoadingSinkAdd(true); 132 | Future future = getIPAddress('$period'); 133 | future.then((result) { 134 | final parseJson = json.decode(result); 135 | MarketData marketData = MarketData.fromJson(parseJson); 136 | List list = List(); 137 | for (var item in marketData.data) { 138 | Market market = 139 | Market(item.open, item.high, item.low, item.close, item.vol,item.id); 140 | list.add(market); 141 | } 142 | this.showLoadingSinkAdd(false); 143 | this.updateDataList(list); 144 | }); 145 | } 146 | } 147 | -------------------------------------------------------------------------------- /lib/packages/bloc/klineBloc.dart: -------------------------------------------------------------------------------- 1 | /* 2 | * @Description: 3 | * @Author: zhaojijin 4 | * @LastEditors: zhaojijin 5 | * @Date: 2019-04-16 15:02:34 6 | * @LastEditTime: 2019-10-11 10:29:43 7 | */ 8 | import 'dart:math'; 9 | 10 | import 'package:flutter/material.dart'; 11 | import 'package:flutter_kline/packages/bloc/klineBlocProvider.dart'; 12 | import 'package:flutter_kline/packages/manager/klineDataManager.dart'; 13 | import 'package:flutter_kline/packages/model/klineModel.dart'; 14 | import 'package:flutter_kline/packages/model/klineConstrants.dart'; 15 | import 'package:rxdart/rxdart.dart'; 16 | 17 | class KlineBloc extends KlineBlocBase { 18 | // 总数据的流入流出 19 | BehaviorSubject> _klineListSubject = 20 | BehaviorSubject>(); 21 | Sink> get _klineListSink => _klineListSubject.sink; 22 | Stream> get klineListStream => _klineListSubject.stream; 23 | 24 | // 当前数据的流入流出 25 | PublishSubject> _klineCurrentListSubject = 26 | PublishSubject>(); 27 | Sink> get _currentKlineListSink => _klineCurrentListSubject.sink; 28 | Stream> get currentKlineListStream => 29 | _klineCurrentListSubject.stream; 30 | 31 | // 点击获取单条k线数据 32 | PublishSubject _klineMarketSubject = PublishSubject(); 33 | Sink get _klineMarketSink => _klineMarketSubject.sink; 34 | Stream get klineMarketStream => _klineMarketSubject.stream; 35 | 36 | // periodSwitch 37 | PublishSubject _klinePeriodSwitchSubject = PublishSubject(); 38 | Sink get _klinePeriodSwitchSink => _klinePeriodSwitchSubject.sink; 39 | Stream get _klinePeriodSwitchStream => _klinePeriodSwitchSubject.stream; 40 | 41 | // showloading 42 | PublishSubject _klineShowLoadingSubject = PublishSubject(); 43 | Sink get _klineShowLoadingSink => _klineShowLoadingSubject.sink; 44 | Stream get klineShowLoadingStream => _klineShowLoadingSubject.stream; 45 | 46 | /// 单屏显示的kline数据 47 | List klineCurrentList = List(); 48 | /// 总数据 49 | List klineTotalList = List(); 50 | 51 | double screenWidth = 375; 52 | double priceMax; 53 | double priceMin; 54 | 55 | double pMax; 56 | double pMin; 57 | 58 | double volumeMax; 59 | int firstScreenCandleCount; 60 | double candlestickWidth = kCandlestickWidth; 61 | 62 | GlobalKey candleWidgetKey = GlobalKey(); 63 | GlobalKey volumeWidgetKey = GlobalKey(); 64 | 65 | /// 当前K线滑到的起点位置 66 | int fromIndex; 67 | 68 | /// 当前K线滑到的终点位置 69 | int toIndex; 70 | 71 | KlineBloc() { 72 | initData(); 73 | _klinePeriodSwitchStream.listen(periodSwitch); 74 | } 75 | void periodSwitch(String period) {} 76 | void initData() {} 77 | 78 | @override 79 | void dispose() { 80 | _klineListSubject.close(); 81 | _klineCurrentListSubject.close(); 82 | _klineMarketSubject.close(); 83 | _klinePeriodSwitchSubject.close(); 84 | _klineShowLoadingSubject.close(); 85 | } 86 | 87 | void updateDataList(List dataList) { 88 | if (dataList != null && dataList.length > 0) { 89 | klineTotalList.clear(); 90 | klineTotalList = 91 | KlineDataManager.calculateKlineData(YKChartType.MA, dataList); 92 | _klineListSink.add(klineTotalList); 93 | } 94 | } 95 | 96 | void setCandlestickWidth(double scaleWidth) { 97 | if (scaleWidth > 25 || scaleWidth < 2) { 98 | return; 99 | } 100 | candlestickWidth = scaleWidth; 101 | } 102 | 103 | int getSingleScreenCandleCount(double width) { 104 | screenWidth = width; 105 | double count = 106 | (screenWidth - kCandlestickGap) / (candlestickWidth + kCandlestickGap); 107 | int totalScreenCountNum = count.toInt(); 108 | return totalScreenCountNum; 109 | } 110 | 111 | double getFirstScreenScale() { 112 | return (kGridColumCount - 1) / kGridColumCount; 113 | } 114 | 115 | void setScreenWidth(double width) { 116 | screenWidth = width; 117 | int singleScreenCandleCount = getSingleScreenCandleCount(screenWidth); 118 | int maxCount = this.klineTotalList.length; 119 | int firstScreenNum = 120 | (getFirstScreenScale() * singleScreenCandleCount).toInt(); 121 | if (singleScreenCandleCount > maxCount) { 122 | firstScreenNum = maxCount; 123 | } 124 | firstScreenCandleCount = firstScreenNum; 125 | 126 | getSubKlineList(0, firstScreenCandleCount); 127 | } 128 | 129 | void getSubKlineList(int from, int to) { 130 | fromIndex = from; 131 | toIndex = to; 132 | List list = this.klineTotalList; 133 | klineCurrentList.clear(); 134 | klineCurrentList = list.sublist(from, to); 135 | _calculateCurrentKlineDataLimit(); 136 | _currentKlineListSink.add(klineCurrentList); 137 | } 138 | 139 | void _calculateCurrentKlineDataLimit() { 140 | double _priceMax = -double.infinity; 141 | double _priceMin = double.infinity; 142 | double _pMax = -double.infinity; 143 | double _pMin = double.infinity; 144 | double _volumeMax = -double.infinity; 145 | for (var item in klineCurrentList) { 146 | _volumeMax = max(item.vol, _volumeMax); 147 | 148 | _priceMax = max(_priceMax, item.high); 149 | _priceMin = min(_priceMin, item.low); 150 | 151 | _pMax = max(_pMax, item.high); 152 | _pMin = min(_pMin, item.low); 153 | 154 | /// 与x日均线数据对比计算最高最低价格 155 | if (item.priceMa1 != null) { 156 | _priceMax = max(_priceMax, item.priceMa1); 157 | _priceMin = min(_priceMin, item.priceMa1); 158 | } 159 | if (item.priceMa2 != null) { 160 | _priceMax = max(_priceMax, item.priceMa2); 161 | _priceMin = min(_priceMin, item.priceMa2); 162 | } 163 | if (item.priceMa3 != null) { 164 | _priceMax = max(_priceMax, item.priceMa3); 165 | _priceMin = min(_priceMin, item.priceMa3); 166 | } 167 | pMax = _pMax; 168 | pMin = _pMin; 169 | priceMax = _priceMax; 170 | priceMin = _priceMin; 171 | volumeMax = _volumeMax; 172 | 173 | // print('priceMax : $priceMax'); 174 | // print('priceMax : $priceMax priceMin: $priceMin volumeMax: $volumeMax'); 175 | } 176 | } 177 | 178 | void marketSinkAdd(Market market) { 179 | if (market != null) { 180 | _klineMarketSink.add(market); 181 | } 182 | } 183 | void periodSwitchSinkAdd(String period) { 184 | if (period != null) { 185 | _klinePeriodSwitchSink.add(period); 186 | } 187 | } 188 | 189 | void showLoadingSinkAdd(bool show) { 190 | // if (show != null) { 191 | _klineShowLoadingSink.add(show); 192 | // } 193 | } 194 | } 195 | -------------------------------------------------------------------------------- /lib/packages/bloc/klineBlocProvider.dart: -------------------------------------------------------------------------------- 1 | /* 2 | * @Description: 3 | * @Author: zhaojijin 4 | * @LastEditors: 5 | * @Date: 2019-04-16 15:02:47 6 | * @LastEditTime: 2019-04-16 15:14:54 7 | */ 8 | import 'package:flutter/material.dart'; 9 | 10 | abstract class KlineBlocBase { 11 | void dispose(); 12 | } 13 | 14 | class KlineBlocProvider extends StatefulWidget { 15 | KlineBlocProvider({Key key, @required this.child, @required this.bloc}) 16 | : super(key: key); 17 | final Widget child; 18 | final T bloc; 19 | @override 20 | _KlineBlocProviderState createState() => _KlineBlocProviderState(); 21 | static T of(BuildContext context) { 22 | final type = _typeOf>(); 23 | KlineBlocProvider provider = context.ancestorWidgetOfExactType(type); 24 | return provider.bloc; 25 | } 26 | static Type _typeOf() => T; 27 | } 28 | 29 | class _KlineBlocProviderState 30 | extends State> { 31 | 32 | @override 33 | void dispose() { 34 | widget.bloc.dispose(); 35 | super.dispose(); 36 | } 37 | 38 | @override 39 | Widget build(BuildContext context) { 40 | return widget.child; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /lib/packages/klinePage.dart: -------------------------------------------------------------------------------- 1 | /* 2 | * @Description: 3 | * @Author: zhaojijin 4 | * @LastEditors: zhaojijin 5 | * @Date: 2019-04-16 11:08:20 6 | * @LastEditTime: 2019-06-03 10:45:24 7 | */ 8 | import 'dart:math'; 9 | 10 | import 'package:flutter/cupertino.dart'; 11 | import 'package:flutter/material.dart'; 12 | import 'package:flutter_kline/packages/bloc/klineBloc.dart'; 13 | import 'package:flutter_kline/packages/bloc/klineBlocProvider.dart'; 14 | import 'package:flutter_kline/packages/model/klineConstrants.dart'; 15 | import 'package:flutter_kline/packages/model/klineModel.dart'; 16 | import 'package:flutter_kline/packages/view/klineWidget.dart'; 17 | 18 | class KlinePageWidget extends StatelessWidget { 19 | final KlineBloc bloc; 20 | KlinePageWidget(this.bloc); 21 | @override 22 | Widget build(BuildContext context) { 23 | Offset lastPoint; 24 | bool isScale = false; 25 | bool isLongPress = false; 26 | bool isHorizontalDrag = false; 27 | double screenWidth = MediaQuery.of(context).size.width; 28 | _showCrossWidget(Offset offset) { 29 | if (isScale || isHorizontalDrag) { 30 | return; 31 | } 32 | isLongPress = true; 33 | int singleScreenCandleCount = 34 | bloc.getSingleScreenCandleCount(screenWidth); 35 | int offsetCount = 36 | ((offset.dx / screenWidth) * singleScreenCandleCount).toInt(); 37 | // print('offsetCount :$offsetCount length: ${bloc.klineCurrentList.length}'); 38 | if (offsetCount > bloc.klineCurrentList.length - 1) { 39 | return; 40 | } 41 | int index = bloc.klineCurrentList.length - 1 - offsetCount; 42 | 43 | if (index < bloc.klineCurrentList.length) { 44 | Market market = bloc.klineCurrentList[index]; 45 | market.isShowCandleInfo = true; 46 | RenderBox candleWidgetRenderBox = 47 | bloc.candleWidgetKey.currentContext.findRenderObject(); 48 | Offset candleWidgetOriginOffset = 49 | candleWidgetRenderBox.localToGlobal(Offset.zero); 50 | 51 | RenderBox currentWidgetRenderBox = context.findRenderObject(); 52 | Offset currentWidgetOriginOffset = 53 | currentWidgetRenderBox.localToGlobal(Offset.zero); 54 | 55 | RenderBox volumeWidgetRenderBox = bloc.volumeWidgetKey.currentContext.findRenderObject(); 56 | 57 | market.candleWidgetOriginY = 58 | candleWidgetOriginOffset.dy - currentWidgetOriginOffset.dy; 59 | market.gridTotalHeight = candleWidgetRenderBox.size.height + volumeWidgetRenderBox.size.height; 60 | // print('${candleWidgetRenderBox.size} ${volumeWidgetRenderBox.size}'); 61 | bloc.marketSinkAdd(market); 62 | } 63 | } 64 | 65 | _hiddenCrossWidget() { 66 | isLongPress = false; 67 | bloc.marketSinkAdd( 68 | Market(null, null, null, null, null,null, isShowCandleInfo: false)); 69 | } 70 | 71 | _horizontalDrag(Offset offset) { 72 | if (isScale || isLongPress) { 73 | return; 74 | } 75 | isHorizontalDrag = true; 76 | double offsetX = offset.dx - lastPoint.dx; 77 | int singleScreenCandleCount = 78 | bloc.getSingleScreenCandleCount(screenWidth); 79 | // 当前偏移的个数 80 | int offsetCount = 81 | ((offsetX / screenWidth) * singleScreenCandleCount).toInt(); 82 | if (offsetCount == 0) { 83 | return; 84 | } 85 | int firstScreenNum = 86 | (singleScreenCandleCount * bloc.getFirstScreenScale()).toInt(); 87 | if (bloc.klineTotalList.length > firstScreenNum) { 88 | // 当前总的偏移个数 89 | int currentOffsetCount = bloc.toIndex + offsetCount; 90 | int totalListLength = bloc.klineTotalList.length; 91 | currentOffsetCount = min(currentOffsetCount, totalListLength); 92 | if (currentOffsetCount < firstScreenNum) { 93 | return; 94 | } 95 | int fromIndex = 0; 96 | // print('fromIndex: $fromIndex'); 97 | 98 | // 如果当前偏移的个数 没有达到一屏所展示的个数则从0开始取数据 99 | if (currentOffsetCount > singleScreenCandleCount) { 100 | fromIndex = (currentOffsetCount - singleScreenCandleCount); 101 | } 102 | lastPoint = offset; 103 | bloc.getSubKlineList(fromIndex, currentOffsetCount); 104 | // print('fromIndex: $fromIndex currentOffsetCount: $currentOffsetCount'); 105 | } 106 | } 107 | 108 | _scaleUpdate(double scale) { 109 | if (isHorizontalDrag || isLongPress) { 110 | return; 111 | } 112 | isScale = true; 113 | if (scale > 1 && (scale - 1) > 0.03) { 114 | scale = 1.03; 115 | } else if (scale < 1 && (1 - scale) > 0.03) { 116 | scale = 0.97; 117 | } 118 | double candlestickWidth = scale * bloc.candlestickWidth; 119 | bloc.setCandlestickWidth(candlestickWidth); 120 | // print('bloc.candlestickWidth : ${bloc.candlestickWidth}'); 121 | double count = (screenWidth - bloc.candlestickWidth) / 122 | (kCandlestickGap + bloc.candlestickWidth); 123 | int currentScreenCountNum = count.toInt(); 124 | 125 | int toIndex = bloc.toIndex; 126 | int fromIndex = toIndex - currentScreenCountNum; 127 | fromIndex = max(0, fromIndex); 128 | 129 | // print('from: $fromIndex to: $toIndex currentScreenCountNum: $currentScreenCountNum'); 130 | bloc.getSubKlineList(fromIndex, toIndex); 131 | } 132 | 133 | return KlineBlocProvider( 134 | bloc: bloc, 135 | child: GestureDetector( 136 | onTap: () { 137 | if (isLongPress) { 138 | _hiddenCrossWidget(); 139 | } 140 | }, 141 | /// 长按 142 | onLongPressStart: (longPressDragStartDetail) { 143 | _showCrossWidget(longPressDragStartDetail.globalPosition); 144 | // print('onLongPressDragStart'); 145 | }, 146 | onLongPressMoveUpdate: (longPressDragUpdateDetail) { 147 | _showCrossWidget(longPressDragUpdateDetail.globalPosition); 148 | // print('onLongPressDragUpdate'); 149 | }, 150 | 151 | /// 水平拖拽 152 | onHorizontalDragDown: (horizontalDragDown) { 153 | if (isLongPress) { 154 | _hiddenCrossWidget(); 155 | } 156 | lastPoint = horizontalDragDown.globalPosition; 157 | }, 158 | onHorizontalDragUpdate: (details) { 159 | _horizontalDrag(details.globalPosition); 160 | }, 161 | onHorizontalDragEnd: (_) { 162 | isHorizontalDrag = false; 163 | }, 164 | onHorizontalDragCancel: () { 165 | isHorizontalDrag = false; 166 | }, 167 | onScaleStart: (_) { 168 | isScale = true; 169 | }, 170 | 171 | /// 缩放 172 | onScaleUpdate: (details) { 173 | if (isLongPress) { 174 | _hiddenCrossWidget(); 175 | } 176 | _scaleUpdate(details.scale); 177 | }, 178 | onScaleEnd: (_) { 179 | isScale = false; 180 | }, 181 | 182 | child: StreamBuilder( 183 | stream: bloc.klineListStream, 184 | builder: 185 | (BuildContext context, AsyncSnapshot> snapshot) { 186 | List listData = snapshot.data; 187 | if (listData != null) { 188 | bloc.setScreenWidth(screenWidth); 189 | } 190 | return KlineWidget(); 191 | }, 192 | ), 193 | ), 194 | ); 195 | } 196 | } 197 | -------------------------------------------------------------------------------- /lib/packages/manager/klineDataManager.dart: -------------------------------------------------------------------------------- 1 | /* 2 | * @Description: 3 | * @Author: zhaojijin 4 | * @LastEditors: zhaojijin 5 | * @Date: 2019-04-16 14:33:00 6 | * @LastEditTime: 2019-05-13 16:07:14 7 | */ 8 | 9 | import 'package:flutter_kline/packages/model/klineModel.dart'; 10 | 11 | enum YKChartType { Unknown, MA, VOL } 12 | 13 | class KlineDataManager { 14 | static final List priceMaList = [5, 10, 30]; 15 | static final List volumeMaList = [5, 10]; 16 | static List calculateKlineData( 17 | YKChartType type, List dataList) { 18 | switch (type) { 19 | case YKChartType.MA: 20 | return _calculatePriceMa(dataList); 21 | case YKChartType.VOL: 22 | return _calculateVolumeMa(dataList); 23 | default: 24 | return dataList; 25 | } 26 | } 27 | 28 | static List _calculatePriceMa(List dataList) { 29 | List tmpList = dataList; 30 | for (int numIndex = 0; numIndex < priceMaList.length; numIndex++) { 31 | int maNum = priceMaList[numIndex]; 32 | if (maNum <= 0) { 33 | return tmpList; 34 | } 35 | int listCount = tmpList.length; 36 | for (int i = tmpList.length - 1; i >= 0; i--) { 37 | Market market = tmpList[i]; 38 | if ((numIndex == 0 && market.priceMa1 != null) || 39 | (numIndex == 0 && market.priceMa2 != null) || 40 | (numIndex == 0 && market.priceMa3 != null)) { 41 | return tmpList; 42 | } 43 | 44 | if (i <= tmpList.length - maNum) { 45 | Market lastData; 46 | if (i < tmpList.length - 1) { 47 | lastData = tmpList[i + 1]; 48 | } 49 | double lastMa; 50 | if (lastData != null) { 51 | switch (numIndex) { 52 | case 0: 53 | lastMa = lastData.priceMa1; 54 | break; 55 | case 1: 56 | lastMa = lastData.priceMa2; 57 | break; 58 | case 2: 59 | lastMa = lastData.priceMa3; 60 | break; 61 | default: 62 | break; 63 | } 64 | } 65 | double priceMa = 0; 66 | if (lastMa != null) { 67 | Market deleteData = tmpList[i + maNum]; 68 | priceMa = lastMa * maNum + market.close - deleteData.close; 69 | } else { 70 | List aveArray = tmpList.sublist(i, listCount); 71 | for (var tmpData in aveArray) { 72 | priceMa += tmpData.close; 73 | } 74 | } 75 | priceMa = priceMa / maNum; 76 | switch (numIndex) { 77 | case 0: 78 | tmpList[i].priceMa1 = priceMa; 79 | break; 80 | case 1: 81 | tmpList[i].priceMa2 = priceMa; 82 | break; 83 | case 2: 84 | tmpList[i].priceMa3 = priceMa; 85 | break; 86 | default: 87 | break; 88 | } 89 | } 90 | } 91 | } 92 | return tmpList; 93 | } 94 | 95 | static List _calculateVolumeMa(List dataList) { 96 | // TODO: 计算幅图Ma数据 97 | return dataList; 98 | } 99 | } 100 | -------------------------------------------------------------------------------- /lib/packages/model/klineConstrants.dart: -------------------------------------------------------------------------------- 1 | /* 2 | * @Description: 3 | * @Author: zhaojijin 4 | * @LastEditors: zhaojijin 5 | * @Date: 2019-04-16 16:45:21 6 | * @LastEditTime: 2019-04-26 16:42:32 7 | */ 8 | 9 | import 'package:flutter/material.dart'; 10 | 11 | /********************************kline切换相关配置********************************/ 12 | /// 13 | const double kPeriodHeight = 40; 14 | const double kPeriodAspectRatio = 375/kPeriodHeight; 15 | const String kDefaultPeriod = '1day'; 16 | const List kPeriodList = ['1min', '5min', '15min', '30min', '60min', '1day']; 17 | const List kPeriodTitleList = ['1分', '5分', '15分', '30分', '1小时', '日线']; 18 | const kDefaultPeriodIndex = 5; 19 | /**********************************kline相关配置**********************************/ 20 | /// 烛台宽度 21 | const double kCandlestickWidth = 7.0; 22 | /// 灯芯宽度 23 | const double kWickWidth = 1.0; 24 | /// 烛台间空隙 25 | const double kCandlestickGap = 2.0; 26 | /// 上影线上方距离 27 | const double kTopMargin = 30.0; 28 | const Color kDecreaseColor = Color(0xffff4400); 29 | const Color kIncreaseColor = Colors.green; 30 | const Color kBackgroundColor = Color(0xff111825); 31 | const double kcandleAspectRatio = 1; 32 | const Color kCandleTextColor = Colors.white; 33 | const double kCandleFontSize = 9; 34 | const double kCandleTextHight = 12; 35 | 36 | /**********************************交易量相关配置**********************************/ 37 | /// 柱状体宽度 38 | const double kColumnarWidth = kCandlestickWidth; 39 | /// 柱状体之间间隙 = 烛台间空隙 40 | const double kColumnarGap = kCandlestickGap; 41 | const double kColumnarTopMargin = 32.0; 42 | const double kVolumeAspectRatio = 1/0.25; 43 | 44 | /**********************************网格相关配置**********************************/ 45 | /// 网格线颜色 46 | const Color kGridLineColor = Color(0xff263347); 47 | const Color kGridTextColor = Color(0xff7287A5); 48 | const double kGridLineWidth = 0.5; 49 | const double kGridPriceFontSize = 10; 50 | const int kGridRowCount = 4; 51 | const int kGridColumCount = 5; 52 | const int kGridPricePrecision = 7; 53 | const double kColumnTopMargin = 20.0; 54 | 55 | /**********************************MA线相关配置**********************************/ 56 | /// Ma线宽度 57 | const double kMaLineWidth = 1.0; 58 | const double kMaTopMargin = kTopMargin; 59 | const Color kMa5LineColor = Color(0xffF1DB9D); 60 | const Color kMa10LineColor = Color(0xff81CEBF); 61 | const Color kMa20LineColor = Color(0xffC097F6); 62 | 63 | /********************************十字交叉线相关配置********************************/ 64 | /// 65 | const Color kCrossHLineColor = Colors.white; 66 | const Color kCrossVLineColor = Colors.white12; 67 | const Color kCrossPointColor = Colors.white; 68 | const double kCrossHLineWidth = 0.5; 69 | const double kCrossVLineWidth = kCandlestickGap; 70 | const double kCrossPointRadius = 2.0; 71 | const double kCrossTopMargin = 0; 72 | 73 | /********************************单个K线信息相关配置********************************/ 74 | /// 75 | const Color kCandleInfoBgColor = Color(0xff0C1522); 76 | const Color kCandleInfoBorderColor = Color(0xff7286A4); 77 | const Color kCandleInfoTextColor = Color(0xffCFD3E7); 78 | const Color kCandleInfoDecreaseColor = kDecreaseColor; 79 | const Color kCandleInfoIncreaseColor = kIncreaseColor; 80 | const double kCandleInfoLeftFontSize = 10; 81 | const double kCandleInfoRightFontSize = 10; 82 | const double kCandleInfoLeftMargin = 5; 83 | const double kCandleInfoTopMargin = 20; 84 | const double kCandleInfoBorderWidth = 1; 85 | const EdgeInsets kCandleInfoPadding = EdgeInsets.fromLTRB(5, 3, 5, 3); 86 | const double kCandleInfoWidth = 130; 87 | const double kCandleInfoHeight = 137; 88 | 89 | enum YKMAType { 90 | MA5, 91 | MA10, 92 | MA30 93 | } -------------------------------------------------------------------------------- /lib/packages/model/klineModel.dart: -------------------------------------------------------------------------------- 1 | /* 2 | * @Description: 3 | * @Author: zhaojijin 4 | * @LastEditors: zhaojijin 5 | * @Date: 2019-04-16 14:30:22 6 | * @LastEditTime: 2019-04-28 16:25:54 7 | */ 8 | 9 | import 'package:flutter/material.dart'; 10 | import 'package:flutter_kline/packages/model/klineConstrants.dart'; 11 | // import "package:intl/intl.dart"; 12 | 13 | class Market { 14 | Market(this.open, this.high, this.low, this.close, this.vol, this.id, 15 | {this.isShowCandleInfo}); 16 | double open; 17 | double high; 18 | double low; 19 | double close; 20 | double vol; 21 | int id; 22 | 23 | //指标线数据 24 | double priceMa1; 25 | double priceMa2; 26 | double priceMa3; 27 | 28 | // 十字交叉点 29 | Offset offset; 30 | double candleWidgetOriginY; 31 | double gridTotalHeight; 32 | 33 | bool isShowCandleInfo; 34 | List candleInfo() { 35 | double limitUpDownAmount = close - open; 36 | double limitUpDownPercent = (limitUpDownAmount / open) * 100; 37 | String pre = ''; 38 | if (limitUpDownAmount < 0) { 39 | pre = ''; 40 | } else if (limitUpDownAmount > 0) { 41 | pre = '+'; 42 | } 43 | String limitUpDownAmountStr = 44 | '$pre${limitUpDownAmount.toStringAsFixed(2)}'; 45 | String limitPercentStr = '$pre${limitUpDownPercent.toStringAsFixed(2)}%'; 46 | return [ 47 | readTimestamp(id), 48 | open.toStringAsPrecision(kGridPricePrecision), 49 | high.toStringAsPrecision(kGridPricePrecision), 50 | low.toStringAsPrecision(kGridPricePrecision), 51 | close.toStringAsPrecision(kGridPricePrecision), 52 | limitUpDownAmountStr, 53 | limitPercentStr, 54 | vol.toStringAsPrecision(kGridPricePrecision) 55 | ]; 56 | } 57 | 58 | void printDesc() { 59 | print( 60 | 'open :$open close :$close high :$high low :$low vol :$vol offset: $offset'); 61 | } 62 | } 63 | 64 | String readTimestamp(int timestamp) { 65 | DateTime date = DateTime.fromMillisecondsSinceEpoch(timestamp * 1000); 66 | String time = 67 | '${date.year.toString()}-${date.month.toString().padLeft(2, '0')}-${date.day.toString().padLeft(2, '0')} ${date.hour.toString().padLeft(2, '0')}:${date.minute.toString().padLeft(2, '0')}'; 68 | if (date.hour == 0 && date.minute == 0) { 69 | time = '${date.year.toString()}-${date.month.toString().padLeft(2, '0')}-${date.day.toString().padLeft(2, '0')}'; 70 | } 71 | return time; 72 | } 73 | -------------------------------------------------------------------------------- /lib/packages/view/grid/klinePriceGridWidget.dart: -------------------------------------------------------------------------------- 1 | /* 2 | * @Description: 3 | * @Author: zhaojijin 4 | * @LastEditors: zhaojijin 5 | * @Date: 2019-04-16 17:31:59 6 | * @LastEditTime: 2019-04-26 16:31:41 7 | */ 8 | import 'package:flutter/material.dart'; 9 | import 'package:flutter_kline/packages/bloc/klineBloc.dart'; 10 | import 'package:flutter_kline/packages/bloc/klineBlocProvider.dart'; 11 | import 'package:flutter_kline/packages/model/klineModel.dart'; 12 | import 'package:flutter_kline/packages/model/klineConstrants.dart'; 13 | 14 | class KlinePriceGridWidget extends StatelessWidget { 15 | @override 16 | Widget build(BuildContext context) { 17 | KlineBloc klineBloc = KlineBlocProvider.of(context); 18 | 19 | return StreamBuilder( 20 | stream: klineBloc.currentKlineListStream, 21 | builder: (BuildContext context, AsyncSnapshot> snapshot) { 22 | return CustomPaint( 23 | size: Size.infinite, 24 | painter: _KlineGridPainter(klineBloc.priceMax, klineBloc.priceMin), 25 | ); 26 | }, 27 | ); 28 | } 29 | } 30 | 31 | class _KlineGridPainter extends CustomPainter { 32 | final double max; 33 | final double min; 34 | _KlineGridPainter(this.max, this.min); 35 | 36 | final double lineWidth = kGridLineWidth; 37 | final Color lineColor = kGridLineColor; 38 | 39 | @override 40 | void paint(Canvas canvas, Size size) { 41 | double height = size.height - kTopMargin; 42 | double width = size.width; 43 | Paint linePaint = Paint() 44 | ..color = lineColor 45 | ..strokeWidth = lineWidth 46 | ..isAntiAlias = true 47 | ..filterQuality = FilterQuality.high; 48 | //绘制横线/价格 49 | double heightOffset = height / kGridRowCount; 50 | for (var i = 0; i < kGridRowCount + 1; i++) { 51 | canvas.drawLine(Offset(0, kTopMargin + heightOffset * i), 52 | Offset(width, kTopMargin + heightOffset * i), linePaint); 53 | } 54 | // 画竖线 55 | double widthOffset = (width ~/ kGridColumCount).toDouble(); 56 | for (int i = 1; i < kGridColumCount; i++) { 57 | canvas.drawLine(Offset(i * widthOffset, 0), 58 | Offset(i * widthOffset, height + kTopMargin), linePaint); 59 | } 60 | if (max == null || min == null) { 61 | return; 62 | } 63 | double priceOffset = (max - min) / kGridRowCount; 64 | double priceOriginX = width; 65 | // 字体是10号字,但是实际上字体的高度会大于10所以加3 66 | double textHeight = kGridPriceFontSize + 3; 67 | for (var i = 0; i < kGridRowCount + 1; i++) { 68 | double originY = kTopMargin + heightOffset * i - textHeight; 69 | if (i == 0) { 70 | originY = kTopMargin; 71 | } 72 | _drawText( 73 | canvas, 74 | Offset(priceOriginX, originY), 75 | (min + priceOffset * (kGridRowCount - i)) 76 | .toStringAsPrecision(kGridPricePrecision)); 77 | } 78 | } 79 | 80 | _drawText(Canvas canvas, Offset offset, String text) { 81 | TextPainter textPainter = TextPainter( 82 | text: TextSpan( 83 | text: text, 84 | style: TextStyle( 85 | color: kGridTextColor, 86 | fontSize: kGridPriceFontSize, 87 | fontWeight: FontWeight.normal, 88 | ), 89 | ), 90 | textDirection: TextDirection.ltr); 91 | textPainter.layout(); 92 | Offset of = Offset(offset.dx - textPainter.width, offset.dy); 93 | textPainter.paint(canvas, of); 94 | } 95 | 96 | @override 97 | bool shouldRepaint(CustomPainter oldDelegate) { 98 | return max != null && min != null; 99 | } 100 | } 101 | -------------------------------------------------------------------------------- /lib/packages/view/grid/klineVolumeGridWidget.dart: -------------------------------------------------------------------------------- 1 | /* 2 | * @Description: 3 | * @Author: zhaojijin 4 | * @LastEditors: zhaojijin 5 | * @Date: 2019-04-16 17:57:47 6 | * @LastEditTime: 2019-04-25 17:30:41 7 | */ 8 | import 'package:flutter/material.dart'; 9 | import 'package:flutter_kline/packages/bloc/klineBloc.dart'; 10 | import 'package:flutter_kline/packages/bloc/klineBlocProvider.dart'; 11 | import 'package:flutter_kline/packages/model/klineConstrants.dart'; 12 | import 'package:flutter_kline/packages/model/klineModel.dart'; 13 | 14 | class KlineVolumeGridWidget extends StatelessWidget { 15 | @override 16 | Widget build(BuildContext context) { 17 | KlineBloc bloc = KlineBlocProvider.of(context); 18 | 19 | return StreamBuilder( 20 | stream: bloc.currentKlineListStream, 21 | builder: (BuildContext context, AsyncSnapshot> snapshot) { 22 | return CustomPaint( 23 | size: Size.infinite, 24 | painter: _VolumeGridPainter(bloc.volumeMax), 25 | ); 26 | }, 27 | ); 28 | } 29 | } 30 | 31 | class _VolumeGridPainter extends CustomPainter { 32 | final double maxVolume; 33 | _VolumeGridPainter( 34 | this.maxVolume, 35 | ); 36 | final Color lineColor = kGridLineColor; 37 | final double lineWidth = kGridLineWidth; 38 | final double columnTopMargin = kColumnTopMargin; 39 | @override 40 | void paint(Canvas canvas, Size size) { 41 | double height = size.height; 42 | double width = size.width; 43 | Paint linePaint = Paint() 44 | ..color = lineColor 45 | ..strokeWidth = lineWidth 46 | ..isAntiAlias = true 47 | ..filterQuality = FilterQuality.high; 48 | // 绘制横线 49 | canvas.drawLine(Offset(0, columnTopMargin), Offset(width, columnTopMargin), linePaint); 50 | canvas.drawLine(Offset(0, height), Offset(width, height), linePaint); 51 | // 绘制竖线 52 | double widthOffset = (width ~/ kGridColumCount).toDouble(); 53 | for (int i = 1; i < kGridColumCount; i++) { 54 | canvas.drawLine(Offset(i * widthOffset, columnTopMargin), 55 | Offset(i * widthOffset, height), linePaint); 56 | } 57 | if (maxVolume == null) { 58 | return; 59 | } 60 | // 绘制当前最大值 61 | double orginX = 62 | width - maxVolume.toStringAsPrecision(kGridPricePrecision).length * 6; 63 | _drawText(canvas, Offset(orginX, columnTopMargin), 64 | maxVolume.toStringAsPrecision(kGridPricePrecision)); 65 | } 66 | 67 | _drawText(Canvas canvas, Offset offset, String text) { 68 | TextPainter textPainter = TextPainter( 69 | text: TextSpan( 70 | text: text, 71 | style: TextStyle( 72 | color: kGridTextColor, 73 | fontSize: kGridPriceFontSize, 74 | fontWeight: FontWeight.normal, 75 | ), 76 | ), 77 | textDirection: TextDirection.ltr); 78 | textPainter.layout(); 79 | textPainter.paint(canvas, offset); 80 | } 81 | 82 | @override 83 | bool shouldRepaint(CustomPainter oldDelegate) { 84 | return maxVolume != null; 85 | } 86 | } 87 | -------------------------------------------------------------------------------- /lib/packages/view/kline/klineCandleCrossWidget.dart: -------------------------------------------------------------------------------- 1 | /* 2 | * @Description: 3 | * @Author: zhaojijin 4 | * @LastEditors: zhaojijin 5 | * @Date: 2019-04-22 17:15:14 6 | * @LastEditTime: 2019-04-26 18:51:37 7 | */ 8 | 9 | import 'dart:ui'; 10 | 11 | import 'package:flutter/material.dart'; 12 | import 'package:flutter_kline/packages/bloc/klineBloc.dart'; 13 | import 'package:flutter_kline/packages/bloc/klineBlocProvider.dart'; 14 | import 'package:flutter_kline/packages/model/klineConstrants.dart'; 15 | import 'package:flutter_kline/packages/model/klineModel.dart'; 16 | 17 | class KlineCandleCrossWidget extends StatelessWidget { 18 | @override 19 | Widget build(BuildContext context) { 20 | KlineBloc bloc = KlineBlocProvider.of(context); 21 | return StreamBuilder( 22 | stream: bloc.klineMarketStream, 23 | builder: (BuildContext context, AsyncSnapshot snapshot) { 24 | Market market = snapshot.data; 25 | return market == null 26 | ? Container() 27 | : market.isShowCandleInfo 28 | ? CustomPaint( 29 | size: Size(bloc.screenWidth, market?.gridTotalHeight), 30 | painter: _KlineCandleCrossPainter( 31 | snapshot.data, bloc.candlestickWidth), 32 | ) 33 | : Container(); 34 | }, 35 | ); 36 | } 37 | } 38 | 39 | class _KlineCandleCrossPainter extends CustomPainter { 40 | _KlineCandleCrossPainter(this.market, this.crossVLineWidth); 41 | final Market market; 42 | final double crossVLineWidth; 43 | 44 | final Color crossHLineColor = kCrossHLineColor; 45 | final Color crossVLineColor = kCrossVLineColor; 46 | final double crossHLineWidth = kCrossHLineWidth; 47 | final double crossPointRadius = kCrossPointRadius; 48 | final Color crossPointColor = kCrossPointColor; 49 | @override 50 | void paint(Canvas canvas, Size size) { 51 | if (market == null) { 52 | return; 53 | } 54 | double originY = market.candleWidgetOriginY; 55 | Paint paintH = Paint() 56 | ..color = crossHLineColor 57 | ..strokeWidth = crossHLineWidth 58 | ..isAntiAlias = true; 59 | 60 | Paint paintV = Paint() 61 | ..color = crossVLineColor 62 | ..strokeWidth = crossVLineWidth 63 | ..isAntiAlias = true; 64 | 65 | // 画竖线 66 | canvas.drawLine(Offset(market.offset.dx, originY), 67 | Offset(market.offset.dx, market.gridTotalHeight + originY), paintV); 68 | // 画点 69 | Paint pointPaint = Paint()..color = crossPointColor; 70 | Offset realOffset = Offset(market.offset.dx, market.offset.dy + originY); 71 | canvas.drawCircle(realOffset, crossPointRadius, pointPaint); 72 | 73 | // 画当前收盘价 74 | TextPainter closePainter = TextPainter( 75 | text: TextSpan( 76 | text: market.close.toStringAsPrecision(kGridPricePrecision), 77 | style: TextStyle( 78 | color: kCandleTextColor, 79 | fontSize: kCandleFontSize, 80 | fontWeight: FontWeight.normal, 81 | ), 82 | ), 83 | maxLines: 1, 84 | textDirection: TextDirection.ltr); 85 | closePainter.layout(); 86 | double closeTextOriginX = 0; 87 | double crossHlineStartOriginX = 0; 88 | double crossHlineEndOriginX = 0; 89 | double hMargin = 1; 90 | double leftPadding = 4; 91 | double topPadding = 4; 92 | Offset offset1; 93 | Offset offset2; 94 | Offset offset3; 95 | Offset offset4; 96 | Offset offset5; 97 | double halfRectHeight = topPadding + closePainter.height / 2; 98 | double rectTopY = originY + market.offset.dy - halfRectHeight; 99 | double rectBottomY = originY + market.offset.dy + halfRectHeight; 100 | 101 | if (market.offset.dx < size.width / 2) { 102 | closeTextOriginX = hMargin + leftPadding; 103 | crossHlineStartOriginX = 104 | leftPadding + hMargin + closePainter.width + halfRectHeight; 105 | crossHlineEndOriginX = size.width; 106 | offset1 = Offset(hMargin, rectTopY); 107 | offset2 = Offset(crossHlineStartOriginX - halfRectHeight, rectTopY); 108 | offset3 = Offset(crossHlineStartOriginX, originY + market.offset.dy); 109 | offset4 = Offset(crossHlineStartOriginX - halfRectHeight, rectBottomY); 110 | offset5 = Offset(hMargin, rectBottomY); 111 | } else { 112 | closeTextOriginX = 113 | size.width - leftPadding - hMargin - closePainter.width; 114 | crossHlineStartOriginX = 0; 115 | crossHlineEndOriginX = closeTextOriginX - halfRectHeight; 116 | 117 | offset1 = Offset(size.width - hMargin, rectTopY); 118 | offset2 = Offset(crossHlineEndOriginX + halfRectHeight, rectTopY); 119 | offset3 = Offset(crossHlineEndOriginX, originY + market.offset.dy); 120 | offset4 = Offset(crossHlineEndOriginX + halfRectHeight, rectBottomY); 121 | offset5 = Offset(size.width - hMargin, rectBottomY); 122 | } 123 | 124 | // 画横线 125 | canvas.drawLine(Offset(crossHlineStartOriginX, market.offset.dy + originY), 126 | Offset(crossHlineEndOriginX, market.offset.dy + originY), paintH); 127 | List points = [ 128 | offset1, 129 | offset2, 130 | offset3, 131 | offset4, 132 | offset5, 133 | offset1 134 | ]; 135 | // 填充多边形颜色 136 | Paint polygonPainter = Paint() 137 | ..color = kBackgroundColor 138 | ..style = PaintingStyle.fill 139 | ..isAntiAlias = true; 140 | Path path = Path()..moveTo(offset1.dx, offset1.dy); 141 | path.addPolygon(points, false); 142 | canvas.drawPath(path, polygonPainter); 143 | 144 | // 绘制多边形 145 | canvas.drawPoints(PointMode.polygon, points, paintH); 146 | // 绘制文字 147 | Offset of = Offset( 148 | closeTextOriginX, originY + market.offset.dy - closePainter.height / 2); 149 | closePainter.paint(canvas, of); 150 | } 151 | 152 | @override 153 | bool shouldRepaint(CustomPainter oldDelegate) { 154 | return market != null; 155 | } 156 | } 157 | -------------------------------------------------------------------------------- /lib/packages/view/kline/klineCandleInfoWidget.dart: -------------------------------------------------------------------------------- 1 | /* 2 | * @Description: 3 | * @Author: zhaojijin 4 | * @LastEditors: zhaojijin 5 | * @Date: 2019-04-22 18:55:06 6 | * @LastEditTime: 2019-04-26 16:37:31 7 | */ 8 | 9 | import 'package:flutter/material.dart'; 10 | import 'package:flutter_kline/packages/bloc/klineBloc.dart'; 11 | import 'package:flutter_kline/packages/bloc/klineBlocProvider.dart'; 12 | import 'package:flutter_kline/packages/model/klineConstrants.dart'; 13 | import 'package:flutter_kline/packages/model/klineModel.dart'; 14 | 15 | class KlineCandleInfoWidget extends StatelessWidget { 16 | @override 17 | Widget build(BuildContext context) { 18 | List _list = ['时间', '开', '高', '低', '收', '涨跌额', '涨跌幅', '成交量']; 19 | KlineBloc bloc = KlineBlocProvider.of(context); 20 | double screenWidth = MediaQuery.of(context).size.width; 21 | double width = kCandleInfoWidth; 22 | double height = kCandleInfoHeight; 23 | double rightLeftMargin = screenWidth - width - kCandleInfoLeftMargin; 24 | double rowTotalHeight = 25 | height - kCandleInfoPadding.top - kCandleInfoPadding.bottom; 26 | double rowHeight = (rowTotalHeight / _list.length); 27 | 28 | return StreamBuilder( 29 | stream: bloc.klineMarketStream, 30 | builder: (BuildContext context, AsyncSnapshot snapshot) { 31 | Market market = snapshot.data; 32 | double originY = market?.candleWidgetOriginY; 33 | Container _candleInfoWidget() { 34 | return Container( 35 | width: width, 36 | height: height, 37 | margin: (market.offset.dx > screenWidth / 2) 38 | ? EdgeInsets.only( 39 | top: kCandleInfoTopMargin + originY, 40 | left: kCandleInfoLeftMargin) 41 | : EdgeInsets.only( 42 | top: kCandleInfoTopMargin + originY, left: rightLeftMargin), 43 | decoration: BoxDecoration( 44 | border: Border.all( 45 | color: kCandleInfoBorderColor, 46 | width: kCandleInfoBorderWidth), 47 | color: kCandleInfoBgColor), 48 | child: ListView.builder( 49 | padding: kCandleInfoPadding, 50 | itemCount: _list.length, 51 | itemBuilder: (BuildContext context, int index) { 52 | List marketInfoList = market?.candleInfo(); 53 | return Container( 54 | child: Stack( 55 | children: [ 56 | Container( 57 | height: rowHeight, 58 | alignment: Alignment.centerLeft, 59 | child: Text( 60 | '${_list[index]}', 61 | style: TextStyle( 62 | color: kCandleInfoTextColor, 63 | fontSize: kCandleInfoLeftFontSize), 64 | ), 65 | ), 66 | Container( 67 | height: rowHeight, 68 | alignment: Alignment.centerRight, 69 | child: marketInfoList == null 70 | ? Text('') 71 | : Text( 72 | '${marketInfoList[index]}', 73 | style: TextStyle( 74 | color: _list[index].contains('涨') 75 | ? marketInfoList[index].contains('+') 76 | ? kIncreaseColor 77 | : kDecreaseColor 78 | : kCandleInfoTextColor, 79 | fontSize: kCandleInfoRightFontSize), 80 | ), 81 | ), 82 | ], 83 | ), 84 | ); 85 | }, 86 | ), 87 | ); 88 | } 89 | 90 | return market == null 91 | ? Container() 92 | : (market.isShowCandleInfo ? _candleInfoWidget() : Container()); 93 | }, 94 | ); 95 | } 96 | } 97 | -------------------------------------------------------------------------------- /lib/packages/view/kline/klineCandleWidget.dart: -------------------------------------------------------------------------------- 1 | /* 2 | * @Description: 3 | * @Author: zhaojijin 4 | * @LastEditors: zhaojijin 5 | * @Date: 2019-04-18 12:44:49 6 | * @LastEditTime: 2019-08-20 15:16:52 7 | */ 8 | 9 | import 'package:flutter/material.dart'; 10 | import 'package:flutter_kline/packages/bloc/klineBloc.dart'; 11 | import 'package:flutter_kline/packages/bloc/klineBlocProvider.dart'; 12 | import 'package:flutter_kline/packages/model/klineConstrants.dart'; 13 | import 'package:flutter_kline/packages/model/klineModel.dart'; 14 | 15 | class KlineCandleWidget extends StatelessWidget { 16 | @override 17 | Widget build(BuildContext context) { 18 | KlineBloc bloc = KlineBlocProvider.of(context); 19 | return StreamBuilder( 20 | stream: bloc.currentKlineListStream, 21 | builder: (BuildContext context, AsyncSnapshot> snapshot) { 22 | return CustomPaint( 23 | key: bloc.candleWidgetKey, 24 | size: Size(bloc.screenWidth, bloc.screenWidth / kcandleAspectRatio), 25 | painter: _CandlePainter( 26 | listData: snapshot.data, 27 | priceMax: bloc.priceMax, 28 | priceMin: bloc.priceMin, 29 | pMax: bloc.pMax, 30 | pMin: bloc.pMin, 31 | candlestickWidth: bloc.candlestickWidth), 32 | ); 33 | }, 34 | ); 35 | } 36 | } 37 | 38 | class _CandlePainter extends CustomPainter { 39 | _CandlePainter({ 40 | @required this.listData, 41 | @required this.priceMax, 42 | @required this.priceMin, 43 | @required this.pMax, 44 | @required this.pMin, 45 | @required this.candlestickWidth, 46 | }); 47 | final List listData; 48 | final double priceMax; 49 | final double priceMin; 50 | final double pMax; 51 | final double pMin; 52 | 53 | /// 烛台宽度 54 | final double candlestickWidth; 55 | 56 | /// 灯芯宽度 57 | final double wickWidth = kWickWidth; 58 | 59 | /// 烛台间空隙 60 | final double candlestickGap = kCandlestickGap; 61 | 62 | /// 上影线上方距离 63 | final double topMargin = kTopMargin + kCandleTextHight / 2; 64 | final Color increaseColor = kIncreaseColor; 65 | final Color decreaseColor = kDecreaseColor; 66 | final double candleTextHight = kCandleTextHight; 67 | 68 | @override 69 | void paint(Canvas canvas, Size size) { 70 | Paint linePaint = Paint() 71 | ..color = Colors.black 72 | ..blendMode = BlendMode.colorBurn 73 | ..strokeWidth = 0.5; 74 | canvas.drawLine(Offset(0, 0), Offset(size.width, 0), linePaint); 75 | if (listData == null || priceMax == null || priceMin == null) { 76 | return; 77 | } 78 | double height = size.height - topMargin - kCandleTextHight / 2; 79 | double heightPriceOffset = 0; 80 | if ((priceMax - priceMin) != 0) { 81 | heightPriceOffset = height / (priceMax - priceMin); 82 | } 83 | double candlestickLeft; 84 | double candlestickTop; 85 | double candlestickRight; 86 | double candlestickBottom; 87 | Paint candlestickPaint; 88 | bool maxPricePainted = false; 89 | bool minPricePainted = false; 90 | for (int i = 0; i < listData.length; i++) { 91 | Market market = listData[i]; 92 | // 画笔 93 | Color painterColor; 94 | PaintingStyle paintingStyle; 95 | if (market.open > market.close) { 96 | painterColor = decreaseColor; 97 | paintingStyle = PaintingStyle.fill; 98 | } else if (market.open == market.close) { 99 | painterColor = Colors.white; 100 | paintingStyle = PaintingStyle.fill; 101 | } else { 102 | painterColor = increaseColor; 103 | paintingStyle = PaintingStyle.fill; 104 | } 105 | candlestickPaint = Paint() 106 | ..color = painterColor 107 | ..strokeWidth = wickWidth 108 | ..isAntiAlias = true 109 | ..filterQuality = FilterQuality.high 110 | ..style = paintingStyle; 111 | 112 | // 绘制烛台 113 | int j = listData.length - 1 - i; 114 | candlestickLeft = 115 | j * (candlestickWidth + candlestickGap) + candlestickGap; 116 | candlestickRight = candlestickLeft + candlestickWidth; 117 | // print('candlestickLeft: $candlestickLeft === candlestickRight: $candlestickRight ${listData.length}'); 118 | candlestickTop = 119 | height - (market.open - priceMin) * heightPriceOffset + topMargin; 120 | candlestickBottom = 121 | height - (market.close - priceMin) * heightPriceOffset + topMargin; 122 | 123 | Rect candlestickRect = Rect.fromLTRB( 124 | candlestickLeft, candlestickTop, candlestickRight, candlestickBottom); 125 | canvas.drawRect(candlestickRect, candlestickPaint); 126 | 127 | // 绘制上影线/下影线 128 | double low = 129 | height - (market.low - priceMin) * heightPriceOffset + topMargin; 130 | double high = 131 | height - (market.high - priceMin) * heightPriceOffset + topMargin; 132 | double candlestickCenterX = candlestickLeft + 133 | candlestickWidth.ceilToDouble() / 2.0; 134 | double closeOffsetY = 135 | height - (market.close - priceMin) * heightPriceOffset + topMargin; 136 | market.offset = Offset(candlestickCenterX, closeOffsetY); 137 | Offset highBottomOffset = Offset(candlestickCenterX, candlestickTop); 138 | Offset highTopOffset = Offset(candlestickCenterX, high); 139 | Offset lowBottomOffset = Offset(candlestickCenterX, candlestickBottom); 140 | Offset lowTopOffset = Offset(candlestickCenterX, low); 141 | canvas.drawLine(highBottomOffset, highTopOffset, candlestickPaint); 142 | canvas.drawLine(lowBottomOffset, lowTopOffset, candlestickPaint); 143 | 144 | Paint pricePaint = Paint() 145 | ..color = kCandleTextColor 146 | ..strokeWidth = 1; 147 | // 绘制最大值 148 | double lineWidth = 10; 149 | bool isLeft = false; 150 | double textOrginX; 151 | if (candlestickCenterX < size.width / 2) { 152 | textOrginX = candlestickCenterX + lineWidth; 153 | isLeft = true; 154 | } else { 155 | textOrginX = candlestickCenterX - lineWidth; 156 | isLeft = false; 157 | } 158 | if (market.high == pMax && !maxPricePainted) { 159 | canvas.drawLine(Offset(candlestickCenterX, high), 160 | Offset(textOrginX, high), pricePaint); 161 | _drawText(canvas, Offset(textOrginX, high - kCandleTextHight / 2), 162 | market.high.toStringAsPrecision(kGridPricePrecision), isLeft); 163 | maxPricePainted = true; 164 | } 165 | // 绘制最小值 166 | if (market.low == pMin && !minPricePainted) { 167 | canvas.drawLine(Offset(candlestickCenterX, low), 168 | Offset(textOrginX, low), pricePaint); 169 | _drawText(canvas, Offset(textOrginX, low - kCandleTextHight / 2), 170 | market.low.toStringAsPrecision(kGridPricePrecision), isLeft); 171 | minPricePainted = true; 172 | } 173 | } 174 | } 175 | 176 | _drawText(Canvas canvas, Offset offset, String text, bool isLeft) { 177 | TextPainter textPainter = TextPainter( 178 | text: TextSpan( 179 | text: text, 180 | style: TextStyle( 181 | color: kCandleTextColor, 182 | fontSize: kCandleFontSize, 183 | fontWeight: FontWeight.normal, 184 | ), 185 | ), 186 | maxLines: 1, 187 | textDirection: TextDirection.ltr); 188 | textPainter.layout(); 189 | Offset of = offset; 190 | if (!isLeft) { 191 | of = Offset(offset.dx - textPainter.width, offset.dy); 192 | } 193 | textPainter.paint(canvas, of); 194 | } 195 | 196 | @override 197 | bool shouldRepaint(CustomPainter oldDelegate) { 198 | return listData != null; 199 | } 200 | } 201 | -------------------------------------------------------------------------------- /lib/packages/view/kline/klineLoadingWidget.dart: -------------------------------------------------------------------------------- 1 | /* 2 | * @Description: 3 | * @Author: zhaojijin 4 | * @LastEditors: zhaojijin 5 | * @Date: 2019-04-23 21:38:13 6 | * @LastEditTime: 2019-12-13 15:53:51 7 | */ 8 | import 'package:flutter/cupertino.dart'; 9 | import 'package:flutter/material.dart'; 10 | import 'package:flutter_kline/packages/bloc/klineBloc.dart'; 11 | import 'package:flutter_kline/packages/bloc/klineBlocProvider.dart'; 12 | 13 | class KlineLoadingWidget extends StatelessWidget { 14 | @override 15 | Widget build(BuildContext context) { 16 | KlineBloc bloc = KlineBlocProvider.of(context); 17 | return StreamBuilder( 18 | stream: bloc.klineShowLoadingStream, 19 | builder: (BuildContext context, AsyncSnapshot snapshot) { 20 | bool show = snapshot.data == null ? true : snapshot.data; 21 | return Container( 22 | child: Center(child: show ? CupertinoActivityIndicator() : null)); 23 | }, 24 | ); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /lib/packages/view/kline/klineMaLineWidget.dart: -------------------------------------------------------------------------------- 1 | /* 2 | * @Description: 3 | * @Author: zhaojijin 4 | * @LastEditors: zhaojijin 5 | * @Date: 2019-04-18 16:48:38 6 | * @LastEditTime: 2019-04-25 11:47:15 7 | */ 8 | import 'package:flutter/material.dart'; 9 | import 'package:flutter_kline/packages/bloc/klineBloc.dart'; 10 | import 'package:flutter_kline/packages/bloc/klineBlocProvider.dart'; 11 | import 'package:flutter_kline/packages/model/klineConstrants.dart'; 12 | import 'package:flutter_kline/packages/model/klineModel.dart'; 13 | 14 | class KlineMaLineWidget extends StatelessWidget { 15 | final YKMAType maType; 16 | KlineMaLineWidget(this.maType); 17 | @override 18 | Widget build(BuildContext context) { 19 | KlineBloc bloc = KlineBlocProvider.of(context); 20 | return StreamBuilder( 21 | stream: bloc.currentKlineListStream, 22 | builder: (BuildContext context, AsyncSnapshot> snapshot) { 23 | List listData; 24 | if (snapshot.data != null) { 25 | listData = snapshot.data; 26 | } 27 | return CustomPaint( 28 | size: Size(bloc.screenWidth, bloc.screenWidth / kcandleAspectRatio), 29 | painter: _KlineMaLinePainter(listData, maType, bloc.priceMax, 30 | bloc.priceMin, bloc.candlestickWidth), 31 | ); 32 | }, 33 | ); 34 | } 35 | } 36 | 37 | class _KlineMaLinePainter extends CustomPainter { 38 | _KlineMaLinePainter(this.listData, this.maType, this.priceMax, this.priceMin, 39 | this.candlestickWidth); 40 | final List listData; 41 | final YKMAType maType; 42 | final double priceMax; 43 | final double priceMin; 44 | final double candlestickWidth; 45 | final double lineWidth = kMaLineWidth; 46 | final double topMargin = kMaTopMargin; 47 | final double candlestickGap = kCandlestickGap; 48 | Color lineColor; 49 | 50 | @override 51 | void paint(Canvas canvas, Size size) { 52 | if (listData == null || 53 | priceMax == null || 54 | priceMin == null || 55 | maType == null) { 56 | return; 57 | } 58 | 59 | double height = size.height - topMargin; 60 | double heightPriceOffset = 0; 61 | if (priceMax - priceMin != 0) { 62 | heightPriceOffset = height / (priceMax - priceMin); 63 | } 64 | 65 | for (int i = 0; i < listData.length; i++) { 66 | if (i == listData.length - 1) { 67 | break; 68 | } 69 | 70 | Market market = listData[i]; 71 | Market nextMarket = listData[i + 1]; 72 | // print( 73 | // '============ market.priceMa1 : ${market.priceMa1} market.priceMa2 : ${market.priceMa2} market.priceMa3 : ${market.priceMa3} index: $i count : ${listData.length}'); 74 | if ((market.priceMa1 == null && maType == YKMAType.MA5) || 75 | (market.priceMa2 == null && maType == YKMAType.MA10) || 76 | (market.priceMa3 == null && maType == YKMAType.MA30)) { 77 | // print( 78 | // 'continue========= ${market.priceMa1}==${market.priceMa2}==${market.priceMa3}'); 79 | break; 80 | } 81 | double currentMaPrice; 82 | double currentNextMaPrice; 83 | 84 | switch (maType) { 85 | case YKMAType.MA5: 86 | { 87 | lineColor = kMa5LineColor; 88 | currentMaPrice = market.priceMa1; 89 | currentNextMaPrice = nextMarket.priceMa1; 90 | } 91 | break; 92 | case YKMAType.MA10: 93 | { 94 | lineColor = kMa10LineColor; 95 | currentMaPrice = market.priceMa2; 96 | currentNextMaPrice = nextMarket.priceMa2; 97 | } 98 | break; 99 | case YKMAType.MA30: 100 | { 101 | lineColor = kMa20LineColor; 102 | currentMaPrice = market.priceMa3; 103 | currentNextMaPrice = nextMarket.priceMa3; 104 | } 105 | break; 106 | default: 107 | } 108 | 109 | Paint maPainter = Paint() 110 | ..color = lineColor 111 | ..isAntiAlias = true 112 | ..filterQuality = FilterQuality.high 113 | // ..strokeCap = StrokeCap.round 114 | ..strokeWidth = lineWidth; 115 | 116 | double startX, startY, endX, endY; 117 | int j = listData.length - 1 - i; 118 | 119 | double startRectLeft = 120 | j * (candlestickWidth + candlestickGap) + candlestickGap; 121 | double endRectLeft = 122 | (j - 1) * (candlestickWidth + candlestickGap) + candlestickGap; 123 | startX = startRectLeft + candlestickWidth / 2; 124 | endX = endRectLeft + candlestickWidth / 2; 125 | 126 | // print('startX: $startX ==== endX: $endX === ${i}'); 127 | if (currentMaPrice != null && currentNextMaPrice != null) { 128 | startY = height - 129 | (currentMaPrice - priceMin) * heightPriceOffset + 130 | topMargin; 131 | endY = height - 132 | (currentNextMaPrice - priceMin) * heightPriceOffset + 133 | topMargin; 134 | 135 | canvas.drawLine(Offset(startX, startY), Offset(endX, endY), maPainter); 136 | } 137 | } 138 | } 139 | 140 | @override 141 | bool shouldRepaint(CustomPainter oldDelegate) { 142 | return listData != null; 143 | } 144 | } 145 | -------------------------------------------------------------------------------- /lib/packages/view/kline/klinePeriodSwitch.dart: -------------------------------------------------------------------------------- 1 | /* 2 | * @Description: 3 | * @Author: zhaojijin 4 | * @LastEditors: zhaojijin 5 | * @Date: 2019-04-23 18:44:59 6 | * @LastEditTime: 2019-04-25 17:48:50 7 | */ 8 | 9 | import 'package:flutter/cupertino.dart'; 10 | import 'package:flutter/material.dart'; 11 | import 'package:flutter_kline/packages/bloc/klineBloc.dart'; 12 | import 'package:flutter_kline/packages/bloc/klineBlocProvider.dart'; 13 | import 'package:flutter_kline/packages/model/klineConstrants.dart'; 14 | 15 | class KlinePeriodSwitchWidget extends StatefulWidget { 16 | @override 17 | _KlinePeriodSwitchWidgetState createState() => 18 | _KlinePeriodSwitchWidgetState(); 19 | } 20 | 21 | class _KlinePeriodSwitchWidgetState extends State { 22 | List periodList = kPeriodList; 23 | List periodTitleList = kPeriodTitleList; 24 | int currentIndex = kDefaultPeriodIndex; 25 | @override 26 | Widget build(BuildContext context) { 27 | KlineBloc bloc = KlineBlocProvider.of(context); 28 | double screenWidth = bloc.screenWidth; 29 | double height = kPeriodHeight; 30 | double width = screenWidth / periodList.length; 31 | Widget _listView() { 32 | return ListView.builder( 33 | scrollDirection: Axis.horizontal, 34 | itemCount: periodList.length, 35 | itemBuilder: (BuildContext context, int index) { 36 | return Container( 37 | width: width, 38 | alignment: Alignment.center, 39 | child: CupertinoButton( 40 | pressedOpacity: 0.7, 41 | padding: EdgeInsets.all(0), 42 | child: Text( 43 | '${periodTitleList[index]}', 44 | style: TextStyle( 45 | fontSize: 12, 46 | fontWeight: FontWeight.w700, 47 | color: kGridTextColor), 48 | ), 49 | onPressed: () { 50 | setState(() { 51 | currentIndex = index; 52 | }); 53 | bloc.periodSwitchSinkAdd(periodList[index]); 54 | }, 55 | ), 56 | ); 57 | }); 58 | } 59 | 60 | double indicatorWidth = (width * 2 / 3).ceilToDouble(); 61 | double indicatorHeight = 2; 62 | double indicatorTopMargin = height - indicatorHeight*2; 63 | double left = (currentIndex * width + indicatorWidth / 4).ceilToDouble(); 64 | 65 | Widget _indicator() { 66 | return AnimatedPositioned( 67 | left: left, 68 | child: Container( 69 | height: indicatorHeight, 70 | width: indicatorWidth, 71 | margin: EdgeInsets.only(top: indicatorTopMargin), 72 | color: kGridTextColor, 73 | ), 74 | duration: Duration(milliseconds: 200), 75 | ); 76 | } 77 | 78 | return Container( 79 | width: screenWidth, 80 | height: height, 81 | child: Stack( 82 | children: [_listView(), _indicator()], 83 | )); 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /lib/packages/view/kline/klineVolumeWidget.dart: -------------------------------------------------------------------------------- 1 | /* 2 | * @Description: 3 | * @Author: zhaojijin 4 | * @LastEditors: zhaojijin 5 | * @Date: 2019-04-18 15:21:47 6 | * @LastEditTime: 2019-04-25 11:54:24 7 | */ 8 | import 'package:flutter/material.dart'; 9 | import 'package:flutter_kline/packages/bloc/klineBloc.dart'; 10 | import 'package:flutter_kline/packages/bloc/klineBlocProvider.dart'; 11 | import 'package:flutter_kline/packages/model/klineConstrants.dart'; 12 | import 'package:flutter_kline/packages/model/klineModel.dart'; 13 | 14 | class KlineVolumeWidget extends StatelessWidget { 15 | @override 16 | Widget build(BuildContext context) { 17 | KlineBloc bloc = KlineBlocProvider.of(context); 18 | return StreamBuilder( 19 | stream: bloc.currentKlineListStream, 20 | builder: (BuildContext context, AsyncSnapshot> snapshot) { 21 | return CustomPaint( 22 | key: bloc.volumeWidgetKey, 23 | size: Size(bloc.screenWidth, bloc.screenWidth / kVolumeAspectRatio), 24 | painter: _KlineVolumePainter( 25 | snapshot.data, bloc.volumeMax, bloc.candlestickWidth), 26 | ); 27 | }, 28 | ); 29 | } 30 | } 31 | 32 | class _KlineVolumePainter extends CustomPainter { 33 | final List listData; 34 | final double maxVolume; 35 | _KlineVolumePainter( 36 | this.listData, 37 | this.maxVolume, 38 | this.columnarWidth, 39 | ); 40 | 41 | /// 柱状体宽度 42 | final double columnarWidth; 43 | 44 | /// 柱状体之间间隙 = 烛台间空隙 45 | final double columnarGap = kColumnarGap; 46 | final double columnarTopMargin = kColumnarTopMargin; 47 | final Color increaseColor = kIncreaseColor; 48 | final Color decreaseColor = kDecreaseColor; 49 | 50 | @override 51 | void paint(Canvas canvas, Size size) { 52 | if (listData == null || maxVolume == null || maxVolume == 0) { 53 | return; 54 | } 55 | double height = size.height - columnarTopMargin; 56 | final double heightVolumeOffset = height / maxVolume; 57 | double columnarRectLeft; 58 | double columnarRectTop; 59 | double columnarRectRight; 60 | double columnarRectBottom; 61 | 62 | Paint columnarPaint; 63 | 64 | for (int i = 0; i < listData.length; i++) { 65 | Market market = listData[i]; 66 | // 画笔 67 | Color painterColor; 68 | if (market.open > market.close) { 69 | painterColor = decreaseColor; 70 | } else if (market.open == market.close) { 71 | painterColor = Colors.white; 72 | } else { 73 | painterColor = increaseColor; 74 | } 75 | columnarPaint = Paint() 76 | ..color = painterColor 77 | ..strokeWidth = columnarWidth 78 | ..isAntiAlias = true 79 | ..filterQuality = FilterQuality.high; 80 | 81 | // 柱状体 82 | int j = listData.length - 1 - i; 83 | columnarRectLeft = j * (columnarWidth + columnarGap) + columnarGap; 84 | columnarRectRight = columnarRectLeft + columnarWidth; 85 | columnarRectTop = 86 | height - market.vol * heightVolumeOffset + columnarTopMargin; 87 | columnarRectBottom = height + columnarTopMargin; 88 | // print('columnarRectTop : $columnarRectTop columnarRectBottom: $columnarRectBottom'); 89 | Rect columnarRect = Rect.fromLTRB(columnarRectLeft, columnarRectTop, 90 | columnarRectRight, columnarRectBottom); 91 | canvas.drawRect(columnarRect, columnarPaint); 92 | } 93 | } 94 | 95 | @override 96 | bool shouldRepaint(CustomPainter oldDelegate) { 97 | return listData != null; 98 | } 99 | } 100 | -------------------------------------------------------------------------------- /lib/packages/view/klineWidget.dart: -------------------------------------------------------------------------------- 1 | /* 2 | * @Description: 3 | * @Author: zhaojijin 4 | * @LastEditors: zhaojijin 5 | * @Date: 2019-04-18 13:54:54 6 | * @LastEditTime: 2019-04-25 11:44:32 7 | */ 8 | import 'package:flutter/material.dart'; 9 | import 'package:flutter_kline/packages/model/klineConstrants.dart'; 10 | import 'package:flutter_kline/packages/view/grid/klinePriceGridWidget.dart'; 11 | import 'package:flutter_kline/packages/view/grid/klineVolumeGridWidget.dart'; 12 | import 'package:flutter_kline/packages/view/kline/klineCandleCrossWidget.dart'; 13 | import 'package:flutter_kline/packages/view/kline/klineCandleInfoWidget.dart'; 14 | import 'package:flutter_kline/packages/view/kline/klineCandleWidget.dart'; 15 | import 'package:flutter_kline/packages/view/kline/klineLoadingWidget.dart'; 16 | import 'package:flutter_kline/packages/view/kline/klineMaLineWidget.dart'; 17 | import 'package:flutter_kline/packages/view/kline/klinePeriodSwitch.dart'; 18 | import 'package:flutter_kline/packages/view/kline/klineVolumeWidget.dart'; 19 | 20 | class KlineWidget extends StatelessWidget { 21 | @override 22 | Widget build(BuildContext context) { 23 | return AspectRatio( 24 | aspectRatio: _getTotalAspectRatio( 25 | context, kcandleAspectRatio, kVolumeAspectRatio, kPeriodAspectRatio), 26 | child: Container( 27 | color: kBackgroundColor, 28 | child: Stack( 29 | children: [ 30 | Column( 31 | children: [ 32 | AspectRatio( 33 | child: KlinePeriodSwitchWidget(), 34 | aspectRatio: kPeriodAspectRatio, 35 | ), 36 | AspectRatio( 37 | aspectRatio: kcandleAspectRatio, 38 | child: Stack( 39 | children: [ 40 | KlinePriceGridWidget(), 41 | KlineCandleWidget(), 42 | KlineMaLineWidget(YKMAType.MA5), 43 | KlineMaLineWidget(YKMAType.MA10), 44 | KlineMaLineWidget(YKMAType.MA30), 45 | ], 46 | ), 47 | ), 48 | AspectRatio( 49 | aspectRatio: kVolumeAspectRatio, 50 | child: Stack( 51 | children: [ 52 | KlineVolumeGridWidget(), 53 | KlineVolumeWidget(), 54 | ], 55 | ), 56 | ), 57 | ], 58 | ), 59 | KlineCandleCrossWidget(), 60 | KlineCandleInfoWidget(), 61 | KlineLoadingWidget(), 62 | ], 63 | ), 64 | ), 65 | ); 66 | } 67 | } 68 | 69 | double _getTotalAspectRatio( 70 | BuildContext context, double aspectRatio1, aspectRatio2, aspectRatio3) { 71 | if (aspectRatio1 == 0 || aspectRatio2 == 0 || aspectRatio3 == 0) { 72 | return 1; 73 | } 74 | double width = MediaQuery.of(context).size.width; 75 | // width/height1 = aspectRatio1; height1 = width/aspectRatio1; 76 | double height1 = width / aspectRatio1; 77 | double height2 = width / aspectRatio2; 78 | double heitht3 = width / aspectRatio3; 79 | return width / (height1 + height2 + heitht3); 80 | } 81 | -------------------------------------------------------------------------------- /pubspec.lock: -------------------------------------------------------------------------------- 1 | # Generated by pub 2 | # See https://dart.dev/tools/pub/glossary#lockfile 3 | packages: 4 | _fe_analyzer_shared: 5 | dependency: transitive 6 | description: 7 | name: _fe_analyzer_shared 8 | url: "https://pub.flutter-io.cn" 9 | source: hosted 10 | version: "2.1.0" 11 | analyzer: 12 | dependency: transitive 13 | description: 14 | name: analyzer 15 | url: "https://pub.flutter-io.cn" 16 | source: hosted 17 | version: "0.39.6" 18 | archive: 19 | dependency: transitive 20 | description: 21 | name: archive 22 | url: "https://pub.flutter-io.cn" 23 | source: hosted 24 | version: "2.0.11" 25 | args: 26 | dependency: transitive 27 | description: 28 | name: args 29 | url: "https://pub.flutter-io.cn" 30 | source: hosted 31 | version: "1.5.2" 32 | async: 33 | dependency: transitive 34 | description: 35 | name: async 36 | url: "https://pub.flutter-io.cn" 37 | source: hosted 38 | version: "2.4.0" 39 | boolean_selector: 40 | dependency: transitive 41 | description: 42 | name: boolean_selector 43 | url: "https://pub.flutter-io.cn" 44 | source: hosted 45 | version: "1.0.5" 46 | build: 47 | dependency: transitive 48 | description: 49 | name: build 50 | url: "https://pub.flutter-io.cn" 51 | source: hosted 52 | version: "1.2.2" 53 | build_config: 54 | dependency: transitive 55 | description: 56 | name: build_config 57 | url: "https://pub.flutter-io.cn" 58 | source: hosted 59 | version: "0.4.2" 60 | charcode: 61 | dependency: transitive 62 | description: 63 | name: charcode 64 | url: "https://pub.flutter-io.cn" 65 | source: hosted 66 | version: "1.1.2" 67 | checked_yaml: 68 | dependency: transitive 69 | description: 70 | name: checked_yaml 71 | url: "https://pub.flutter-io.cn" 72 | source: hosted 73 | version: "1.0.2" 74 | collection: 75 | dependency: transitive 76 | description: 77 | name: collection 78 | url: "https://pub.flutter-io.cn" 79 | source: hosted 80 | version: "1.14.11" 81 | convert: 82 | dependency: transitive 83 | description: 84 | name: convert 85 | url: "https://pub.flutter-io.cn" 86 | source: hosted 87 | version: "2.1.1" 88 | crypto: 89 | dependency: transitive 90 | description: 91 | name: crypto 92 | url: "https://pub.flutter-io.cn" 93 | source: hosted 94 | version: "2.1.3" 95 | csslib: 96 | dependency: transitive 97 | description: 98 | name: csslib 99 | url: "https://pub.flutter-io.cn" 100 | source: hosted 101 | version: "0.16.1" 102 | cupertino_icons: 103 | dependency: "direct main" 104 | description: 105 | name: cupertino_icons 106 | url: "https://pub.flutter-io.cn" 107 | source: hosted 108 | version: "0.1.2" 109 | dart_style: 110 | dependency: transitive 111 | description: 112 | name: dart_style 113 | url: "https://pub.flutter-io.cn" 114 | source: hosted 115 | version: "1.3.4" 116 | flutter: 117 | dependency: "direct main" 118 | description: flutter 119 | source: sdk 120 | version: "0.0.0" 121 | flutter_test: 122 | dependency: "direct dev" 123 | description: flutter 124 | source: sdk 125 | version: "0.0.0" 126 | glob: 127 | dependency: transitive 128 | description: 129 | name: glob 130 | url: "https://pub.flutter-io.cn" 131 | source: hosted 132 | version: "1.1.7" 133 | html: 134 | dependency: transitive 135 | description: 136 | name: html 137 | url: "https://pub.flutter-io.cn" 138 | source: hosted 139 | version: "0.14.0+3" 140 | http: 141 | dependency: "direct main" 142 | description: 143 | name: http 144 | url: "https://pub.flutter-io.cn" 145 | source: hosted 146 | version: "0.12.0+2" 147 | http_parser: 148 | dependency: transitive 149 | description: 150 | name: http_parser 151 | url: "https://pub.flutter-io.cn" 152 | source: hosted 153 | version: "3.1.3" 154 | image: 155 | dependency: transitive 156 | description: 157 | name: image 158 | url: "https://pub.flutter-io.cn" 159 | source: hosted 160 | version: "2.1.4" 161 | json_annotation: 162 | dependency: "direct main" 163 | description: 164 | name: json_annotation 165 | url: "https://pub.flutter-io.cn" 166 | source: hosted 167 | version: "3.0.1" 168 | json_serializable: 169 | dependency: "direct dev" 170 | description: 171 | name: json_serializable 172 | url: "https://pub.flutter-io.cn" 173 | source: hosted 174 | version: "3.3.0" 175 | logging: 176 | dependency: transitive 177 | description: 178 | name: logging 179 | url: "https://pub.flutter-io.cn" 180 | source: hosted 181 | version: "0.11.3+2" 182 | matcher: 183 | dependency: transitive 184 | description: 185 | name: matcher 186 | url: "https://pub.flutter-io.cn" 187 | source: hosted 188 | version: "0.12.6" 189 | meta: 190 | dependency: transitive 191 | description: 192 | name: meta 193 | url: "https://pub.flutter-io.cn" 194 | source: hosted 195 | version: "1.1.8" 196 | package_config: 197 | dependency: transitive 198 | description: 199 | name: package_config 200 | url: "https://pub.flutter-io.cn" 201 | source: hosted 202 | version: "1.0.5" 203 | path: 204 | dependency: transitive 205 | description: 206 | name: path 207 | url: "https://pub.flutter-io.cn" 208 | source: hosted 209 | version: "1.6.4" 210 | pedantic: 211 | dependency: transitive 212 | description: 213 | name: pedantic 214 | url: "https://pub.flutter-io.cn" 215 | source: hosted 216 | version: "1.8.0+1" 217 | petitparser: 218 | dependency: transitive 219 | description: 220 | name: petitparser 221 | url: "https://pub.flutter-io.cn" 222 | source: hosted 223 | version: "2.4.0" 224 | pub_semver: 225 | dependency: transitive 226 | description: 227 | name: pub_semver 228 | url: "https://pub.flutter-io.cn" 229 | source: hosted 230 | version: "1.4.2" 231 | pubspec_parse: 232 | dependency: transitive 233 | description: 234 | name: pubspec_parse 235 | url: "https://pub.flutter-io.cn" 236 | source: hosted 237 | version: "0.1.5" 238 | quiver: 239 | dependency: transitive 240 | description: 241 | name: quiver 242 | url: "https://pub.flutter-io.cn" 243 | source: hosted 244 | version: "2.0.5" 245 | rxdart: 246 | dependency: "direct main" 247 | description: 248 | name: rxdart 249 | url: "https://pub.flutter-io.cn" 250 | source: hosted 251 | version: "0.21.0" 252 | sky_engine: 253 | dependency: transitive 254 | description: flutter 255 | source: sdk 256 | version: "0.0.99" 257 | source_gen: 258 | dependency: transitive 259 | description: 260 | name: source_gen 261 | url: "https://pub.flutter-io.cn" 262 | source: hosted 263 | version: "0.9.5" 264 | source_span: 265 | dependency: transitive 266 | description: 267 | name: source_span 268 | url: "https://pub.flutter-io.cn" 269 | source: hosted 270 | version: "1.5.5" 271 | stack_trace: 272 | dependency: transitive 273 | description: 274 | name: stack_trace 275 | url: "https://pub.flutter-io.cn" 276 | source: hosted 277 | version: "1.9.3" 278 | stream_channel: 279 | dependency: transitive 280 | description: 281 | name: stream_channel 282 | url: "https://pub.flutter-io.cn" 283 | source: hosted 284 | version: "2.0.0" 285 | string_scanner: 286 | dependency: transitive 287 | description: 288 | name: string_scanner 289 | url: "https://pub.flutter-io.cn" 290 | source: hosted 291 | version: "1.0.5" 292 | term_glyph: 293 | dependency: transitive 294 | description: 295 | name: term_glyph 296 | url: "https://pub.flutter-io.cn" 297 | source: hosted 298 | version: "1.1.0" 299 | test_api: 300 | dependency: transitive 301 | description: 302 | name: test_api 303 | url: "https://pub.flutter-io.cn" 304 | source: hosted 305 | version: "0.2.11" 306 | typed_data: 307 | dependency: transitive 308 | description: 309 | name: typed_data 310 | url: "https://pub.flutter-io.cn" 311 | source: hosted 312 | version: "1.1.6" 313 | vector_math: 314 | dependency: transitive 315 | description: 316 | name: vector_math 317 | url: "https://pub.flutter-io.cn" 318 | source: hosted 319 | version: "2.0.8" 320 | watcher: 321 | dependency: transitive 322 | description: 323 | name: watcher 324 | url: "https://pub.flutter-io.cn" 325 | source: hosted 326 | version: "0.9.7+10" 327 | xml: 328 | dependency: transitive 329 | description: 330 | name: xml 331 | url: "https://pub.flutter-io.cn" 332 | source: hosted 333 | version: "3.5.0" 334 | yaml: 335 | dependency: transitive 336 | description: 337 | name: yaml 338 | url: "https://pub.flutter-io.cn" 339 | source: hosted 340 | version: "2.1.15" 341 | sdks: 342 | dart: ">=2.7.0 <3.0.0" 343 | -------------------------------------------------------------------------------- /pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: flutter_kline 2 | description: A new Flutter project. 3 | 4 | # The following defines the version and build number for your application. 5 | # A version number is three numbers separated by dots, like 1.2.43 6 | # followed by an optional build number separated by a +. 7 | # Both the version and the builder number may be overridden in flutter 8 | # build by specifying --build-name and --build-number, respectively. 9 | # In Android, build-name is used as versionName while build-number used as versionCode. 10 | # Read more about Android versioning at https://developer.android.com/studio/publish/versioning 11 | # In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion. 12 | # Read more about iOS versioning at 13 | # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html 14 | version: 1.0.0+1 15 | 16 | environment: 17 | sdk: ">=2.1.0 <3.0.0" 18 | 19 | dependencies: 20 | flutter: 21 | sdk: flutter 22 | rxdart: ^0.21.0 23 | http: ^0.12.0+2 24 | json_annotation: ^3.0.0 25 | # The following adds the Cupertino Icons font to your application. 26 | # Use with the CupertinoIcons class for iOS style icons. 27 | cupertino_icons: ^0.1.2 28 | 29 | dev_dependencies: 30 | flutter_test: 31 | sdk: flutter 32 | json_serializable: ^3.2.3 33 | 34 | 35 | # For information on the generic Dart part of this file, see the 36 | # following page: https://www.dartlang.org/tools/pub/pubspec 37 | 38 | # The following section is specific to Flutter. 39 | flutter: 40 | 41 | # The following line ensures that the Material Icons font is 42 | # included with your application, so that you can use the icons in 43 | # the material Icons class. 44 | uses-material-design: true 45 | 46 | # To add assets to your application, add an assets section, like this: 47 | assets: 48 | - json/btcusdt.json 49 | # - images/a_dot_ham.jpeg 50 | 51 | # An image asset can refer to one or more resolution-specific "variants", see 52 | # https://flutter.io/assets-and-images/#resolution-aware. 53 | 54 | # For details regarding adding assets from package dependencies, see 55 | # https://flutter.io/assets-and-images/#from-packages 56 | 57 | # To add custom fonts to your application, add a fonts section here, 58 | # in this "flutter" section. Each entry in this list should have a 59 | # "family" key with the font family name, and a "fonts" key with a 60 | # list giving the asset and other descriptors for the font. For 61 | # example: 62 | # fonts: 63 | # - family: Schyler 64 | # fonts: 65 | # - asset: fonts/Schyler-Regular.ttf 66 | # - asset: fonts/Schyler-Italic.ttf 67 | # style: italic 68 | # - family: Trajan Pro 69 | # fonts: 70 | # - asset: fonts/TrajanPro.ttf 71 | # - asset: fonts/TrajanPro_Bold.ttf 72 | # weight: 700 73 | # 74 | # For details regarding fonts from package dependencies, 75 | # see https://flutter.io/custom-fonts/#from-packages 76 | -------------------------------------------------------------------------------- /test/widget_test.dart: -------------------------------------------------------------------------------- 1 | // This is a basic Flutter widget test. 2 | // 3 | // To perform an interaction with a widget in your test, use the WidgetTester 4 | // utility that Flutter provides. For example, you can send tap and scroll 5 | // gestures. You can also use WidgetTester to find child widgets in the widget 6 | // tree, read text, and verify that the values of widget properties are correct. 7 | 8 | import 'package:flutter/material.dart'; 9 | import 'package:flutter_test/flutter_test.dart'; 10 | 11 | import 'package:flutter_kline/main.dart'; 12 | 13 | void main() { 14 | testWidgets('Counter increments smoke test', (WidgetTester tester) async { 15 | // Build our app and trigger a frame. 16 | await tester.pumpWidget(MyApp()); 17 | 18 | // Verify that our counter starts at 0. 19 | expect(find.text('0'), findsOneWidget); 20 | expect(find.text('1'), findsNothing); 21 | 22 | // Tap the '+' icon and trigger a frame. 23 | await tester.tap(find.byIcon(Icons.add)); 24 | await tester.pump(); 25 | 26 | // Verify that our counter has incremented. 27 | expect(find.text('0'), findsNothing); 28 | expect(find.text('1'), findsOneWidget); 29 | }); 30 | } 31 | --------------------------------------------------------------------------------