├── linux
├── .gitignore
├── main.cc
├── flutter
│ ├── generated_plugin_registrant.cc
│ ├── generated_plugin_registrant.h
│ └── generated_plugins.cmake
└── my_application.h
├── example
├── linux
│ ├── .gitignore
│ ├── main.cc
│ ├── flutter
│ │ ├── generated_plugin_registrant.cc
│ │ ├── generated_plugin_registrant.h
│ │ └── generated_plugins.cmake
│ └── my_application.h
├── ios
│ ├── Flutter
│ │ ├── Debug.xcconfig
│ │ ├── Release.xcconfig
│ │ └── AppFrameworkInfo.plist
│ ├── Runner
│ │ ├── Runner-Bridging-Header.h
│ │ ├── Assets.xcassets
│ │ │ ├── LaunchImage.imageset
│ │ │ │ ├── LaunchImage.png
│ │ │ │ ├── LaunchImage@2x.png
│ │ │ │ ├── LaunchImage@3x.png
│ │ │ │ ├── README.md
│ │ │ │ └── Contents.json
│ │ │ └── AppIcon.appiconset
│ │ │ │ ├── Icon-App-20x20@1x.png
│ │ │ │ ├── Icon-App-20x20@2x.png
│ │ │ │ ├── Icon-App-20x20@3x.png
│ │ │ │ ├── Icon-App-29x29@1x.png
│ │ │ │ ├── Icon-App-29x29@2x.png
│ │ │ │ ├── Icon-App-29x29@3x.png
│ │ │ │ ├── Icon-App-40x40@1x.png
│ │ │ │ ├── Icon-App-40x40@2x.png
│ │ │ │ ├── Icon-App-40x40@3x.png
│ │ │ │ ├── Icon-App-60x60@2x.png
│ │ │ │ ├── Icon-App-60x60@3x.png
│ │ │ │ ├── Icon-App-76x76@1x.png
│ │ │ │ ├── Icon-App-76x76@2x.png
│ │ │ │ ├── Icon-App-1024x1024@1x.png
│ │ │ │ └── Icon-App-83.5x83.5@2x.png
│ │ ├── AppDelegate.swift
│ │ ├── Base.lproj
│ │ │ ├── Main.storyboard
│ │ │ └── LaunchScreen.storyboard
│ │ └── Info.plist
│ ├── Runner.xcodeproj
│ │ └── project.xcworkspace
│ │ │ ├── contents.xcworkspacedata
│ │ │ └── xcshareddata
│ │ │ ├── WorkspaceSettings.xcsettings
│ │ │ └── IDEWorkspaceChecks.plist
│ ├── Runner.xcworkspace
│ │ ├── contents.xcworkspacedata
│ │ └── xcshareddata
│ │ │ ├── WorkspaceSettings.xcsettings
│ │ │ └── IDEWorkspaceChecks.plist
│ ├── RunnerTests
│ │ └── RunnerTests.swift
│ └── .gitignore
├── macos
│ ├── Flutter
│ │ ├── Flutter-Debug.xcconfig
│ │ ├── Flutter-Release.xcconfig
│ │ └── GeneratedPluginRegistrant.swift
│ ├── Runner
│ │ ├── Configs
│ │ │ ├── Debug.xcconfig
│ │ │ ├── Release.xcconfig
│ │ │ ├── Warnings.xcconfig
│ │ │ └── AppInfo.xcconfig
│ │ ├── Assets.xcassets
│ │ │ └── AppIcon.appiconset
│ │ │ │ ├── app_icon_128.png
│ │ │ │ ├── app_icon_16.png
│ │ │ │ ├── app_icon_256.png
│ │ │ │ ├── app_icon_32.png
│ │ │ │ ├── app_icon_512.png
│ │ │ │ ├── app_icon_64.png
│ │ │ │ ├── app_icon_1024.png
│ │ │ │ └── Contents.json
│ │ ├── AppDelegate.swift
│ │ ├── Release.entitlements
│ │ ├── DebugProfile.entitlements
│ │ ├── MainFlutterWindow.swift
│ │ └── Info.plist
│ ├── .gitignore
│ ├── Runner.xcworkspace
│ │ ├── contents.xcworkspacedata
│ │ └── xcshareddata
│ │ │ └── IDEWorkspaceChecks.plist
│ ├── Runner.xcodeproj
│ │ └── project.xcworkspace
│ │ │ └── xcshareddata
│ │ │ └── IDEWorkspaceChecks.plist
│ └── RunnerTests
│ │ └── RunnerTests.swift
├── web
│ ├── favicon.png
│ ├── icons
│ │ ├── Icon-192.png
│ │ ├── Icon-512.png
│ │ ├── Icon-maskable-192.png
│ │ └── Icon-maskable-512.png
│ ├── manifest.json
│ └── index.html
├── android
│ ├── gradle.properties
│ ├── app
│ │ ├── src
│ │ │ ├── main
│ │ │ │ ├── res
│ │ │ │ │ ├── mipmap-hdpi
│ │ │ │ │ │ └── ic_launcher.png
│ │ │ │ │ ├── mipmap-mdpi
│ │ │ │ │ │ └── ic_launcher.png
│ │ │ │ │ ├── mipmap-xhdpi
│ │ │ │ │ │ └── ic_launcher.png
│ │ │ │ │ ├── mipmap-xxhdpi
│ │ │ │ │ │ └── ic_launcher.png
│ │ │ │ │ ├── mipmap-xxxhdpi
│ │ │ │ │ │ └── ic_launcher.png
│ │ │ │ │ ├── drawable
│ │ │ │ │ │ └── launch_background.xml
│ │ │ │ │ ├── drawable-v21
│ │ │ │ │ │ └── launch_background.xml
│ │ │ │ │ ├── values
│ │ │ │ │ │ └── styles.xml
│ │ │ │ │ └── values-night
│ │ │ │ │ │ └── styles.xml
│ │ │ │ ├── kotlin
│ │ │ │ │ └── com
│ │ │ │ │ │ └── example
│ │ │ │ │ │ └── example
│ │ │ │ │ │ └── MainActivity.kt
│ │ │ │ └── AndroidManifest.xml
│ │ │ ├── debug
│ │ │ │ └── AndroidManifest.xml
│ │ │ └── profile
│ │ │ │ └── AndroidManifest.xml
│ │ └── build.gradle
│ ├── gradle
│ │ └── wrapper
│ │ │ └── gradle-wrapper.properties
│ ├── .gitignore
│ ├── settings.gradle
│ └── build.gradle
├── windows
│ ├── runner
│ │ ├── resources
│ │ │ └── app_icon.ico
│ │ ├── resource.h
│ │ ├── utils.h
│ │ ├── runner.exe.manifest
│ │ ├── flutter_window.h
│ │ ├── main.cpp
│ │ ├── CMakeLists.txt
│ │ ├── utils.cpp
│ │ └── flutter_window.cpp
│ ├── flutter
│ │ ├── generated_plugin_registrant.cc
│ │ ├── generated_plugin_registrant.h
│ │ └── generated_plugins.cmake
│ └── .gitignore
├── lib
│ ├── data
│ │ ├── example_vertical_line_data.dart
│ │ ├── example_badge_data.dart
│ │ └── example_volume_profile_widget.dart
│ └── main.dart
├── README.md
├── .gitignore
├── test
│ └── widget_test.dart
├── analysis_options.yaml
└── .metadata
├── ios
├── Flutter
│ ├── Debug.xcconfig
│ ├── Release.xcconfig
│ └── AppFrameworkInfo.plist
├── Runner
│ ├── Runner-Bridging-Header.h
│ ├── Assets.xcassets
│ │ ├── LaunchImage.imageset
│ │ │ ├── LaunchImage.png
│ │ │ ├── LaunchImage@2x.png
│ │ │ ├── LaunchImage@3x.png
│ │ │ ├── README.md
│ │ │ └── Contents.json
│ │ └── AppIcon.appiconset
│ │ │ ├── Icon-App-20x20@1x.png
│ │ │ ├── Icon-App-20x20@2x.png
│ │ │ ├── Icon-App-20x20@3x.png
│ │ │ ├── Icon-App-29x29@1x.png
│ │ │ ├── Icon-App-29x29@2x.png
│ │ │ ├── Icon-App-29x29@3x.png
│ │ │ ├── Icon-App-40x40@1x.png
│ │ │ ├── Icon-App-40x40@2x.png
│ │ │ ├── Icon-App-40x40@3x.png
│ │ │ ├── Icon-App-60x60@2x.png
│ │ │ ├── Icon-App-60x60@3x.png
│ │ │ ├── Icon-App-76x76@1x.png
│ │ │ ├── Icon-App-76x76@2x.png
│ │ │ ├── Icon-App-1024x1024@1x.png
│ │ │ └── Icon-App-83.5x83.5@2x.png
│ ├── AppDelegate.swift
│ ├── Base.lproj
│ │ ├── Main.storyboard
│ │ └── LaunchScreen.storyboard
│ └── Info.plist
├── Runner.xcodeproj
│ └── project.xcworkspace
│ │ ├── contents.xcworkspacedata
│ │ └── xcshareddata
│ │ ├── WorkspaceSettings.xcsettings
│ │ └── IDEWorkspaceChecks.plist
├── Runner.xcworkspace
│ ├── contents.xcworkspacedata
│ └── xcshareddata
│ │ ├── WorkspaceSettings.xcsettings
│ │ └── IDEWorkspaceChecks.plist
└── .gitignore
├── example_java_kline
├── src
│ └── main
│ │ ├── resources
│ │ └── application.properties
│ │ └── java
│ │ └── com
│ │ └── example
│ │ └── example_java_kline
│ │ ├── FlutterKlineNetworkApplication.java
│ │ ├── websocket
│ │ └── WebSocketConfig.java
│ │ ├── vo
│ │ ├── BaseChartVo.java
│ │ ├── ResponseResult.java
│ │ └── LineChartVo.java
│ │ └── task
│ │ └── MinuteScheduleTask.java
└── pom.xml
├── macos
├── Flutter
│ ├── Flutter-Debug.xcconfig
│ ├── Flutter-Release.xcconfig
│ └── GeneratedPluginRegistrant.swift
├── Runner
│ ├── Configs
│ │ ├── Debug.xcconfig
│ │ ├── Release.xcconfig
│ │ ├── Warnings.xcconfig
│ │ └── AppInfo.xcconfig
│ ├── Assets.xcassets
│ │ └── AppIcon.appiconset
│ │ │ ├── app_icon_128.png
│ │ │ ├── app_icon_16.png
│ │ │ ├── app_icon_256.png
│ │ │ ├── app_icon_32.png
│ │ │ ├── app_icon_512.png
│ │ │ ├── app_icon_64.png
│ │ │ ├── app_icon_1024.png
│ │ │ └── Contents.json
│ ├── AppDelegate.swift
│ ├── Release.entitlements
│ ├── DebugProfile.entitlements
│ ├── MainFlutterWindow.swift
│ └── Info.plist
├── .gitignore
├── Runner.xcworkspace
│ ├── contents.xcworkspacedata
│ └── xcshareddata
│ │ └── IDEWorkspaceChecks.plist
└── Runner.xcodeproj
│ └── project.xcworkspace
│ └── xcshareddata
│ └── IDEWorkspaceChecks.plist
├── web
├── favicon.png
├── icons
│ ├── Icon-192.png
│ ├── Icon-512.png
│ ├── Icon-maskable-192.png
│ └── Icon-maskable-512.png
├── manifest.json
└── index.html
├── lib
├── common
│ ├── constants
│ │ ├── direction.dart
│ │ ├── chart_location.dart
│ │ └── line_type.dart
│ ├── chart_show_data_item_vo.dart
│ ├── mask_layer.dart
│ ├── line_config.dart
│ ├── rect_config.dart
│ ├── exts
│ │ └── canvas_ext.dart
│ ├── widget
│ │ ├── color_block_widget.dart
│ │ └── double_back_exit_app_widget.dart
│ ├── volume_profile.dart
│ ├── utils
│ │ ├── kline_random_util.dart
│ │ ├── kline_num_util.dart
│ │ └── kline_date_util.dart
│ ├── pointer_info.dart
│ ├── main_chart_selected_data_vo.dart
│ ├── pair.dart
│ └── kline_config.dart
├── widget
│ ├── k_line_chart_widget.dart
│ ├── mask_layer_widget.dart
│ ├── candlestick_show_data_widget.dart
│ ├── sub_chart_show_data_widget.dart
│ └── main_chart_show_data_widget.dart
└── painter
│ ├── triangle_painter.dart
│ ├── candlestick_painter.dart
│ ├── cross_curve_text_painter.dart
│ ├── price_line_painter.dart
│ ├── vertical_line_chart_painter.dart
│ ├── volume_profile_painter.dart
│ └── line_chart_painter.dart
├── resources
├── example_1.jpg
└── example_2.jpg
├── android
├── gradle.properties
├── app
│ ├── src
│ │ ├── main
│ │ │ ├── res
│ │ │ │ ├── mipmap-hdpi
│ │ │ │ │ └── ic_launcher.png
│ │ │ │ ├── mipmap-mdpi
│ │ │ │ │ └── ic_launcher.png
│ │ │ │ ├── mipmap-xhdpi
│ │ │ │ │ └── ic_launcher.png
│ │ │ │ ├── mipmap-xxhdpi
│ │ │ │ │ └── ic_launcher.png
│ │ │ │ ├── mipmap-xxxhdpi
│ │ │ │ │ └── ic_launcher.png
│ │ │ │ ├── drawable
│ │ │ │ │ └── launch_background.xml
│ │ │ │ ├── drawable-v21
│ │ │ │ │ └── launch_background.xml
│ │ │ │ ├── values
│ │ │ │ │ └── styles.xml
│ │ │ │ └── values-night
│ │ │ │ │ └── styles.xml
│ │ │ ├── kotlin
│ │ │ │ └── com
│ │ │ │ │ └── example
│ │ │ │ │ └── flutter_kline
│ │ │ │ │ └── MainActivity.kt
│ │ │ └── AndroidManifest.xml
│ │ ├── debug
│ │ │ └── AndroidManifest.xml
│ │ └── profile
│ │ │ └── AndroidManifest.xml
│ └── build.gradle
├── gradle
│ └── wrapper
│ │ └── gradle-wrapper.properties
├── .gitignore
├── settings.gradle
└── build.gradle
├── windows
├── runner
│ ├── resources
│ │ └── app_icon.ico
│ ├── resource.h
│ ├── utils.h
│ ├── runner.exe.manifest
│ ├── flutter_window.h
│ ├── main.cpp
│ ├── CMakeLists.txt
│ ├── utils.cpp
│ └── flutter_window.cpp
├── flutter
│ ├── generated_plugin_registrant.cc
│ ├── generated_plugin_registrant.h
│ └── generated_plugins.cmake
└── .gitignore
├── example_network
├── analysis_options.yaml
├── .metadata
├── README.md
├── .gitignore
├── test
│ └── widget_test.dart
└── lib
│ └── example_network
│ ├── example_minute_network_widget.dart
│ └── example_day_network_widget.dart
├── test
└── widget_test.dart
├── README.md
├── .gitignore
├── analysis_options.yaml
└── .metadata
/linux/.gitignore:
--------------------------------------------------------------------------------
1 | flutter/ephemeral
2 |
--------------------------------------------------------------------------------
/example/linux/.gitignore:
--------------------------------------------------------------------------------
1 | flutter/ephemeral
2 |
--------------------------------------------------------------------------------
/ios/Flutter/Debug.xcconfig:
--------------------------------------------------------------------------------
1 | #include "Generated.xcconfig"
2 |
--------------------------------------------------------------------------------
/ios/Flutter/Release.xcconfig:
--------------------------------------------------------------------------------
1 | #include "Generated.xcconfig"
2 |
--------------------------------------------------------------------------------
/example/ios/Flutter/Debug.xcconfig:
--------------------------------------------------------------------------------
1 | #include "Generated.xcconfig"
2 |
--------------------------------------------------------------------------------
/example_java_kline/src/main/resources/application.properties:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/example/ios/Flutter/Release.xcconfig:
--------------------------------------------------------------------------------
1 | #include "Generated.xcconfig"
2 |
--------------------------------------------------------------------------------
/ios/Runner/Runner-Bridging-Header.h:
--------------------------------------------------------------------------------
1 | #import "GeneratedPluginRegistrant.h"
2 |
--------------------------------------------------------------------------------
/example/ios/Runner/Runner-Bridging-Header.h:
--------------------------------------------------------------------------------
1 | #import "GeneratedPluginRegistrant.h"
2 |
--------------------------------------------------------------------------------
/macos/Flutter/Flutter-Debug.xcconfig:
--------------------------------------------------------------------------------
1 | #include "ephemeral/Flutter-Generated.xcconfig"
2 |
--------------------------------------------------------------------------------
/macos/Flutter/Flutter-Release.xcconfig:
--------------------------------------------------------------------------------
1 | #include "ephemeral/Flutter-Generated.xcconfig"
2 |
--------------------------------------------------------------------------------
/example/macos/Flutter/Flutter-Debug.xcconfig:
--------------------------------------------------------------------------------
1 | #include "ephemeral/Flutter-Generated.xcconfig"
2 |
--------------------------------------------------------------------------------
/example/macos/Flutter/Flutter-Release.xcconfig:
--------------------------------------------------------------------------------
1 | #include "ephemeral/Flutter-Generated.xcconfig"
2 |
--------------------------------------------------------------------------------
/web/favicon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BrinedFish0222/flutter_kline/HEAD/web/favicon.png
--------------------------------------------------------------------------------
/lib/common/constants/direction.dart:
--------------------------------------------------------------------------------
1 |
2 | /// 方向
3 | enum Direction {
4 | left,
5 | right,
6 | }
7 |
--------------------------------------------------------------------------------
/web/icons/Icon-192.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BrinedFish0222/flutter_kline/HEAD/web/icons/Icon-192.png
--------------------------------------------------------------------------------
/web/icons/Icon-512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BrinedFish0222/flutter_kline/HEAD/web/icons/Icon-512.png
--------------------------------------------------------------------------------
/example/web/favicon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BrinedFish0222/flutter_kline/HEAD/example/web/favicon.png
--------------------------------------------------------------------------------
/resources/example_1.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BrinedFish0222/flutter_kline/HEAD/resources/example_1.jpg
--------------------------------------------------------------------------------
/resources/example_2.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BrinedFish0222/flutter_kline/HEAD/resources/example_2.jpg
--------------------------------------------------------------------------------
/android/gradle.properties:
--------------------------------------------------------------------------------
1 | org.gradle.jvmargs=-Xmx1536M
2 | android.useAndroidX=true
3 | android.enableJetifier=true
4 |
--------------------------------------------------------------------------------
/macos/Runner/Configs/Debug.xcconfig:
--------------------------------------------------------------------------------
1 | #include "../../Flutter/Flutter-Debug.xcconfig"
2 | #include "Warnings.xcconfig"
3 |
--------------------------------------------------------------------------------
/example/android/gradle.properties:
--------------------------------------------------------------------------------
1 | org.gradle.jvmargs=-Xmx1536M
2 | android.useAndroidX=true
3 | android.enableJetifier=true
4 |
--------------------------------------------------------------------------------
/example/macos/Runner/Configs/Debug.xcconfig:
--------------------------------------------------------------------------------
1 | #include "../../Flutter/Flutter-Debug.xcconfig"
2 | #include "Warnings.xcconfig"
3 |
--------------------------------------------------------------------------------
/example/web/icons/Icon-192.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BrinedFish0222/flutter_kline/HEAD/example/web/icons/Icon-192.png
--------------------------------------------------------------------------------
/example/web/icons/Icon-512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BrinedFish0222/flutter_kline/HEAD/example/web/icons/Icon-512.png
--------------------------------------------------------------------------------
/lib/common/constants/chart_location.dart:
--------------------------------------------------------------------------------
1 | /// 图位置
2 | enum ChartLocation {
3 | leftmost,
4 | centre,
5 | rightmost,
6 | }
--------------------------------------------------------------------------------
/macos/Runner/Configs/Release.xcconfig:
--------------------------------------------------------------------------------
1 | #include "../../Flutter/Flutter-Release.xcconfig"
2 | #include "Warnings.xcconfig"
3 |
--------------------------------------------------------------------------------
/web/icons/Icon-maskable-192.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BrinedFish0222/flutter_kline/HEAD/web/icons/Icon-maskable-192.png
--------------------------------------------------------------------------------
/web/icons/Icon-maskable-512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BrinedFish0222/flutter_kline/HEAD/web/icons/Icon-maskable-512.png
--------------------------------------------------------------------------------
/example/macos/Runner/Configs/Release.xcconfig:
--------------------------------------------------------------------------------
1 | #include "../../Flutter/Flutter-Release.xcconfig"
2 | #include "Warnings.xcconfig"
3 |
--------------------------------------------------------------------------------
/macos/.gitignore:
--------------------------------------------------------------------------------
1 | # Flutter-related
2 | **/Flutter/ephemeral/
3 | **/Pods/
4 |
5 | # Xcode-related
6 | **/dgph
7 | **/xcuserdata/
8 |
--------------------------------------------------------------------------------
/windows/runner/resources/app_icon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BrinedFish0222/flutter_kline/HEAD/windows/runner/resources/app_icon.ico
--------------------------------------------------------------------------------
/example/macos/.gitignore:
--------------------------------------------------------------------------------
1 | # Flutter-related
2 | **/Flutter/ephemeral/
3 | **/Pods/
4 |
5 | # Xcode-related
6 | **/dgph
7 | **/xcuserdata/
8 |
--------------------------------------------------------------------------------
/example/web/icons/Icon-maskable-192.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BrinedFish0222/flutter_kline/HEAD/example/web/icons/Icon-maskable-192.png
--------------------------------------------------------------------------------
/example/web/icons/Icon-maskable-512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BrinedFish0222/flutter_kline/HEAD/example/web/icons/Icon-maskable-512.png
--------------------------------------------------------------------------------
/example/windows/runner/resources/app_icon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BrinedFish0222/flutter_kline/HEAD/example/windows/runner/resources/app_icon.ico
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BrinedFish0222/flutter_kline/HEAD/android/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BrinedFish0222/flutter_kline/HEAD/android/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BrinedFish0222/flutter_kline/HEAD/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BrinedFish0222/flutter_kline/HEAD/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BrinedFish0222/flutter_kline/HEAD/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BrinedFish0222/flutter_kline/HEAD/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BrinedFish0222/flutter_kline/HEAD/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BrinedFish0222/flutter_kline/HEAD/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BrinedFish0222/flutter_kline/HEAD/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BrinedFish0222/flutter_kline/HEAD/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BrinedFish0222/flutter_kline/HEAD/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png
--------------------------------------------------------------------------------
/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BrinedFish0222/flutter_kline/HEAD/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png
--------------------------------------------------------------------------------
/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BrinedFish0222/flutter_kline/HEAD/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png
--------------------------------------------------------------------------------
/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BrinedFish0222/flutter_kline/HEAD/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png
--------------------------------------------------------------------------------
/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BrinedFish0222/flutter_kline/HEAD/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png
--------------------------------------------------------------------------------
/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BrinedFish0222/flutter_kline/HEAD/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png
--------------------------------------------------------------------------------
/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BrinedFish0222/flutter_kline/HEAD/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BrinedFish0222/flutter_kline/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BrinedFish0222/flutter_kline/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BrinedFish0222/flutter_kline/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BrinedFish0222/flutter_kline/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BrinedFish0222/flutter_kline/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BrinedFish0222/flutter_kline/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BrinedFish0222/flutter_kline/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BrinedFish0222/flutter_kline/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BrinedFish0222/flutter_kline/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BrinedFish0222/flutter_kline/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BrinedFish0222/flutter_kline/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BrinedFish0222/flutter_kline/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BrinedFish0222/flutter_kline/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BrinedFish0222/flutter_kline/HEAD/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BrinedFish0222/flutter_kline/HEAD/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png
--------------------------------------------------------------------------------
/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BrinedFish0222/flutter_kline/HEAD/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BrinedFish0222/flutter_kline/HEAD/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png
--------------------------------------------------------------------------------
/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BrinedFish0222/flutter_kline/HEAD/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png
--------------------------------------------------------------------------------
/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BrinedFish0222/flutter_kline/HEAD/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png
--------------------------------------------------------------------------------
/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BrinedFish0222/flutter_kline/HEAD/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png
--------------------------------------------------------------------------------
/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BrinedFish0222/flutter_kline/HEAD/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png
--------------------------------------------------------------------------------
/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BrinedFish0222/flutter_kline/HEAD/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png
--------------------------------------------------------------------------------
/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BrinedFish0222/flutter_kline/HEAD/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png
--------------------------------------------------------------------------------
/example_network/analysis_options.yaml:
--------------------------------------------------------------------------------
1 | include: package:flutter_lints/flutter.yaml
2 |
3 | # Additional information about this file can be found at
4 | # https://dart.dev/guides/language/analysis-options
5 |
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BrinedFish0222/flutter_kline/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BrinedFish0222/flutter_kline/HEAD/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BrinedFish0222/flutter_kline/HEAD/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BrinedFish0222/flutter_kline/HEAD/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png
--------------------------------------------------------------------------------
/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BrinedFish0222/flutter_kline/HEAD/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BrinedFish0222/flutter_kline/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BrinedFish0222/flutter_kline/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BrinedFish0222/flutter_kline/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BrinedFish0222/flutter_kline/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BrinedFish0222/flutter_kline/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BrinedFish0222/flutter_kline/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BrinedFish0222/flutter_kline/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BrinedFish0222/flutter_kline/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BrinedFish0222/flutter_kline/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BrinedFish0222/flutter_kline/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BrinedFish0222/flutter_kline/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BrinedFish0222/flutter_kline/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BrinedFish0222/flutter_kline/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png
--------------------------------------------------------------------------------
/linux/main.cc:
--------------------------------------------------------------------------------
1 | #include "my_application.h"
2 |
3 | int main(int argc, char** argv) {
4 | g_autoptr(MyApplication) app = my_application_new();
5 | return g_application_run(G_APPLICATION(app), argc, argv);
6 | }
7 |
--------------------------------------------------------------------------------
/android/app/src/main/kotlin/com/example/flutter_kline/MainActivity.kt:
--------------------------------------------------------------------------------
1 | package com.example.flutter_kline
2 |
3 | import io.flutter.embedding.android.FlutterActivity
4 |
5 | class MainActivity: FlutterActivity() {
6 | }
7 |
--------------------------------------------------------------------------------
/example/android/app/src/main/kotlin/com/example/example/MainActivity.kt:
--------------------------------------------------------------------------------
1 | package com.example.example
2 |
3 | import io.flutter.embedding.android.FlutterActivity
4 |
5 | class MainActivity: FlutterActivity() {
6 | }
7 |
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BrinedFish0222/flutter_kline/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/BrinedFish0222/flutter_kline/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png
--------------------------------------------------------------------------------
/example/linux/main.cc:
--------------------------------------------------------------------------------
1 | #include "my_application.h"
2 |
3 | int main(int argc, char** argv) {
4 | g_autoptr(MyApplication) app = my_application_new();
5 | return g_application_run(G_APPLICATION(app), argc, argv);
6 | }
7 |
--------------------------------------------------------------------------------
/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/ios/Runner.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/macos/Runner.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/example/ios/Runner.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/example/macos/Runner.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/macos/Flutter/GeneratedPluginRegistrant.swift:
--------------------------------------------------------------------------------
1 | //
2 | // Generated file. Do not edit.
3 | //
4 |
5 | import FlutterMacOS
6 | import Foundation
7 |
8 |
9 | func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
10 | }
11 |
--------------------------------------------------------------------------------
/example/macos/Flutter/GeneratedPluginRegistrant.swift:
--------------------------------------------------------------------------------
1 | //
2 | // Generated file. Do not edit.
3 | //
4 |
5 | import FlutterMacOS
6 | import Foundation
7 |
8 |
9 | func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
10 | }
11 |
--------------------------------------------------------------------------------
/linux/flutter/generated_plugin_registrant.cc:
--------------------------------------------------------------------------------
1 | //
2 | // Generated file. Do not edit.
3 | //
4 |
5 | // clang-format off
6 |
7 | #include "generated_plugin_registrant.h"
8 |
9 |
10 | void fl_register_plugins(FlPluginRegistry* registry) {
11 | }
12 |
--------------------------------------------------------------------------------
/android/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionBase=GRADLE_USER_HOME
2 | distributionPath=wrapper/dists
3 | zipStoreBase=GRADLE_USER_HOME
4 | zipStorePath=wrapper/dists
5 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-all.zip
6 |
--------------------------------------------------------------------------------
/windows/flutter/generated_plugin_registrant.cc:
--------------------------------------------------------------------------------
1 | //
2 | // Generated file. Do not edit.
3 | //
4 |
5 | // clang-format off
6 |
7 | #include "generated_plugin_registrant.h"
8 |
9 |
10 | void RegisterPlugins(flutter::PluginRegistry* registry) {
11 | }
12 |
--------------------------------------------------------------------------------
/example/linux/flutter/generated_plugin_registrant.cc:
--------------------------------------------------------------------------------
1 | //
2 | // Generated file. Do not edit.
3 | //
4 |
5 | // clang-format off
6 |
7 | #include "generated_plugin_registrant.h"
8 |
9 |
10 | void fl_register_plugins(FlPluginRegistry* registry) {
11 | }
12 |
--------------------------------------------------------------------------------
/example/android/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionBase=GRADLE_USER_HOME
2 | distributionPath=wrapper/dists
3 | zipStoreBase=GRADLE_USER_HOME
4 | zipStorePath=wrapper/dists
5 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-all.zip
6 |
--------------------------------------------------------------------------------
/example/windows/flutter/generated_plugin_registrant.cc:
--------------------------------------------------------------------------------
1 | //
2 | // Generated file. Do not edit.
3 | //
4 |
5 | // clang-format off
6 |
7 | #include "generated_plugin_registrant.h"
8 |
9 |
10 | void RegisterPlugins(flutter::PluginRegistry* registry) {
11 | }
12 |
--------------------------------------------------------------------------------
/macos/Runner/AppDelegate.swift:
--------------------------------------------------------------------------------
1 | import Cocoa
2 | import FlutterMacOS
3 |
4 | @NSApplicationMain
5 | class AppDelegate: FlutterAppDelegate {
6 | override func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool {
7 | return true
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/example/macos/Runner/AppDelegate.swift:
--------------------------------------------------------------------------------
1 | import Cocoa
2 | import FlutterMacOS
3 |
4 | @NSApplicationMain
5 | class AppDelegate: FlutterAppDelegate {
6 | override func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool {
7 | return true
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/macos/Runner/Release.entitlements:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | com.apple.security.app-sandbox
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/example/macos/Runner/Release.entitlements:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | com.apple.security.app-sandbox
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | PreviewsEnabled
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/example/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | PreviewsEnabled
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/macos/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/example/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/example/macos/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | PreviewsEnabled
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | PreviewsEnabled
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/lib/common/chart_show_data_item_vo.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | /// 图显示数据项
4 | /// 例如:MA的MA13、MA34、MA144,此项不包括MA。
5 | class ChartShowDataItemVo {
6 | String name;
7 | double? value;
8 | Color color;
9 |
10 | ChartShowDataItemVo({this.name = '', this.value, this.color = Colors.black,});
11 |
12 | }
13 |
--------------------------------------------------------------------------------
/macos/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/example/macos/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/android/.gitignore:
--------------------------------------------------------------------------------
1 | gradle-wrapper.jar
2 | /.gradle
3 | /captures/
4 | /gradlew
5 | /gradlew.bat
6 | /local.properties
7 | GeneratedPluginRegistrant.java
8 |
9 | # Remember to never publicly share your keystore.
10 | # See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app
11 | key.properties
12 | **/*.keystore
13 | **/*.jks
14 |
--------------------------------------------------------------------------------
/example/android/.gitignore:
--------------------------------------------------------------------------------
1 | gradle-wrapper.jar
2 | /.gradle
3 | /captures/
4 | /gradlew
5 | /gradlew.bat
6 | /local.properties
7 | GeneratedPluginRegistrant.java
8 |
9 | # Remember to never publicly share your keystore.
10 | # See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app
11 | key.properties
12 | **/*.keystore
13 | **/*.jks
14 |
--------------------------------------------------------------------------------
/example/ios/RunnerTests/RunnerTests.swift:
--------------------------------------------------------------------------------
1 | import Flutter
2 | import UIKit
3 | import XCTest
4 |
5 | class RunnerTests: XCTestCase {
6 |
7 | func testExample() {
8 | // If you add code to the Runner application, consider adding tests here.
9 | // See https://developer.apple.com/documentation/xctest for more information about using XCTest.
10 | }
11 |
12 | }
13 |
--------------------------------------------------------------------------------
/example_network/.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: 2ad6cd72c040113b47ee9055e722606a490ef0da
8 | channel: stable
9 |
10 | project_type: module
11 |
--------------------------------------------------------------------------------
/example/macos/RunnerTests/RunnerTests.swift:
--------------------------------------------------------------------------------
1 | import FlutterMacOS
2 | import Cocoa
3 | import XCTest
4 |
5 | class RunnerTests: XCTestCase {
6 |
7 | func testExample() {
8 | // If you add code to the Runner application, consider adding tests here.
9 | // See https://developer.apple.com/documentation/xctest for more information about using XCTest.
10 | }
11 |
12 | }
13 |
--------------------------------------------------------------------------------
/windows/.gitignore:
--------------------------------------------------------------------------------
1 | flutter/ephemeral/
2 |
3 | # Visual Studio user-specific files.
4 | *.suo
5 | *.user
6 | *.userosscache
7 | *.sln.docstates
8 |
9 | # Visual Studio build-related files.
10 | x64/
11 | x86/
12 |
13 | # Visual Studio cache files
14 | # files ending in .cache can be ignored
15 | *.[Cc]ache
16 | # but keep track of directories ending in .cache
17 | !*.[Cc]ache/
18 |
--------------------------------------------------------------------------------
/example/windows/.gitignore:
--------------------------------------------------------------------------------
1 | flutter/ephemeral/
2 |
3 | # Visual Studio user-specific files.
4 | *.suo
5 | *.user
6 | *.userosscache
7 | *.sln.docstates
8 |
9 | # Visual Studio build-related files.
10 | x64/
11 | x86/
12 |
13 | # Visual Studio cache files
14 | # files ending in .cache can be ignored
15 | *.[Cc]ache
16 | # but keep track of directories ending in .cache
17 | !*.[Cc]ache/
18 |
--------------------------------------------------------------------------------
/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.
--------------------------------------------------------------------------------
/example/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.
--------------------------------------------------------------------------------
/example_network/README.md:
--------------------------------------------------------------------------------
1 | # example_network
2 |
3 | A new Flutter module project.
4 |
5 | ## Getting Started
6 |
7 | For help getting started with Flutter development, view the online
8 | [documentation](https://flutter.dev/).
9 |
10 | For instructions integrating Flutter modules to your existing applications,
11 | see the [add-to-app documentation](https://flutter.dev/docs/development/add-to-app).
12 |
--------------------------------------------------------------------------------
/linux/flutter/generated_plugin_registrant.h:
--------------------------------------------------------------------------------
1 | //
2 | // Generated file. Do not edit.
3 | //
4 |
5 | // clang-format off
6 |
7 | #ifndef GENERATED_PLUGIN_REGISTRANT_
8 | #define GENERATED_PLUGIN_REGISTRANT_
9 |
10 | #include
11 |
12 | // Registers Flutter plugins.
13 | void fl_register_plugins(FlPluginRegistry* registry);
14 |
15 | #endif // GENERATED_PLUGIN_REGISTRANT_
16 |
--------------------------------------------------------------------------------
/windows/flutter/generated_plugin_registrant.h:
--------------------------------------------------------------------------------
1 | //
2 | // Generated file. Do not edit.
3 | //
4 |
5 | // clang-format off
6 |
7 | #ifndef GENERATED_PLUGIN_REGISTRANT_
8 | #define GENERATED_PLUGIN_REGISTRANT_
9 |
10 | #include
11 |
12 | // Registers Flutter plugins.
13 | void RegisterPlugins(flutter::PluginRegistry* registry);
14 |
15 | #endif // GENERATED_PLUGIN_REGISTRANT_
16 |
--------------------------------------------------------------------------------
/example/linux/flutter/generated_plugin_registrant.h:
--------------------------------------------------------------------------------
1 | //
2 | // Generated file. Do not edit.
3 | //
4 |
5 | // clang-format off
6 |
7 | #ifndef GENERATED_PLUGIN_REGISTRANT_
8 | #define GENERATED_PLUGIN_REGISTRANT_
9 |
10 | #include
11 |
12 | // Registers Flutter plugins.
13 | void fl_register_plugins(FlPluginRegistry* registry);
14 |
15 | #endif // GENERATED_PLUGIN_REGISTRANT_
16 |
--------------------------------------------------------------------------------
/example/windows/flutter/generated_plugin_registrant.h:
--------------------------------------------------------------------------------
1 | //
2 | // Generated file. Do not edit.
3 | //
4 |
5 | // clang-format off
6 |
7 | #ifndef GENERATED_PLUGIN_REGISTRANT_
8 | #define GENERATED_PLUGIN_REGISTRANT_
9 |
10 | #include
11 |
12 | // Registers Flutter plugins.
13 | void RegisterPlugins(flutter::PluginRegistry* registry);
14 |
15 | #endif // GENERATED_PLUGIN_REGISTRANT_
16 |
--------------------------------------------------------------------------------
/macos/Runner/DebugProfile.entitlements:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | com.apple.security.app-sandbox
6 |
7 | com.apple.security.cs.allow-jit
8 |
9 | com.apple.security.network.server
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/example/android/app/src/debug/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/example/android/app/src/profile/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/example/macos/Runner/DebugProfile.entitlements:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | com.apple.security.app-sandbox
6 |
7 | com.apple.security.cs.allow-jit
8 |
9 | com.apple.security.network.server
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/lib/common/mask_layer.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | /// 遮罩
4 | class MaskLayer {
5 | /// 遮罩百分比。取值范围 0~1
6 | double percent;
7 |
8 | /// 显示的组件,不设置则使用默认
9 | Widget? widget;
10 |
11 | /// 遮罩点击事件
12 | GestureTapCallback? onTap;
13 |
14 | MaskLayer({this.percent = 0.3, this.widget, this.onTap}) {
15 | // 处理数值不合规的情况。
16 | percent = percent < 0 ? 0 : percent;
17 | percent = percent > 1 ? 1 : percent;
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/android/app/src/debug/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/android/app/src/profile/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/ios/Runner/AppDelegate.swift:
--------------------------------------------------------------------------------
1 | import UIKit
2 | import Flutter
3 |
4 | @UIApplicationMain
5 | @objc class AppDelegate: FlutterAppDelegate {
6 | override func application(
7 | _ application: UIApplication,
8 | didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
9 | ) -> Bool {
10 | GeneratedPluginRegistrant.register(with: self)
11 | return super.application(application, didFinishLaunchingWithOptions: launchOptions)
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/lib/common/line_config.dart:
--------------------------------------------------------------------------------
1 |
2 | import 'package:flutter/material.dart';
3 |
4 | import 'constants/line_type.dart';
5 |
6 | /// 线配置
7 | class LineConfig {
8 | LineType type;
9 | Color color;
10 |
11 | /// 虚线长度
12 | double dottedLineLength;
13 |
14 | /// 虚线间隔
15 | double dottedLineSpace;
16 |
17 | LineConfig(
18 | {this.type = LineType.full,
19 | this.color = Colors.black,
20 | this.dottedLineLength = 2,
21 | this.dottedLineSpace = 2});
22 | }
--------------------------------------------------------------------------------
/linux/my_application.h:
--------------------------------------------------------------------------------
1 | #ifndef FLUTTER_MY_APPLICATION_H_
2 | #define FLUTTER_MY_APPLICATION_H_
3 |
4 | #include
5 |
6 | G_DECLARE_FINAL_TYPE(MyApplication, my_application, MY, APPLICATION,
7 | GtkApplication)
8 |
9 | /**
10 | * my_application_new:
11 | *
12 | * Creates a new Flutter-based application.
13 | *
14 | * Returns: a new #MyApplication.
15 | */
16 | MyApplication* my_application_new();
17 |
18 | #endif // FLUTTER_MY_APPLICATION_H_
19 |
--------------------------------------------------------------------------------
/example/ios/Runner/AppDelegate.swift:
--------------------------------------------------------------------------------
1 | import UIKit
2 | import Flutter
3 |
4 | @UIApplicationMain
5 | @objc class AppDelegate: FlutterAppDelegate {
6 | override func application(
7 | _ application: UIApplication,
8 | didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
9 | ) -> Bool {
10 | GeneratedPluginRegistrant.register(with: self)
11 | return super.application(application, didFinishLaunchingWithOptions: launchOptions)
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/example/macos/Runner/MainFlutterWindow.swift:
--------------------------------------------------------------------------------
1 | import Cocoa
2 | import FlutterMacOS
3 |
4 | class MainFlutterWindow: NSWindow {
5 | override func awakeFromNib() {
6 | let flutterViewController = FlutterViewController()
7 | let windowFrame = self.frame
8 | self.contentViewController = flutterViewController
9 | self.setFrame(windowFrame, display: true)
10 |
11 | RegisterGeneratedPlugins(registry: flutterViewController)
12 |
13 | super.awakeFromNib()
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/macos/Runner/MainFlutterWindow.swift:
--------------------------------------------------------------------------------
1 | import Cocoa
2 | import FlutterMacOS
3 |
4 | class MainFlutterWindow: NSWindow {
5 | override func awakeFromNib() {
6 | let flutterViewController = FlutterViewController.init()
7 | let windowFrame = self.frame
8 | self.contentViewController = flutterViewController
9 | self.setFrame(windowFrame, display: true)
10 |
11 | RegisterGeneratedPlugins(registry: flutterViewController)
12 |
13 | super.awakeFromNib()
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/example/linux/my_application.h:
--------------------------------------------------------------------------------
1 | #ifndef FLUTTER_MY_APPLICATION_H_
2 | #define FLUTTER_MY_APPLICATION_H_
3 |
4 | #include
5 |
6 | G_DECLARE_FINAL_TYPE(MyApplication, my_application, MY, APPLICATION,
7 | GtkApplication)
8 |
9 | /**
10 | * my_application_new:
11 | *
12 | * Creates a new Flutter-based application.
13 | *
14 | * Returns: a new #MyApplication.
15 | */
16 | MyApplication* my_application_new();
17 |
18 | #endif // FLUTTER_MY_APPLICATION_H_
19 |
--------------------------------------------------------------------------------
/lib/common/constants/line_type.dart:
--------------------------------------------------------------------------------
1 | /// 线类型
2 | enum LineType {
3 | full(description: '实线'),
4 | dotted(description: '虚线');
5 |
6 | final String description;
7 |
8 | const LineType({required this.description});
9 |
10 | static LineType getByName(String? name) {
11 | if (name == null || name.trim() == '') {
12 | return LineType.full;
13 | }
14 |
15 | return LineType.values
16 | .firstWhere((e) => e.name == name, orElse: () => LineType.full);
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/example_java_kline/src/main/java/com/example/example_java_kline/FlutterKlineNetworkApplication.java:
--------------------------------------------------------------------------------
1 | package com.example.example_java_kline;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
5 |
6 |
7 |
8 | @SpringBootApplication
9 | public class FlutterKlineNetworkApplication {
10 |
11 | public static void main(String[] args) {
12 |
13 | SpringApplication.run(FlutterKlineNetworkApplication.class, args);
14 | }
15 |
16 | }
17 |
--------------------------------------------------------------------------------
/windows/runner/resource.h:
--------------------------------------------------------------------------------
1 | //{{NO_DEPENDENCIES}}
2 | // Microsoft Visual C++ generated include file.
3 | // Used by Runner.rc
4 | //
5 | #define IDI_APP_ICON 101
6 |
7 | // Next default values for new objects
8 | //
9 | #ifdef APSTUDIO_INVOKED
10 | #ifndef APSTUDIO_READONLY_SYMBOLS
11 | #define _APS_NEXT_RESOURCE_VALUE 102
12 | #define _APS_NEXT_COMMAND_VALUE 40001
13 | #define _APS_NEXT_CONTROL_VALUE 1001
14 | #define _APS_NEXT_SYMED_VALUE 101
15 | #endif
16 | #endif
17 |
--------------------------------------------------------------------------------
/android/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 |
3 | def localPropertiesFile = new File(rootProject.projectDir, "local.properties")
4 | def properties = new Properties()
5 |
6 | assert localPropertiesFile.exists()
7 | localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) }
8 |
9 | def flutterSdkPath = properties.getProperty("flutter.sdk")
10 | assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
11 | apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle"
12 |
--------------------------------------------------------------------------------
/example/windows/runner/resource.h:
--------------------------------------------------------------------------------
1 | //{{NO_DEPENDENCIES}}
2 | // Microsoft Visual C++ generated include file.
3 | // Used by Runner.rc
4 | //
5 | #define IDI_APP_ICON 101
6 |
7 | // Next default values for new objects
8 | //
9 | #ifdef APSTUDIO_INVOKED
10 | #ifndef APSTUDIO_READONLY_SYMBOLS
11 | #define _APS_NEXT_RESOURCE_VALUE 102
12 | #define _APS_NEXT_COMMAND_VALUE 40001
13 | #define _APS_NEXT_CONTROL_VALUE 1001
14 | #define _APS_NEXT_SYMED_VALUE 101
15 | #endif
16 | #endif
17 |
--------------------------------------------------------------------------------
/android/app/src/main/res/drawable/launch_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
12 |
13 |
--------------------------------------------------------------------------------
/example/android/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 |
3 | def localPropertiesFile = new File(rootProject.projectDir, "local.properties")
4 | def properties = new Properties()
5 |
6 | assert localPropertiesFile.exists()
7 | localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) }
8 |
9 | def flutterSdkPath = properties.getProperty("flutter.sdk")
10 | assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
11 | apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle"
12 |
--------------------------------------------------------------------------------
/lib/common/rect_config.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:flutter_kline/common/kline_config.dart';
3 |
4 | /// 矩形设置
5 | class RectConfig {
6 | /// 是否显示
7 | final bool isShow;
8 |
9 | /// 矩形中间的横线
10 | final int transverseLineNum;
11 |
12 | final Color color;
13 |
14 | final double fontSize;
15 |
16 | const RectConfig({
17 | this.isShow = true,
18 | this.transverseLineNum = 2,
19 | this.color = Colors.grey,
20 | this.fontSize = KlineConfig.rectFontSize,
21 | });
22 | }
23 |
--------------------------------------------------------------------------------
/android/app/src/main/res/drawable-v21/launch_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
12 |
13 |
--------------------------------------------------------------------------------
/example/android/app/src/main/res/drawable/launch_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
12 |
13 |
--------------------------------------------------------------------------------
/example/android/app/src/main/res/drawable-v21/launch_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
12 |
13 |
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "filename" : "LaunchImage.png",
6 | "scale" : "1x"
7 | },
8 | {
9 | "idiom" : "universal",
10 | "filename" : "LaunchImage@2x.png",
11 | "scale" : "2x"
12 | },
13 | {
14 | "idiom" : "universal",
15 | "filename" : "LaunchImage@3x.png",
16 | "scale" : "3x"
17 | }
18 | ],
19 | "info" : {
20 | "version" : 1,
21 | "author" : "xcode"
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/example_java_kline/src/main/java/com/example/example_java_kline/websocket/WebSocketConfig.java:
--------------------------------------------------------------------------------
1 | package com.example.example_java_kline.websocket;
2 |
3 | import org.springframework.context.annotation.Bean;
4 | import org.springframework.context.annotation.Configuration;
5 | import org.springframework.web.socket.server.standard.ServerEndpointExporter;
6 |
7 | @Configuration
8 | public class WebSocketConfig {
9 | @Bean
10 | public ServerEndpointExporter serverEndpointExporter() {
11 | return new ServerEndpointExporter();
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/example/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 |
--------------------------------------------------------------------------------
/example/lib/data/example_vertical_line_data.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:flutter_kline/chart/vertical_line_chart.dart';
3 |
4 | class ExampleVerticalLineData {
5 | static VerticalLineChart get verticalLine {
6 | List dataList = [];
7 | for (int i = 0; i < 800; ++i) {
8 | dataList.add(null);
9 | }
10 | dataList[795] = VerticalLineChartData(id: '795', top: 12.5, bottom: 12, color: Colors.blue);
11 |
12 | return VerticalLineChart(id: 'verticalLineChartVo', data: dataList, );
13 | }
14 | }
--------------------------------------------------------------------------------
/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 in the flutter_test package. 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_test/flutter_test.dart';
9 |
10 | void main() {
11 | testWidgets('Counter increments smoke test', (WidgetTester tester) async {
12 |
13 | });
14 | }
15 |
--------------------------------------------------------------------------------
/lib/common/exts/canvas_ext.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | extension CanvasExt on Canvas {
4 | /// 画虚线
5 | /// 注意:目前仅支持同一y轴高度的虚线
6 | void drawDottedLine(Offset p1, Offset p2, Paint paint,
7 | {double dottedLineLength = 2, double dottedLineSpace = 2}) {
8 | int dottedLineNum =
9 | (p2.dx - p1.dx) ~/ (dottedLineLength + dottedLineSpace);
10 | double x = 0;
11 | for (int i = 0; i < dottedLineNum; ++i) {
12 | x = i * (dottedLineLength + dottedLineSpace);
13 | drawLine(Offset(x, p1.dy), Offset(x + dottedLineLength, p2.dy), paint);
14 | }
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/example/README.md:
--------------------------------------------------------------------------------
1 | # example
2 |
3 | A new Flutter project.
4 |
5 | ## Getting Started
6 |
7 | This project is a starting point for a Flutter application.
8 |
9 | A few resources to get you started if this is your first Flutter project:
10 |
11 | - [Lab: Write your first Flutter app](https://docs.flutter.dev/get-started/codelab)
12 | - [Cookbook: Useful Flutter samples](https://docs.flutter.dev/cookbook)
13 |
14 | For help getting started with Flutter development, view the
15 | [online documentation](https://docs.flutter.dev/), which offers tutorials,
16 | samples, guidance on mobile development, and a full API reference.
17 |
--------------------------------------------------------------------------------
/macos/Runner/Configs/Warnings.xcconfig:
--------------------------------------------------------------------------------
1 | WARNING_CFLAGS = -Wall -Wconditional-uninitialized -Wnullable-to-nonnull-conversion -Wmissing-method-return-type -Woverlength-strings
2 | GCC_WARN_UNDECLARED_SELECTOR = YES
3 | CLANG_UNDEFINED_BEHAVIOR_SANITIZER_NULLABILITY = YES
4 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE
5 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES
6 | CLANG_WARN_PRAGMA_PACK = YES
7 | CLANG_WARN_STRICT_PROTOTYPES = YES
8 | CLANG_WARN_COMMA = YES
9 | GCC_WARN_STRICT_SELECTOR_MATCH = YES
10 | CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = YES
11 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES
12 | GCC_WARN_SHADOW = YES
13 | CLANG_WARN_UNREACHABLE_CODE = YES
14 |
--------------------------------------------------------------------------------
/example/macos/Runner/Configs/Warnings.xcconfig:
--------------------------------------------------------------------------------
1 | WARNING_CFLAGS = -Wall -Wconditional-uninitialized -Wnullable-to-nonnull-conversion -Wmissing-method-return-type -Woverlength-strings
2 | GCC_WARN_UNDECLARED_SELECTOR = YES
3 | CLANG_UNDEFINED_BEHAVIOR_SANITIZER_NULLABILITY = YES
4 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE
5 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES
6 | CLANG_WARN_PRAGMA_PACK = YES
7 | CLANG_WARN_STRICT_PROTOTYPES = YES
8 | CLANG_WARN_COMMA = YES
9 | GCC_WARN_STRICT_SELECTOR_MATCH = YES
10 | CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = YES
11 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES
12 | GCC_WARN_SHADOW = YES
13 | CLANG_WARN_UNREACHABLE_CODE = YES
14 |
--------------------------------------------------------------------------------
/example/macos/Runner/Configs/AppInfo.xcconfig:
--------------------------------------------------------------------------------
1 | // Application-level settings for the Runner target.
2 | //
3 | // This may be replaced with something auto-generated from metadata (e.g., pubspec.yaml) in the
4 | // future. If not, the values below would default to using the project name when this becomes a
5 | // 'flutter create' template.
6 |
7 | // The application's name. By default this is also the title of the Flutter window.
8 | PRODUCT_NAME = example
9 |
10 | // The application's bundle identifier
11 | PRODUCT_BUNDLE_IDENTIFIER = com.example.example
12 |
13 | // The copyright displayed in application information
14 | PRODUCT_COPYRIGHT = Copyright © 2024 com.example. All rights reserved.
15 |
--------------------------------------------------------------------------------
/macos/Runner/Configs/AppInfo.xcconfig:
--------------------------------------------------------------------------------
1 | // Application-level settings for the Runner target.
2 | //
3 | // This may be replaced with something auto-generated from metadata (e.g., pubspec.yaml) in the
4 | // future. If not, the values below would default to using the project name when this becomes a
5 | // 'flutter create' template.
6 |
7 | // The application's name. By default this is also the title of the Flutter window.
8 | PRODUCT_NAME = flutter_kline
9 |
10 | // The application's bundle identifier
11 | PRODUCT_BUNDLE_IDENTIFIER = com.example.flutterKline
12 |
13 | // The copyright displayed in application information
14 | PRODUCT_COPYRIGHT = Copyright © 2023 com.example. All rights reserved.
15 |
--------------------------------------------------------------------------------
/lib/widget/k_line_chart_widget.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:flutter_kline/painter/line_chart_painter.dart';
3 |
4 | import '../chart/line_chart.dart';
5 |
6 | /// 线图组件
7 | class KLineChartWidget extends StatelessWidget {
8 | const KLineChartWidget({
9 | super.key,
10 | required this.chart,
11 | });
12 |
13 | final LineChart chart;
14 |
15 | @override
16 | Widget build(BuildContext context) {
17 | return LayoutBuilder(builder: (context, constraints) {
18 | return CustomPaint(
19 | size: Size(constraints.maxWidth, constraints.maxHeight),
20 | painter: LineChartPainter(lineChartData: chart),
21 | );
22 | });
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/example_network/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 | .dart_tool/
3 |
4 | .packages
5 | .pub/
6 |
7 | .idea/
8 | .vagrant/
9 | .sconsign.dblite
10 | .svn/
11 |
12 | migrate_working_dir/
13 |
14 | *.swp
15 | profile
16 |
17 | DerivedData/
18 |
19 | .generated/
20 |
21 | *.pbxuser
22 | *.mode1v3
23 | *.mode2v3
24 | *.perspectivev3
25 |
26 | !default.pbxuser
27 | !default.mode1v3
28 | !default.mode2v3
29 | !default.perspectivev3
30 |
31 | xcuserdata
32 |
33 | *.moved-aside
34 |
35 | *.pyc
36 | *sync/
37 | Icon?
38 | .tags*
39 |
40 | build/
41 | .android/
42 | .ios/
43 | .flutter-plugins
44 | .flutter-plugins-dependencies
45 |
46 | # Symbolication related
47 | app.*.symbols
48 |
49 | # Obfuscation related
50 | app.*.map.json
51 |
--------------------------------------------------------------------------------
/ios/.gitignore:
--------------------------------------------------------------------------------
1 | **/dgph
2 | *.mode1v3
3 | *.mode2v3
4 | *.moved-aside
5 | *.pbxuser
6 | *.perspectivev3
7 | **/*sync/
8 | .sconsign.dblite
9 | .tags*
10 | **/.vagrant/
11 | **/DerivedData/
12 | Icon?
13 | **/Pods/
14 | **/.symlinks/
15 | profile
16 | xcuserdata
17 | **/.generated/
18 | Flutter/App.framework
19 | Flutter/Flutter.framework
20 | Flutter/Flutter.podspec
21 | Flutter/Generated.xcconfig
22 | Flutter/ephemeral/
23 | Flutter/app.flx
24 | Flutter/app.zip
25 | Flutter/flutter_assets/
26 | Flutter/flutter_export_environment.sh
27 | ServiceDefinitions.json
28 | Runner/GeneratedPluginRegistrant.*
29 |
30 | # Exceptions to above rules.
31 | !default.mode1v3
32 | !default.mode2v3
33 | !default.pbxuser
34 | !default.perspectivev3
35 |
--------------------------------------------------------------------------------
/example/ios/.gitignore:
--------------------------------------------------------------------------------
1 | **/dgph
2 | *.mode1v3
3 | *.mode2v3
4 | *.moved-aside
5 | *.pbxuser
6 | *.perspectivev3
7 | **/*sync/
8 | .sconsign.dblite
9 | .tags*
10 | **/.vagrant/
11 | **/DerivedData/
12 | Icon?
13 | **/Pods/
14 | **/.symlinks/
15 | profile
16 | xcuserdata
17 | **/.generated/
18 | Flutter/App.framework
19 | Flutter/Flutter.framework
20 | Flutter/Flutter.podspec
21 | Flutter/Generated.xcconfig
22 | Flutter/ephemeral/
23 | Flutter/app.flx
24 | Flutter/app.zip
25 | Flutter/flutter_assets/
26 | Flutter/flutter_export_environment.sh
27 | ServiceDefinitions.json
28 | Runner/GeneratedPluginRegistrant.*
29 |
30 | # Exceptions to above rules.
31 | !default.mode1v3
32 | !default.mode2v3
33 | !default.pbxuser
34 | !default.perspectivev3
35 |
--------------------------------------------------------------------------------
/android/build.gradle:
--------------------------------------------------------------------------------
1 | buildscript {
2 | ext.kotlin_version = '1.7.10'
3 | repositories {
4 | google()
5 | mavenCentral()
6 | }
7 |
8 | dependencies {
9 | classpath 'com.android.tools.build:gradle:7.2.0'
10 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
11 | }
12 | }
13 |
14 | allprojects {
15 | repositories {
16 | google()
17 | mavenCentral()
18 | }
19 | }
20 |
21 | rootProject.buildDir = '../build'
22 | subprojects {
23 | project.buildDir = "${rootProject.buildDir}/${project.name}"
24 | }
25 | subprojects {
26 | project.evaluationDependsOn(':app')
27 | }
28 |
29 | tasks.register("clean", Delete) {
30 | delete rootProject.buildDir
31 | }
32 |
--------------------------------------------------------------------------------
/example/android/build.gradle:
--------------------------------------------------------------------------------
1 | buildscript {
2 | ext.kotlin_version = '1.7.10'
3 | repositories {
4 | google()
5 | mavenCentral()
6 | }
7 |
8 | dependencies {
9 | classpath 'com.android.tools.build:gradle:7.3.0'
10 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
11 | }
12 | }
13 |
14 | allprojects {
15 | repositories {
16 | google()
17 | mavenCentral()
18 | }
19 | }
20 |
21 | rootProject.buildDir = '../build'
22 | subprojects {
23 | project.buildDir = "${rootProject.buildDir}/${project.name}"
24 | }
25 | subprojects {
26 | project.evaluationDependsOn(':app')
27 | }
28 |
29 | tasks.register("clean", Delete) {
30 | delete rootProject.buildDir
31 | }
32 |
--------------------------------------------------------------------------------
/lib/common/widget/color_block_widget.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | /// 创建 [size] 个颜色块
4 | class ColorBlockWidget extends StatelessWidget {
5 | const ColorBlockWidget({super.key, this.size = 5});
6 |
7 | final int size;
8 |
9 | @override
10 | Widget build(BuildContext context) {
11 | return Column(
12 | children: [
13 | ...List.generate(
14 | size,
15 | (index) => Padding(
16 | padding: const EdgeInsets.only(top: 15),
17 | child: Container(
18 | color: index % 2 == 0 ? Colors.red : Colors.green,
19 | height: 100,
20 | ),
21 | )).toList(),
22 | ],
23 | );
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/windows/runner/utils.h:
--------------------------------------------------------------------------------
1 | #ifndef RUNNER_UTILS_H_
2 | #define RUNNER_UTILS_H_
3 |
4 | #include
5 | #include
6 |
7 | // Creates a console for the process, and redirects stdout and stderr to
8 | // it for both the runner and the Flutter library.
9 | void CreateAndAttachConsole();
10 |
11 | // Takes a null-terminated wchar_t* encoded in UTF-16 and returns a std::string
12 | // encoded in UTF-8. Returns an empty std::string on failure.
13 | std::string Utf8FromUtf16(const wchar_t* utf16_string);
14 |
15 | // Gets the command line arguments passed in as a std::vector,
16 | // encoded in UTF-8. Returns an empty std::vector on failure.
17 | std::vector GetCommandLineArguments();
18 |
19 | #endif // RUNNER_UTILS_H_
20 |
--------------------------------------------------------------------------------
/example/windows/runner/utils.h:
--------------------------------------------------------------------------------
1 | #ifndef RUNNER_UTILS_H_
2 | #define RUNNER_UTILS_H_
3 |
4 | #include
5 | #include
6 |
7 | // Creates a console for the process, and redirects stdout and stderr to
8 | // it for both the runner and the Flutter library.
9 | void CreateAndAttachConsole();
10 |
11 | // Takes a null-terminated wchar_t* encoded in UTF-16 and returns a std::string
12 | // encoded in UTF-8. Returns an empty std::string on failure.
13 | std::string Utf8FromUtf16(const wchar_t* utf16_string);
14 |
15 | // Gets the command line arguments passed in as a std::vector,
16 | // encoded in UTF-8. Returns an empty std::vector on failure.
17 | std::vector GetCommandLineArguments();
18 |
19 | #endif // RUNNER_UTILS_H_
20 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # flutter_kline
2 |
3 | 
4 |
5 | **flutter_kline 只是给你提供一个实现K线图的思路。** 手势交互方式类似通达信。
6 |
7 | :warning: 目前 flutter_kline 更多是一个画K线图的思路,不是完整可以直接商业使用的版本。
8 |
9 | 如果这个项目对你有启发,请一定要给个 :star: :star: :star:
10 |
11 |
12 |
13 | flutter_kline 是一个没有任何第三方插件包的项目,它不会和你项目原本指定的第三方插件版本产生冲突,降低集成的成本,它是纯净的。
14 |
15 |
16 |
17 | 如果你需要股票指标引擎的思路,可以参考我另一个开源项目:[BrinedFish0222/stock_indicator_engine: 股票指标引擎 (github.com)](https://github.com/BrinedFish0222/stock_indicator_engine)
18 |
19 | # 使用
20 |
21 | 两种体验方式:
22 |
23 | - 直接[下载 apk 体验](https://github.com/BrinedFish0222/flutter_kline/releases)。
24 | - `example/lib/main.dart` 启动即可。
25 |
--------------------------------------------------------------------------------
/linux/flutter/generated_plugins.cmake:
--------------------------------------------------------------------------------
1 | #
2 | # Generated file, do not edit.
3 | #
4 |
5 | list(APPEND FLUTTER_PLUGIN_LIST
6 | )
7 |
8 | list(APPEND FLUTTER_FFI_PLUGIN_LIST
9 | )
10 |
11 | set(PLUGIN_BUNDLED_LIBRARIES)
12 |
13 | foreach(plugin ${FLUTTER_PLUGIN_LIST})
14 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/linux plugins/${plugin})
15 | target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin)
16 | list(APPEND PLUGIN_BUNDLED_LIBRARIES $)
17 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries})
18 | endforeach(plugin)
19 |
20 | foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST})
21 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/linux plugins/${ffi_plugin})
22 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries})
23 | endforeach(ffi_plugin)
24 |
--------------------------------------------------------------------------------
/windows/flutter/generated_plugins.cmake:
--------------------------------------------------------------------------------
1 | #
2 | # Generated file, do not edit.
3 | #
4 |
5 | list(APPEND FLUTTER_PLUGIN_LIST
6 | )
7 |
8 | list(APPEND FLUTTER_FFI_PLUGIN_LIST
9 | )
10 |
11 | set(PLUGIN_BUNDLED_LIBRARIES)
12 |
13 | foreach(plugin ${FLUTTER_PLUGIN_LIST})
14 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/windows plugins/${plugin})
15 | target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin)
16 | list(APPEND PLUGIN_BUNDLED_LIBRARIES $)
17 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries})
18 | endforeach(plugin)
19 |
20 | foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST})
21 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/windows plugins/${ffi_plugin})
22 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries})
23 | endforeach(ffi_plugin)
24 |
--------------------------------------------------------------------------------
/example/linux/flutter/generated_plugins.cmake:
--------------------------------------------------------------------------------
1 | #
2 | # Generated file, do not edit.
3 | #
4 |
5 | list(APPEND FLUTTER_PLUGIN_LIST
6 | )
7 |
8 | list(APPEND FLUTTER_FFI_PLUGIN_LIST
9 | )
10 |
11 | set(PLUGIN_BUNDLED_LIBRARIES)
12 |
13 | foreach(plugin ${FLUTTER_PLUGIN_LIST})
14 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/linux plugins/${plugin})
15 | target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin)
16 | list(APPEND PLUGIN_BUNDLED_LIBRARIES $)
17 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries})
18 | endforeach(plugin)
19 |
20 | foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST})
21 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/linux plugins/${ffi_plugin})
22 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries})
23 | endforeach(ffi_plugin)
24 |
--------------------------------------------------------------------------------
/example/windows/flutter/generated_plugins.cmake:
--------------------------------------------------------------------------------
1 | #
2 | # Generated file, do not edit.
3 | #
4 |
5 | list(APPEND FLUTTER_PLUGIN_LIST
6 | )
7 |
8 | list(APPEND FLUTTER_FFI_PLUGIN_LIST
9 | )
10 |
11 | set(PLUGIN_BUNDLED_LIBRARIES)
12 |
13 | foreach(plugin ${FLUTTER_PLUGIN_LIST})
14 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/windows plugins/${plugin})
15 | target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin)
16 | list(APPEND PLUGIN_BUNDLED_LIBRARIES $)
17 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries})
18 | endforeach(plugin)
19 |
20 | foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST})
21 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/windows plugins/${ffi_plugin})
22 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries})
23 | endforeach(ffi_plugin)
24 |
--------------------------------------------------------------------------------
/example/.gitignore:
--------------------------------------------------------------------------------
1 | # Miscellaneous
2 | *.class
3 | *.log
4 | *.pyc
5 | *.swp
6 | .DS_Store
7 | .atom/
8 | .buildlog/
9 | .history
10 | .svn/
11 | migrate_working_dir/
12 |
13 | # IntelliJ related
14 | *.iml
15 | *.ipr
16 | *.iws
17 | .idea/
18 |
19 | # The .vscode folder contains launch configuration and tasks you configure in
20 | # VS Code which you may wish to be included in version control, so this line
21 | # is commented out by default.
22 | #.vscode/
23 |
24 | # Flutter/Dart/Pub related
25 | **/doc/api/
26 | **/ios/Flutter/.last_build_id
27 | .dart_tool/
28 | .flutter-plugins
29 | .flutter-plugins-dependencies
30 | .packages
31 | .pub-cache/
32 | .pub/
33 | /build/
34 |
35 | # Symbolication related
36 | app.*.symbols
37 |
38 | # Obfuscation related
39 | app.*.map.json
40 |
41 | # Android Studio will place build artifacts here
42 | /android/app/debug
43 | /android/app/profile
44 | /android/app/release
45 |
--------------------------------------------------------------------------------
/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 | 11.0
25 |
26 |
27 |
--------------------------------------------------------------------------------
/example/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 | 11.0
25 |
26 |
27 |
--------------------------------------------------------------------------------
/windows/runner/runner.exe.manifest:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | PerMonitorV2
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/example/windows/runner/runner.exe.manifest:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | PerMonitorV2
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Miscellaneous
2 | *.class
3 | *.log
4 | *.pyc
5 | *.swp
6 | .DS_Store
7 | .atom/
8 | .buildlog/
9 | .history
10 | .svn/
11 | migrate_working_dir/
12 | .vscode/
13 | .fvm/
14 |
15 | # IntelliJ related
16 | *.iml
17 | *.ipr
18 | *.iws
19 | .idea/
20 | .vscode/
21 |
22 | # The .vscode folder contains launch configuration and tasks you configure in
23 | # VS Code which you may wish to be included in version control, so this line
24 | # is commented out by default.
25 | #.vscode/
26 |
27 | # Flutter/Dart/Pub related
28 | **/doc/api/
29 | **/ios/Flutter/.last_build_id
30 | .dart_tool/
31 | .flutter-plugins
32 | .flutter-plugins-dependencies
33 | .packages
34 | .pub-cache/
35 | .pub/
36 | /build/
37 |
38 | # Symbolication related
39 | app.*.symbols
40 |
41 | # Obfuscation related
42 | app.*.map.json
43 |
44 | # Android Studio will place build artifacts here
45 | /android/app/debug
46 | /android/app/profile
47 | /android/app/release
48 | lib/widget_test.dart
49 |
50 | **/target/
51 |
--------------------------------------------------------------------------------
/lib/painter/triangle_painter.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:flutter_kline/common/kline_config.dart';
3 |
4 | /// 三角形
5 | class TrianglePainter extends CustomPainter {
6 | final Color fillColor;
7 |
8 | const TrianglePainter({this.fillColor = KlineConfig.realTimeLineColor});
9 |
10 | @override
11 | void paint(Canvas canvas, Size size) {
12 | final paint = Paint()
13 | ..color = fillColor
14 | ..style = PaintingStyle.fill;
15 |
16 | final path = Path()
17 | ..moveTo(size.width / 2, 0)
18 | ..lineTo(0, size.height)
19 | ..lineTo(size.width, size.height)
20 | ..close();
21 |
22 | canvas.save();
23 | canvas.translate(0, size.height);
24 | canvas.rotate(-90 * 3.1415927 / 180);
25 |
26 | canvas.drawPath(path, paint);
27 | // paint.color = Colors.black;
28 | // canvas.drawRect(Offset.zero & size, paint);
29 | canvas.restore();
30 | }
31 |
32 | @override
33 | bool shouldRepaint(CustomPainter oldDelegate) => false;
34 | }
35 |
--------------------------------------------------------------------------------
/lib/common/volume_profile.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | /// 筹码峰
4 | class VolumeProfile {
5 | /// 价格
6 | double price;
7 |
8 | /// 占比。范围:0~1
9 | double percent;
10 |
11 | /// 颜色
12 | Color color;
13 |
14 | VolumeProfile({
15 | this.price = 0,
16 | this.percent = 0,
17 | this.color = Colors.red,
18 | });
19 |
20 | VolumeProfile copyWith({
21 | double? price,
22 | double? percent,
23 | Color? color,
24 | }) =>
25 | VolumeProfile(
26 | price: price ?? this.price,
27 | percent: percent ?? this.percent,
28 | color: color ?? this.color,
29 | );
30 |
31 | static List copyWithList(List dataList) {
32 | if (dataList.isEmpty) {
33 | return [];
34 | }
35 |
36 | return dataList.map((e) => e.copyWith()).toList();
37 | }
38 |
39 | /// 根据价格排序
40 | static void sortByPrice({required List dataList}) {
41 | dataList.sort((a, b) => b.price.compareTo(a.price));
42 | }
43 |
44 | }
45 |
--------------------------------------------------------------------------------
/lib/common/utils/kline_random_util.dart:
--------------------------------------------------------------------------------
1 | import 'dart:math';
2 |
3 | class KlineRandomUtil {
4 | static num generateRandomNumber(num min, num max) {
5 | Random random = Random();
6 | return min + random.nextDouble() * (max - min);
7 | }
8 |
9 | static double generateRandomDouble(num min, num max) {
10 | Random random = Random();
11 | return min + random.nextDouble() * (max - min);
12 | }
13 |
14 | static double generateDoubleInRange(
15 | {required double min,
16 | required double max,
17 | required double previousValue,
18 | required double floatRange}) {
19 | // 使用 Random 类生成随机数
20 | final random = Random();
21 |
22 | // 生成一个介于 -0.02 到 0.02 之间的随机浮点数
23 | final float = (random.nextDouble() - 0.5) * floatRange;
24 |
25 | // 根据上一次生成的值和浮动值计算新的值
26 | double newValue = previousValue + float;
27 |
28 | // 确保新值在指定范围内
29 | if (newValue < min) {
30 | newValue = min;
31 | } else if (newValue > max) {
32 | newValue = max;
33 | }
34 |
35 | return newValue;
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/example/web/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "example",
3 | "short_name": "example",
4 | "start_url": ".",
5 | "display": "standalone",
6 | "background_color": "#0175C2",
7 | "theme_color": "#0175C2",
8 | "description": "A new Flutter project.",
9 | "orientation": "portrait-primary",
10 | "prefer_related_applications": false,
11 | "icons": [
12 | {
13 | "src": "icons/Icon-192.png",
14 | "sizes": "192x192",
15 | "type": "image/png"
16 | },
17 | {
18 | "src": "icons/Icon-512.png",
19 | "sizes": "512x512",
20 | "type": "image/png"
21 | },
22 | {
23 | "src": "icons/Icon-maskable-192.png",
24 | "sizes": "192x192",
25 | "type": "image/png",
26 | "purpose": "maskable"
27 | },
28 | {
29 | "src": "icons/Icon-maskable-512.png",
30 | "sizes": "512x512",
31 | "type": "image/png",
32 | "purpose": "maskable"
33 | }
34 | ]
35 | }
36 |
--------------------------------------------------------------------------------
/web/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "flutter_kline",
3 | "short_name": "flutter_kline",
4 | "start_url": ".",
5 | "display": "standalone",
6 | "background_color": "#0175C2",
7 | "theme_color": "#0175C2",
8 | "description": "A new Flutter project.",
9 | "orientation": "portrait-primary",
10 | "prefer_related_applications": false,
11 | "icons": [
12 | {
13 | "src": "icons/Icon-192.png",
14 | "sizes": "192x192",
15 | "type": "image/png"
16 | },
17 | {
18 | "src": "icons/Icon-512.png",
19 | "sizes": "512x512",
20 | "type": "image/png"
21 | },
22 | {
23 | "src": "icons/Icon-maskable-192.png",
24 | "sizes": "192x192",
25 | "type": "image/png",
26 | "purpose": "maskable"
27 | },
28 | {
29 | "src": "icons/Icon-maskable-512.png",
30 | "sizes": "512x512",
31 | "type": "image/png",
32 | "purpose": "maskable"
33 | }
34 | ]
35 | }
36 |
--------------------------------------------------------------------------------
/windows/runner/flutter_window.h:
--------------------------------------------------------------------------------
1 | #ifndef RUNNER_FLUTTER_WINDOW_H_
2 | #define RUNNER_FLUTTER_WINDOW_H_
3 |
4 | #include
5 | #include
6 |
7 | #include
8 |
9 | #include "win32_window.h"
10 |
11 | // A window that does nothing but host a Flutter view.
12 | class FlutterWindow : public Win32Window {
13 | public:
14 | // Creates a new FlutterWindow hosting a Flutter view running |project|.
15 | explicit FlutterWindow(const flutter::DartProject& project);
16 | virtual ~FlutterWindow();
17 |
18 | protected:
19 | // Win32Window:
20 | bool OnCreate() override;
21 | void OnDestroy() override;
22 | LRESULT MessageHandler(HWND window, UINT const message, WPARAM const wparam,
23 | LPARAM const lparam) noexcept override;
24 |
25 | private:
26 | // The project to run.
27 | flutter::DartProject project_;
28 |
29 | // The Flutter instance hosted by this window.
30 | std::unique_ptr flutter_controller_;
31 | };
32 |
33 | #endif // RUNNER_FLUTTER_WINDOW_H_
34 |
--------------------------------------------------------------------------------
/android/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
9 |
15 |
18 |
19 |
--------------------------------------------------------------------------------
/example/windows/runner/flutter_window.h:
--------------------------------------------------------------------------------
1 | #ifndef RUNNER_FLUTTER_WINDOW_H_
2 | #define RUNNER_FLUTTER_WINDOW_H_
3 |
4 | #include
5 | #include
6 |
7 | #include
8 |
9 | #include "win32_window.h"
10 |
11 | // A window that does nothing but host a Flutter view.
12 | class FlutterWindow : public Win32Window {
13 | public:
14 | // Creates a new FlutterWindow hosting a Flutter view running |project|.
15 | explicit FlutterWindow(const flutter::DartProject& project);
16 | virtual ~FlutterWindow();
17 |
18 | protected:
19 | // Win32Window:
20 | bool OnCreate() override;
21 | void OnDestroy() override;
22 | LRESULT MessageHandler(HWND window, UINT const message, WPARAM const wparam,
23 | LPARAM const lparam) noexcept override;
24 |
25 | private:
26 | // The project to run.
27 | flutter::DartProject project_;
28 |
29 | // The Flutter instance hosted by this window.
30 | std::unique_ptr flutter_controller_;
31 | };
32 |
33 | #endif // RUNNER_FLUTTER_WINDOW_H_
34 |
--------------------------------------------------------------------------------
/android/app/src/main/res/values-night/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
9 |
15 |
18 |
19 |
--------------------------------------------------------------------------------
/example/android/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
9 |
15 |
18 |
19 |
--------------------------------------------------------------------------------
/example/android/app/src/main/res/values-night/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
9 |
15 |
18 |
19 |
--------------------------------------------------------------------------------
/lib/common/pointer_info.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | /// 指示器信息
4 | class PointerInfo {
5 | int pointer;
6 | Offset localPosition;
7 | Offset globalPosition;
8 | Offset delta;
9 |
10 | /// 是否在顶部
11 | bool isTop;
12 |
13 | PointerInfo({
14 | required this.pointer,
15 | required this.localPosition,
16 | required this.globalPosition,
17 | required this.delta,
18 | this.isTop = true,
19 | });
20 |
21 | static PointerInfo parse(PointerDownEvent event) {
22 | return PointerInfo(
23 | pointer: event.pointer,
24 | localPosition: event.localPosition,
25 | globalPosition: event.position,
26 | delta: event.delta);
27 | }
28 |
29 | PointerInfo copy() {
30 | return PointerInfo(
31 | pointer: pointer,
32 | localPosition: Offset(localPosition.dx, localPosition.dy),
33 | globalPosition: Offset(globalPosition.dx, globalPosition.dy),
34 | delta: Offset(delta.dx, delta.dy),
35 | );
36 | }
37 |
38 | @override
39 | String toString() {
40 | return "{pointer: $pointer, localPosition: $localPosition}";
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/lib/widget/mask_layer_widget.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | import '../common/mask_layer.dart';
4 |
5 | /// 遮罩层
6 | class MaskLayerWidget extends StatelessWidget {
7 | const MaskLayerWidget({
8 | super.key,
9 | required this.maskLayer,
10 | });
11 |
12 | final MaskLayer maskLayer;
13 |
14 | @override
15 | Widget build(BuildContext context) {
16 | return InkWell(
17 | onTap: maskLayer.onTap,
18 | child: LayoutBuilder(builder: _builderWidget),
19 | );
20 | }
21 |
22 | Widget _builderWidget(BuildContext context, BoxConstraints constraints) {
23 | double width = constraints.maxWidth * maskLayer.percent;
24 | double height = constraints.maxHeight;
25 |
26 | return SizedBox(
27 | width: width,
28 | height: height,
29 | child: maskLayer.widget ?? Container(
30 | decoration: const BoxDecoration(
31 | gradient: LinearGradient(
32 | begin: Alignment.topLeft,
33 | end: Alignment.bottomRight,
34 | colors: [Color(0xFFf7f373), Color(0xFFc5b9ab)],
35 | ),
36 | ),
37 | ),
38 | );
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/example/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 in the flutter_test package. 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:example/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(const 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 |
--------------------------------------------------------------------------------
/macos/Runner/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | $(DEVELOPMENT_LANGUAGE)
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIconFile
10 |
11 | CFBundleIdentifier
12 | $(PRODUCT_BUNDLE_IDENTIFIER)
13 | CFBundleInfoDictionaryVersion
14 | 6.0
15 | CFBundleName
16 | $(PRODUCT_NAME)
17 | CFBundlePackageType
18 | APPL
19 | CFBundleShortVersionString
20 | $(FLUTTER_BUILD_NAME)
21 | CFBundleVersion
22 | $(FLUTTER_BUILD_NUMBER)
23 | LSMinimumSystemVersion
24 | $(MACOSX_DEPLOYMENT_TARGET)
25 | NSHumanReadableCopyright
26 | $(PRODUCT_COPYRIGHT)
27 | NSMainNibFile
28 | MainMenu
29 | NSPrincipalClass
30 | NSApplication
31 |
32 |
33 |
--------------------------------------------------------------------------------
/example/macos/Runner/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | $(DEVELOPMENT_LANGUAGE)
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIconFile
10 |
11 | CFBundleIdentifier
12 | $(PRODUCT_BUNDLE_IDENTIFIER)
13 | CFBundleInfoDictionaryVersion
14 | 6.0
15 | CFBundleName
16 | $(PRODUCT_NAME)
17 | CFBundlePackageType
18 | APPL
19 | CFBundleShortVersionString
20 | $(FLUTTER_BUILD_NAME)
21 | CFBundleVersion
22 | $(FLUTTER_BUILD_NUMBER)
23 | LSMinimumSystemVersion
24 | $(MACOSX_DEPLOYMENT_TARGET)
25 | NSHumanReadableCopyright
26 | $(PRODUCT_COPYRIGHT)
27 | NSMainNibFile
28 | MainMenu
29 | NSPrincipalClass
30 | NSApplication
31 |
32 |
33 |
--------------------------------------------------------------------------------
/example_network/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 in the flutter_test package. 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:example_network/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(const MyApp());
17 |
18 | // Verify that our counter starts at 0.
19 | expect(find.text('0'), findsOneWidget);
20 | expect(find.text('1'), findsNothing);
21 |
22 | // Tap the '+' icon and trigger a frame.
23 | await tester.tap(find.byIcon(Icons.add));
24 | await tester.pump();
25 |
26 | // Verify that our counter has incremented.
27 | expect(find.text('0'), findsNothing);
28 | expect(find.text('1'), findsOneWidget);
29 | });
30 | }
31 |
--------------------------------------------------------------------------------
/lib/common/widget/double_back_exit_app_widget.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | import '../utils/kline_util.dart';
4 |
5 | class DoubleBackExitAppWidget extends StatefulWidget {
6 | const DoubleBackExitAppWidget({super.key, required this.child});
7 |
8 | final Widget? child;
9 |
10 | @override
11 | State createState() =>
12 | _DoubleBackExitAppWidgetState();
13 | }
14 |
15 | class _DoubleBackExitAppWidgetState extends State {
16 | DateTime? _lastPressedAt;
17 |
18 | @override
19 | Widget build(BuildContext context) {
20 | return WillPopScope(
21 | onWillPop: () async {
22 | KlineUtil.logd("退出app");
23 | if (_lastPressedAt == null ||
24 | DateTime.now().difference(_lastPressedAt!) >
25 | const Duration(seconds: 2)) {
26 | _lastPressedAt = DateTime.now();
27 | ScaffoldMessenger.of(context).showSnackBar(
28 | const SnackBar(
29 | content: Text('再按一次退出'),
30 | ),
31 | );
32 | return false;
33 | }
34 | return true;
35 | },
36 | child: widget.child ?? const SizedBox(),
37 | );
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/example_java_kline/src/main/java/com/example/example_java_kline/vo/BaseChartVo.java:
--------------------------------------------------------------------------------
1 | package com.example.example_java_kline.vo;
2 |
3 | public class BaseChartVo {
4 | String id;
5 | String name;
6 |
7 | /// 最大值
8 | Double maxValue;
9 |
10 | /// 最小值
11 | /// 柱图如果不支持负数,设置成0。
12 | Double minValue;
13 |
14 | public BaseChartVo() {
15 | }
16 |
17 | public BaseChartVo(String id, String name, Double maxValue, Double minValue) {
18 | this.id = id;
19 | this.name = name;
20 | this.maxValue = maxValue;
21 | this.minValue = minValue;
22 | }
23 |
24 | public String getId() {
25 | return id;
26 | }
27 |
28 | public void setId(String id) {
29 | this.id = id;
30 | }
31 |
32 | public String getName() {
33 | return name;
34 | }
35 |
36 | public void setName(String name) {
37 | this.name = name;
38 | }
39 |
40 | public Double getMaxValue() {
41 | return maxValue;
42 | }
43 |
44 | public void setMaxValue(Double maxValue) {
45 | this.maxValue = maxValue;
46 | }
47 |
48 | public Double getMinValue() {
49 | return minValue;
50 | }
51 |
52 | public void setMinValue(Double minValue) {
53 | this.minValue = minValue;
54 | }
55 |
56 | }
57 |
--------------------------------------------------------------------------------
/lib/common/main_chart_selected_data_vo.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter_kline/common/utils/kline_collection_util.dart';
2 |
3 | import '../chart/base_chart.dart';
4 | import '../chart/candlestick_chart.dart';
5 | import 'chart_show_data_item_vo.dart';
6 | import '../chart/line_chart.dart';
7 |
8 | class MainChartSelectedDataVo {
9 | /// 蜡烛数据
10 | CandlestickChartData? candlestickChartData;
11 |
12 | /// 折线数据
13 | List? lineChartList;
14 |
15 | MainChartSelectedDataVo({this.candlestickChartData, this.lineChartList});
16 |
17 | /// 获取最后显示的数据
18 | static MainChartSelectedDataVo? getLastShowData(
19 | {CandlestickChart? candlestickChartVo,
20 | List? lineChartVoList}) {
21 | if (candlestickChartVo == null &&
22 | KlineCollectionUtil.isEmpty(lineChartVoList)) {
23 | return null;
24 | }
25 |
26 | MainChartSelectedDataVo result = MainChartSelectedDataVo();
27 | if (candlestickChartVo != null &&
28 | KlineCollectionUtil.isNotEmpty(candlestickChartVo.data)) {
29 | result.candlestickChartData = candlestickChartVo.data.last;
30 | }
31 | if (KlineCollectionUtil.isNotEmpty(lineChartVoList)) {
32 | result.lineChartList = BaseChart.getLastShowData(lineChartVoList);
33 | }
34 |
35 | return result;
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/example_java_kline/src/main/java/com/example/example_java_kline/vo/ResponseResult.java:
--------------------------------------------------------------------------------
1 | package com.example.example_java_kline.vo;
2 |
3 | public class ResponseResult {
4 | private Integer code;
5 | private String msg;
6 | private String type;
7 | private T data;
8 |
9 | public ResponseResult() {
10 | }
11 |
12 | public ResponseResult(Integer code, String msg, String type, T data) {
13 | this.code = code;
14 | this.msg = msg;
15 | this.type = type;
16 | this.data = data;
17 | }
18 |
19 | public static ResponseResult success(String type, T data) {
20 | return new ResponseResult(200, "", type, data);
21 | }
22 |
23 | public Integer getCode() {
24 | return code;
25 | }
26 |
27 | public void setCode(Integer code) {
28 | this.code = code;
29 | }
30 |
31 | public String getMsg() {
32 | return msg;
33 | }
34 |
35 | public void setMsg(String msg) {
36 | this.msg = msg;
37 | }
38 |
39 | public String getType() {
40 | return type;
41 | }
42 |
43 | public void setType(String type) {
44 | this.type = type;
45 | }
46 |
47 | public T getData() {
48 | return data;
49 | }
50 |
51 | public void setData(T data) {
52 | this.data = data;
53 | }
54 |
55 | }
56 |
--------------------------------------------------------------------------------
/lib/common/pair.dart:
--------------------------------------------------------------------------------
1 | class Pair {
2 | L left;
3 | R right;
4 |
5 | Pair({required this.left, required this.right});
6 |
7 | static Pair get defaultMaxMinValue {
8 | return Pair(left: -double.maxFinite, right: double.maxFinite);
9 | }
10 |
11 | bool isNull() {
12 | return left == null && right == null;
13 | }
14 |
15 | bool isNotNull() {
16 | return !isNull();
17 | }
18 |
19 | static Pair getMaxMinValue(
20 | List?> dataList,
21 | {double? defaultMaxValue,
22 | double? defaultMinValue}) {
23 | Pair maxMinValue =
24 | Pair(left: -double.maxFinite, right: double.maxFinite);
25 | for (Pair? data in dataList) {
26 | if (data != null) {
27 | if (maxMinValue.left < data.left) {
28 | maxMinValue.left = data.left;
29 | }
30 | if (maxMinValue.right > data.right) {
31 | maxMinValue.right = data.right;
32 | }
33 | }
34 | }
35 |
36 | if (defaultMaxValue != null && maxMinValue.left == -double.maxFinite) {
37 | maxMinValue.left = defaultMaxValue;
38 | }
39 |
40 | if (defaultMinValue != null && maxMinValue.right == double.maxFinite) {
41 | maxMinValue.right = defaultMinValue;
42 | }
43 |
44 | return maxMinValue;
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/example_java_kline/src/main/java/com/example/example_java_kline/vo/LineChartVo.java:
--------------------------------------------------------------------------------
1 | package com.example.example_java_kline.vo;
2 |
3 | import java.util.Date;
4 | import java.util.List;
5 |
6 | public class LineChartVo extends BaseChartVo {
7 | List dataList;
8 |
9 | public LineChartVo() {
10 | }
11 |
12 | public LineChartVo(String id, String name, Double maxValue, Double minValue, List dataList) {
13 | super(id, name, maxValue, minValue);
14 | this.dataList = dataList;
15 | }
16 |
17 | public List getDataList() {
18 | return dataList;
19 | }
20 |
21 | public void setDataList(List dataList) {
22 | this.dataList = dataList;
23 | }
24 |
25 | }
26 |
27 | class LineChartData {
28 | Date dateTime;
29 |
30 | Double value;
31 |
32 | public LineChartData() {
33 | }
34 |
35 | public LineChartData(Date dateTime, Double value) {
36 | this.dateTime = dateTime;
37 | this.value = value;
38 | }
39 |
40 | public Date getDateTime() {
41 | return dateTime;
42 | }
43 |
44 | public void setDateTime(Date dateTime) {
45 | this.dateTime = dateTime;
46 | }
47 |
48 | public Double getValue() {
49 | return value;
50 | }
51 |
52 | public void setValue(Double value) {
53 | this.value = value;
54 | };
55 |
56 | }
--------------------------------------------------------------------------------
/example/windows/runner/main.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 | #include
4 |
5 | #include "flutter_window.h"
6 | #include "utils.h"
7 |
8 | int APIENTRY wWinMain(_In_ HINSTANCE instance, _In_opt_ HINSTANCE prev,
9 | _In_ wchar_t *command_line, _In_ int show_command) {
10 | // Attach to console when present (e.g., 'flutter run') or create a
11 | // new console when running with a debugger.
12 | if (!::AttachConsole(ATTACH_PARENT_PROCESS) && ::IsDebuggerPresent()) {
13 | CreateAndAttachConsole();
14 | }
15 |
16 | // Initialize COM, so that it is available for use in the library and/or
17 | // plugins.
18 | ::CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED);
19 |
20 | flutter::DartProject project(L"data");
21 |
22 | std::vector command_line_arguments =
23 | GetCommandLineArguments();
24 |
25 | project.set_dart_entrypoint_arguments(std::move(command_line_arguments));
26 |
27 | FlutterWindow window(project);
28 | Win32Window::Point origin(10, 10);
29 | Win32Window::Size size(1280, 720);
30 | if (!window.Create(L"example", origin, size)) {
31 | return EXIT_FAILURE;
32 | }
33 | window.SetQuitOnClose(true);
34 |
35 | ::MSG msg;
36 | while (::GetMessage(&msg, nullptr, 0, 0)) {
37 | ::TranslateMessage(&msg);
38 | ::DispatchMessage(&msg);
39 | }
40 |
41 | ::CoUninitialize();
42 | return EXIT_SUCCESS;
43 | }
44 |
--------------------------------------------------------------------------------
/windows/runner/main.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 | #include
4 |
5 | #include "flutter_window.h"
6 | #include "utils.h"
7 |
8 | int APIENTRY wWinMain(_In_ HINSTANCE instance, _In_opt_ HINSTANCE prev,
9 | _In_ wchar_t *command_line, _In_ int show_command) {
10 | // Attach to console when present (e.g., 'flutter run') or create a
11 | // new console when running with a debugger.
12 | if (!::AttachConsole(ATTACH_PARENT_PROCESS) && ::IsDebuggerPresent()) {
13 | CreateAndAttachConsole();
14 | }
15 |
16 | // Initialize COM, so that it is available for use in the library and/or
17 | // plugins.
18 | ::CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED);
19 |
20 | flutter::DartProject project(L"data");
21 |
22 | std::vector command_line_arguments =
23 | GetCommandLineArguments();
24 |
25 | project.set_dart_entrypoint_arguments(std::move(command_line_arguments));
26 |
27 | FlutterWindow window(project);
28 | Win32Window::Point origin(10, 10);
29 | Win32Window::Size size(1280, 720);
30 | if (!window.Create(L"flutter_kline", origin, size)) {
31 | return EXIT_FAILURE;
32 | }
33 | window.SetQuitOnClose(true);
34 |
35 | ::MSG msg;
36 | while (::GetMessage(&msg, nullptr, 0, 0)) {
37 | ::TranslateMessage(&msg);
38 | ::DispatchMessage(&msg);
39 | }
40 |
41 | ::CoUninitialize();
42 | return EXIT_SUCCESS;
43 | }
44 |
--------------------------------------------------------------------------------
/analysis_options.yaml:
--------------------------------------------------------------------------------
1 | # This file configures the analyzer, which statically analyzes Dart code to
2 | # check for errors, warnings, and lints.
3 | #
4 | # The issues identified by the analyzer are surfaced in the UI of Dart-enabled
5 | # IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be
6 | # invoked from the command line by running `flutter analyze`.
7 |
8 | # The following line activates a set of recommended lints for Flutter apps,
9 | # packages, and plugins designed to encourage good coding practices.
10 | include: package:flutter_lints/flutter.yaml
11 |
12 | linter:
13 | # The lint rules applied to this project can be customized in the
14 | # section below to disable rules from the `package:flutter_lints/flutter.yaml`
15 | # included above or to enable additional rules. A list of all available lints
16 | # and their documentation is published at
17 | # https://dart-lang.github.io/linter/lints/index.html.
18 | #
19 | # Instead of disabling a lint rule for the entire project in the
20 | # section below, it can also be suppressed for a single line of code
21 | # or a specific dart file by using the `// ignore: name_of_lint` and
22 | # `// ignore_for_file: name_of_lint` syntax on the line or in the file
23 | # producing the lint.
24 | rules:
25 | # avoid_print: false # Uncomment to disable the `avoid_print` rule
26 | # prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule
27 |
28 | # Additional information about this file can be found at
29 | # https://dart.dev/guides/language/analysis-options
30 |
--------------------------------------------------------------------------------
/lib/common/kline_config.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:flutter_kline/common/pair.dart';
3 |
4 | class KlineConfig {
5 | static const List kLineColors = [
6 | Color(0xFF969AA1),
7 | Color(0xFFC4C049),
8 | Color(0xFFC845CF),
9 | Color(0xFF7FB370),
10 | Color(0xFF50C9DF),
11 | Colors.black,
12 | Colors.blue,
13 | Colors.red,
14 | Colors.yellow,
15 | Colors.pink
16 | ];
17 |
18 | static const Color red = Colors.red;
19 | static const Color green = Colors.green;
20 |
21 | /// 实时价格线颜色
22 | static const Color realTimeLineColor = Color(0xFFE1AC45);
23 | static const Color realTimeLineColor2 = Color(0xFF666666);
24 |
25 | /// 显示数据 - 空间大小
26 | static const double showDataSpaceSize = 22;
27 |
28 | /// 显示数据 - 字体大小
29 | static const double showDataFontSize = 10;
30 |
31 | /// 显示数据 - 图标大小
32 | static const double showDataIconSize = 12;
33 |
34 | /// 显示数据 = 默认长度
35 | static const int showDataDefaultLength = 40;
36 |
37 | /// 显示数据 - 最小长度
38 | static const int showDataMinLength = 10;
39 |
40 | /// 显示数据 - 最大长度
41 | static const int showDataMaxLength = 90;
42 |
43 | /// 矩形数字大小
44 | static const double rectFontSize = 8;
45 |
46 | /// 分时图一天数据点
47 | static const int minuteDataNum = 240;
48 |
49 | /// 默认数据最大最小值
50 | static final Pair defaultMaxMinValue = Pair(left: 1, right: 0);
51 |
52 | /// 数据点像素占比
53 | static const double pointWidthRatio = .8;
54 |
55 | /// 横向滑动动画值
56 | static const double horizontalDragAnimationValue = 2;
57 |
58 | }
59 |
--------------------------------------------------------------------------------
/example/analysis_options.yaml:
--------------------------------------------------------------------------------
1 | # This file configures the analyzer, which statically analyzes Dart code to
2 | # check for errors, warnings, and lints.
3 | #
4 | # The issues identified by the analyzer are surfaced in the UI of Dart-enabled
5 | # IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be
6 | # invoked from the command line by running `flutter analyze`.
7 |
8 | # The following line activates a set of recommended lints for Flutter apps,
9 | # packages, and plugins designed to encourage good coding practices.
10 | include: package:flutter_lints/flutter.yaml
11 |
12 | linter:
13 | # The lint rules applied to this project can be customized in the
14 | # section below to disable rules from the `package:flutter_lints/flutter.yaml`
15 | # included above or to enable additional rules. A list of all available lints
16 | # and their documentation is published at
17 | # https://dart-lang.github.io/linter/lints/index.html.
18 | #
19 | # Instead of disabling a lint rule for the entire project in the
20 | # section below, it can also be suppressed for a single line of code
21 | # or a specific dart file by using the `// ignore: name_of_lint` and
22 | # `// ignore_for_file: name_of_lint` syntax on the line or in the file
23 | # producing the lint.
24 | rules:
25 | # avoid_print: false # Uncomment to disable the `avoid_print` rule
26 | # prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule
27 |
28 | # Additional information about this file can be found at
29 | # https://dart.dev/guides/language/analysis-options
30 |
--------------------------------------------------------------------------------
/macos/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "size" : "16x16",
5 | "idiom" : "mac",
6 | "filename" : "app_icon_16.png",
7 | "scale" : "1x"
8 | },
9 | {
10 | "size" : "16x16",
11 | "idiom" : "mac",
12 | "filename" : "app_icon_32.png",
13 | "scale" : "2x"
14 | },
15 | {
16 | "size" : "32x32",
17 | "idiom" : "mac",
18 | "filename" : "app_icon_32.png",
19 | "scale" : "1x"
20 | },
21 | {
22 | "size" : "32x32",
23 | "idiom" : "mac",
24 | "filename" : "app_icon_64.png",
25 | "scale" : "2x"
26 | },
27 | {
28 | "size" : "128x128",
29 | "idiom" : "mac",
30 | "filename" : "app_icon_128.png",
31 | "scale" : "1x"
32 | },
33 | {
34 | "size" : "128x128",
35 | "idiom" : "mac",
36 | "filename" : "app_icon_256.png",
37 | "scale" : "2x"
38 | },
39 | {
40 | "size" : "256x256",
41 | "idiom" : "mac",
42 | "filename" : "app_icon_256.png",
43 | "scale" : "1x"
44 | },
45 | {
46 | "size" : "256x256",
47 | "idiom" : "mac",
48 | "filename" : "app_icon_512.png",
49 | "scale" : "2x"
50 | },
51 | {
52 | "size" : "512x512",
53 | "idiom" : "mac",
54 | "filename" : "app_icon_512.png",
55 | "scale" : "1x"
56 | },
57 | {
58 | "size" : "512x512",
59 | "idiom" : "mac",
60 | "filename" : "app_icon_1024.png",
61 | "scale" : "2x"
62 | }
63 | ],
64 | "info" : {
65 | "version" : 1,
66 | "author" : "xcode"
67 | }
68 | }
69 |
--------------------------------------------------------------------------------
/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "size" : "16x16",
5 | "idiom" : "mac",
6 | "filename" : "app_icon_16.png",
7 | "scale" : "1x"
8 | },
9 | {
10 | "size" : "16x16",
11 | "idiom" : "mac",
12 | "filename" : "app_icon_32.png",
13 | "scale" : "2x"
14 | },
15 | {
16 | "size" : "32x32",
17 | "idiom" : "mac",
18 | "filename" : "app_icon_32.png",
19 | "scale" : "1x"
20 | },
21 | {
22 | "size" : "32x32",
23 | "idiom" : "mac",
24 | "filename" : "app_icon_64.png",
25 | "scale" : "2x"
26 | },
27 | {
28 | "size" : "128x128",
29 | "idiom" : "mac",
30 | "filename" : "app_icon_128.png",
31 | "scale" : "1x"
32 | },
33 | {
34 | "size" : "128x128",
35 | "idiom" : "mac",
36 | "filename" : "app_icon_256.png",
37 | "scale" : "2x"
38 | },
39 | {
40 | "size" : "256x256",
41 | "idiom" : "mac",
42 | "filename" : "app_icon_256.png",
43 | "scale" : "1x"
44 | },
45 | {
46 | "size" : "256x256",
47 | "idiom" : "mac",
48 | "filename" : "app_icon_512.png",
49 | "scale" : "2x"
50 | },
51 | {
52 | "size" : "512x512",
53 | "idiom" : "mac",
54 | "filename" : "app_icon_512.png",
55 | "scale" : "1x"
56 | },
57 | {
58 | "size" : "512x512",
59 | "idiom" : "mac",
60 | "filename" : "app_icon_1024.png",
61 | "scale" : "2x"
62 | }
63 | ],
64 | "info" : {
65 | "version" : 1,
66 | "author" : "xcode"
67 | }
68 | }
69 |
--------------------------------------------------------------------------------
/lib/painter/candlestick_painter.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | /// 画蜡烛
4 | class CandlestickPainter extends CustomPainter {
5 | final double open;
6 | final double close;
7 | final Color lineColor;
8 | final Color? rectFillColor;
9 |
10 | const CandlestickPainter({
11 | required this.open,
12 | required this.close,
13 | this.lineColor = Colors.black,
14 | this.rectFillColor,
15 | });
16 |
17 | @override
18 | void paint(Canvas canvas, Size size) {
19 | Paint paint = Paint()
20 | ..style = PaintingStyle.stroke
21 | ..color = lineColor
22 | ..strokeWidth = 1;
23 | if (rectFillColor != null) {
24 | paint
25 | ..color = rectFillColor!
26 | ..style = PaintingStyle.fill;
27 | }
28 |
29 |
30 | canvas.drawRect(Rect.fromLTRB(0, open, size.width, close), paint);
31 |
32 | paint
33 | ..color = lineColor
34 | ..style = PaintingStyle.stroke;
35 |
36 | double middleX = size.width / 2;
37 | double topLine = open > close ? close : open;
38 | double bottomLine = open > close ? open : close;
39 | // 最高线
40 | canvas.drawLine(Offset(middleX, 0), Offset(middleX, topLine), paint);
41 | // 最低线
42 | canvas.drawLine(Offset(middleX, bottomLine), Offset(middleX, size.height), paint);
43 | }
44 |
45 | @override
46 | bool shouldRepaint(covariant CustomPainter oldDelegate) {
47 | if (oldDelegate is CandlestickPainter) {
48 | return open != oldDelegate.open ||
49 | close != oldDelegate.close ||
50 | lineColor != oldDelegate.lineColor ||
51 | rectFillColor != oldDelegate.rectFillColor;
52 | }
53 | return true;
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/ios/Runner/Base.lproj/Main.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/lib/painter/cross_curve_text_painter.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | /// 十字线文本
4 | class CrossCurveTextPainter extends CustomPainter {
5 | /// 文本
6 | final String text;
7 | final TextStyle textStyle;
8 | /// 显示的位置
9 | final Offset offset;
10 | final Color backgroundColor;
11 |
12 | const CrossCurveTextPainter(
13 | {required this.text,
14 | this.textStyle = const TextStyle(fontSize: 9, color: Colors.white),
15 | required this.offset,
16 | this.backgroundColor = const Color(0xFFA3E1FF)});
17 |
18 | @override
19 | void paint(Canvas canvas, Size size) {
20 | Paint paint = Paint()
21 | ..color = backgroundColor
22 | ..style = PaintingStyle.fill;
23 |
24 | var textPainter = TextPainter(
25 | text: TextSpan(text: text, style: textStyle),
26 | textDirection: TextDirection.ltr)
27 | ..layout();
28 |
29 | RRect rect = _computeRRect(textPainter: textPainter);
30 | canvas.drawRRect(rect, paint);
31 | // (rect.top - rect.bottom) / 2 为了让文本处于矩形范围中间。
32 | textPainter.paint(canvas, Offset(offset.dx, offset.dy + (rect.top - rect.bottom) / 2));
33 | }
34 |
35 | /// 计算矩形范围
36 | RRect _computeRRect({required TextPainter textPainter}) {
37 | // textPainter.height / 2 是为了让矩形处于 y 轴中间。
38 | double top = offset.dy - textPainter.height / 2;
39 | double bottom = offset.dy + textPainter.height / 2;
40 |
41 | return RRect.fromLTRBR(
42 | offset.dx,
43 | top,
44 | offset.dx + textPainter.width,
45 | bottom,
46 | const Radius.circular(2));
47 | }
48 |
49 | @override
50 | bool shouldRepaint(covariant CustomPainter oldDelegate) {
51 | return true;
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/example/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 |
--------------------------------------------------------------------------------
/example/android/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
14 |
18 |
22 |
23 |
24 |
25 |
26 |
27 |
29 |
32 |
33 |
34 |
--------------------------------------------------------------------------------
/android/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
7 |
15 |
19 |
23 |
24 |
25 |
26 |
27 |
28 |
30 |
33 |
34 |
35 |
--------------------------------------------------------------------------------
/.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.
5 |
6 | version:
7 | revision: 2ad6cd72c040113b47ee9055e722606a490ef0da
8 | channel: stable
9 |
10 | project_type: app
11 |
12 | # Tracks metadata for the flutter migrate command
13 | migration:
14 | platforms:
15 | - platform: root
16 | create_revision: 2ad6cd72c040113b47ee9055e722606a490ef0da
17 | base_revision: 2ad6cd72c040113b47ee9055e722606a490ef0da
18 | - platform: android
19 | create_revision: 2ad6cd72c040113b47ee9055e722606a490ef0da
20 | base_revision: 2ad6cd72c040113b47ee9055e722606a490ef0da
21 | - platform: ios
22 | create_revision: 2ad6cd72c040113b47ee9055e722606a490ef0da
23 | base_revision: 2ad6cd72c040113b47ee9055e722606a490ef0da
24 | - platform: linux
25 | create_revision: 2ad6cd72c040113b47ee9055e722606a490ef0da
26 | base_revision: 2ad6cd72c040113b47ee9055e722606a490ef0da
27 | - platform: macos
28 | create_revision: 2ad6cd72c040113b47ee9055e722606a490ef0da
29 | base_revision: 2ad6cd72c040113b47ee9055e722606a490ef0da
30 | - platform: web
31 | create_revision: 2ad6cd72c040113b47ee9055e722606a490ef0da
32 | base_revision: 2ad6cd72c040113b47ee9055e722606a490ef0da
33 | - platform: windows
34 | create_revision: 2ad6cd72c040113b47ee9055e722606a490ef0da
35 | base_revision: 2ad6cd72c040113b47ee9055e722606a490ef0da
36 |
37 | # User provided section
38 |
39 | # List of Local paths (relative to this file) that should be
40 | # ignored by the migrate tool.
41 | #
42 | # Files that are not part of the templates will be ignored by default.
43 | unmanaged_files:
44 | - 'lib/main.dart'
45 | - 'ios/Runner.xcodeproj/project.pbxproj'
46 |
--------------------------------------------------------------------------------
/example/.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.
5 |
6 | version:
7 | revision: f468f3366c26a5092eb964a230ce7892fda8f2f8
8 | channel: stable
9 |
10 | project_type: app
11 |
12 | # Tracks metadata for the flutter migrate command
13 | migration:
14 | platforms:
15 | - platform: root
16 | create_revision: f468f3366c26a5092eb964a230ce7892fda8f2f8
17 | base_revision: f468f3366c26a5092eb964a230ce7892fda8f2f8
18 | - platform: android
19 | create_revision: f468f3366c26a5092eb964a230ce7892fda8f2f8
20 | base_revision: f468f3366c26a5092eb964a230ce7892fda8f2f8
21 | - platform: ios
22 | create_revision: f468f3366c26a5092eb964a230ce7892fda8f2f8
23 | base_revision: f468f3366c26a5092eb964a230ce7892fda8f2f8
24 | - platform: linux
25 | create_revision: f468f3366c26a5092eb964a230ce7892fda8f2f8
26 | base_revision: f468f3366c26a5092eb964a230ce7892fda8f2f8
27 | - platform: macos
28 | create_revision: f468f3366c26a5092eb964a230ce7892fda8f2f8
29 | base_revision: f468f3366c26a5092eb964a230ce7892fda8f2f8
30 | - platform: web
31 | create_revision: f468f3366c26a5092eb964a230ce7892fda8f2f8
32 | base_revision: f468f3366c26a5092eb964a230ce7892fda8f2f8
33 | - platform: windows
34 | create_revision: f468f3366c26a5092eb964a230ce7892fda8f2f8
35 | base_revision: f468f3366c26a5092eb964a230ce7892fda8f2f8
36 |
37 | # User provided section
38 |
39 | # List of Local paths (relative to this file) that should be
40 | # ignored by the migrate tool.
41 | #
42 | # Files that are not part of the templates will be ignored by default.
43 | unmanaged_files:
44 | - 'lib/main.dart'
45 | - 'ios/Runner.xcodeproj/project.pbxproj'
46 |
--------------------------------------------------------------------------------
/example/ios/Runner/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | $(DEVELOPMENT_LANGUAGE)
7 | CFBundleDisplayName
8 | Example
9 | CFBundleExecutable
10 | $(EXECUTABLE_NAME)
11 | CFBundleIdentifier
12 | $(PRODUCT_BUNDLE_IDENTIFIER)
13 | CFBundleInfoDictionaryVersion
14 | 6.0
15 | CFBundleName
16 | example
17 | CFBundlePackageType
18 | APPL
19 | CFBundleShortVersionString
20 | $(FLUTTER_BUILD_NAME)
21 | CFBundleSignature
22 | ????
23 | CFBundleVersion
24 | $(FLUTTER_BUILD_NUMBER)
25 | LSRequiresIPhoneOS
26 |
27 | UILaunchStoryboardName
28 | LaunchScreen
29 | UIMainStoryboardFile
30 | Main
31 | UISupportedInterfaceOrientations
32 |
33 | UIInterfaceOrientationPortrait
34 | UIInterfaceOrientationLandscapeLeft
35 | UIInterfaceOrientationLandscapeRight
36 |
37 | UISupportedInterfaceOrientations~ipad
38 |
39 | UIInterfaceOrientationPortrait
40 | UIInterfaceOrientationPortraitUpsideDown
41 | UIInterfaceOrientationLandscapeLeft
42 | UIInterfaceOrientationLandscapeRight
43 |
44 | UIViewControllerBasedStatusBarAppearance
45 |
46 | CADisableMinimumFrameDurationOnPhone
47 |
48 | UIApplicationSupportsIndirectInputEvents
49 |
50 |
51 |
52 |
--------------------------------------------------------------------------------
/ios/Runner/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | $(DEVELOPMENT_LANGUAGE)
7 | CFBundleDisplayName
8 | Flutter Kline
9 | CFBundleExecutable
10 | $(EXECUTABLE_NAME)
11 | CFBundleIdentifier
12 | $(PRODUCT_BUNDLE_IDENTIFIER)
13 | CFBundleInfoDictionaryVersion
14 | 6.0
15 | CFBundleName
16 | flutter_kline
17 | CFBundlePackageType
18 | APPL
19 | CFBundleShortVersionString
20 | $(FLUTTER_BUILD_NAME)
21 | CFBundleSignature
22 | ????
23 | CFBundleVersion
24 | $(FLUTTER_BUILD_NUMBER)
25 | LSRequiresIPhoneOS
26 |
27 | UILaunchStoryboardName
28 | LaunchScreen
29 | UIMainStoryboardFile
30 | Main
31 | UISupportedInterfaceOrientations
32 |
33 | UIInterfaceOrientationPortrait
34 | UIInterfaceOrientationLandscapeLeft
35 | UIInterfaceOrientationLandscapeRight
36 |
37 | UISupportedInterfaceOrientations~ipad
38 |
39 | UIInterfaceOrientationPortrait
40 | UIInterfaceOrientationPortraitUpsideDown
41 | UIInterfaceOrientationLandscapeLeft
42 | UIInterfaceOrientationLandscapeRight
43 |
44 | UIViewControllerBasedStatusBarAppearance
45 |
46 | CADisableMinimumFrameDurationOnPhone
47 |
48 | UIApplicationSupportsIndirectInputEvents
49 |
50 |
51 |
52 |
--------------------------------------------------------------------------------
/example_java_kline/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 | 4.0.0
5 |
6 | org.springframework.boot
7 | spring-boot-starter-parent
8 | 2.7.15
9 |
10 |
11 |
12 | com.example
13 | example_java_kline
14 | 0.0.1-SNAPSHOT
15 | example_java_kline
16 | Demo project for Spring Boot
17 |
18 | 11
19 |
20 |
21 |
22 | org.springframework.boot
23 | spring-boot-starter-web
24 |
25 |
26 |
27 | org.springframework.boot
28 | spring-boot-starter-test
29 | test
30 |
31 |
32 |
33 | org.springframework.boot
34 | spring-boot-starter-websocket
35 |
36 |
37 |
38 | com.alibaba
39 | fastjson
40 | 2.0.32
41 |
42 |
43 | org.apache.commons
44 | commons-lang3
45 | 3.12.0
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 | org.springframework.boot
55 | spring-boot-maven-plugin
56 |
57 |
58 |
59 |
60 |
61 |
--------------------------------------------------------------------------------
/windows/runner/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 3.14)
2 | project(runner LANGUAGES CXX)
3 |
4 | # Define the application target. To change its name, change BINARY_NAME in the
5 | # top-level CMakeLists.txt, not the value here, or `flutter run` will no longer
6 | # work.
7 | #
8 | # Any new source files that you add to the application should be added here.
9 | add_executable(${BINARY_NAME} WIN32
10 | "flutter_window.cpp"
11 | "main.cpp"
12 | "utils.cpp"
13 | "win32_window.cpp"
14 | "${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc"
15 | "Runner.rc"
16 | "runner.exe.manifest"
17 | )
18 |
19 | # Apply the standard set of build settings. This can be removed for applications
20 | # that need different build settings.
21 | apply_standard_settings(${BINARY_NAME})
22 |
23 | # Add preprocessor definitions for the build version.
24 | target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION=\"${FLUTTER_VERSION}\"")
25 | target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_MAJOR=${FLUTTER_VERSION_MAJOR}")
26 | target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_MINOR=${FLUTTER_VERSION_MINOR}")
27 | target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_PATCH=${FLUTTER_VERSION_PATCH}")
28 | target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_BUILD=${FLUTTER_VERSION_BUILD}")
29 |
30 | # Disable Windows macros that collide with C++ standard library functions.
31 | target_compile_definitions(${BINARY_NAME} PRIVATE "NOMINMAX")
32 |
33 | # Add dependency libraries and include directories. Add any application-specific
34 | # dependencies here.
35 | target_link_libraries(${BINARY_NAME} PRIVATE flutter flutter_wrapper_app)
36 | target_link_libraries(${BINARY_NAME} PRIVATE "dwmapi.lib")
37 | target_include_directories(${BINARY_NAME} PRIVATE "${CMAKE_SOURCE_DIR}")
38 |
39 | # Run the Flutter tool portions of the build. This must not be removed.
40 | add_dependencies(${BINARY_NAME} flutter_assemble)
41 |
--------------------------------------------------------------------------------
/example/windows/runner/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 3.14)
2 | project(runner LANGUAGES CXX)
3 |
4 | # Define the application target. To change its name, change BINARY_NAME in the
5 | # top-level CMakeLists.txt, not the value here, or `flutter run` will no longer
6 | # work.
7 | #
8 | # Any new source files that you add to the application should be added here.
9 | add_executable(${BINARY_NAME} WIN32
10 | "flutter_window.cpp"
11 | "main.cpp"
12 | "utils.cpp"
13 | "win32_window.cpp"
14 | "${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc"
15 | "Runner.rc"
16 | "runner.exe.manifest"
17 | )
18 |
19 | # Apply the standard set of build settings. This can be removed for applications
20 | # that need different build settings.
21 | apply_standard_settings(${BINARY_NAME})
22 |
23 | # Add preprocessor definitions for the build version.
24 | target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION=\"${FLUTTER_VERSION}\"")
25 | target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_MAJOR=${FLUTTER_VERSION_MAJOR}")
26 | target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_MINOR=${FLUTTER_VERSION_MINOR}")
27 | target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_PATCH=${FLUTTER_VERSION_PATCH}")
28 | target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_BUILD=${FLUTTER_VERSION_BUILD}")
29 |
30 | # Disable Windows macros that collide with C++ standard library functions.
31 | target_compile_definitions(${BINARY_NAME} PRIVATE "NOMINMAX")
32 |
33 | # Add dependency libraries and include directories. Add any application-specific
34 | # dependencies here.
35 | target_link_libraries(${BINARY_NAME} PRIVATE flutter flutter_wrapper_app)
36 | target_link_libraries(${BINARY_NAME} PRIVATE "dwmapi.lib")
37 | target_include_directories(${BINARY_NAME} PRIVATE "${CMAKE_SOURCE_DIR}")
38 |
39 | # Run the Flutter tool portions of the build. This must not be removed.
40 | add_dependencies(${BINARY_NAME} flutter_assemble)
41 |
--------------------------------------------------------------------------------
/windows/runner/utils.cpp:
--------------------------------------------------------------------------------
1 | #include "utils.h"
2 |
3 | #include
4 | #include
5 | #include
6 | #include
7 |
8 | #include
9 |
10 | void CreateAndAttachConsole() {
11 | if (::AllocConsole()) {
12 | FILE *unused;
13 | if (freopen_s(&unused, "CONOUT$", "w", stdout)) {
14 | _dup2(_fileno(stdout), 1);
15 | }
16 | if (freopen_s(&unused, "CONOUT$", "w", stderr)) {
17 | _dup2(_fileno(stdout), 2);
18 | }
19 | std::ios::sync_with_stdio();
20 | FlutterDesktopResyncOutputStreams();
21 | }
22 | }
23 |
24 | std::vector GetCommandLineArguments() {
25 | // Convert the UTF-16 command line arguments to UTF-8 for the Engine to use.
26 | int argc;
27 | wchar_t** argv = ::CommandLineToArgvW(::GetCommandLineW(), &argc);
28 | if (argv == nullptr) {
29 | return std::vector();
30 | }
31 |
32 | std::vector command_line_arguments;
33 |
34 | // Skip the first argument as it's the binary name.
35 | for (int i = 1; i < argc; i++) {
36 | command_line_arguments.push_back(Utf8FromUtf16(argv[i]));
37 | }
38 |
39 | ::LocalFree(argv);
40 |
41 | return command_line_arguments;
42 | }
43 |
44 | std::string Utf8FromUtf16(const wchar_t* utf16_string) {
45 | if (utf16_string == nullptr) {
46 | return std::string();
47 | }
48 | int target_length = ::WideCharToMultiByte(
49 | CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string,
50 | -1, nullptr, 0, nullptr, nullptr);
51 | std::string utf8_string;
52 | if (target_length == 0 || target_length > utf8_string.max_size()) {
53 | return utf8_string;
54 | }
55 | utf8_string.resize(target_length);
56 | int converted_length = ::WideCharToMultiByte(
57 | CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string,
58 | -1, utf8_string.data(),
59 | target_length, nullptr, nullptr);
60 | if (converted_length == 0) {
61 | return std::string();
62 | }
63 | return utf8_string;
64 | }
65 |
--------------------------------------------------------------------------------
/example/windows/runner/utils.cpp:
--------------------------------------------------------------------------------
1 | #include "utils.h"
2 |
3 | #include
4 | #include
5 | #include
6 | #include
7 |
8 | #include
9 |
10 | void CreateAndAttachConsole() {
11 | if (::AllocConsole()) {
12 | FILE *unused;
13 | if (freopen_s(&unused, "CONOUT$", "w", stdout)) {
14 | _dup2(_fileno(stdout), 1);
15 | }
16 | if (freopen_s(&unused, "CONOUT$", "w", stderr)) {
17 | _dup2(_fileno(stdout), 2);
18 | }
19 | std::ios::sync_with_stdio();
20 | FlutterDesktopResyncOutputStreams();
21 | }
22 | }
23 |
24 | std::vector GetCommandLineArguments() {
25 | // Convert the UTF-16 command line arguments to UTF-8 for the Engine to use.
26 | int argc;
27 | wchar_t** argv = ::CommandLineToArgvW(::GetCommandLineW(), &argc);
28 | if (argv == nullptr) {
29 | return std::vector();
30 | }
31 |
32 | std::vector command_line_arguments;
33 |
34 | // Skip the first argument as it's the binary name.
35 | for (int i = 1; i < argc; i++) {
36 | command_line_arguments.push_back(Utf8FromUtf16(argv[i]));
37 | }
38 |
39 | ::LocalFree(argv);
40 |
41 | return command_line_arguments;
42 | }
43 |
44 | std::string Utf8FromUtf16(const wchar_t* utf16_string) {
45 | if (utf16_string == nullptr) {
46 | return std::string();
47 | }
48 | int target_length = ::WideCharToMultiByte(
49 | CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string,
50 | -1, nullptr, 0, nullptr, nullptr)
51 | -1; // remove the trailing null character
52 | int input_length = (int)wcslen(utf16_string);
53 | std::string utf8_string;
54 | if (target_length <= 0 || target_length > utf8_string.max_size()) {
55 | return utf8_string;
56 | }
57 | utf8_string.resize(target_length);
58 | int converted_length = ::WideCharToMultiByte(
59 | CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string,
60 | input_length, utf8_string.data(), target_length, nullptr, nullptr);
61 | if (converted_length == 0) {
62 | return std::string();
63 | }
64 | return utf8_string;
65 | }
66 |
--------------------------------------------------------------------------------
/example/web/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 | example
33 |
34 |
35 |
39 |
40 |
41 |
42 |
43 |
58 |
59 |
60 |
--------------------------------------------------------------------------------
/web/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 | flutter_kline
33 |
34 |
35 |
39 |
40 |
41 |
42 |
43 |
58 |
59 |
60 |
--------------------------------------------------------------------------------
/example/windows/runner/flutter_window.cpp:
--------------------------------------------------------------------------------
1 | #include "flutter_window.h"
2 |
3 | #include
4 |
5 | #include "flutter/generated_plugin_registrant.h"
6 |
7 | FlutterWindow::FlutterWindow(const flutter::DartProject& project)
8 | : project_(project) {}
9 |
10 | FlutterWindow::~FlutterWindow() {}
11 |
12 | bool FlutterWindow::OnCreate() {
13 | if (!Win32Window::OnCreate()) {
14 | return false;
15 | }
16 |
17 | RECT frame = GetClientArea();
18 |
19 | // The size here must match the window dimensions to avoid unnecessary surface
20 | // creation / destruction in the startup path.
21 | flutter_controller_ = std::make_unique(
22 | frame.right - frame.left, frame.bottom - frame.top, project_);
23 | // Ensure that basic setup of the controller was successful.
24 | if (!flutter_controller_->engine() || !flutter_controller_->view()) {
25 | return false;
26 | }
27 | RegisterPlugins(flutter_controller_->engine());
28 | SetChildContent(flutter_controller_->view()->GetNativeWindow());
29 |
30 | flutter_controller_->engine()->SetNextFrameCallback([&]() {
31 | this->Show();
32 | });
33 |
34 | return true;
35 | }
36 |
37 | void FlutterWindow::OnDestroy() {
38 | if (flutter_controller_) {
39 | flutter_controller_ = nullptr;
40 | }
41 |
42 | Win32Window::OnDestroy();
43 | }
44 |
45 | LRESULT
46 | FlutterWindow::MessageHandler(HWND hwnd, UINT const message,
47 | WPARAM const wparam,
48 | LPARAM const lparam) noexcept {
49 | // Give Flutter, including plugins, an opportunity to handle window messages.
50 | if (flutter_controller_) {
51 | std::optional result =
52 | flutter_controller_->HandleTopLevelWindowProc(hwnd, message, wparam,
53 | lparam);
54 | if (result) {
55 | return *result;
56 | }
57 | }
58 |
59 | switch (message) {
60 | case WM_FONTCHANGE:
61 | flutter_controller_->engine()->ReloadSystemFonts();
62 | break;
63 | }
64 |
65 | return Win32Window::MessageHandler(hwnd, message, wparam, lparam);
66 | }
67 |
--------------------------------------------------------------------------------
/example/lib/data/example_badge_data.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:flutter_kline/chart/badge_chart.dart';
3 | import 'package:flutter_kline/widget/bs_point_widget.dart';
4 |
5 |
6 | class ExampleBadgeData {
7 | static BadgeChart get badgeChartVo {
8 | List dataList = [];
9 | for (int i = 0; i < 794; ++i) {
10 | dataList.add(null);
11 | }
12 | dataList.addAll([
13 | BadgeChartData(
14 | id: '20230811',
15 | minSize: const Size(20, 30),
16 | widget: const BsPointWidget.buy(),
17 | invertWidget: const BsPointWidget.buy(invert: true,),
18 | value: 12.7,
19 | invertValue: 11.89,
20 | ),
21 | null,
22 | BadgeChartData(
23 | id: '20230815',
24 | minSize: const Size(20, 30),
25 | widget: const BsPointWidget.buy(),
26 | invertWidget: const BsPointWidget.buy(invert: true,),
27 | value: 11.80,
28 | invertValue: 11.60,
29 | ),
30 | null,
31 | null,
32 | BadgeChartData(
33 | id: '20230818',
34 | minSize: const Size(20, 30),
35 | widget: const BsPointWidget.sell(),
36 | invertWidget: const BsPointWidget.sell(invert: true,),
37 | value: 11.74,
38 | invertValue: 11.53,
39 | ),
40 | ]);
41 |
42 | return BadgeChart(id: 'BadgeChartVo', data: dataList);
43 | }
44 |
45 | static BadgeChart get volBadgeChartVo {
46 | List dataList = [];
47 | for (int i = 0; i < 796; ++i) {
48 | dataList.add(null);
49 | }
50 | dataList.addAll([
51 | BadgeChartData(
52 | id: '20230815',
53 | minSize: const Size(20, 30),
54 | widget: const BsPointWidget.buy(),
55 | invertWidget: const BsPointWidget.buy(invert: true,),
56 | ),
57 | null,
58 | null,
59 | BadgeChartData(
60 | id: '20230818',
61 | minSize: const Size(20, 30),
62 | widget: const BsPointWidget.sell(),
63 | invertWidget: const BsPointWidget.sell(invert: true,),
64 | ),
65 | ]);
66 |
67 | return BadgeChart(id: "BadgeChartVo", data: dataList);
68 | }
69 | }
70 |
--------------------------------------------------------------------------------
/lib/common/utils/kline_num_util.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter_kline/common/pair.dart';
2 |
3 | class KlineNumUtil {
4 | /// 找出和 [target] 相差最多的数
5 | static double findNumberWithMaxDifference(List dataList, double target) {
6 | // 初始化最大差值为负数,确保第一个元素肯定会大于该值
7 | double maxDifference = -1;
8 | double result = target;
9 |
10 | for (double? number in dataList) {
11 | if (number == null) {
12 | continue;
13 | }
14 | double difference = (number - target).abs();
15 | if (difference > maxDifference) {
16 | maxDifference = difference;
17 | result = number;
18 | }
19 | }
20 |
21 | return result;
22 | }
23 |
24 | /// 提取最大最小值。
25 | /// @return Pair left 是最大值;Pair right 是最小值。
26 | static Pair? maxMinValue(List? dataList) {
27 | if (dataList == null ||
28 | dataList.isEmpty ||
29 | dataList.every((element) => element == null)) {
30 | return null;
31 | }
32 |
33 | Pair result =
34 | Pair(left: -double.maxFinite, right: double.maxFinite);
35 |
36 | for (var data in dataList) {
37 | if (data == null) {
38 | continue;
39 | }
40 |
41 | if (data > result.left) {
42 | result.left = data;
43 | }
44 |
45 | if (data < result.right) {
46 | result.right = data;
47 | }
48 | }
49 |
50 | return result;
51 | }
52 |
53 | static Pair maxMinValueDouble(List? dataList) {
54 | var value = maxMinValue(dataList);
55 | return Pair(
56 | left: value?.left.toDouble() ?? -double.maxFinite,
57 | right: value?.right.toDouble() ?? double.maxFinite);
58 | }
59 |
60 | /// 格式化数字,返回带单位的结果
61 | static String formatNumberUnit(double? number) {
62 | if (number == null || number == 0) {
63 | return '0';
64 | } else if (number >= 100000000 || number <= -100000000) {
65 | double result = number / 100000000.0;
66 | return '${result.toStringAsFixed(2)}亿';
67 | } else if (number >= 10000 || number <= -10000) {
68 | double result = number / 10000.0;
69 | return '${result.toStringAsFixed(2)}万';
70 | } else {
71 | return number.toStringAsFixed(2);
72 | }
73 | }
74 | }
75 |
--------------------------------------------------------------------------------
/windows/runner/flutter_window.cpp:
--------------------------------------------------------------------------------
1 | #include "flutter_window.h"
2 |
3 | #include
4 |
5 | #include "flutter/generated_plugin_registrant.h"
6 |
7 | FlutterWindow::FlutterWindow(const flutter::DartProject& project)
8 | : project_(project) {}
9 |
10 | FlutterWindow::~FlutterWindow() {}
11 |
12 | bool FlutterWindow::OnCreate() {
13 | if (!Win32Window::OnCreate()) {
14 | return false;
15 | }
16 |
17 | RECT frame = GetClientArea();
18 |
19 | // The size here must match the window dimensions to avoid unnecessary surface
20 | // creation / destruction in the startup path.
21 | flutter_controller_ = std::make_unique(
22 | frame.right - frame.left, frame.bottom - frame.top, project_);
23 | // Ensure that basic setup of the controller was successful.
24 | if (!flutter_controller_->engine() || !flutter_controller_->view()) {
25 | return false;
26 | }
27 | RegisterPlugins(flutter_controller_->engine());
28 | SetChildContent(flutter_controller_->view()->GetNativeWindow());
29 |
30 | flutter_controller_->engine()->SetNextFrameCallback([&]() {
31 | this->Show();
32 | });
33 |
34 | // Flutter can complete the first frame before the "show window" callback is
35 | // registered. The following call ensures a frame is pending to ensure the
36 | // window is shown. It is a no-op if the first frame hasn't completed yet.
37 | flutter_controller_->ForceRedraw();
38 |
39 | return true;
40 | }
41 |
42 | void FlutterWindow::OnDestroy() {
43 | if (flutter_controller_) {
44 | flutter_controller_ = nullptr;
45 | }
46 |
47 | Win32Window::OnDestroy();
48 | }
49 |
50 | LRESULT
51 | FlutterWindow::MessageHandler(HWND hwnd, UINT const message,
52 | WPARAM const wparam,
53 | LPARAM const lparam) noexcept {
54 | // Give Flutter, including plugins, an opportunity to handle window messages.
55 | if (flutter_controller_) {
56 | std::optional result =
57 | flutter_controller_->HandleTopLevelWindowProc(hwnd, message, wparam,
58 | lparam);
59 | if (result) {
60 | return *result;
61 | }
62 | }
63 |
64 | switch (message) {
65 | case WM_FONTCHANGE:
66 | flutter_controller_->engine()->ReloadSystemFonts();
67 | break;
68 | }
69 |
70 | return Win32Window::MessageHandler(hwnd, message, wparam, lparam);
71 | }
72 |
--------------------------------------------------------------------------------
/android/app/build.gradle:
--------------------------------------------------------------------------------
1 | def localProperties = new Properties()
2 | def localPropertiesFile = rootProject.file('local.properties')
3 | if (localPropertiesFile.exists()) {
4 | localPropertiesFile.withReader('UTF-8') { reader ->
5 | localProperties.load(reader)
6 | }
7 | }
8 |
9 | def flutterRoot = localProperties.getProperty('flutter.sdk')
10 | if (flutterRoot == null) {
11 | throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
12 | }
13 |
14 | def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
15 | if (flutterVersionCode == null) {
16 | flutterVersionCode = '1'
17 | }
18 |
19 | def flutterVersionName = localProperties.getProperty('flutter.versionName')
20 | if (flutterVersionName == null) {
21 | flutterVersionName = '1.0'
22 | }
23 |
24 | apply plugin: 'com.android.application'
25 | apply plugin: 'kotlin-android'
26 | apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
27 |
28 | android {
29 | compileSdkVersion flutter.compileSdkVersion
30 | ndkVersion flutter.ndkVersion
31 |
32 | compileOptions {
33 | sourceCompatibility JavaVersion.VERSION_1_8
34 | targetCompatibility JavaVersion.VERSION_1_8
35 | }
36 |
37 | kotlinOptions {
38 | jvmTarget = '1.8'
39 | }
40 |
41 | sourceSets {
42 | main.java.srcDirs += 'src/main/kotlin'
43 | }
44 |
45 | defaultConfig {
46 | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
47 | applicationId "com.example.flutter_kline"
48 | // You can update the following values to match your application needs.
49 | // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
50 | minSdkVersion flutter.minSdkVersion
51 | targetSdkVersion flutter.targetSdkVersion
52 | versionCode flutterVersionCode.toInteger()
53 | versionName flutterVersionName
54 | }
55 |
56 | buildTypes {
57 | release {
58 | // TODO: Add your own signing config for the release build.
59 | // Signing with the debug keys for now, so `flutter run --release` works.
60 | signingConfig signingConfigs.debug
61 | }
62 | }
63 | }
64 |
65 | flutter {
66 | source '../..'
67 | }
68 |
69 | dependencies {
70 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
71 | }
72 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/example/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 |
--------------------------------------------------------------------------------
/example/android/app/build.gradle:
--------------------------------------------------------------------------------
1 | def localProperties = new Properties()
2 | def localPropertiesFile = rootProject.file('local.properties')
3 | if (localPropertiesFile.exists()) {
4 | localPropertiesFile.withReader('UTF-8') { reader ->
5 | localProperties.load(reader)
6 | }
7 | }
8 |
9 | def flutterRoot = localProperties.getProperty('flutter.sdk')
10 | if (flutterRoot == null) {
11 | throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
12 | }
13 |
14 | def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
15 | if (flutterVersionCode == null) {
16 | flutterVersionCode = '1'
17 | }
18 |
19 | def flutterVersionName = localProperties.getProperty('flutter.versionName')
20 | if (flutterVersionName == null) {
21 | flutterVersionName = '1.0'
22 | }
23 |
24 | apply plugin: 'com.android.application'
25 | apply plugin: 'kotlin-android'
26 | apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
27 |
28 | android {
29 | namespace "com.example.example"
30 | compileSdkVersion flutter.compileSdkVersion
31 | ndkVersion flutter.ndkVersion
32 |
33 | compileOptions {
34 | sourceCompatibility JavaVersion.VERSION_1_8
35 | targetCompatibility JavaVersion.VERSION_1_8
36 | }
37 |
38 | kotlinOptions {
39 | jvmTarget = '1.8'
40 | }
41 |
42 | sourceSets {
43 | main.java.srcDirs += 'src/main/kotlin'
44 | }
45 |
46 | defaultConfig {
47 | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
48 | applicationId "com.example.example"
49 | // You can update the following values to match your application needs.
50 | // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
51 | minSdkVersion flutter.minSdkVersion
52 | targetSdkVersion flutter.targetSdkVersion
53 | versionCode flutterVersionCode.toInteger()
54 | versionName flutterVersionName
55 | }
56 |
57 | buildTypes {
58 | release {
59 | // TODO: Add your own signing config for the release build.
60 | // Signing with the debug keys for now, so `flutter run --release` works.
61 | signingConfig signingConfigs.debug
62 | }
63 | }
64 | }
65 |
66 | flutter {
67 | source '../..'
68 | }
69 |
70 | dependencies {
71 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
72 | }
73 |
--------------------------------------------------------------------------------
/lib/widget/candlestick_show_data_widget.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:flutter_kline/common/kline_config.dart';
3 |
4 | import '../chart/candlestick_chart.dart';
5 | import '../common/utils/kline_date_util.dart';
6 |
7 | /// 蜡烛图显示数据
8 | class CandlestickShowDataWidget extends StatelessWidget {
9 | const CandlestickShowDataWidget({
10 | super.key,
11 | required this.vo,
12 | this.builder,
13 | });
14 |
15 | final CandlestickChartData vo;
16 |
17 | final double _leftPadding = 10;
18 |
19 | final Widget Function(CandlestickChartData data)? builder;
20 |
21 | @override
22 | Widget build(BuildContext context) {
23 | return Container(
24 | width: MediaQuery.of(context).size.width,
25 | height: 40,
26 | color: const Color(0xFFF5F5F5),
27 | child: builder == null ? _defaultWidget : builder!(vo),
28 | );
29 | }
30 |
31 | Widget get _defaultWidget {
32 | return Row(
33 | crossAxisAlignment: CrossAxisAlignment.center,
34 | children: [
35 | SizedBox(
36 | width: _leftPadding,
37 | ),
38 | Expanded(
39 | child: Text(
40 | KlineDateUtil.formatDate(date: vo.dateTime),
41 | style: const TextStyle(
42 | color: Colors.black, fontSize: KlineConfig.showDataFontSize),
43 | ),
44 | ),
45 | Expanded(
46 | child: Column(
47 | mainAxisAlignment: MainAxisAlignment.center,
48 | children: [
49 | Text(
50 | '开 ${vo.open.toStringAsFixed(2)}',
51 | style:
52 | const TextStyle(fontSize: KlineConfig.showDataFontSize),
53 | ),
54 | Text('收 ${vo.close.toStringAsFixed(2)}',
55 | style: const TextStyle(
56 | fontSize: KlineConfig.showDataFontSize)),
57 | ],
58 | ),
59 | ),
60 | Expanded(
61 | child: Column(
62 | mainAxisAlignment: MainAxisAlignment.center,
63 | children: [
64 | Text('高 ${vo.high.toStringAsFixed(2)}',
65 | style: const TextStyle(
66 | fontSize: KlineConfig.showDataFontSize)),
67 | Text('低 ${vo.low.toStringAsFixed(2)}',
68 | style: const TextStyle(
69 | fontSize: KlineConfig.showDataFontSize)),
70 | ],
71 | ),
72 | ),
73 | SizedBox(
74 | width: _leftPadding,
75 | ),
76 | ],
77 | );
78 | }
79 | }
80 |
--------------------------------------------------------------------------------
/lib/painter/price_line_painter.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:flutter_kline/common/kline_config.dart';
3 | import 'package:flutter_kline/common/pair.dart';
4 | import 'package:flutter_kline/painter/triangle_painter.dart';
5 |
6 | import '../common/utils/kline_util.dart';
7 |
8 | /// 价格线
9 | class PriceLinePainter extends CustomPainter {
10 | /// 价格
11 | final double price;
12 | final Pair maxMinValue;
13 | final PriceLinePainterStyle? style;
14 |
15 | const PriceLinePainter(
16 | {required this.price, required this.maxMinValue, this.style});
17 |
18 | @override
19 | void paint(Canvas canvas, Size size) {
20 | // 超出范围,直接结束
21 | if (price > maxMinValue.left || price < maxMinValue.right) {
22 | return;
23 | }
24 |
25 | canvas.save();
26 |
27 | PriceLinePainterStyle style = this.style ?? const PriceLinePainterStyle();
28 | var paint = Paint()
29 | ..color = style.color
30 | ..strokeWidth = style.paintStrokeWidth;
31 |
32 | // 计算y轴位置
33 | double y = KlineUtil.computeYAxis(
34 | maxMinValue: maxMinValue,
35 | maxHeight: size.height,
36 | value: price,
37 | );
38 |
39 | // 计算有多少段线
40 | double eachLineWidthAndGap = style.lineGap + style.eachLineWidth;
41 | int lineCount = (size.width ~/ eachLineWidthAndGap).toInt();
42 | for (int i = 0; i < lineCount; ++i) {
43 | canvas.drawLine(Offset(0, y), Offset(style.eachLineWidth, y), paint);
44 | canvas.translate(eachLineWidthAndGap, 0);
45 | }
46 |
47 | double triangleSize = 5;
48 | // 将画图起始点移到对的位置。
49 | canvas.translate(-1, y - triangleSize / 2);
50 | TrianglePainter(fillColor: style.color)
51 | .paint(canvas, Size(triangleSize, triangleSize));
52 | canvas.restore();
53 | }
54 |
55 | @override
56 | bool shouldRepaint(covariant CustomPainter oldDelegate) {
57 | if (oldDelegate is! PriceLinePainter) {
58 | return true;
59 | }
60 |
61 | return oldDelegate.price != price ||
62 | oldDelegate.maxMinValue.left != maxMinValue.left ||
63 | oldDelegate.maxMinValue.right != maxMinValue.right;
64 | }
65 | }
66 |
67 | /// 价格线样式
68 | class PriceLinePainterStyle {
69 | /// 颜色
70 | final Color color;
71 |
72 | /// 画线宽度
73 | final double paintStrokeWidth;
74 |
75 | /// 每段线宽度
76 | final double eachLineWidth;
77 |
78 | /// 线间隔
79 | final double lineGap;
80 |
81 | const PriceLinePainterStyle({
82 | this.color = KlineConfig.realTimeLineColor,
83 | this.paintStrokeWidth = 1.0,
84 | this.eachLineWidth = 4,
85 | this.lineGap = 1.8,
86 | });
87 | }
88 |
--------------------------------------------------------------------------------
/lib/painter/vertical_line_chart_painter.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | import '../chart/vertical_line_chart.dart';
4 | import '../common/pair.dart';
5 | import '../common/utils/kline_util.dart';
6 |
7 | /// 竖线 painter
8 | class VerticalLineChartPainter extends CustomPainter {
9 | VerticalLineChartPainter({
10 | required this.data,
11 | required this.maxMinValue,
12 | required this.pointWidth,
13 | required this.pointGap,
14 | });
15 |
16 | VerticalLineChart data;
17 | Pair maxMinValue;
18 | double pointWidth;
19 | double pointGap;
20 |
21 | @override
22 | void paint(Canvas canvas, Size size) {
23 | if (data.dataLength == 0) {
24 | return;
25 | }
26 |
27 | // 生成图数据
28 | List chartData = _chartData(size: size);
29 |
30 | const Color defaultColor = Colors.black;
31 | Paint paint = Paint()
32 | ..color = defaultColor
33 | ..strokeWidth = 2;
34 |
35 | // 竖线 x轴相等,y轴不等
36 | for (int j = 0; j < chartData.length; j++) {
37 | VerticalLineChartData? data = chartData[j];
38 | if (data == null) {
39 | continue;
40 | }
41 |
42 | paint.color = data.color ?? defaultColor;
43 |
44 | double x = KlineUtil.computeXAxis(
45 | index: j,
46 | pointWidth: pointWidth,
47 | pointGap: pointGap,
48 | );
49 | canvas.drawLine(Offset(x, data.top), Offset(x, data.bottom), paint);
50 |
51 | paint.color = defaultColor;
52 | }
53 | }
54 |
55 | @override
56 | bool shouldRepaint(covariant CustomPainter oldDelegate) {
57 | if (oldDelegate is VerticalLineChartPainter) {
58 | return oldDelegate.data != data ||
59 | oldDelegate.maxMinValue != maxMinValue ||
60 | oldDelegate.pointWidth != pointWidth ||
61 | oldDelegate.pointGap != pointGap;
62 | }
63 | return true;
64 | }
65 |
66 | /// 将真实数据转成图数据
67 | List _chartData({required Size size}) {
68 | if (data.dataLength == 0) {
69 | return [];
70 | }
71 |
72 | List result = [];
73 | for (VerticalLineChartData? element in data.data) {
74 | if (element == null) {
75 | result.add(null);
76 | continue;
77 | }
78 |
79 | result.add(element.copyWith(
80 | top: KlineUtil.convertDataToChartDataSingle(element.top, size.height,
81 | maxMinValue: maxMinValue),
82 | bottom: KlineUtil.convertDataToChartDataSingle(
83 | element.bottom, size.height,
84 | maxMinValue: maxMinValue),
85 | ));
86 | }
87 |
88 | return result;
89 | }
90 | }
91 |
--------------------------------------------------------------------------------
/lib/painter/volume_profile_painter.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | import '../common/volume_profile.dart';
4 |
5 |
6 | /// 筹码峰
7 | class VolumeProfilePainter extends CustomPainter {
8 | const VolumeProfilePainter({required this.maxValue, required this.minValue, required this.dataList});
9 |
10 | /// 右边值数量
11 | static const int rightTextNum = 5;
12 |
13 | final double maxValue;
14 | final double minValue;
15 | final List dataList;
16 |
17 | @override
18 | void paint(Canvas canvas, Size size) {
19 | _drawRightText(canvas, size);
20 | _drawColumn(canvas, size);
21 | }
22 |
23 | @override
24 | bool shouldRepaint(covariant CustomPainter oldDelegate) {
25 | return true;
26 | }
27 |
28 | /// 画右边值文本
29 | void _drawRightText(Canvas canvas, Size size) {
30 | TextStyle textStyle = const TextStyle(fontSize: 8, color: Colors.grey);
31 |
32 | TextPainter textPainter = TextPainter(
33 | text: TextSpan(text: maxValue.toStringAsFixed(2), style: textStyle),
34 | textDirection: TextDirection.ltr,
35 | );
36 | textPainter.layout();
37 | textPainter.paint(canvas, Offset(size.width - textPainter.width, 0));
38 |
39 | // 计算一份文本占用的高度空间
40 | double textSpaceHeight = size.height / rightTextNum;
41 |
42 | // 画中间值
43 | for (int i = 0; i < (rightTextNum - 2); ++i) {
44 | double y = (i + 1) * (textPainter.height + textSpaceHeight);
45 | int index = y ~/ (size.height / dataList.length);
46 |
47 | textPainter.text = TextSpan(text: dataList[index].price.toStringAsFixed(2), style: textStyle);
48 | textPainter.layout();
49 | textPainter.paint(canvas, Offset(size.width - textPainter.width, y - textPainter.height / 2));
50 | }
51 |
52 | textPainter.text = TextSpan(text: minValue.toStringAsFixed(2), style: textStyle);
53 | textPainter.layout();
54 | textPainter.paint(canvas, Offset(size.width - textPainter.width, size.height - textPainter.height));
55 | }
56 |
57 | /// 画资金柱体
58 | void _drawColumn(Canvas canvas, Size size) {
59 | if (dataList.isEmpty) {
60 | return;
61 | }
62 |
63 | // 柱高
64 | double columnHeight = size.height / dataList.length;
65 | Paint paint = Paint()
66 | ..style = PaintingStyle.fill
67 | ..color = Colors.red
68 | ..strokeWidth = 1;
69 |
70 | double top = 0;
71 | double bottom = columnHeight;
72 | for (var data in dataList) {
73 | paint.color = data.color;
74 | double right = (size.width - 4) * (data.percent.clamp(0, 1));
75 | canvas.drawRect(Rect.fromLTRB(0, top, right, bottom), paint);
76 |
77 | top += columnHeight;
78 | bottom += columnHeight;
79 | }
80 | }
81 | }
82 |
--------------------------------------------------------------------------------
/example/lib/data/example_volume_profile_widget.dart:
--------------------------------------------------------------------------------
1 | import 'dart:async';
2 |
3 | import 'package:flutter/material.dart';
4 | import 'package:flutter_kline/common/pair.dart';
5 | import 'package:flutter_kline/common/utils/kline_util.dart';
6 | import 'package:flutter_kline/widget/volume_profile_widget.dart';
7 |
8 | import 'example_volume_profile_data.dart';
9 |
10 | /// 筹码峰
11 | class ExampleVolumeProfileWidget extends StatefulWidget {
12 | const ExampleVolumeProfileWidget({super.key});
13 |
14 | @override
15 | State createState() => _ExampleVolumeProfileWidgetState();
16 | }
17 |
18 | class _ExampleVolumeProfileWidgetState extends State {
19 | /// 十字线流
20 | late final StreamController> _crossCurveStream;
21 |
22 | /// 十字线选中数据索引流
23 | late final StreamController _selectedChartDataIndexStream;
24 |
25 | @override
26 | void initState() {
27 | _crossCurveStream = StreamController();
28 | _selectedChartDataIndexStream = StreamController();
29 | super.initState();
30 | }
31 |
32 | @override
33 | Widget build(BuildContext context) {
34 | var dataList = ExampleVolumeProfileData.dataList;
35 | return Padding(
36 | padding: const EdgeInsets.all(8.0),
37 | child: Column(
38 | children: [
39 | SizedBox(
40 | height: 300,
41 | width: 200,
42 | // color: Colors.yellow,
43 | child: GestureDetector(
44 | onTap: () {
45 | _crossCurveStream.add(Pair(left: null, right: null));
46 | },
47 | onHorizontalDragUpdate: (details) {
48 | _crossCurveStream.add(Pair(left: details.globalPosition.dx, right: details.globalPosition.dy));
49 | },
50 | child: VolumeProfileWidget(
51 | maxValue: 27.94,
52 | minValue: 0.07,
53 | dataList: dataList,
54 | crossCurveStream: _crossCurveStream,
55 | selectedChartDataIndexStream: _selectedChartDataIndexStream,
56 | ),
57 | ),
58 | ),
59 |
60 | StreamBuilder(
61 | stream: _selectedChartDataIndexStream.stream,
62 | builder: (context, snapshot) {
63 | KlineUtil.logd("volume profile cross curve selected data: ${snapshot.data}, dataList length: ${dataList.length}");
64 | int idx = snapshot.data == null || snapshot.data! < 0 ? 0 : snapshot.data!;
65 | idx = idx > dataList.length - 1 ? dataList.length - 1 : idx;
66 |
67 | return Text(dataList[idx].price.toStringAsFixed(2));
68 | }
69 | ),
70 | ],
71 | ),
72 | );
73 | }
74 | }
75 |
--------------------------------------------------------------------------------
/example/lib/main.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:flutter/services.dart';
3 | import 'package:flutter_kline/common/widget/double_back_exit_app_widget.dart';
4 |
5 | import 'data/example_candlestick_data.dart';
6 | import 'data/example_day_widget.dart';
7 | import 'data/example_minute_widget.dart';
8 |
9 | void main() {
10 | WidgetsFlutterBinding.ensureInitialized();
11 | ExampleCandlestickData.getCandlestickData();
12 | // 设置应用程序的方向为竖屏(只允许竖屏显示)
13 | SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp])
14 | .then((_) {
15 | runApp(const MyApp());
16 | });
17 | }
18 |
19 | class MyApp extends StatelessWidget {
20 | const MyApp({super.key});
21 |
22 | @override
23 | Widget build(BuildContext context) {
24 | return MaterialApp(
25 | title: 'Flutter Demo',
26 | theme: ThemeData(
27 | primarySwatch: Colors.blue,
28 | ),
29 | home: const DoubleBackExitAppWidget(
30 | child: MyHomePage(title: 'Flutter Kline')),
31 | );
32 | }
33 | }
34 |
35 | class MyHomePage extends StatefulWidget {
36 | const MyHomePage({super.key, required this.title});
37 |
38 | final String title;
39 |
40 | @override
41 | State createState() => _MyHomePageState();
42 | }
43 |
44 | class _MyHomePageState extends State {
45 | final GlobalKey _globalKey = GlobalKey();
46 |
47 | @override
48 | Widget build(BuildContext context) {
49 | return DefaultTabController(
50 | length: 2,
51 | initialIndex: 1,
52 | child: Scaffold(
53 | appBar: AppBar(
54 | title: Text(widget.title),
55 | ),
56 | body: Column(
57 | children: [
58 | TabBar(key: _globalKey, tabs: const [
59 | Tab(
60 | child: Text(
61 | '分时',
62 | style: TextStyle(color: Colors.black),
63 | ),
64 | ),
65 | Tab(
66 | child: Text(
67 | '日K',
68 | style: TextStyle(color: Colors.black),
69 | ),
70 | ),
71 | /*Tab(
72 | child: Text(
73 | '筹码峰',
74 | style: TextStyle(color: Colors.black),
75 | ),
76 | ),*/
77 | ]),
78 | Expanded(
79 | child: TabBarView(children: [
80 | ExampleMinuteWidget(
81 | overlayEntryLocationKey: _globalKey,
82 | ),
83 | ExampleDayWidget(
84 | overlayEntryLocationKey: _globalKey,
85 | ),
86 | // const ExampleVolumeProfileWidget(),
87 | ]),
88 | )
89 | ],
90 | ),
91 | ),
92 | );
93 | }
94 | }
95 |
--------------------------------------------------------------------------------
/lib/common/utils/kline_date_util.dart:
--------------------------------------------------------------------------------
1 | /// 时间工具类
2 | class KlineDateUtil {
3 | /// 格式化日期
4 | /// [date] 日期
5 | /// [spaceCharacter] 间隔符
6 | static String formatDate({
7 | required DateTime? date,
8 | String spaceCharacter = '/',
9 | String timeSpaceCharacter = ':',
10 | DateTimeFormatType formatType = DateTimeFormatType.dateTimeNoSecond,
11 | }) {
12 | if (date == null) {
13 | return '';
14 | }
15 |
16 | String month = date.month.toString().padLeft(2, '0');
17 | String day = date.day.toString().padLeft(2, '0');
18 |
19 | if (formatType == DateTimeFormatType.date) {
20 | return '${date.year}$spaceCharacter$month$spaceCharacter$day';
21 | }
22 |
23 | String hour = date.hour.toString().padLeft(2, '0');
24 | String minute = date.minute.toString().padLeft(2, '0');
25 |
26 | if (formatType == DateTimeFormatType.time) {
27 | return '$hour$timeSpaceCharacter$minute';
28 | }
29 |
30 | if (formatType == DateTimeFormatType.dateTimeNoSecond) {
31 | return '${date.year}$spaceCharacter$month$spaceCharacter$day $hour$timeSpaceCharacter$minute';
32 | }
33 |
34 | String second = date.second.toString().padLeft(2, '0');
35 | return '${date.year}$spaceCharacter$month$spaceCharacter$day $hour$timeSpaceCharacter$minute$timeSpaceCharacter$second';
36 | }
37 |
38 | /// 格式化时间
39 | static String formatTime(
40 | {required DateTime? dateTime, String spaceCharacter = ':'}) {
41 | if (dateTime == null) {
42 | return '';
43 | }
44 |
45 | String minuteStr = dateTime.minute < 10
46 | ? '0${dateTime.minute}'
47 | : dateTime.minute.toString();
48 | return '${dateTime.hour}$spaceCharacter$minuteStr';
49 | }
50 |
51 | static DateTime parseIntDateToDateTime(int intDate) {
52 | var dateStr = intDate.toString();
53 | int year = int.parse(dateStr.substring(0, 4));
54 | int month = int.parse(dateStr.substring(4, 6));
55 | int day = int.parse(dateStr.substring(6, 8));
56 | return DateTime(year, month, day);
57 | }
58 |
59 | static DateTime? parseIntTime(int time) {
60 | if (time < 0 || time > 2359) {
61 | return null;
62 | }
63 |
64 | // 提取小时和分钟部分
65 | int hour = time ~/ 100; // 整除得到小时
66 | int minute = time % 100; // 取余得到分钟
67 |
68 | if (hour < 0 || hour > 23 || minute < 0 || minute > 59) {
69 | return null;
70 | }
71 |
72 | // 构建时间字符串
73 | String hourStr = hour.toString().padLeft(2, '0'); // 补0,确保两位数字
74 | String minuteStr = minute.toString().padLeft(2, '0'); // 补0,确保两位数字
75 |
76 | DateTime now = DateTime.now();
77 | return DateTime(
78 | now.year,
79 | now.month,
80 | now.day,
81 | int.parse(hourStr),
82 | int.parse(minuteStr),
83 | );
84 | }
85 | }
86 |
87 |
88 | enum DateTimeFormatType {
89 | dateTime,
90 | time,
91 | date,
92 | dateTimeNoSecond,
93 | }
94 |
--------------------------------------------------------------------------------
/lib/widget/sub_chart_show_data_widget.dart:
--------------------------------------------------------------------------------
1 | import 'dart:async';
2 |
3 | import 'package:flutter/material.dart';
4 | import 'package:flutter_kline/common/kline_config.dart';
5 |
6 | import '../common/chart_show_data_item_vo.dart';
7 | import '../common/utils/kline_num_util.dart';
8 |
9 |
10 | /// 图显示的信息栏
11 | /// 例如:MA MA13:11.37 MA34:12.15
12 | class SubChartShowDataWidget extends StatelessWidget {
13 | const SubChartShowDataWidget({
14 | super.key,
15 | required this.name,
16 | required this.onTapName,
17 | this.initData,
18 | required this.chartShowDataItemsStream,
19 | });
20 |
21 | final String name;
22 | final GestureTapCallback? onTapName;
23 | final List? initData;
24 | final StreamController> chartShowDataItemsStream;
25 |
26 | @override
27 | Widget build(BuildContext context) {
28 | return SizedBox(
29 | height: KlineConfig.showDataSpaceSize,
30 | child: Row(mainAxisAlignment: MainAxisAlignment.center, children: [
31 | InkWell(
32 | onTap: onTapName,
33 | child: Row(
34 | children: [
35 | Text(
36 | name,
37 | style:
38 | const TextStyle(fontSize: KlineConfig.showDataFontSize),
39 | ),
40 | const Icon(
41 | Icons.arrow_drop_down,
42 | size: KlineConfig.showDataIconSize,
43 | ),
44 | ],
45 | ),
46 | ),
47 | Expanded(
48 | child: StreamBuilder>(
49 | initialData: initData,
50 | stream: chartShowDataItemsStream.stream,
51 | builder: (context, snapshot) {
52 | var data = snapshot.data;
53 |
54 | return ListView(
55 | scrollDirection: Axis.horizontal,
56 | children: data
57 | ?.where((element) => element.value != null)
58 | .map((e) => Padding(
59 | padding: const EdgeInsets.only(right: 5),
60 | child: Center(
61 | child: Text(
62 | '${e.name} ${KlineNumUtil.formatNumberUnit(e.value)}',
63 | style: TextStyle(
64 | color: e.color,
65 | fontSize:
66 | KlineConfig.showDataFontSize),
67 | ),
68 | ),
69 | ))
70 | .toList() ??
71 | [],
72 | );
73 | }),
74 | )
75 | ]));
76 | }
77 | }
78 |
--------------------------------------------------------------------------------
/example_java_kline/src/main/java/com/example/example_java_kline/task/MinuteScheduleTask.java:
--------------------------------------------------------------------------------
1 | package com.example.example_java_kline.task;
2 |
3 | import java.util.ArrayList;
4 | import java.util.List;
5 |
6 | import org.springframework.context.annotation.Configuration;
7 | import org.springframework.scheduling.annotation.EnableAsync;
8 | import org.springframework.scheduling.annotation.EnableScheduling;
9 | import org.springframework.scheduling.annotation.Scheduled;
10 |
11 | import com.example.example_java_kline.example.ExampleMinuteData;
12 | import com.example.example_java_kline.vo.ResponseResult;
13 | import com.example.example_java_kline.websocket.WebSocketTest;
14 |
15 | /**
16 | * 分时定时任务
17 | */
18 | @Configuration
19 | @EnableScheduling
20 | @EnableAsync
21 | public class MinuteScheduleTask {
22 |
23 | /**
24 | * 分时 - 全部数据索引位置
25 | */
26 | private static int minuteAllIndex = 0;
27 |
28 | /**
29 | * 分时 - 单根数据
30 | */
31 | @Scheduled(fixedRate=300)
32 | private void minuteSingleTask() {
33 | // System.err.println("执行静态定时任务时间: " + LocalDateTime.now());
34 | if (ExampleMinuteData.index >= ExampleMinuteData.lineData2.size()) {
35 | ExampleMinuteData.index = 0;
36 | }
37 | List dataList = ExampleMinuteData.lineData2.get(ExampleMinuteData.index);
38 | // 时间
39 | Double date = dataList.get(8);
40 | // 值
41 | Double value = dataList.get(5);
42 | List sendData = new ArrayList<>();
43 | sendData.add(date);
44 | sendData.add(value);
45 | sendData.add(ExampleMinuteData.a1.get(ExampleMinuteData.index));
46 | ResponseResult> responseResult = ResponseResult.success("minute", sendData);
47 |
48 | WebSocketTest.sendMessage(responseResult);
49 | ExampleMinuteData.index += 1;
50 | }
51 |
52 | /**
53 | * 分时 - 全部数据
54 | */
55 | @Scheduled(fixedRate = 300)
56 | private void minuteAllTask() {
57 | // System.err.println("执行静态定时任务时间: " + LocalDateTime.now());
58 | if (minuteAllIndex >= ExampleMinuteData.lineData2.size()) {
59 | minuteAllIndex = 0;
60 | }
61 |
62 | List> sendDataList = new ArrayList<>();
63 | for (int i = 0; i <= minuteAllIndex; ++i) {
64 | List dataList = ExampleMinuteData.lineData2.get(i);
65 | // 时间
66 | Double date = dataList.get(8);
67 | // 值
68 | Double value = dataList.get(5);
69 | List sendData = new ArrayList<>();
70 | sendData.add(date);
71 | sendData.add(value);
72 | sendData.add(ExampleMinuteData.a1.get(i));
73 | sendDataList.add(sendData);
74 | }
75 |
76 | ResponseResult>> responseResult = ResponseResult.success("minuteAll", sendDataList);
77 |
78 | WebSocketTest.sendMessage(responseResult);
79 | minuteAllIndex += 1;
80 | }
81 | }
82 |
--------------------------------------------------------------------------------
/example_network/lib/example_network/example_minute_network_widget.dart:
--------------------------------------------------------------------------------
1 | import 'dart:async';
2 |
3 | import 'package:example_network/main.dart';
4 | import 'package:example_network/vo/response_result.dart';
5 | import 'package:flutter/material.dart';
6 | import 'package:flutter_kline/chart/line_chart.dart';
7 | import 'package:flutter_kline/common/chart_data.dart';
8 | import 'package:flutter_kline/common/k_chart_data_source.dart';
9 | import 'package:flutter_kline/common/kline_config.dart';
10 | import 'package:flutter_kline/common/utils/kline_util.dart';
11 | import 'package:flutter_kline/widget/k_minute_chart_widget.dart';
12 |
13 | import '../data/example_minute_data.dart';
14 |
15 | class ExampleMinuteNetworkWidget extends StatefulWidget {
16 | const ExampleMinuteNetworkWidget(
17 | {super.key, required this.overlayEntryLocationKey});
18 | final GlobalKey overlayEntryLocationKey;
19 |
20 | @override
21 | State createState() =>
22 | _ExampleMinuteNetworkWidgetState();
23 | }
24 |
25 | class _ExampleMinuteNetworkWidgetState
26 | extends State {
27 | late StreamSubscription _streamSubscription;
28 | late KChartDataSource _source;
29 | final LineChart _vo = LineChart(data: [], id: 'minute');
30 |
31 | @override
32 | void initState() {
33 | _source = KChartDataSource(
34 | showDataNum: KlineConfig.minuteDataNum,
35 | originCharts: [
36 | ChartData(id: '0', name: '分时图', baseCharts: [_vo, ...ExampleMinuteData.subDataMinute()]),
37 | // ChartData(id: '1', name: 'RMO', baseCharts: [ExampleRmoData.barChartDataMinute..barWidth = 4]),
38 | // ChartData(id: '2', name: 'MACD', baseCharts: ExampleMacdData.macdMinute)
39 | ]);
40 | // 监听websocket数据
41 | _streamSubscription = webSocketChannelStream.listen((data) {
42 | if (data == null) {
43 | return;
44 | }
45 |
46 | ResponseResult responseResult = responseResultFromJson(data);
47 |
48 | /// 分时图全量数据更新
49 | var lineChartDataList = responseResult.parseMinuteAllData();
50 | if (lineChartDataList?.isNotEmpty ?? false) {
51 | _source.updateData(
52 | newCharts: [
53 | ChartData(
54 | id: '0', baseCharts: [LineChart(data: lineChartDataList!, id: 'minute')])
55 | ],
56 | isEnd: true,
57 | );
58 | _source.notifyListeners();
59 | }
60 | });
61 | super.initState();
62 | }
63 |
64 | @override
65 | void dispose() {
66 | _streamSubscription.cancel();
67 | super.dispose();
68 | }
69 |
70 | @override
71 | Widget build(BuildContext context) {
72 | return KMinuteChartWidget(
73 | source: _source,
74 | middleNum: 11.39,
75 | differenceNumbers: const [11.42, 11.36],
76 | onTapIndicator: (int index) {
77 | KlineUtil.showToast(context: context, text: '点击指标索引:$index');
78 | },
79 | overlayEntryLocationKey: widget.overlayEntryLocationKey,
80 | );
81 | }
82 | }
83 |
--------------------------------------------------------------------------------
/lib/widget/main_chart_show_data_widget.dart:
--------------------------------------------------------------------------------
1 | import 'dart:async';
2 |
3 | import 'package:flutter/material.dart';
4 |
5 | import '../common/chart_show_data_item_vo.dart';
6 | import '../common/main_chart_selected_data_vo.dart';
7 | import '../common/kline_config.dart';
8 |
9 | /// 主图信息栏
10 | class MainChartShowDataWidget extends StatelessWidget {
11 | const MainChartShowDataWidget({
12 | super.key,
13 | required this.name,
14 | required StreamController
15 | mainChartSelectedDataStream,
16 | this.initData,
17 | required this.onTap,
18 | }) : _mainChartSelectedDataStream = mainChartSelectedDataStream;
19 |
20 | final String name;
21 | final StreamController _mainChartSelectedDataStream;
22 | final MainChartSelectedDataVo? initData;
23 | final void Function() onTap;
24 |
25 | @override
26 | Widget build(BuildContext context) {
27 | return SizedBox(
28 | height: KlineConfig.showDataSpaceSize,
29 | child: Row(children: [
30 | InkWell(
31 | onTap: onTap,
32 | child: Row(
33 | children: [
34 | Text(
35 | name,
36 | style: const TextStyle(fontSize: KlineConfig.showDataFontSize),
37 | ),
38 | const Icon(
39 | Icons.arrow_drop_down,
40 | size: KlineConfig.showDataIconSize,
41 | ),
42 | ],
43 | ),
44 | ),
45 | Expanded(
46 | child: StreamBuilder(
47 | initialData: initData,
48 | stream: _mainChartSelectedDataStream.stream,
49 | builder: (context, snapshot) {
50 | List? data = snapshot.data?.lineChartList
51 | ?.where((element) => element?.value != null)
52 | .map((e) => e!)
53 | .toList();
54 |
55 | if (data == null || data.isEmpty) {
56 | return const SizedBox();
57 | }
58 |
59 | return ListView(
60 | scrollDirection: Axis.horizontal,
61 | children: data
62 | .map(
63 | (e) => _ShowDataItemWidget(e),
64 | )
65 | .toList(),
66 | );
67 | }),
68 | )
69 | ]),
70 | );
71 | }
72 | }
73 |
74 | class _ShowDataItemWidget extends StatelessWidget {
75 | const _ShowDataItemWidget(
76 | this.item,
77 | );
78 |
79 | final ChartShowDataItemVo item;
80 |
81 | @override
82 | Widget build(BuildContext context) {
83 | return Padding(
84 | padding: const EdgeInsets.only(right: 5),
85 | child: Center(
86 | child: Text(
87 | '${item.name} ${item.value?.toStringAsFixed(2)}',
88 | style: TextStyle(
89 | color: item.color,
90 | fontSize: KlineConfig.showDataFontSize,
91 | ),
92 | ),
93 | ),
94 | );
95 | }
96 | }
97 |
--------------------------------------------------------------------------------
/example_network/lib/example_network/example_day_network_widget.dart:
--------------------------------------------------------------------------------
1 | import 'package:example_network/main.dart';
2 | import 'package:example_network/vo/response_result.dart';
3 | import 'package:flutter/material.dart';
4 | import 'package:flutter_kline/chart/base_chart.dart';
5 | import 'package:flutter_kline/chart/candlestick_chart.dart';
6 | import 'package:flutter_kline/common/chart_data.dart';
7 | import 'package:flutter_kline/common/k_chart_data_source.dart';
8 | import 'package:flutter_kline/common/utils/kline_util.dart';
9 | import 'package:flutter_kline/widget/k_chart_widget.dart';
10 |
11 | /// 日K网络组件示例
12 | class ExampleDayNetworkWidget extends StatefulWidget {
13 | const ExampleDayNetworkWidget({
14 | super.key,
15 | required this.overlayEntryLocationKey,
16 | });
17 |
18 | final GlobalKey overlayEntryLocationKey;
19 |
20 | @override
21 | State createState() =>
22 | _ExampleDayNetworkWidgetState();
23 | }
24 |
25 | class _ExampleDayNetworkWidgetState extends State {
26 | late KChartDataSource _source;
27 |
28 | @override
29 | void initState() {
30 | _source = KChartDataSource(
31 | originCharts: [
32 | ChartData(id: '0', name: 'MA', baseCharts: [
33 | CandlestickChart(data: [], id: 'MA'),
34 | // ...ExampleLineData.getLineChartMA13(),
35 | // ExampleBadgeData.badgeChartVo,
36 | ]),
37 | /* ChartData(id: '1', name: 'VOL', baseCharts: [
38 | ExampleVolData.barChartData..minValue = 0,
39 | ...ExampleVolData.lineChartData,
40 | ExampleBadgeData.badgeChartVo,
41 | ]),
42 | ChartData(id: '2', name: 'RMO', baseCharts: [ExampleRmoData.barChartData..barWidth = 4]),
43 | ChartData(id: '3', name: 'MACD', baseCharts: ExampleMacdData.macd),
44 | ChartData(id: '4', name: 'ESS', baseCharts: [
45 | ExampleEssData.barChartData
46 | ..barWidth = 2
47 | ..minValue = 0,
48 | ExampleEssData.lineChartA,
49 | ExampleEssData.lineChartB
50 | ]), */
51 | ],
52 | );
53 |
54 | webSocketChannelStream.listen((data) {
55 | if (data == null) {
56 | return;
57 | }
58 |
59 | ResponseResult responseResult = responseResultFromJson(data);
60 | // KlineUtil.logd('日K initState responseResult type:${responseResult.type}');
61 | List dataList = responseResult.parseDayData(type: 'daySingle');
62 | if (dataList.isEmpty) {
63 | return;
64 | }
65 | KlineUtil.logd('更新日K数据,数据长度:${dataList.first.dataLength}');
66 | _source.updateData(newCharts: [
67 | ChartData(id: '0', baseCharts: dataList)
68 | ], isEnd: true);
69 | _source.notifyListeners();
70 | });
71 | super.initState();
72 | }
73 |
74 | @override
75 | Widget build(BuildContext context) {
76 | return KChartWidget(
77 | source: _source,
78 | onTapIndicator: (val) {
79 | KlineUtil.showToast(context: context, text: '指标索引位置:$val');
80 | },
81 | overlayEntryLocationKey: widget.overlayEntryLocationKey,
82 | );
83 | }
84 | }
85 |
--------------------------------------------------------------------------------
/lib/painter/line_chart_painter.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:flutter_kline/common/pair.dart';
3 |
4 | import '../chart/line_chart.dart';
5 | import '../common/utils/kline_num_util.dart';
6 | import '../common/utils/kline_util.dart';
7 | import 'gradient_chart_painter.dart';
8 |
9 | /// 折线图
10 | class LineChartPainter extends CustomPainter {
11 | final LineChart lineChartData;
12 | final double? pointWidth;
13 | final double pointGap;
14 | final Pair? maxMinValue;
15 |
16 | const LineChartPainter({
17 | required this.lineChartData,
18 | this.pointWidth,
19 | this.pointGap = 0,
20 | this.maxMinValue,
21 | });
22 |
23 | /// 初始化:最大最小值。
24 | Pair _initMaxMinValue() {
25 | if (this.maxMinValue != null) {
26 | return this.maxMinValue!;
27 | }
28 |
29 | Pair maxMinValue = KlineNumUtil.maxMinValueDouble(
30 | lineChartData.data.map((e) => e?.value).toList());
31 |
32 | return maxMinValue;
33 | }
34 |
35 | @override
36 | void paint(Canvas canvas, Size size) {
37 | if (lineChartData.data.isEmpty) {
38 | return;
39 | }
40 |
41 | Paint paint = Paint()
42 | ..style = PaintingStyle.stroke
43 | ..color = Colors.black
44 | ..strokeWidth = 1;
45 |
46 | Pair maxMinValue = _initMaxMinValue();
47 | // 数据点宽度,和 [lineChartData] 一一对应。
48 | double pointWidth =
49 | (this.pointWidth ?? size.width / lineChartData.dataLength);
50 |
51 | paint.color = lineChartData.color;
52 |
53 | var convertDataList = KlineUtil.convertDataToChartData(
54 | lineChartData.data.map((e) {
55 | if (e?.value == 0) {
56 | return null;
57 | }
58 |
59 | return e?.value;
60 | }).toList(),
61 | size.height,
62 | maxMinValue: maxMinValue,
63 | );
64 |
65 | double? lastX;
66 | double? lastY;
67 | for (int j = 0; j < convertDataList.length; j++) {
68 | double? data = convertDataList[j];
69 | if (data == null) {
70 | continue;
71 | }
72 |
73 | lastX ??= KlineUtil.computeXAxis(
74 | index: j, pointWidth: pointWidth, pointGap: pointGap);
75 | lastY ??= data;
76 |
77 | double x = KlineUtil.computeXAxis(
78 | index: j, pointWidth: pointWidth, pointGap: pointGap);
79 | double y = data;
80 |
81 | // KlineUtil.logd('LineChartPainter lastX $lastX, lastY $lastY, x $x, y $y, j $j, data $data, originData: ${lineChartData.data[j]?.value}');
82 | canvas.drawLine(Offset(lastX, lastY), Offset(x, y), paint);
83 | lastX = x;
84 | lastY = y;
85 | }
86 |
87 | if (lineChartData.gradient != null) {
88 | GradientChartPainter(
89 | gradient: lineChartData.gradient!,
90 | heightList: convertDataList,
91 | pointWidth: pointWidth,
92 | pointGap: pointGap,
93 | ).paint(canvas, size);
94 | }
95 | }
96 |
97 | @override
98 | bool shouldRepaint(covariant CustomPainter oldDelegate) {
99 | return true;
100 | }
101 | }
102 |
--------------------------------------------------------------------------------