├── .gitignore
├── .metadata
├── README.md
├── android
├── app
│ ├── build.gradle
│ └── src
│ │ └── main
│ │ ├── AndroidManifest.xml
│ │ ├── kotlin
│ │ └── com
│ │ │ └── nb
│ │ │ └── fluttercanvas
│ │ │ └── MainActivity.kt
│ │ └── res
│ │ ├── drawable
│ │ ├── ic_launcher.png
│ │ └── launch_background.xml
│ │ ├── mipmap-hdpi
│ │ └── ic_launcher.png
│ │ ├── mipmap-mdpi
│ │ └── ic_launcher.png
│ │ ├── mipmap-xhdpi
│ │ └── ic_launcher.png
│ │ ├── mipmap-xxhdpi
│ │ └── ic_launcher.png
│ │ ├── mipmap-xxxhdpi
│ │ └── ic_launcher.png
│ │ └── values
│ │ └── styles.xml
├── build.gradle
├── gradle.properties
├── gradle
│ └── wrapper
│ │ └── gradle-wrapper.properties
└── settings.gradle
├── doc
├── RoundPolygon
│ ├── group08_2_no_yellow.png
│ ├── how_change_to_round_angle.png
│ ├── polygon_all.png
│ ├── regular_polygon.png
│ ├── result_all.png
│ ├── result_large.png
│ ├── step_01.jpg
│ └── step_02.jpg
├── canvas_change.png
├── circle
│ ├── circle_all_4.png
│ ├── circle_end_9.png
│ ├── circle_pie_chart.png
│ ├── pie_chart_tri.gif
│ └── principle.png
├── circle_note.png
├── flutter_note.png
├── logo.png
├── result_200_400.png
├── result_280_320.png
└── result_full_screen.png
├── images
├── circel_round_angle.png
├── circle_end_9.png
├── circle_pie_chart.png
├── logo.png
└── polygon_type1_4.png
├── ios
├── Flutter
│ ├── AppFrameworkInfo.plist
│ ├── Debug.xcconfig
│ └── Release.xcconfig
├── Runner.xcodeproj
│ ├── project.pbxproj
│ ├── project.xcworkspace
│ │ └── contents.xcworkspacedata
│ └── xcshareddata
│ │ └── xcschemes
│ │ └── Runner.xcscheme
├── Runner.xcworkspace
│ └── contents.xcworkspacedata
└── Runner
│ ├── AppDelegate.h
│ ├── AppDelegate.m
│ ├── Assets.xcassets
│ ├── AppIcon.appiconset
│ │ ├── Contents.json
│ │ ├── Icon-App-1024x1024@1x.png
│ │ ├── Icon-App-20x20@1x.png
│ │ ├── Icon-App-20x20@2x.png
│ │ ├── Icon-App-20x20@3x.png
│ │ ├── Icon-App-29x29@1x.png
│ │ ├── Icon-App-29x29@2x.png
│ │ ├── Icon-App-29x29@3x.png
│ │ ├── Icon-App-40x40@1x.png
│ │ ├── Icon-App-40x40@2x.png
│ │ ├── Icon-App-40x40@3x.png
│ │ ├── Icon-App-60x60@2x.png
│ │ ├── Icon-App-60x60@3x.png
│ │ ├── Icon-App-76x76@1x.png
│ │ ├── Icon-App-76x76@2x.png
│ │ └── Icon-App-83.5x83.5@2x.png
│ └── LaunchImage.imageset
│ │ ├── Contents.json
│ │ ├── LaunchImage.png
│ │ ├── LaunchImage@2x.png
│ │ ├── LaunchImage@3x.png
│ │ └── README.md
│ ├── Base.lproj
│ ├── LaunchScreen.storyboard
│ └── Main.storyboard
│ ├── Info.plist
│ └── main.m
├── lib
├── circle
│ ├── CirclePage.dart
│ ├── CirclePainter.dart
│ ├── CircleTrianglePage.dart
│ └── CircleTrianglePainter.dart
├── const
│ ├── ImageConst.dart
│ ├── PageConst.dart
│ └── size_const.dart
├── logo
│ ├── LogoPage.dart
│ └── OpenPainter.dart
├── main.dart
├── math
│ ├── circle.dart
│ └── line.dart
└── polygon
│ ├── PolygonUtil.dart
│ ├── RegularPolygonPage.dart
│ ├── RegularPolygonPainter.dart
│ ├── RoundPolygonPage.dart
│ └── RoundPolygonPainter.dart
├── mdfile
├── canvas_tutorial_01.md
└── canvas_tutorial_02.md
├── pubspec.yaml
└── test
└── widget_test.dart
/.gitignore:
--------------------------------------------------------------------------------
1 | # Miscellaneous
2 | *.class
3 | *.lock
4 | *.log
5 | *.pyc
6 | *.swp
7 | .DS_Store
8 | .atom/
9 | .buildlog/
10 | .history
11 | .svn/
12 |
13 | # IntelliJ related
14 | *.iml
15 | *.ipr
16 | *.iws
17 | .idea/
18 |
19 | # Visual Studio Code related
20 | .vscode/
21 |
22 | # Flutter/Dart/Pub related
23 | **/doc/api/
24 | .dart_tool/
25 | .flutter-plugins
26 | .packages
27 | .pub-cache/
28 | .pub/
29 | build/
30 |
31 | # Android related
32 | **/android/**/gradle-wrapper.jar
33 | **/android/.gradle
34 | **/android/captures/
35 | **/android/gradlew
36 | **/android/gradlew.bat
37 | **/android/local.properties
38 | **/android/**/GeneratedPluginRegistrant.java
39 |
40 | # iOS/XCode related
41 | **/ios/**/*.mode1v3
42 | **/ios/**/*.mode2v3
43 | **/ios/**/*.moved-aside
44 | **/ios/**/*.pbxuser
45 | **/ios/**/*.perspectivev3
46 | **/ios/**/*sync/
47 | **/ios/**/.sconsign.dblite
48 | **/ios/**/.tags*
49 | **/ios/**/.vagrant/
50 | **/ios/**/DerivedData/
51 | **/ios/**/Icon?
52 | **/ios/**/Pods/
53 | **/ios/**/.symlinks/
54 | **/ios/**/profile
55 | **/ios/**/xcuserdata
56 | **/ios/.generated/
57 | **/ios/Flutter/App.framework
58 | **/ios/Flutter/Flutter.framework
59 | **/ios/Flutter/Generated.xcconfig
60 | **/ios/Flutter/app.flx
61 | **/ios/Flutter/app.zip
62 | **/ios/Flutter/flutter_assets/
63 | **/ios/ServiceDefinitions.json
64 | **/ios/Runner/GeneratedPluginRegistrant.*
65 |
66 | # Exceptions to above rules.
67 | !**/ios/**/default.mode1v3
68 | !**/ios/**/default.mode2v3
69 | !**/ios/**/default.pbxuser
70 | !**/ios/**/default.perspectivev3
71 | !/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages
72 |
--------------------------------------------------------------------------------
/.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: 8426910a19abc4ab081c58fd1a72c433353eaa31
8 | channel: master
9 |
10 | project_type: app
11 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | ### :heart: Star :heart: the repo to support the project or :smile:[Follow Me](https://github.com/nb312).Thanks!
2 | Facebook Page | Facebook Group | QQ Group | Developer |
3 | --- | --- | --- | ---
4 | [Flutter Open ](https://www.facebook.com/flutteropen) | [Flutter Open](https://www.facebook.com/groups/948618338674126/) | 963828159 |[NieBin](https://github.com/nb312)
5 |
6 | Article | Pictures
7 | --- | ---
8 | [Canvas tutorial 05 How to use the gesture with the custom painter in the flutter?](https://medium.com/flutteropen/canvas-tutorial-05-how-to-use-the-gesture-with-the-custom-painter-in-the-flutter-3fc4c2deca06) |
9 | [Canvas tutorial 04 How to draw a pie chart and with a round angle in the flutter?](https://medium.com/flutteropen/canvas-tutorial-04-how-to-draw-a-pie-chart-and-with-a-round-angle-in-the-flutter-8a22126704f4) |
10 | [Canvas tutorial 03 How to draw a regular round angle polygon in the flutter?](https://medium.com/flutteropen/canvas-tutorial-03-how-to-draw-a-regular-round-angle-polygon-83b055b7af6c) |
11 | [tutorial 02 How to draw round angle polygon in the flutter?](https://medium.com/flutteropen/canvas-tutorial-02-how-to-draw-round-angle-polygon-in-the-flutter-7890e933cfb1) |
12 | [ tutorial 01 How to use the canvas in the flutter?](https://medium.com/flutteropen/canvas-tutorial-01-how-to-use-the-canvas-in-the-flutter-8aade29ddc9) |
13 |
--------------------------------------------------------------------------------
/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 27
30 |
31 | sourceSets {
32 | main.java.srcDirs += 'src/main/kotlin'
33 | }
34 |
35 | lintOptions {
36 | disable 'InvalidPackage'
37 | }
38 |
39 | defaultConfig {
40 | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
41 | applicationId "com.nb.fluttercanvas"
42 | minSdkVersion 16
43 | targetSdkVersion 27
44 | versionCode flutterVersionCode.toInteger()
45 | versionName flutterVersionName
46 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
47 | }
48 |
49 | buildTypes {
50 | release {
51 | // TODO: Add your own signing config for the release build.
52 | // Signing with the debug keys for now, so `flutter run --release` works.
53 | signingConfig signingConfigs.debug
54 | }
55 | }
56 | }
57 |
58 | flutter {
59 | source '../..'
60 | }
61 |
62 | dependencies {
63 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
64 | testImplementation 'junit:junit:4.12'
65 | androidTestImplementation 'com.android.support.test:runner:1.0.2'
66 | androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
67 | }
68 |
--------------------------------------------------------------------------------
/android/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
3 |
4 |
8 |
9 |
10 |
15 |
19 |
26 |
30 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
--------------------------------------------------------------------------------
/android/app/src/main/kotlin/com/nb/fluttercanvas/MainActivity.kt:
--------------------------------------------------------------------------------
1 | package com.nb.fluttercanvas
2 |
3 | import android.os.Bundle
4 |
5 | import io.flutter.app.FlutterActivity
6 | import io.flutter.plugins.GeneratedPluginRegistrant
7 |
8 | class MainActivity: FlutterActivity() {
9 | override fun onCreate(savedInstanceState: Bundle?) {
10 | super.onCreate(savedInstanceState)
11 | GeneratedPluginRegistrant.registerWith(this)
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/android/app/src/main/res/drawable/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FlutterOpen/flutter-canvas/14b1ed5e4bdc06149c7eae56da64ee76aa180484/android/app/src/main/res/drawable/ic_launcher.png
--------------------------------------------------------------------------------
/android/app/src/main/res/drawable/launch_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
12 |
13 |
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FlutterOpen/flutter-canvas/14b1ed5e4bdc06149c7eae56da64ee76aa180484/android/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FlutterOpen/flutter-canvas/14b1ed5e4bdc06149c7eae56da64ee76aa180484/android/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FlutterOpen/flutter-canvas/14b1ed5e4bdc06149c7eae56da64ee76aa180484/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FlutterOpen/flutter-canvas/14b1ed5e4bdc06149c7eae56da64ee76aa180484/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FlutterOpen/flutter-canvas/14b1ed5e4bdc06149c7eae56da64ee76aa180484/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/android/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
8 |
9 |
--------------------------------------------------------------------------------
/android/build.gradle:
--------------------------------------------------------------------------------
1 | buildscript {
2 | ext.kotlin_version = '1.2.71'
3 | repositories {
4 | google()
5 | jcenter()
6 | }
7 |
8 | dependencies {
9 | classpath 'com.android.tools.build:gradle:3.2.1'
10 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
11 | }
12 | }
13 |
14 | allprojects {
15 | repositories {
16 | google()
17 | jcenter()
18 | }
19 | }
20 |
21 | rootProject.buildDir = '../build'
22 | subprojects {
23 | project.buildDir = "${rootProject.buildDir}/${project.name}"
24 | }
25 | subprojects {
26 | project.evaluationDependsOn(':app')
27 | }
28 |
29 | task clean(type: Delete) {
30 | delete rootProject.buildDir
31 | }
32 |
--------------------------------------------------------------------------------
/android/gradle.properties:
--------------------------------------------------------------------------------
1 | org.gradle.jvmargs=-Xmx1536M
2 |
--------------------------------------------------------------------------------
/android/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Fri Jun 23 08:50:38 CEST 2017
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-all.zip
7 |
--------------------------------------------------------------------------------
/android/settings.gradle:
--------------------------------------------------------------------------------
1 | include ':app'
2 |
3 | def flutterProjectRoot = rootProject.projectDir.parentFile.toPath()
4 |
5 | def plugins = new Properties()
6 | def pluginsFile = new File(flutterProjectRoot.toFile(), '.flutter-plugins')
7 | if (pluginsFile.exists()) {
8 | pluginsFile.withReader('UTF-8') { reader -> plugins.load(reader) }
9 | }
10 |
11 | plugins.each { name, path ->
12 | def pluginDirectory = flutterProjectRoot.resolve(path).resolve('android').toFile()
13 | include ":$name"
14 | project(":$name").projectDir = pluginDirectory
15 | }
16 |
--------------------------------------------------------------------------------
/doc/RoundPolygon/group08_2_no_yellow.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FlutterOpen/flutter-canvas/14b1ed5e4bdc06149c7eae56da64ee76aa180484/doc/RoundPolygon/group08_2_no_yellow.png
--------------------------------------------------------------------------------
/doc/RoundPolygon/how_change_to_round_angle.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FlutterOpen/flutter-canvas/14b1ed5e4bdc06149c7eae56da64ee76aa180484/doc/RoundPolygon/how_change_to_round_angle.png
--------------------------------------------------------------------------------
/doc/RoundPolygon/polygon_all.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FlutterOpen/flutter-canvas/14b1ed5e4bdc06149c7eae56da64ee76aa180484/doc/RoundPolygon/polygon_all.png
--------------------------------------------------------------------------------
/doc/RoundPolygon/regular_polygon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FlutterOpen/flutter-canvas/14b1ed5e4bdc06149c7eae56da64ee76aa180484/doc/RoundPolygon/regular_polygon.png
--------------------------------------------------------------------------------
/doc/RoundPolygon/result_all.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FlutterOpen/flutter-canvas/14b1ed5e4bdc06149c7eae56da64ee76aa180484/doc/RoundPolygon/result_all.png
--------------------------------------------------------------------------------
/doc/RoundPolygon/result_large.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FlutterOpen/flutter-canvas/14b1ed5e4bdc06149c7eae56da64ee76aa180484/doc/RoundPolygon/result_large.png
--------------------------------------------------------------------------------
/doc/RoundPolygon/step_01.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FlutterOpen/flutter-canvas/14b1ed5e4bdc06149c7eae56da64ee76aa180484/doc/RoundPolygon/step_01.jpg
--------------------------------------------------------------------------------
/doc/RoundPolygon/step_02.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FlutterOpen/flutter-canvas/14b1ed5e4bdc06149c7eae56da64ee76aa180484/doc/RoundPolygon/step_02.jpg
--------------------------------------------------------------------------------
/doc/canvas_change.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FlutterOpen/flutter-canvas/14b1ed5e4bdc06149c7eae56da64ee76aa180484/doc/canvas_change.png
--------------------------------------------------------------------------------
/doc/circle/circle_all_4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FlutterOpen/flutter-canvas/14b1ed5e4bdc06149c7eae56da64ee76aa180484/doc/circle/circle_all_4.png
--------------------------------------------------------------------------------
/doc/circle/circle_end_9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FlutterOpen/flutter-canvas/14b1ed5e4bdc06149c7eae56da64ee76aa180484/doc/circle/circle_end_9.png
--------------------------------------------------------------------------------
/doc/circle/circle_pie_chart.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FlutterOpen/flutter-canvas/14b1ed5e4bdc06149c7eae56da64ee76aa180484/doc/circle/circle_pie_chart.png
--------------------------------------------------------------------------------
/doc/circle/pie_chart_tri.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FlutterOpen/flutter-canvas/14b1ed5e4bdc06149c7eae56da64ee76aa180484/doc/circle/pie_chart_tri.gif
--------------------------------------------------------------------------------
/doc/circle/principle.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FlutterOpen/flutter-canvas/14b1ed5e4bdc06149c7eae56da64ee76aa180484/doc/circle/principle.png
--------------------------------------------------------------------------------
/doc/circle_note.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FlutterOpen/flutter-canvas/14b1ed5e4bdc06149c7eae56da64ee76aa180484/doc/circle_note.png
--------------------------------------------------------------------------------
/doc/flutter_note.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FlutterOpen/flutter-canvas/14b1ed5e4bdc06149c7eae56da64ee76aa180484/doc/flutter_note.png
--------------------------------------------------------------------------------
/doc/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FlutterOpen/flutter-canvas/14b1ed5e4bdc06149c7eae56da64ee76aa180484/doc/logo.png
--------------------------------------------------------------------------------
/doc/result_200_400.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FlutterOpen/flutter-canvas/14b1ed5e4bdc06149c7eae56da64ee76aa180484/doc/result_200_400.png
--------------------------------------------------------------------------------
/doc/result_280_320.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FlutterOpen/flutter-canvas/14b1ed5e4bdc06149c7eae56da64ee76aa180484/doc/result_280_320.png
--------------------------------------------------------------------------------
/doc/result_full_screen.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FlutterOpen/flutter-canvas/14b1ed5e4bdc06149c7eae56da64ee76aa180484/doc/result_full_screen.png
--------------------------------------------------------------------------------
/images/circel_round_angle.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FlutterOpen/flutter-canvas/14b1ed5e4bdc06149c7eae56da64ee76aa180484/images/circel_round_angle.png
--------------------------------------------------------------------------------
/images/circle_end_9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FlutterOpen/flutter-canvas/14b1ed5e4bdc06149c7eae56da64ee76aa180484/images/circle_end_9.png
--------------------------------------------------------------------------------
/images/circle_pie_chart.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FlutterOpen/flutter-canvas/14b1ed5e4bdc06149c7eae56da64ee76aa180484/images/circle_pie_chart.png
--------------------------------------------------------------------------------
/images/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FlutterOpen/flutter-canvas/14b1ed5e4bdc06149c7eae56da64ee76aa180484/images/logo.png
--------------------------------------------------------------------------------
/images/polygon_type1_4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FlutterOpen/flutter-canvas/14b1ed5e4bdc06149c7eae56da64ee76aa180484/images/polygon_type1_4.png
--------------------------------------------------------------------------------
/ios/Flutter/AppFrameworkInfo.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | App
9 | CFBundleIdentifier
10 | io.flutter.flutter.app
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | App
15 | CFBundlePackageType
16 | FMWK
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 1.0
23 | MinimumOSVersion
24 | 8.0
25 |
26 |
27 |
--------------------------------------------------------------------------------
/ios/Flutter/Debug.xcconfig:
--------------------------------------------------------------------------------
1 | #include "Generated.xcconfig"
2 |
--------------------------------------------------------------------------------
/ios/Flutter/Release.xcconfig:
--------------------------------------------------------------------------------
1 | #include "Generated.xcconfig"
2 |
--------------------------------------------------------------------------------
/ios/Runner.xcodeproj/project.pbxproj:
--------------------------------------------------------------------------------
1 | // !$*UTF8*$!
2 | {
3 | archiveVersion = 1;
4 | classes = {
5 | };
6 | objectVersion = 46;
7 | objects = {
8 |
9 | /* Begin PBXBuildFile section */
10 | 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; };
11 | 2D5378261FAA1A9400D5DBA9 /* flutter_assets in Resources */ = {isa = PBXBuildFile; fileRef = 2D5378251FAA1A9400D5DBA9 /* flutter_assets */; };
12 | 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; };
13 | 3B80C3941E831B6300D905FE /* App.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; };
14 | 3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
15 | 9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; };
16 | 9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
17 | 9740EEB41CF90195004384FC /* Debug.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = 9740EEB21CF90195004384FC /* Debug.xcconfig */; };
18 | 978B8F6F1D3862AE00F588F7 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */; };
19 | 97C146F31CF9000F007C117D /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 97C146F21CF9000F007C117D /* main.m */; };
20 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; };
21 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; };
22 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; };
23 | /* End PBXBuildFile section */
24 |
25 | /* Begin PBXCopyFilesBuildPhase section */
26 | 9705A1C41CF9048500538489 /* Embed Frameworks */ = {
27 | isa = PBXCopyFilesBuildPhase;
28 | buildActionMask = 2147483647;
29 | dstPath = "";
30 | dstSubfolderSpec = 10;
31 | files = (
32 | 3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */,
33 | 9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */,
34 | );
35 | name = "Embed Frameworks";
36 | runOnlyForDeploymentPostprocessing = 0;
37 | };
38 | /* End PBXCopyFilesBuildPhase section */
39 |
40 | /* Begin PBXFileReference section */
41 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; };
42 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; };
43 | 2D5378251FAA1A9400D5DBA9 /* flutter_assets */ = {isa = PBXFileReference; lastKnownFileType = folder; name = flutter_assets; path = Flutter/flutter_assets; sourceTree = SOURCE_ROOT; };
44 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; };
45 | 3B80C3931E831B6300D905FE /* App.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = App.framework; path = Flutter/App.framework; sourceTree = ""; };
46 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; };
47 | 7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; };
48 | 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; };
49 | 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; };
50 | 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; };
51 | 9740EEBA1CF902C7004384FC /* Flutter.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Flutter.framework; path = Flutter/Flutter.framework; sourceTree = ""; };
52 | 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; };
53 | 97C146F21CF9000F007C117D /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; };
54 | 97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; };
55 | 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; };
56 | 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; };
57 | 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
58 | /* End PBXFileReference section */
59 |
60 | /* Begin PBXFrameworksBuildPhase section */
61 | 97C146EB1CF9000F007C117D /* Frameworks */ = {
62 | isa = PBXFrameworksBuildPhase;
63 | buildActionMask = 2147483647;
64 | files = (
65 | 9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */,
66 | 3B80C3941E831B6300D905FE /* App.framework in Frameworks */,
67 | );
68 | runOnlyForDeploymentPostprocessing = 0;
69 | };
70 | /* End PBXFrameworksBuildPhase section */
71 |
72 | /* Begin PBXGroup section */
73 | 9740EEB11CF90186004384FC /* Flutter */ = {
74 | isa = PBXGroup;
75 | children = (
76 | 2D5378251FAA1A9400D5DBA9 /* flutter_assets */,
77 | 3B80C3931E831B6300D905FE /* App.framework */,
78 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */,
79 | 9740EEBA1CF902C7004384FC /* Flutter.framework */,
80 | 9740EEB21CF90195004384FC /* Debug.xcconfig */,
81 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */,
82 | 9740EEB31CF90195004384FC /* Generated.xcconfig */,
83 | );
84 | name = Flutter;
85 | sourceTree = "";
86 | };
87 | 97C146E51CF9000F007C117D = {
88 | isa = PBXGroup;
89 | children = (
90 | 9740EEB11CF90186004384FC /* Flutter */,
91 | 97C146F01CF9000F007C117D /* Runner */,
92 | 97C146EF1CF9000F007C117D /* Products */,
93 | CF3B75C9A7D2FA2A4C99F110 /* Frameworks */,
94 | );
95 | sourceTree = "";
96 | };
97 | 97C146EF1CF9000F007C117D /* Products */ = {
98 | isa = PBXGroup;
99 | children = (
100 | 97C146EE1CF9000F007C117D /* Runner.app */,
101 | );
102 | name = Products;
103 | sourceTree = "";
104 | };
105 | 97C146F01CF9000F007C117D /* Runner */ = {
106 | isa = PBXGroup;
107 | children = (
108 | 7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */,
109 | 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */,
110 | 97C146FA1CF9000F007C117D /* Main.storyboard */,
111 | 97C146FD1CF9000F007C117D /* Assets.xcassets */,
112 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */,
113 | 97C147021CF9000F007C117D /* Info.plist */,
114 | 97C146F11CF9000F007C117D /* Supporting Files */,
115 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */,
116 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */,
117 | );
118 | path = Runner;
119 | sourceTree = "";
120 | };
121 | 97C146F11CF9000F007C117D /* Supporting Files */ = {
122 | isa = PBXGroup;
123 | children = (
124 | 97C146F21CF9000F007C117D /* main.m */,
125 | );
126 | name = "Supporting Files";
127 | sourceTree = "";
128 | };
129 | /* End PBXGroup section */
130 |
131 | /* Begin PBXNativeTarget section */
132 | 97C146ED1CF9000F007C117D /* Runner */ = {
133 | isa = PBXNativeTarget;
134 | buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */;
135 | buildPhases = (
136 | 9740EEB61CF901F6004384FC /* Run Script */,
137 | 97C146EA1CF9000F007C117D /* Sources */,
138 | 97C146EB1CF9000F007C117D /* Frameworks */,
139 | 97C146EC1CF9000F007C117D /* Resources */,
140 | 9705A1C41CF9048500538489 /* Embed Frameworks */,
141 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */,
142 | );
143 | buildRules = (
144 | );
145 | dependencies = (
146 | );
147 | name = Runner;
148 | productName = Runner;
149 | productReference = 97C146EE1CF9000F007C117D /* Runner.app */;
150 | productType = "com.apple.product-type.application";
151 | };
152 | /* End PBXNativeTarget section */
153 |
154 | /* Begin PBXProject section */
155 | 97C146E61CF9000F007C117D /* Project object */ = {
156 | isa = PBXProject;
157 | attributes = {
158 | LastUpgradeCheck = 0910;
159 | ORGANIZATIONNAME = "The Chromium Authors";
160 | TargetAttributes = {
161 | 97C146ED1CF9000F007C117D = {
162 | CreatedOnToolsVersion = 7.3.1;
163 | };
164 | };
165 | };
166 | buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */;
167 | compatibilityVersion = "Xcode 3.2";
168 | developmentRegion = English;
169 | hasScannedForEncodings = 0;
170 | knownRegions = (
171 | en,
172 | Base,
173 | );
174 | mainGroup = 97C146E51CF9000F007C117D;
175 | productRefGroup = 97C146EF1CF9000F007C117D /* Products */;
176 | projectDirPath = "";
177 | projectRoot = "";
178 | targets = (
179 | 97C146ED1CF9000F007C117D /* Runner */,
180 | );
181 | };
182 | /* End PBXProject section */
183 |
184 | /* Begin PBXResourcesBuildPhase section */
185 | 97C146EC1CF9000F007C117D /* Resources */ = {
186 | isa = PBXResourcesBuildPhase;
187 | buildActionMask = 2147483647;
188 | files = (
189 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */,
190 | 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */,
191 | 9740EEB41CF90195004384FC /* Debug.xcconfig in Resources */,
192 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */,
193 | 2D5378261FAA1A9400D5DBA9 /* flutter_assets in Resources */,
194 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */,
195 | );
196 | runOnlyForDeploymentPostprocessing = 0;
197 | };
198 | /* End PBXResourcesBuildPhase section */
199 |
200 | /* Begin PBXShellScriptBuildPhase section */
201 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = {
202 | isa = PBXShellScriptBuildPhase;
203 | buildActionMask = 2147483647;
204 | files = (
205 | );
206 | inputPaths = (
207 | );
208 | name = "Thin Binary";
209 | outputPaths = (
210 | );
211 | runOnlyForDeploymentPostprocessing = 0;
212 | shellPath = /bin/sh;
213 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" thin";
214 | };
215 | 9740EEB61CF901F6004384FC /* Run Script */ = {
216 | isa = PBXShellScriptBuildPhase;
217 | buildActionMask = 2147483647;
218 | files = (
219 | );
220 | inputPaths = (
221 | );
222 | name = "Run Script";
223 | outputPaths = (
224 | );
225 | runOnlyForDeploymentPostprocessing = 0;
226 | shellPath = /bin/sh;
227 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build";
228 | };
229 | /* End PBXShellScriptBuildPhase section */
230 |
231 | /* Begin PBXSourcesBuildPhase section */
232 | 97C146EA1CF9000F007C117D /* Sources */ = {
233 | isa = PBXSourcesBuildPhase;
234 | buildActionMask = 2147483647;
235 | files = (
236 | 978B8F6F1D3862AE00F588F7 /* AppDelegate.m in Sources */,
237 | 97C146F31CF9000F007C117D /* main.m in Sources */,
238 | 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */,
239 | );
240 | runOnlyForDeploymentPostprocessing = 0;
241 | };
242 | /* End PBXSourcesBuildPhase section */
243 |
244 | /* Begin PBXVariantGroup section */
245 | 97C146FA1CF9000F007C117D /* Main.storyboard */ = {
246 | isa = PBXVariantGroup;
247 | children = (
248 | 97C146FB1CF9000F007C117D /* Base */,
249 | );
250 | name = Main.storyboard;
251 | sourceTree = "";
252 | };
253 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */ = {
254 | isa = PBXVariantGroup;
255 | children = (
256 | 97C147001CF9000F007C117D /* Base */,
257 | );
258 | name = LaunchScreen.storyboard;
259 | sourceTree = "";
260 | };
261 | /* End PBXVariantGroup section */
262 |
263 | /* Begin XCBuildConfiguration section */
264 | 249021D3217E4FDB00AE95B9 /* Profile */ = {
265 | isa = XCBuildConfiguration;
266 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
267 | buildSettings = {
268 | ALWAYS_SEARCH_USER_PATHS = NO;
269 | CLANG_ANALYZER_NONNULL = YES;
270 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
271 | CLANG_CXX_LIBRARY = "libc++";
272 | CLANG_ENABLE_MODULES = YES;
273 | CLANG_ENABLE_OBJC_ARC = YES;
274 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
275 | CLANG_WARN_BOOL_CONVERSION = YES;
276 | CLANG_WARN_COMMA = YES;
277 | CLANG_WARN_CONSTANT_CONVERSION = YES;
278 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
279 | CLANG_WARN_EMPTY_BODY = YES;
280 | CLANG_WARN_ENUM_CONVERSION = YES;
281 | CLANG_WARN_INFINITE_RECURSION = YES;
282 | CLANG_WARN_INT_CONVERSION = YES;
283 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
284 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
285 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
286 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
287 | CLANG_WARN_STRICT_PROTOTYPES = YES;
288 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
289 | CLANG_WARN_UNREACHABLE_CODE = YES;
290 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
291 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
292 | COPY_PHASE_STRIP = NO;
293 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
294 | ENABLE_NS_ASSERTIONS = NO;
295 | ENABLE_STRICT_OBJC_MSGSEND = YES;
296 | GCC_C_LANGUAGE_STANDARD = gnu99;
297 | GCC_NO_COMMON_BLOCKS = YES;
298 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
299 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
300 | GCC_WARN_UNDECLARED_SELECTOR = YES;
301 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
302 | GCC_WARN_UNUSED_FUNCTION = YES;
303 | GCC_WARN_UNUSED_VARIABLE = YES;
304 | IPHONEOS_DEPLOYMENT_TARGET = 8.0;
305 | MTL_ENABLE_DEBUG_INFO = NO;
306 | SDKROOT = iphoneos;
307 | TARGETED_DEVICE_FAMILY = "1,2";
308 | VALIDATE_PRODUCT = YES;
309 | };
310 | name = Profile;
311 | };
312 | 249021D4217E4FDB00AE95B9 /* Profile */ = {
313 | isa = XCBuildConfiguration;
314 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
315 | buildSettings = {
316 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
317 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
318 | DEVELOPMENT_TEAM = S8QB4VV633;
319 | ENABLE_BITCODE = NO;
320 | FRAMEWORK_SEARCH_PATHS = (
321 | "$(inherited)",
322 | "$(PROJECT_DIR)/Flutter",
323 | );
324 | INFOPLIST_FILE = Runner/Info.plist;
325 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
326 | LIBRARY_SEARCH_PATHS = (
327 | "$(inherited)",
328 | "$(PROJECT_DIR)/Flutter",
329 | );
330 | PRODUCT_BUNDLE_IDENTIFIER = com.nb.flutterCanvas;
331 | PRODUCT_NAME = "$(TARGET_NAME)";
332 | VERSIONING_SYSTEM = "apple-generic";
333 | };
334 | name = Profile;
335 | };
336 | 97C147031CF9000F007C117D /* Debug */ = {
337 | isa = XCBuildConfiguration;
338 | baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */;
339 | buildSettings = {
340 | ALWAYS_SEARCH_USER_PATHS = NO;
341 | CLANG_ANALYZER_NONNULL = YES;
342 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
343 | CLANG_CXX_LIBRARY = "libc++";
344 | CLANG_ENABLE_MODULES = YES;
345 | CLANG_ENABLE_OBJC_ARC = YES;
346 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
347 | CLANG_WARN_BOOL_CONVERSION = YES;
348 | CLANG_WARN_COMMA = YES;
349 | CLANG_WARN_CONSTANT_CONVERSION = YES;
350 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
351 | CLANG_WARN_EMPTY_BODY = YES;
352 | CLANG_WARN_ENUM_CONVERSION = YES;
353 | CLANG_WARN_INFINITE_RECURSION = YES;
354 | CLANG_WARN_INT_CONVERSION = YES;
355 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
356 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
357 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
358 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
359 | CLANG_WARN_STRICT_PROTOTYPES = YES;
360 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
361 | CLANG_WARN_UNREACHABLE_CODE = YES;
362 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
363 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
364 | COPY_PHASE_STRIP = NO;
365 | DEBUG_INFORMATION_FORMAT = dwarf;
366 | ENABLE_STRICT_OBJC_MSGSEND = YES;
367 | ENABLE_TESTABILITY = YES;
368 | GCC_C_LANGUAGE_STANDARD = gnu99;
369 | GCC_DYNAMIC_NO_PIC = NO;
370 | GCC_NO_COMMON_BLOCKS = YES;
371 | GCC_OPTIMIZATION_LEVEL = 0;
372 | GCC_PREPROCESSOR_DEFINITIONS = (
373 | "DEBUG=1",
374 | "$(inherited)",
375 | );
376 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
377 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
378 | GCC_WARN_UNDECLARED_SELECTOR = YES;
379 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
380 | GCC_WARN_UNUSED_FUNCTION = YES;
381 | GCC_WARN_UNUSED_VARIABLE = YES;
382 | IPHONEOS_DEPLOYMENT_TARGET = 8.0;
383 | MTL_ENABLE_DEBUG_INFO = YES;
384 | ONLY_ACTIVE_ARCH = YES;
385 | SDKROOT = iphoneos;
386 | TARGETED_DEVICE_FAMILY = "1,2";
387 | };
388 | name = Debug;
389 | };
390 | 97C147041CF9000F007C117D /* Release */ = {
391 | isa = XCBuildConfiguration;
392 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
393 | buildSettings = {
394 | ALWAYS_SEARCH_USER_PATHS = NO;
395 | CLANG_ANALYZER_NONNULL = YES;
396 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
397 | CLANG_CXX_LIBRARY = "libc++";
398 | CLANG_ENABLE_MODULES = YES;
399 | CLANG_ENABLE_OBJC_ARC = YES;
400 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
401 | CLANG_WARN_BOOL_CONVERSION = YES;
402 | CLANG_WARN_COMMA = YES;
403 | CLANG_WARN_CONSTANT_CONVERSION = YES;
404 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
405 | CLANG_WARN_EMPTY_BODY = YES;
406 | CLANG_WARN_ENUM_CONVERSION = YES;
407 | CLANG_WARN_INFINITE_RECURSION = YES;
408 | CLANG_WARN_INT_CONVERSION = YES;
409 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
410 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
411 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
412 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
413 | CLANG_WARN_STRICT_PROTOTYPES = YES;
414 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
415 | CLANG_WARN_UNREACHABLE_CODE = YES;
416 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
417 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
418 | COPY_PHASE_STRIP = NO;
419 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
420 | ENABLE_NS_ASSERTIONS = NO;
421 | ENABLE_STRICT_OBJC_MSGSEND = YES;
422 | GCC_C_LANGUAGE_STANDARD = gnu99;
423 | GCC_NO_COMMON_BLOCKS = YES;
424 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
425 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
426 | GCC_WARN_UNDECLARED_SELECTOR = YES;
427 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
428 | GCC_WARN_UNUSED_FUNCTION = YES;
429 | GCC_WARN_UNUSED_VARIABLE = YES;
430 | IPHONEOS_DEPLOYMENT_TARGET = 8.0;
431 | MTL_ENABLE_DEBUG_INFO = NO;
432 | SDKROOT = iphoneos;
433 | TARGETED_DEVICE_FAMILY = "1,2";
434 | VALIDATE_PRODUCT = YES;
435 | };
436 | name = Release;
437 | };
438 | 97C147061CF9000F007C117D /* Debug */ = {
439 | isa = XCBuildConfiguration;
440 | baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */;
441 | buildSettings = {
442 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
443 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
444 | ENABLE_BITCODE = NO;
445 | FRAMEWORK_SEARCH_PATHS = (
446 | "$(inherited)",
447 | "$(PROJECT_DIR)/Flutter",
448 | );
449 | INFOPLIST_FILE = Runner/Info.plist;
450 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
451 | LIBRARY_SEARCH_PATHS = (
452 | "$(inherited)",
453 | "$(PROJECT_DIR)/Flutter",
454 | );
455 | PRODUCT_BUNDLE_IDENTIFIER = com.nb.flutterCanvas;
456 | PRODUCT_NAME = "$(TARGET_NAME)";
457 | VERSIONING_SYSTEM = "apple-generic";
458 | };
459 | name = Debug;
460 | };
461 | 97C147071CF9000F007C117D /* Release */ = {
462 | isa = XCBuildConfiguration;
463 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
464 | buildSettings = {
465 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
466 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
467 | ENABLE_BITCODE = NO;
468 | FRAMEWORK_SEARCH_PATHS = (
469 | "$(inherited)",
470 | "$(PROJECT_DIR)/Flutter",
471 | );
472 | INFOPLIST_FILE = Runner/Info.plist;
473 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
474 | LIBRARY_SEARCH_PATHS = (
475 | "$(inherited)",
476 | "$(PROJECT_DIR)/Flutter",
477 | );
478 | PRODUCT_BUNDLE_IDENTIFIER = com.nb.flutterCanvas;
479 | PRODUCT_NAME = "$(TARGET_NAME)";
480 | VERSIONING_SYSTEM = "apple-generic";
481 | };
482 | name = Release;
483 | };
484 | /* End XCBuildConfiguration section */
485 |
486 | /* Begin XCConfigurationList section */
487 | 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = {
488 | isa = XCConfigurationList;
489 | buildConfigurations = (
490 | 97C147031CF9000F007C117D /* Debug */,
491 | 97C147041CF9000F007C117D /* Release */,
492 | 249021D3217E4FDB00AE95B9 /* Profile */,
493 | );
494 | defaultConfigurationIsVisible = 0;
495 | defaultConfigurationName = Release;
496 | };
497 | 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */ = {
498 | isa = XCConfigurationList;
499 | buildConfigurations = (
500 | 97C147061CF9000F007C117D /* Debug */,
501 | 97C147071CF9000F007C117D /* Release */,
502 | 249021D4217E4FDB00AE95B9 /* Profile */,
503 | );
504 | defaultConfigurationIsVisible = 0;
505 | defaultConfigurationName = Release;
506 | };
507 | /* End XCConfigurationList section */
508 | };
509 | rootObject = 97C146E61CF9000F007C117D /* Project object */;
510 | }
511 |
--------------------------------------------------------------------------------
/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
24 |
25 |
31 |
32 |
33 |
34 |
40 |
41 |
42 |
43 |
44 |
45 |
56 |
58 |
64 |
65 |
66 |
67 |
68 |
69 |
75 |
77 |
83 |
84 |
85 |
86 |
88 |
89 |
92 |
93 |
94 |
--------------------------------------------------------------------------------
/ios/Runner.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/ios/Runner/AppDelegate.h:
--------------------------------------------------------------------------------
1 | #import
2 | #import
3 |
4 | @interface AppDelegate : FlutterAppDelegate
5 |
6 | @end
7 |
--------------------------------------------------------------------------------
/ios/Runner/AppDelegate.m:
--------------------------------------------------------------------------------
1 | #include "AppDelegate.h"
2 | #include "GeneratedPluginRegistrant.h"
3 |
4 | @implementation AppDelegate
5 |
6 | - (BOOL)application:(UIApplication *)application
7 | didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
8 | [GeneratedPluginRegistrant registerWithRegistry:self];
9 | // Override point for customization after application launch.
10 | return [super application:application didFinishLaunchingWithOptions:launchOptions];
11 | }
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "size" : "20x20",
5 | "idiom" : "iphone",
6 | "filename" : "Icon-App-20x20@2x.png",
7 | "scale" : "2x"
8 | },
9 | {
10 | "size" : "20x20",
11 | "idiom" : "iphone",
12 | "filename" : "Icon-App-20x20@3x.png",
13 | "scale" : "3x"
14 | },
15 | {
16 | "size" : "29x29",
17 | "idiom" : "iphone",
18 | "filename" : "Icon-App-29x29@1x.png",
19 | "scale" : "1x"
20 | },
21 | {
22 | "size" : "29x29",
23 | "idiom" : "iphone",
24 | "filename" : "Icon-App-29x29@2x.png",
25 | "scale" : "2x"
26 | },
27 | {
28 | "size" : "29x29",
29 | "idiom" : "iphone",
30 | "filename" : "Icon-App-29x29@3x.png",
31 | "scale" : "3x"
32 | },
33 | {
34 | "size" : "40x40",
35 | "idiom" : "iphone",
36 | "filename" : "Icon-App-40x40@2x.png",
37 | "scale" : "2x"
38 | },
39 | {
40 | "size" : "40x40",
41 | "idiom" : "iphone",
42 | "filename" : "Icon-App-40x40@3x.png",
43 | "scale" : "3x"
44 | },
45 | {
46 | "size" : "60x60",
47 | "idiom" : "iphone",
48 | "filename" : "Icon-App-60x60@2x.png",
49 | "scale" : "2x"
50 | },
51 | {
52 | "size" : "60x60",
53 | "idiom" : "iphone",
54 | "filename" : "Icon-App-60x60@3x.png",
55 | "scale" : "3x"
56 | },
57 | {
58 | "size" : "20x20",
59 | "idiom" : "ipad",
60 | "filename" : "Icon-App-20x20@1x.png",
61 | "scale" : "1x"
62 | },
63 | {
64 | "size" : "20x20",
65 | "idiom" : "ipad",
66 | "filename" : "Icon-App-20x20@2x.png",
67 | "scale" : "2x"
68 | },
69 | {
70 | "size" : "29x29",
71 | "idiom" : "ipad",
72 | "filename" : "Icon-App-29x29@1x.png",
73 | "scale" : "1x"
74 | },
75 | {
76 | "size" : "29x29",
77 | "idiom" : "ipad",
78 | "filename" : "Icon-App-29x29@2x.png",
79 | "scale" : "2x"
80 | },
81 | {
82 | "size" : "40x40",
83 | "idiom" : "ipad",
84 | "filename" : "Icon-App-40x40@1x.png",
85 | "scale" : "1x"
86 | },
87 | {
88 | "size" : "40x40",
89 | "idiom" : "ipad",
90 | "filename" : "Icon-App-40x40@2x.png",
91 | "scale" : "2x"
92 | },
93 | {
94 | "size" : "76x76",
95 | "idiom" : "ipad",
96 | "filename" : "Icon-App-76x76@1x.png",
97 | "scale" : "1x"
98 | },
99 | {
100 | "size" : "76x76",
101 | "idiom" : "ipad",
102 | "filename" : "Icon-App-76x76@2x.png",
103 | "scale" : "2x"
104 | },
105 | {
106 | "size" : "83.5x83.5",
107 | "idiom" : "ipad",
108 | "filename" : "Icon-App-83.5x83.5@2x.png",
109 | "scale" : "2x"
110 | },
111 | {
112 | "size" : "1024x1024",
113 | "idiom" : "ios-marketing",
114 | "filename" : "Icon-App-1024x1024@1x.png",
115 | "scale" : "1x"
116 | }
117 | ],
118 | "info" : {
119 | "version" : 1,
120 | "author" : "xcode"
121 | }
122 | }
123 |
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FlutterOpen/flutter-canvas/14b1ed5e4bdc06149c7eae56da64ee76aa180484/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FlutterOpen/flutter-canvas/14b1ed5e4bdc06149c7eae56da64ee76aa180484/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/FlutterOpen/flutter-canvas/14b1ed5e4bdc06149c7eae56da64ee76aa180484/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/FlutterOpen/flutter-canvas/14b1ed5e4bdc06149c7eae56da64ee76aa180484/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/FlutterOpen/flutter-canvas/14b1ed5e4bdc06149c7eae56da64ee76aa180484/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/FlutterOpen/flutter-canvas/14b1ed5e4bdc06149c7eae56da64ee76aa180484/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/FlutterOpen/flutter-canvas/14b1ed5e4bdc06149c7eae56da64ee76aa180484/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/FlutterOpen/flutter-canvas/14b1ed5e4bdc06149c7eae56da64ee76aa180484/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/FlutterOpen/flutter-canvas/14b1ed5e4bdc06149c7eae56da64ee76aa180484/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/FlutterOpen/flutter-canvas/14b1ed5e4bdc06149c7eae56da64ee76aa180484/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/FlutterOpen/flutter-canvas/14b1ed5e4bdc06149c7eae56da64ee76aa180484/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/FlutterOpen/flutter-canvas/14b1ed5e4bdc06149c7eae56da64ee76aa180484/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/FlutterOpen/flutter-canvas/14b1ed5e4bdc06149c7eae56da64ee76aa180484/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/FlutterOpen/flutter-canvas/14b1ed5e4bdc06149c7eae56da64ee76aa180484/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FlutterOpen/flutter-canvas/14b1ed5e4bdc06149c7eae56da64ee76aa180484/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "filename" : "LaunchImage.png",
6 | "scale" : "1x"
7 | },
8 | {
9 | "idiom" : "universal",
10 | "filename" : "LaunchImage@2x.png",
11 | "scale" : "2x"
12 | },
13 | {
14 | "idiom" : "universal",
15 | "filename" : "LaunchImage@3x.png",
16 | "scale" : "3x"
17 | }
18 | ],
19 | "info" : {
20 | "version" : 1,
21 | "author" : "xcode"
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FlutterOpen/flutter-canvas/14b1ed5e4bdc06149c7eae56da64ee76aa180484/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FlutterOpen/flutter-canvas/14b1ed5e4bdc06149c7eae56da64ee76aa180484/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FlutterOpen/flutter-canvas/14b1ed5e4bdc06149c7eae56da64ee76aa180484/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png
--------------------------------------------------------------------------------
/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md:
--------------------------------------------------------------------------------
1 | # Launch Screen Assets
2 |
3 | You can customize the launch screen with your own desired assets by replacing the image files in this directory.
4 |
5 | You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images.
--------------------------------------------------------------------------------
/ios/Runner/Base.lproj/LaunchScreen.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/ios/Runner/Base.lproj/Main.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/ios/Runner/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIdentifier
10 | $(PRODUCT_BUNDLE_IDENTIFIER)
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | flutter_canvas
15 | CFBundlePackageType
16 | APPL
17 | CFBundleShortVersionString
18 | $(FLUTTER_BUILD_NAME)
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | $(FLUTTER_BUILD_NUMBER)
23 | LSRequiresIPhoneOS
24 |
25 | UILaunchStoryboardName
26 | LaunchScreen
27 | UIMainStoryboardFile
28 | Main
29 | UISupportedInterfaceOrientations
30 |
31 | UIInterfaceOrientationPortrait
32 | UIInterfaceOrientationLandscapeLeft
33 | UIInterfaceOrientationLandscapeRight
34 |
35 | UISupportedInterfaceOrientations~ipad
36 |
37 | UIInterfaceOrientationPortrait
38 | UIInterfaceOrientationPortraitUpsideDown
39 | UIInterfaceOrientationLandscapeLeft
40 | UIInterfaceOrientationLandscapeRight
41 |
42 | UIViewControllerBasedStatusBarAppearance
43 |
44 |
45 |
46 |
--------------------------------------------------------------------------------
/ios/Runner/main.m:
--------------------------------------------------------------------------------
1 | #import
2 | #import
3 | #import "AppDelegate.h"
4 |
5 | int main(int argc, char* argv[]) {
6 | @autoreleasepool {
7 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/lib/circle/CirclePage.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'CirclePainter.dart';
3 | import 'package:flutter_canvas/const/PageConst.dart';
4 |
5 | class CirclePage extends StatefulWidget {
6 | @override
7 | _CircleState createState() => _CircleState();
8 | }
9 |
10 | class _CircleState extends State {
11 | double _len = 0.0;
12 | double _x = 0.0;
13 | double _y = 0.0;
14 |
15 | @override
16 | Widget build(BuildContext context) {
17 | return Scaffold(
18 | appBar: AppBar(
19 | title: Text(PageConst.CIRCLE_PAGE),
20 | ),
21 | body: Container(
22 | child: Center(
23 | child: GestureDetector(
24 | onHorizontalDragStart: (detail) {
25 | _x = detail.globalPosition.dx;
26 | },
27 | onVerticalDragStart: (detail) {
28 | _y = detail.globalPosition.dy;
29 | },
30 | onHorizontalDragUpdate: (detail) {
31 | setState(() {
32 | _len -= detail.globalPosition.dx - _x;
33 | _x = detail.globalPosition.dx;
34 | });
35 | },
36 | onVerticalDragUpdate: (detail) {
37 | setState(() {
38 | _len += detail.globalPosition.dy - _y;
39 | _y = detail.globalPosition.dy;
40 | });
41 | },
42 | child: Container(
43 | width: 300,
44 | height: 300,
45 | child: CustomPaint(
46 | painter: CirclePainter(startAngle: _len),
47 | child: Container(),
48 | ),
49 | ),
50 | ))),
51 | );
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/lib/circle/CirclePainter.dart:
--------------------------------------------------------------------------------
1 | ///
2 | /// Created by NieBin on 2019/1/1
3 | /// Github: https://github.com/nb312
4 | /// Email: niebin312@gmail.com
5 | ///
6 |
7 | import "package:flutter/material.dart";
8 |
9 | //import 'package:flutter_canvas/size_const.dart';
10 | import 'dart:math';
11 | import 'package:flutter_canvas/const/size_const.dart';
12 | import 'package:flutter_canvas/math/line.dart';
13 | import 'package:flutter_canvas/math/circle.dart';
14 |
15 | const BLUE_NORMAL = Color(0xff54c5f8);
16 | const GREEN_NORMAL = Color(0xff6bde54);
17 | const BLUE_DARK2 = Color(0xff01579b);
18 | const BLUE_DARK1 = Color(0xff29b6f6);
19 | const RED_DARK1 = Color(0xfff26388);
20 | const RED_DARK2 = Color(0xfff782a0);
21 | const RED_DARK3 = Color(0xfffb8ba8);
22 | const RED_DARK4 = Color(0xfffb89a6);
23 | const RED_DARK5 = Color(0xfffd86a5);
24 | const YELLOW_NORMAL = Color(0xfffcce89);
25 | const List POINT = [Point(100, 100)];
26 |
27 | SizeUtil get _sizeUtil {
28 | return SizeUtil.getInstance(key: SizeKeyConst.CIRCLE_KEY);
29 | }
30 |
31 | class CirclePainter extends CustomPainter {
32 | CirclePainter({this.startAngle});
33 |
34 | final double startAngle;
35 |
36 | @override
37 | void paint(Canvas canvas, Size size) {
38 | if (size.width > 1.0 && size.height > 1.0) {
39 | print(">1.9");
40 | _sizeUtil.logicSize = size;
41 | }
42 | var paint = Paint()
43 | ..style = PaintingStyle.fill
44 | ..color = BLUE_NORMAL
45 | ..strokeWidth = 2.0
46 | ..isAntiAlias = true;
47 | paint.color = Colors.grey[900];
48 | // canvas.drawCircle(
49 | // Offset(_sizeUtil.getAxisX(250), _sizeUtil.getAxisY(250.0)),
50 | // _sizeUtil.getAxisBoth(200.0),
51 | // paint);
52 | paint.color = RED_DARK1;
53 | paint.strokeWidth = 20;
54 | paint.style = PaintingStyle.stroke;
55 | var center = Offset(
56 | _sizeUtil.getAxisX(250.0),
57 | _sizeUtil.getAxisY(250.0),
58 | );
59 | var radius = _sizeUtil.getAxisBoth(200);
60 | _drawArcGroup(
61 | canvas,
62 | center: center,
63 | radius: radius,
64 | sources: [
65 | 1,
66 | 1,
67 | 1,
68 | 1,
69 | 1,
70 | 1,
71 | 1,
72 | 1,
73 | 1,
74 | ],
75 | colors: [BLUE_DARK1, RED_DARK1, BLUE_DARK2, GREEN_NORMAL, YELLOW_NORMAL],
76 | paintWidth: 80.0,
77 | startAngle: 1.3 * startAngle / radius,
78 | hasEnd: true,
79 | hasCurrent: false,
80 | curPaintWidth: 45.0,
81 | curIndex: 1,
82 | );
83 | canvas.save();
84 | canvas.restore();
85 | }
86 |
87 | void _drawArcGroup(Canvas canvas,
88 | {Offset center,
89 | double radius,
90 | List sources,
91 | List colors,
92 | double startAngle = 0.0,
93 | double paintWidth = 10.0,
94 | bool hasEnd = false,
95 | hasCurrent = false,
96 | int curIndex = 0,
97 | curPaintWidth = 12.0}) {
98 | assert(sources != null && sources.length > 0);
99 | assert(colors != null && colors.length > 0);
100 | var paint = Paint()
101 | ..style = PaintingStyle.fill
102 | ..color = BLUE_NORMAL
103 | ..strokeWidth = paintWidth
104 | ..isAntiAlias = true;
105 | double total = 0;
106 | for (double d in sources) {
107 | total += d;
108 | }
109 | assert(total > 0.0);
110 | List radians = List();
111 | for (double d in sources) {
112 | double radian = d * 2 * pi / total;
113 | radians.add(radian);
114 | }
115 | var startA = startAngle;
116 | paint.style = PaintingStyle.stroke;
117 | var curStartAngle = 0.0;
118 | for (int i = 0; i < radians.length; i++) {
119 | var rd = radians[i];
120 | if (hasCurrent && curIndex == i) {
121 | curStartAngle = startA;
122 | startA += rd;
123 | continue;
124 | }
125 | paint.color = colors[i % colors.length];
126 | paint.strokeWidth = paintWidth;
127 | _drawArcWithCenter(canvas, paint,
128 | center: center, radius: radius, startRadian: startA, sweepRadian: rd);
129 | startA += rd;
130 | }
131 | if (hasEnd) {
132 | startA = startAngle;
133 | paint.strokeWidth = paintWidth;
134 | for (int i = 0; i < radians.length; i++) {
135 | var rd = radians[i];
136 | if (hasCurrent && curIndex == i) {
137 | startA += rd;
138 | continue;
139 | }
140 | paint.color = colors[i % colors.length];
141 | paint.strokeWidth = paintWidth;
142 | _drawArcTwoPoint(canvas, paint,
143 | center: center,
144 | radius: radius,
145 | startRadian: startA,
146 | sweepRadian: rd,
147 | hasEndArc: true);
148 | startA += rd;
149 | }
150 | }
151 |
152 | if (hasCurrent) {
153 | paint.color = colors[curIndex % colors.length];
154 | paint.strokeWidth = curPaintWidth;
155 | paint.style = PaintingStyle.stroke;
156 | _drawArcWithCenter(canvas, paint,
157 | center: center,
158 | radius: radius,
159 | startRadian: curStartAngle,
160 | sweepRadian: radians[curIndex]);
161 | }
162 | if (hasCurrent && hasEnd) {
163 | var rd = radians[curIndex % radians.length];
164 | paint.color = colors[curIndex % colors.length];
165 | paint.strokeWidth = curPaintWidth;
166 | paint.style = PaintingStyle.fill;
167 | _drawArcTwoPoint(canvas, paint,
168 | center: center,
169 | radius: radius,
170 | startRadian: curStartAngle,
171 | sweepRadian: rd,
172 | hasEndArc: true,
173 | hasStartArc: true);
174 | }
175 | }
176 |
177 | void _drawArcWithCenter(
178 | Canvas canvas,
179 | Paint paint, {
180 | Offset center,
181 | double radius,
182 | startRadian = 0.0,
183 | sweepRadian = pi,
184 | }) {
185 | canvas.drawArc(
186 | Rect.fromCircle(center: center, radius: radius),
187 | startRadian,
188 | sweepRadian,
189 | false,
190 | paint,
191 | );
192 | }
193 |
194 | void _drawArcTwoPoint(Canvas canvas, Paint paint,
195 | {Offset center,
196 | double radius,
197 | startRadian = 0.0,
198 | sweepRadian = pi,
199 | hasStartArc = false,
200 | hasEndArc = false}) {
201 | var smallR = paint.strokeWidth / 2;
202 | paint.strokeWidth = smallR;
203 | if (hasStartArc) {
204 | var startCenter = LineCircle.radianPoint(
205 | Point(center.dx, center.dy), radius, startRadian);
206 | paint.style = PaintingStyle.fill;
207 | canvas.drawCircle(Offset(startCenter.x, startCenter.y), smallR, paint);
208 | }
209 | if (hasEndArc) {
210 | var endCenter = LineCircle.radianPoint(
211 | Point(center.dx, center.dy), radius, startRadian + sweepRadian);
212 | paint.style = PaintingStyle.fill;
213 | canvas.drawCircle(Offset(endCenter.x, endCenter.y), smallR, paint);
214 | }
215 | }
216 |
217 | @override
218 | bool shouldRepaint(CustomPainter oldDelegate) => true;
219 | }
220 |
--------------------------------------------------------------------------------
/lib/circle/CircleTrianglePage.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'CircleTrianglePainter.dart';
3 | import 'package:flutter_canvas/const/PageConst.dart';
4 |
5 | class CircleTrianglePage extends StatefulWidget {
6 | @override
7 | _CircleTriangleState createState() => _CircleTriangleState();
8 | }
9 |
10 | class _CircleTriangleState extends State {
11 | double _len = 0.0;
12 | double _x = 0.0;
13 | double _y = 0.0;
14 |
15 | @override
16 | Widget build(BuildContext context) {
17 | return Scaffold(
18 | appBar: AppBar(
19 | title: Text(PageConst.CIRCLE_TRIANGLE_PAGE),
20 | ),
21 | body: Container(
22 | child: Center(
23 | child: GestureDetector(
24 | onHorizontalDragStart: (detail) {
25 | _x = detail.globalPosition.dx;
26 | },
27 | onVerticalDragStart: (detail) {
28 | _y = detail.globalPosition.dy;
29 | },
30 | onHorizontalDragUpdate: (detail) {
31 | setState(() {
32 | _len -= detail.globalPosition.dx - _x;
33 | _x = detail.globalPosition.dx;
34 | });
35 | },
36 | onVerticalDragUpdate: (detail) {
37 | setState(() {
38 | _len += detail.globalPosition.dy - _y;
39 | _y = detail.globalPosition.dy;
40 | });
41 | },
42 | child: Container(
43 | width: 300,
44 | height: 300,
45 | child: CustomPaint(
46 | painter: (CircleTrianglePainter(scrollLen: _len)),
47 | child: Container(),
48 | ),
49 | ),
50 | ),
51 | )),
52 | );
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/lib/circle/CircleTrianglePainter.dart:
--------------------------------------------------------------------------------
1 | ///
2 | /// Created by NieBin on 2019/1/1
3 | /// Github: https://github.com/nb312
4 | /// Email: niebin312@gmail.com
5 | ///
6 |
7 | import "package:flutter/material.dart";
8 |
9 | //import 'package:flutter_canvas/size_const.dart';
10 | import 'dart:math';
11 | import 'package:flutter_canvas/const/size_const.dart';
12 | import 'package:flutter_canvas/math/line.dart';
13 | import 'package:flutter_canvas/math/circle.dart';
14 |
15 | const BLUE_NORMAL = Color(0xff54c5f8);
16 | const GREEN_NORMAL = Color(0xff6bde54);
17 | const BLUE_DARK2 = Color(0xff01579b);
18 | const BLUE_DARK1 = Color(0xff29b6f6);
19 | const RED_DARK1 = Color(0xfff26388);
20 | const RED_DARK2 = Color(0xfff782a0);
21 | const RED_DARK3 = Color(0xfffb8ba8);
22 | const RED_DARK4 = Color(0xfffb89a6);
23 | const RED_DARK5 = Color(0xfffd86a5);
24 | const YELLOW_NORMAL = Color(0xfffcce89);
25 | const List POINT = [Point(100, 100)];
26 |
27 | SizeUtil get _sizeUtil {
28 | return SizeUtil.getInstance(key: SizeKeyConst.CIRCLE_TRIANGLE_KEY);
29 | }
30 |
31 | class CircleTrianglePainter extends CustomPainter {
32 | CircleTrianglePainter({this.scrollLen});
33 |
34 | final double scrollLen;
35 |
36 | @override
37 | void paint(Canvas canvas, Size size) {
38 | if (size.width > 1.0 && size.height > 1.0) {
39 | print(">1.9");
40 | _sizeUtil.logicSize = size;
41 | }
42 | var paint = Paint()
43 | ..style = PaintingStyle.fill
44 | ..color = BLUE_NORMAL
45 | ..strokeWidth = 2.0
46 | ..isAntiAlias = true;
47 | paint.color = Colors.grey[900];
48 | // canvas.drawCircle(
49 | // Offset(_sizeUtil.getAxisX(250), _sizeUtil.getAxisY(250.0)),
50 | // _sizeUtil.getAxisBoth(200.0),
51 | // paint);
52 | paint.color = RED_DARK1;
53 | paint.strokeWidth = 20;
54 | paint.style = PaintingStyle.stroke;
55 | var center = Offset(
56 | _sizeUtil.getAxisX(250.0),
57 | _sizeUtil.getAxisY(250.0),
58 | );
59 | var radius = _sizeUtil.getAxisBoth(200);
60 | paint.style = PaintingStyle.fill;
61 | // canvas.drawArc(Rect.fromCircle(center: center, radius: radius),
62 | // 1.4 * scrollLen / radius, pi / 2, true, paint);
63 | _drawTriCircle(
64 | canvas,
65 | paint,
66 | sources: [1,2,1,1,1,1,1],
67 | colors: [
68 | RED_DARK1,
69 | BLUE_NORMAL,
70 | GREEN_NORMAL,
71 | RED_DARK5,
72 | YELLOW_NORMAL
73 | ],
74 | center: center,
75 | radius: radius,
76 | startRadian: 1.4 * scrollLen / radius,
77 | );
78 | canvas.save();
79 | canvas.restore();
80 | }
81 |
82 | void _drawTriCircle(Canvas canvas, Paint paint,
83 | {Offset center,
84 | double radius,
85 | List sources,
86 | List colors,
87 | double startRadian}) {
88 | assert(sources != null && sources.length > 0);
89 | assert(colors != null && colors.length > 0);
90 | var total = 0.0;
91 | for (var d in sources) {
92 | total += d;
93 | }
94 | List radians = [];
95 | for (var data in sources) {
96 | radians.add(data * 2 * pi / total);
97 | }
98 | for (int i = 0; i < radians.length; i++) {
99 | paint.color = colors[i % colors.length];
100 | canvas.drawArc(Rect.fromCircle(center: center, radius: radius),
101 | startRadian, radians[i], true, paint);
102 | startRadian += radians[i];
103 | }
104 | }
105 |
106 | @override
107 | bool shouldRepaint(CircleTrianglePainter oldDelegate) =>
108 | oldDelegate.scrollLen != scrollLen;
109 | }
110 |
--------------------------------------------------------------------------------
/lib/const/ImageConst.dart:
--------------------------------------------------------------------------------
1 | ///
2 | /// Created by NieBin on 2019/1/2
3 | /// Github: https://github.com/nb312
4 | /// Email: niebin312@gmail.com
5 | ///
6 | class ImageConst {
7 | static const _IMAGE_PATH = "images";
8 | static const LOGO_CANVAS = "$_IMAGE_PATH/logo.png";
9 | static const CIRCLE_ROUND_ANGLE = "$_IMAGE_PATH/circel_round_angle.png";
10 | static const REGULAR_POLYGON = "$_IMAGE_PATH/polygon_type1_4.png";
11 | static const CIRCLE_ITEM = "$_IMAGE_PATH/circle_end_9.png";
12 | static const CIRCLE_TRIANGLE_ITEM = "$_IMAGE_PATH/circle_pie_chart.png";
13 | }
14 |
--------------------------------------------------------------------------------
/lib/const/PageConst.dart:
--------------------------------------------------------------------------------
1 | ///
2 | /// Created by NieBin on 2019/1/2
3 | /// Github: https://github.com/nb312
4 | /// Email: niebin312@gmail.com
5 | ///
6 | class PageConst {
7 | static const LOGO_PAGE = "Logo page";
8 | static const ROUND_ANGLE_POLYGON_PAGE = "Round angle polygon";
9 | static const REGULAR_POLYGON_PAGE = "Regular round angle polygon";
10 | static const CIRCLE_PAGE = "Circle page.";
11 | static const CIRCLE_TRIANGLE_PAGE = "Circle Triangle page.";
12 | }
13 |
--------------------------------------------------------------------------------
/lib/const/size_const.dart:
--------------------------------------------------------------------------------
1 | ///
2 | /// Created by NieBin on 2018/12/26
3 | /// Github: https://github.com/nb312
4 | /// Email: niebin312@gmail.com
5 | ///
6 | import 'package:flutter/material.dart';
7 | import 'dart:math';
8 |
9 | class SizeKeyConst {
10 | static const DEVICE_KEY = "device_size";
11 | static const ROUND_ANGLE_KEY = "round_angle_size";
12 | static const REGULAR_POLYGON_KEY = "regular_angle_size";
13 | static const CIRCLE_KEY = "circle custom painter";
14 | static const CIRCLE_TRIANGLE_KEY = "circle triangle painter";
15 | static const LOGO_KEY = "logo_page_size";
16 | }
17 |
18 | class SizeUtil {
19 | static Map _keyValues = Map();
20 |
21 | static initDesignSize() {
22 | getInstance(key: SizeKeyConst.ROUND_ANGLE_KEY).designSize =
23 | Size(500.0, 500.0);
24 | getInstance(key: SizeKeyConst.REGULAR_POLYGON_KEY).designSize =
25 | Size(500.0, 500.0);
26 | getInstance(key: SizeKeyConst.LOGO_KEY).designSize = Size(580, 648.0);
27 | getInstance(key: SizeKeyConst.CIRCLE_KEY).designSize = Size(500.0, 500.0);
28 | getInstance(key: SizeKeyConst.CIRCLE_TRIANGLE_KEY).designSize =
29 | Size(500.0, 500.0);
30 | }
31 |
32 | static SizeUtil getInstance({key = SizeKeyConst.DEVICE_KEY}) {
33 | if (_keyValues.containsKey(key)) {
34 | return _keyValues[key];
35 | } else {
36 | _keyValues[key] = SizeUtil();
37 | return _keyValues[key];
38 | }
39 | }
40 |
41 | Size _designSize;
42 |
43 | set designSize(Size size) {
44 | _designSize = size;
45 | }
46 |
47 | //logic size in device
48 | Size _logicalSize;
49 |
50 | //device pixel radio.
51 |
52 | get width => _logicalSize.width;
53 |
54 | get height => _logicalSize.height;
55 |
56 | set logicSize(Size size) => _logicalSize = size;
57 |
58 | //@param w is the design w;
59 | double getAxisX(double w) {
60 | return (w * width) / _designSize.width;
61 | }
62 |
63 | // the y direction
64 | double getAxisY(double h) {
65 | return (h * height) / _designSize.height;
66 | }
67 |
68 | // diagonal direction value with design size s.
69 | double getAxisBoth(double s) {
70 | return s *
71 | sqrt((width * width + height * height) /
72 | (_designSize.width * _designSize.width +
73 | _designSize.height * _designSize.height));
74 | }
75 | }
76 |
--------------------------------------------------------------------------------
/lib/logo/LogoPage.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:flutter_canvas/logo/OpenPainter.dart';
3 | import 'OpenPainter.dart';
4 | import 'package:flutter_canvas/const/PageConst.dart';
5 |
6 | class LogoPage extends StatefulWidget {
7 | @override
8 | _LogoState createState() => _LogoState();
9 | }
10 |
11 | class _LogoState extends State {
12 | @override
13 | Widget build(BuildContext context) {
14 | return Scaffold(
15 | appBar: AppBar(
16 | title: Text(PageConst.LOGO_PAGE),
17 | ),
18 | body: Container(
19 | child: Center(
20 | child: Container(
21 | width: 280,
22 | height: 320.0,
23 | child: CustomPaint(
24 | painter: OpenPainter(),
25 | ),
26 | ),
27 | )),
28 | );
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/lib/logo/OpenPainter.dart:
--------------------------------------------------------------------------------
1 | ///
2 | /// Created by NieBin on 2019/1/1
3 | /// Github: https://github.com/nb312
4 | /// Email: niebin312@gmail.com
5 | ///
6 |
7 | import "package:flutter/material.dart";
8 | import 'package:flutter_canvas/const/size_const.dart';
9 | import 'dart:math';
10 |
11 | const BLUE_NORMAL = Color(0xff54c5f8);
12 | const GREEN_NORMAL = Color(0xff6bde54);
13 | const BLUE_DARK2 = Color(0xff01579b);
14 | const BLUE_DARK1 = Color(0xff29b6f6);
15 |
16 | SizeUtil get _sizeUtil {
17 | return SizeUtil.getInstance(key: SizeKeyConst.LOGO_KEY);
18 | }
19 |
20 | class OpenPainter extends CustomPainter {
21 | void _drawFourShape(Canvas canvas,
22 | {Offset left_top,
23 | Offset right_top,
24 | Offset right_bottom,
25 | Offset left_bottom,
26 | Size size,
27 | paint}) {
28 | left_top = _convertLogicSize(left_top, size);
29 | right_top = _convertLogicSize(right_top, size);
30 | right_bottom = _convertLogicSize(right_bottom, size);
31 | left_bottom = _convertLogicSize(left_bottom, size);
32 | var path1 = Path()
33 | ..moveTo(left_top.dx, left_top.dy)
34 | ..lineTo(right_top.dx, right_top.dy)
35 | ..lineTo(right_bottom.dx, right_bottom.dy)
36 | ..lineTo(left_bottom.dx, left_bottom.dy);
37 | canvas.drawPath(path1, paint);
38 | }
39 |
40 | Offset _convertLogicSize(Offset off, Size size) {
41 | return Offset(_sizeUtil.getAxisX(off.dx), _sizeUtil.getAxisY(off.dy));
42 | }
43 |
44 | @override
45 | void paint(Canvas canvas, Size size) {
46 | //580*648
47 | if (size.width > 1.0 && size.height > 1.0) {
48 | print(">1.9");
49 | _sizeUtil.logicSize = size;
50 | }
51 | var paint = Paint()
52 | ..style = PaintingStyle.fill
53 | ..color = BLUE_NORMAL
54 | ..isAntiAlias = true;
55 | _drawFourShape(canvas,
56 | left_top: Offset(291, 178),
57 | right_top: Offset(580, 458),
58 | right_bottom: Offset(580, 628),
59 | left_bottom: Offset(203, 267),
60 | size: size,
61 | paint: paint);
62 | _drawFourShape(canvas,
63 | left_top: Offset(156, 314),
64 | right_top: Offset(312, 468),
65 | right_bottom: Offset(312, 645),
66 | left_bottom: Offset(70, 402),
67 | size: size,
68 | paint: paint);
69 | paint.color = BLUE_DARK2;
70 | _drawFourShape(canvas,
71 | left_top: Offset(156, 314),
72 | right_top: Offset(245, 402),
73 | right_bottom: Offset(4, 643),
74 | left_bottom: Offset(4, 467),
75 | size: size,
76 | paint: paint);
77 | paint.color = BLUE_DARK1;
78 | _drawFourShape(canvas,
79 | left_top: Offset(156, 314),
80 | right_top: Offset(245, 402),
81 | right_bottom: Offset(157, 490),
82 | left_bottom: Offset(70, 402),
83 | size: size,
84 | paint: paint);
85 | var circleCenter = Offset(_sizeUtil.getAxisX(294), _sizeUtil.getAxisY(175));
86 | paint.color = BLUE_NORMAL;
87 | canvas.drawCircle(circleCenter, _sizeUtil.getAxisBoth(174), paint);
88 | paint.color = GREEN_NORMAL;
89 | canvas.drawCircle(circleCenter, _sizeUtil.getAxisBoth(124), paint);
90 | paint.color = Colors.white;
91 | canvas.drawCircle(circleCenter, _sizeUtil.getAxisBoth(80), paint);
92 | canvas.save();
93 | canvas.restore();
94 | }
95 |
96 | @override
97 | bool shouldRepaint(CustomPainter oldDelegate) => false;
98 | }
99 |
--------------------------------------------------------------------------------
/lib/main.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:flutter_canvas/const/size_const.dart';
3 | import 'package:flutter_canvas/logo/LogoPage.dart';
4 | import 'package:flutter_canvas/const/PageConst.dart';
5 | import 'package:flutter_canvas/const/ImageConst.dart';
6 | import "package:flutter_canvas/polygon/RoundPolygonPage.dart";
7 | import 'package:flutter_canvas/polygon/RegularPolygonPage.dart';
8 | import 'package:flutter_canvas/circle/CirclePage.dart';
9 | import 'package:flutter_canvas/circle/CircleTrianglePage.dart';
10 |
11 | void main() => runApp(MyApp());
12 |
13 | class MyApp extends StatelessWidget {
14 | @override
15 | Widget build(BuildContext context) {
16 | return MaterialApp(
17 | title: 'Flutter Canvas',
18 | theme: ThemeData(
19 | primarySwatch: Colors.blue,
20 | ),
21 | home: HomePage(),
22 | routes: {
23 | PageConst.LOGO_PAGE: (context) => LogoPage(),
24 | PageConst.ROUND_ANGLE_POLYGON_PAGE: (context) => RoundPolygonPage(),
25 | PageConst.REGULAR_POLYGON_PAGE: (context) => RegularPolygonPage(),
26 | PageConst.CIRCLE_PAGE: (context) => CirclePage(),
27 | PageConst.CIRCLE_TRIANGLE_PAGE: (context) => CircleTrianglePage(),
28 | },
29 | );
30 | }
31 | }
32 |
33 | class HomePage extends StatefulWidget {
34 | @override
35 | _HomeState createState() => _HomeState();
36 | }
37 |
38 | //const PAGES = [PageConst.LOGO_PAGE, PageConst.CHART_PAGE];
39 | const PAGES_CONST = [
40 | {
41 | "image": ImageConst.LOGO_CANVAS,
42 | "title": "Use canvas",
43 | "click": PageConst.LOGO_PAGE,
44 | },
45 | {
46 | "image": ImageConst.CIRCLE_ROUND_ANGLE,
47 | "title": "Round angle polygon",
48 | "click": PageConst.ROUND_ANGLE_POLYGON_PAGE,
49 | },
50 | {
51 | "image": ImageConst.REGULAR_POLYGON,
52 | "title": "Regular polygon with round angle",
53 | "click": PageConst.REGULAR_POLYGON_PAGE,
54 | },
55 | {
56 | "image": ImageConst.CIRCLE_ITEM,
57 | "title": "Circle",
58 | "click": PageConst.CIRCLE_PAGE,
59 | },
60 | {
61 | "image": ImageConst.CIRCLE_TRIANGLE_ITEM,
62 | "title": "Circle Triangle",
63 | "click": PageConst.CIRCLE_TRIANGLE_PAGE,
64 | },
65 | ];
66 |
67 | class _HomeState extends State {
68 | @override
69 | Widget build(BuildContext context) {
70 | SizeUtil.getInstance().logicSize = MediaQuery.of(context).size;
71 | SizeUtil.initDesignSize();
72 | return Scaffold(
73 | appBar: AppBar(
74 | title: Text("Choose Page"),
75 | ),
76 | body: Container(
77 | child: GridView.builder(
78 | gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
79 | crossAxisCount: 1,
80 | mainAxisSpacing: 10,
81 | childAspectRatio: 1.5,
82 | ),
83 | itemBuilder: (context, index) {
84 | return InkWell(
85 | child: Stack(
86 | children: [
87 | Center(
88 | child: Image.asset(
89 | PAGES_CONST[index]["image"],
90 | fit: BoxFit.cover,
91 | ),
92 | ),
93 | Container(
94 | alignment: AlignmentDirectional.bottomCenter,
95 | padding: EdgeInsets.only(bottom: 10.0),
96 | child: Text(
97 | // PAGES_CONST[index]["title"],
98 | "",
99 | style: TextStyle(color: Colors.grey[700]),
100 | ),
101 | )
102 | ],
103 | ),
104 | onTap: () {
105 | Navigator.of(context).pushNamed(
106 | PAGES_CONST[index]["click"],
107 | );
108 | },
109 | );
110 | },
111 | itemCount: PAGES_CONST.length,
112 | ),
113 | ),
114 | );
115 | }
116 | }
117 |
--------------------------------------------------------------------------------
/lib/math/circle.dart:
--------------------------------------------------------------------------------
1 | ///
2 | /// Created by NieBin on 2019/1/4
3 | /// Github: https://github.com/nb312
4 | /// Email: niebin312@gmail.com
5 |
6 | import "package:flutter/material.dart";
7 | import 'dart:math';
8 |
9 | class LineCircle {
10 | ///give the center ,radius of the circle,
11 | ///and have radian from x clockwise direction.
12 | ///you can get the point coordinate in the circle.
13 | static Point radianPoint(Point center, double r, double radian) {
14 | return Point(center.x + r * cos(radian), center.y + r * sin(radian));
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/lib/math/line.dart:
--------------------------------------------------------------------------------
1 | ///
2 | /// Created by NieBin on 2019/1/3
3 | /// Github: https://github.com/nb312
4 | /// Email: niebin312@gmail.com
5 | ///
6 |
7 | import "dart:math";
8 | import 'package:flutter/material.dart';
9 |
10 | class Line {
11 | ///y = kx + c
12 | static double normalLine(x, {k = 0, c = 0}) {
13 | return k * x + c;
14 | }
15 |
16 | ///Calculate the param K in y = kx +c
17 | static double paramK(Point p1, Point p2) {
18 | if (p1.x == p2.x) return 0;
19 | return (p2.y - p1.y) / (p2.x - p1.x);
20 | }
21 |
22 | ///Calculate the param C in y = kx +c
23 | static double paramC(Point p1, Point p2) {
24 | return p1.y - paramK(p1, p2) * p1.x;
25 | }
26 | }
27 |
28 | /// start point p1, end point p2,p2 is center of the circle,r is its radius.
29 | class LineInterCircle {
30 | /// start point p1, end point p2,p2 is center of the circle,r is its radius.
31 | /// param a: y = kx +c intersect with circle,which has the center with point2 and radius R .
32 | /// when derive to x2+ ax +b = 0 equation. the param a is here.
33 | static double paramA(Point p1, Point p2) {
34 | return (2 * Line.paramK(p1, p2) * Line.paramC(p1, p2) -
35 | 2 * Line.paramK(p1, p2) * p2.y -
36 | 2 * p2.x) /
37 | (Line.paramK(p1, p2) * Line.paramK(p1, p2) + 1);
38 | }
39 |
40 | /// start point p1, end point p2,p2 is center of the circle,r is its radius.
41 | /// param b: y = kx +c intersect with circle,which has the center with point2 and radius R .
42 | /// when derive to x2+ ax +b = 0 equation. the param b is here.
43 | static double paramB(Point p1, Point p2, double r) {
44 | return (p2.x * p2.x -
45 | r * r +
46 | (Line.paramC(p1, p2) - p2.y) * (Line.paramC(p1, p2) - p2.y)) /
47 | (Line.paramK(p1, p2) * Line.paramK(p1, p2) + 1);
48 | }
49 |
50 | ///the circle has the intersection or not
51 | static bool isIntersection(Point p1, Point p2, double r) {
52 | var delta = sqrt(paramA(p1, p2) * paramA(p1, p2) - 4 * paramB(p1, p2, r));
53 | return delta >= 0.0;
54 | }
55 |
56 | ///the x coordinate whether or not is between two point we give.
57 | static bool _betweenPoint(x, Point p1, Point p2) {
58 | if (p1.x > p2.x) {
59 | return x > p2.x && x < p1.x;
60 | } else {
61 | return x > p1.x && x < p2.x;
62 | }
63 | }
64 |
65 | static Point _equalX(Point p1, Point p2, double r) {
66 | if (p1.y > p2.y) {
67 | return Point(p2.x, p2.y + r);
68 | } else if (p1.y < p2.y) {
69 | return Point(p2.x, p2.y - r);
70 | } else {
71 | return p2;
72 | }
73 | }
74 |
75 | static Point _equalY(Point p1, Point p2, double r) {
76 | if (p1.x > p2.x) {
77 | return Point(p2.x + r, p2.y);
78 | } else if (p1.x < p2.x) {
79 | return Point(p2.x - r, p2.y);
80 | } else {
81 | return p2;
82 | }
83 | }
84 |
85 | ///intersection point
86 | static Point intersectionPoint(Point p1, Point p2, double r) {
87 | if (p1.x > p2.x - 1 && p1.x < p2.x + 1) return _equalX(p1, p2, r);
88 | if (p1.y > p2.y - 1 && p1.y < p2.y + 1) return _equalY(p1, p2, r);
89 | var delta = sqrt(paramA(p1, p2) * paramA(p1, p2) - 4 * paramB(p1, p2, r));
90 | if (delta < 0.0) {
91 | //when no intersection, i will return the center of the circ le.
92 | return p2;
93 | }
94 | var a_2 = -paramA(p1, p2) / 2.0;
95 | var x1 = a_2 + delta / 2;
96 | if (_betweenPoint(x1, p1, p2)) {
97 | var y1 = Line.paramK(p1, p2) * x1 + Line.paramC(p1, p2);
98 | return Point(x1, y1);
99 | }
100 | var x2 = a_2 - delta / 2;
101 | var y2 = Line.paramK(p1, p2) * x2 + Line.paramC(p1, p2);
102 | return Point(x2, y2);
103 | }
104 | }
105 |
--------------------------------------------------------------------------------
/lib/polygon/PolygonUtil.dart:
--------------------------------------------------------------------------------
1 | ///
2 | /// Created by NieBin on 2019/1/4
3 | /// Github: https://github.com/nb312
4 | /// Email: niebin312@gmail.com
5 | ///
6 | import "package:flutter/material.dart";
7 | import 'dart:math';
8 | import 'package:flutter_canvas/math/line.dart';
9 | import 'package:flutter_canvas/math/circle.dart';
10 |
11 | const GREEN_NORMAL = Color(0xff6bde54);
12 | const BLUE_DARK2 = Color(0xff01579b);
13 | const BLUE_DARK1 = Color(0xff29b6f6);
14 | const RED_DARK1 = Color(0xfff26388);
15 | const YELLOW_NORMAL = Color(0xfffcce89);
16 |
17 | ///just test
18 | void _testCircle() {
19 | var center = Point(100.0, 100.0);
20 | var p1 =
21 | Point(center.x + 100.0 * cos(pi / 2), center.y + 100.0 * sin(pi / 2));
22 | print("p1.x: ${p1.x},p1.y:${p1.y}");
23 | var p2 = Point(center.x + 100.0 * cos(pi), center.y + 100.0 * sin(pi));
24 | print("p2.x: ${p2.x},p2.y:${p2.y}");
25 |
26 | var p3 = Point(
27 | center.x + 100.0 * cos(pi + pi / 2), center.y + 100.0 * sin(pi + pi / 2));
28 | print("p3.x: ${p3.x},p3.y:${p3.y}");
29 | var p4 =
30 | Point(center.x + 100.0 * cos(pi + pi), center.y + 100.0 * sin(pi + pi));
31 | print("p4.x: ${p4.x},p4.y:${p4.y}");
32 | }
33 |
34 | class PolygonUtil {
35 | static List convertToPoints(Point center, double r, int num,
36 | {double startRadian = 0.0}) {
37 | var list = List();
38 | double perRadian = 2.0 * pi / num;
39 | for (int i = 0; i < num; i++) {
40 | double radian = i * perRadian + startRadian;
41 | var p = LineCircle.radianPoint(center, r, radian);
42 | list.add(p);
43 | }
44 | return list;
45 | }
46 |
47 | static Path drawRoundPolygon(
48 | List listPoints, Canvas canvas, Paint paint,
49 | {double distance = 4.0, double radius = 0.0}) {
50 | if (radius < 0.01) {
51 | radius = 6 * distance;
52 | }
53 | var path = Path();
54 | listPoints.add(listPoints[0]);
55 | listPoints.add(listPoints[1]);
56 | if (paint.style == PaintingStyle.stroke) {
57 | listPoints.add(listPoints[2]);
58 | }
59 | var p0 = LineInterCircle.intersectionPoint(
60 | listPoints[1], listPoints[0], distance);
61 | path.moveTo(p0.x, p0.y);
62 | for (int i = 0; i < listPoints.length - 2; i++) {
63 | var p1 = listPoints[i];
64 | var p2 = listPoints[i + 1];
65 | var p3 = listPoints[i + 2];
66 | var interP1 = LineInterCircle.intersectionPoint(p1, p2, distance);
67 | var interP2 = LineInterCircle.intersectionPoint(p3, p2, distance);
68 | path.lineTo(interP1.x, interP1.y);
69 | path.arcToPoint(
70 | Offset(interP2.x, interP2.y),
71 | radius: Radius.circular(radius),
72 | );
73 | }
74 | return path;
75 | }
76 | }
77 |
--------------------------------------------------------------------------------
/lib/polygon/RegularPolygonPage.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'RegularPolygonPainter.dart';
3 | import 'package:flutter_canvas/const/PageConst.dart';
4 |
5 | class RegularPolygonPage extends StatefulWidget {
6 | @override
7 | _RegularState createState() => _RegularState();
8 | }
9 |
10 | class _RegularState extends State {
11 | double _len = 0.0;
12 | double _x = 0.0;
13 | double _y = 0.0;
14 |
15 | @override
16 | Widget build(BuildContext context) {
17 | return Scaffold(
18 | appBar: AppBar(
19 | title: Text(PageConst.REGULAR_POLYGON_PAGE),
20 | ),
21 | body: Container(
22 | child: GestureDetector(
23 | onHorizontalDragStart: (detail) {
24 | _x = detail.globalPosition.dx;
25 | },
26 | onVerticalDragStart: (detail) {
27 | _y = detail.globalPosition.dy;
28 | },
29 | onHorizontalDragUpdate: (detail) {
30 | setState(() {
31 | _len -= detail.globalPosition.dx - _x;
32 | _x = detail.globalPosition.dx;
33 | });
34 | },
35 | onVerticalDragUpdate: (detail) {
36 | setState(() {
37 | _len += detail.globalPosition.dy - _y;
38 | _y = detail.globalPosition.dy;
39 | });
40 | },
41 | child: Center(
42 | child: Container(
43 | width: 300,
44 | height: 300,
45 | child: CustomPaint(
46 | painter: RegularPolygonPainter(startAngle: _len),
47 | child: Container(),
48 | ),
49 | ),
50 | )),
51 | ),
52 | );
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/lib/polygon/RegularPolygonPainter.dart:
--------------------------------------------------------------------------------
1 | ///
2 | /// Created by NieBin on 2019/1/1
3 | /// Github: https://github.com/nb312
4 | /// Email: niebin312@gmail.com
5 | ///
6 |
7 | import "package:flutter/material.dart";
8 |
9 | //import 'package:flutter_canvas/size_const.dart';
10 | import 'dart:math';
11 | import 'package:flutter_canvas/const/size_const.dart';
12 | import 'package:flutter_canvas/math/line.dart';
13 | import 'PolygonUtil.dart';
14 |
15 | const BLUE_NORMAL = Color(0xff54c5f8);
16 | const GREEN_NORMAL = Color(0xff6bde54);
17 | const BLUE_DARK2 = Color(0xff01579b);
18 | const BLUE_DARK1 = Color(0xff29b6f6);
19 | const RED_DARK1 = Color(0xfff26388);
20 | const RED_DARK2 = Color(0xfff782a0);
21 | const RED_DARK3 = Color(0xfffb8ba8);
22 | const RED_DARK4 = Color(0xfffb89a6);
23 | const RED_DARK5 = Color(0xfffd86a5);
24 | const YELLOW_NORMAL = Color(0xfffcce89);
25 | const List POINT = [Point(100, 100)];
26 |
27 | SizeUtil get _sizeUtil {
28 | return SizeUtil.getInstance(key: SizeKeyConst.REGULAR_POLYGON_KEY);
29 | }
30 |
31 | class RegularPolygonPainter extends CustomPainter {
32 | RegularPolygonPainter({this.startAngle});
33 |
34 | final double startAngle;
35 |
36 | @override
37 | void paint(Canvas canvas, Size size) {
38 | //580*648
39 | if (size.width > 1.0 && size.height > 1.0) {
40 | print(">1.9");
41 | _sizeUtil.logicSize = size;
42 | }
43 | var paint = Paint()
44 | ..style = PaintingStyle.fill
45 | ..color = BLUE_NORMAL
46 | ..strokeWidth = 10.0
47 | ..isAntiAlias = true;
48 | var center = Point(250.0, 250.0);
49 | var colors = [
50 | RED_DARK1,
51 | RED_DARK2,
52 | YELLOW_NORMAL,
53 | BLUE_DARK1,
54 | RED_DARK3,
55 | BLUE_NORMAL
56 | ];
57 | _drawSameCenterPolygon(canvas, paint,
58 | center: center,
59 | max: 250,
60 | min: 10,
61 | count: 7,
62 | polygonCount: 4,
63 | step: 40,
64 | colors: colors,
65 | rotateRadio: 0.1,
66 | startAngle: startAngle);
67 | canvas.save();
68 | canvas.restore();
69 | }
70 |
71 | void _drawSameCenterPolygon(Canvas canvas, Paint paint,
72 | {Point center,
73 | double max = 1.0,
74 | double min = 1.0,
75 | double step = 1.0,
76 | int count = 1,
77 | int polygonCount,
78 | List colors,
79 | rotateRadio = 0.1,
80 | double startAngle = 0.0}) {
81 | for (int i = 0; i < count; i++) {
82 | assert(polygonCount >= 3);
83 | assert(colors != null && colors.length > 0);
84 | var radius = max - i * step;
85 | var index = i % colors.length;
86 | paint.color = colors[index];
87 | if (radius < min) {
88 | radius = min;
89 | List list4 = PolygonUtil.convertToPoints(
90 | center,
91 | radius,
92 | polygonCount,
93 | );
94 | _drawWithPoint(canvas, paint, list4);
95 | break;
96 | }
97 | List list4 = PolygonUtil.convertToPoints(
98 | center, radius, polygonCount,
99 | startRadian: 2 * startAngle / max + i * pi * rotateRadio);
100 | _drawWithPoint(canvas, paint, list4);
101 | }
102 | }
103 |
104 | void _drawWithPoint(canvas, paint, list, {hasShadow = false}) {
105 | list = _resizePoint(list);
106 | var path = PolygonUtil.drawRoundPolygon(list, canvas, paint, distance: 2.0);
107 | if (hasShadow) {
108 | canvas.drawShadow(path, Colors.black26, 10.0, true);
109 | }
110 | canvas.drawPath(path, paint);
111 | }
112 |
113 | List _resizePoint(List list) {
114 | List l = List();
115 | for (var p in list) {
116 | l.add(Point(_sizeUtil.getAxisX(p.x), _sizeUtil.getAxisY(p.y)));
117 | }
118 | return l;
119 | }
120 |
121 | @override
122 | bool shouldRepaint(CustomPainter oldDelegate) => true;
123 | }
124 |
--------------------------------------------------------------------------------
/lib/polygon/RoundPolygonPage.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import './RoundPolygonPainter.dart';
3 | import 'package:flutter_canvas/const/PageConst.dart';
4 |
5 | class RoundPolygonPage extends StatefulWidget {
6 | @override
7 | _RoundState createState() => _RoundState();
8 | }
9 |
10 | class _RoundState extends State {
11 | @override
12 | Widget build(BuildContext context) {
13 | return Scaffold(
14 | appBar: AppBar(
15 | title: Text(PageConst.ROUND_ANGLE_POLYGON_PAGE),
16 | ),
17 | body: Container(
18 | child: Center(
19 | child: Container(
20 | width: 300,
21 | height: 300,
22 | child: CustomPaint(
23 | painter: RoundPolygonPainter(),
24 | ),
25 | ),
26 | )),
27 | );
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/lib/polygon/RoundPolygonPainter.dart:
--------------------------------------------------------------------------------
1 | ///
2 | /// Created by NieBin on 2019/1/1
3 | /// Github: https://github.com/nb312
4 | /// Email: niebin312@gmail.com
5 | ///
6 |
7 | import "package:flutter/material.dart";
8 |
9 | //import 'package:flutter_canvas/size_const.dart';
10 | import 'dart:math';
11 | import 'package:flutter_canvas/const/size_const.dart';
12 | import 'package:flutter_canvas/math/line.dart';
13 | import 'PolygonUtil.dart';
14 |
15 | const BLUE_NORMAL = Color(0xff54c5f8);
16 | const GREEN_NORMAL = Color(0xff6bde54);
17 | const BLUE_DARK2 = Color(0xff01579b);
18 | const BLUE_DARK1 = Color(0xff29b6f6);
19 | const RED_DARK1 = Color(0xfff26388);
20 | const RED_DARK2 = Color(0xfff782a0);
21 | const RED_DARK3 = Color(0xfffb8ba8);
22 | const RED_DARK4 = Color(0xfffb89a6);
23 | const RED_DARK5 = Color(0xfffd86a5);
24 | const YELLOW_NORMAL = Color(0xfffcce89);
25 | const List POINT = [Point(100, 100)];
26 |
27 | SizeUtil get _sizeUtil {
28 | return SizeUtil.getInstance(key: SizeKeyConst.ROUND_ANGLE_KEY);
29 | }
30 |
31 | class RoundPolygonPainter extends CustomPainter {
32 | @override
33 | void paint(Canvas canvas, Size size) {
34 | //580*648
35 | if (size.width > 1.0 && size.height > 1.0) {
36 | print(">1.9");
37 | _sizeUtil.logicSize = size;
38 | }
39 | var paint = Paint()
40 | ..style = PaintingStyle.fill
41 | ..color = BLUE_NORMAL
42 | ..isAntiAlias = true;
43 | List list1 = [
44 | Point(250.0, 0.0),
45 | Point(425.0, 75.0),
46 | Point(500.0, 250.0),
47 | Point(425.0, 425.0),
48 | Point(250.0, 500.0),
49 | Point(75.0, 426.0),
50 | Point(0.0, 250.0),
51 | Point(75.0, 75.0),
52 | ];
53 | paint.color = RED_DARK1;
54 | _drawWithPoint(canvas, paint, list1);
55 | List list2 = [
56 | Point(250.0, 53.0),
57 | Point(392.0, 108.0),
58 | Point(449.0, 250.0),
59 | Point(392.0, 390.0),
60 | Point(250.0, 448.0),
61 | Point(110.0, 390.0),
62 | Point(54.0, 250.0),
63 | Point(110.0, 108.0),
64 | ];
65 | paint.color = RED_DARK2;
66 | _drawWithPoint(canvas, paint, list2, hasShadow: true);
67 |
68 | List list3 = [
69 | Point(250.0, 100.0),
70 | Point(358.0, 143.0),
71 | Point(400.0, 250.0),
72 | Point(355.0, 355.0),
73 | Point(250.0, 400.0),
74 | Point(144.0, 357.0),
75 | Point(100.0, 250.0),
76 | Point(144.0, 144.0),
77 | ];
78 | paint.color = RED_DARK3;
79 | _drawWithPoint(canvas, paint, list3, hasShadow: true);
80 |
81 | List list4 = [
82 | Point(250.0, 150.0),
83 | Point(320.0, 180.0),
84 | Point(348.0, 250.0),
85 | Point(320.0, 320.0),
86 | Point(250.0, 348.0),
87 | Point(180.0, 320.0),
88 | Point(150.0, 250.0),
89 | Point(180.0, 180.0),
90 | ];
91 | paint.color = RED_DARK4;
92 | _drawWithPoint(canvas, paint, list4, hasShadow: true);
93 |
94 | List list5 = [
95 | Point(250.0, 202.0),
96 | Point(286.0, 217.0),
97 | Point(300.0, 250.0),
98 | Point(284.0, 284.0),
99 | Point(250.0, 300.0),
100 | Point(214.0, 282.0),
101 | Point(202.0, 250.0),
102 | Point(216.0, 216.0),
103 | ];
104 | paint.color = RED_DARK5;
105 | _drawWithPoint(canvas, paint, list5, hasShadow: true);
106 |
107 | List listYellow = [
108 | Point(110.0, 104.0),
109 | Point(250.0, 153.0),
110 | Point(358.0, 143.0),
111 | Point(450.0, 252.0),
112 | Point(369.0, 349.0),
113 | Point(250.0, 504.0),
114 | Point(140.0, 353.0),
115 | Point(100.0, 250.0),
116 | ];
117 | paint.color = YELLOW_NORMAL.withOpacity(0.5);
118 | _drawWithPoint(canvas, paint, listYellow);
119 | canvas.save();
120 | canvas.restore();
121 | }
122 |
123 | void _drawWithPoint(canvas, paint, list, {hasShadow = false}) {
124 | list = _resizePoint(list);
125 | var path = PolygonUtil.drawRoundPolygon(list, canvas, paint, distance: 2.0);
126 | if (hasShadow) {
127 | canvas.drawShadow(path, Colors.black26, 10.0, true);
128 | }
129 | canvas.drawPath(path, paint);
130 | }
131 |
132 | List _resizePoint(List list) {
133 | List l = List();
134 | for (var p in list) {
135 | l.add(Point(_sizeUtil.getAxisX(p.x), _sizeUtil.getAxisY(p.y)));
136 | }
137 | return l;
138 | }
139 |
140 | @override
141 | bool shouldRepaint(CustomPainter oldDelegate) => false;
142 | }
143 |
--------------------------------------------------------------------------------
/mdfile/canvas_tutorial_01.md:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FlutterOpen/flutter-canvas/14b1ed5e4bdc06149c7eae56da64ee76aa180484/mdfile/canvas_tutorial_01.md
--------------------------------------------------------------------------------
/mdfile/canvas_tutorial_02.md:
--------------------------------------------------------------------------------
1 |
2 | ### :heart: Star :heart: the repo to support the project or :smile:[Follow Me](https://github.com/nb312).Thanks!
3 | # Canvas tutorial 02 | How to draw round angle polygon in the flutter?
4 | Whole project |Facebook group | Facebook page | Developer
5 | --- | --- | --- | ---
6 | [flutter-canvas](https://github.com/FlutterOpen/flutter-canvas) | [FlutterOpen-Group](https://www.facebook.com/groups/948618338674126/?source_id=2005989649497620) | [Flutter Open](https://www.facebook.com/flutteropen) | [NieBin](https://github.com/nb312)
7 |
8 | Creat by [Flutter Open](https://www.facebook.com/flutteropen).
9 |
10 |
11 | In the flutter, only the common polygon was provided to direct to use. In this tutorial, you will learn how to use the common Path class to draw it.
12 | If you do not use a canvas before, you should read this Canvas tutorial 01. There is some basic knowledge for you to learn.
13 |
14 | ## 0. What we will draw?
15 |
16 |
17 | our purpose
18 |
19 | You can see it, there are many round angles polygon, they just cover the bottom one to show. So let's begin our travel.
20 |
21 | ## 1. How change right angle to round angle?
22 | When you ask the question, you have grasped the most important key point. Of course, we have the method to solve this problem. Let's see the picture below.
23 |
24 |
25 |
26 | change the right angle to round angleIt is easy to understand, you just need to find two points in two sides of the triangle, between them add an arc for it. If we implement this, other work will be easy.
27 |
28 | ## 2. Certain two points in the triangle.
29 | This work will need some math knowledge, look follow the pictures, I use some math to certain the point. If you do not understand, it doesn't meter, you can jump to the code part.
30 |
31 | step 1
32 |
33 | step 2
34 |
35 | In this code, we can give two points with function `intersectionPoint`, then we can certainly one line, if we give the distance we want to cut one part from the line, then we can certain the cut point, this point is that we want in the triangle, the same as this method, we can get the another point. But If you do not know the code, just watch how to use it.
36 |
37 | ```dart
38 | import "dart:math";
39 | import 'package:flutter/material.dart';
40 |
41 | class Line {
42 | ///y = kx + c
43 | static double normalLine(x, {k = 0, c = 0}) {
44 | return k * x + c;
45 | }
46 |
47 | ///Calculate the param K in y = kx +c
48 | static double paramK(Point p1, Point p2) {
49 | if (p1.x == p2.x) return 0;
50 | return (p2.y - p1.y) / (p2.x - p1.x);
51 | }
52 |
53 | ///Calculate the param C in y = kx +c
54 | static double paramC(Point p1, Point p2) {
55 | return p1.y - paramK(p1, p2) * p1.x;
56 | }
57 | }
58 |
59 | /// start point p1, end point p2,p2 is center of the circle,r is its radius.
60 | class LineInterCircle {
61 | /// start point p1, end point p2,p2 is center of the circle,r is its radius.
62 | /// param a: y = kx +c intersect with circle,which has the center with point2 and radius R .
63 | /// when derive to x2+ ax +b = 0 equation. the param a is here.
64 | static double paramA(Point p1, Point p2) {
65 | return (2 * Line.paramK(p1, p2) * Line.paramC(p1, p2) -
66 | 2 * Line.paramK(p1, p2) * p2.y -
67 | 2 * p2.x) /
68 | (Line.paramK(p1, p2) * Line.paramK(p1, p2) + 1);
69 | }
70 |
71 | /// start point p1, end point p2,p2 is center of the circle,r is its radius.
72 | /// param b: y = kx +c intersect with circle,which has the center with point2 and radius R .
73 | /// when derive to x2+ ax +b = 0 equation. the param b is here.
74 | static double paramB(Point p1, Point p2, double r) {
75 | return (p2.x * p2.x -
76 | r * r +
77 | (Line.paramC(p1, p2) - p2.y) * (Line.paramC(p1, p2) - p2.y)) /
78 | (Line.paramK(p1, p2) * Line.paramK(p1, p2) + 1);
79 | }
80 |
81 | ///the circle has the intersection or not
82 | static bool isIntersection(Point p1, Point p2, double r) {
83 | var delta = sqrt(paramA(p1, p2) * paramA(p1, p2) - 4 * paramB(p1, p2, r));
84 | return delta >= 0.0;
85 | }
86 |
87 | ///the x coordinate whether or not is between two point we give.
88 | static bool _betweenPoint(x, Point p1, Point p2) {
89 | if (p1.x > p2.x) {
90 | return x > p2.x && x < p1.x;
91 | } else {
92 | return x > p1.x && x < p2.x;
93 | }
94 | }
95 |
96 | static Point _equalX(Point p1, Point p2, double r) {
97 | if (p1.y > p2.y) {
98 | return Point(p2.x, p2.y + r);
99 | } else if (p1.y < p2.y) {
100 | return Point(p2.x, p2.y - r);
101 | } else {
102 | return p2;
103 | }
104 | }
105 |
106 | static Point _equalY(Point p1, Point p2, double r) {
107 | if (p1.x > p2.x) {
108 | return Point(p2.x + r, p2.y);
109 | } else if (p1.x < p2.x) {
110 | return Point(p2.x - r, p2.y);
111 | } else {
112 | return p2;
113 | }
114 | }
115 |
116 | ///intersection point
117 | static Point intersectionPoint(Point p1, Point p2, double r) {
118 | if (p1.x == p2.x) return _equalX(p1, p2, r);
119 | if (p1.y == p2.y) return _equalY(p1, p2, r);
120 | var delta = sqrt(paramA(p1, p2) * paramA(p1, p2) - 4 * paramB(p1, p2, r));
121 | if (delta < 0.0) {
122 | //when no intersection, i will return the center of the circ le.
123 | return p2;
124 | }
125 | var a_2 = -paramA(p1, p2) / 2.0;
126 | var x1 = a_2 + delta / 2;
127 | if (_betweenPoint(x1, p1, p2)) {
128 | var y1 = Line.paramK(p1, p2) * x1 + Line.paramC(p1, p2);
129 | return Point(x1, y1);
130 | }
131 | var x2 = a_2 - delta / 2;
132 | var y2 = Line.paramK(p1, p2) * x2 + Line.paramC(p1, p2);
133 | return Point(x2, y2);
134 | }
135 | }
136 | ```
137 |
138 | ## 3. Draw the round angle
139 | Fist we need to extends the CustomPainter, the same as Canvas tutorial 01. If you don't know how to use, you should watch it before continuing. In our `void paint(Canvas canvas, Size size)` function we will draw our shape.
140 | When giving three points, and intersect in the point2, we can draw the two and the round angle, we use aPath to draw it, code like this:
141 | ```dart
142 | var interP1 = LineInterCircle.intersectionPoint(p1, p2, distance);
143 | var interP2 = LineInterCircle.intersectionPoint(p3, p2, distance);
144 | path.lineTo(interP1.x, interP1.y);
145 | path.arcToPoint(
146 | Offset(interP2.x, interP2.y),
147 | radius: Radius.circular(distance * 6),
148 | );
149 | ```
150 | That means, we use three points to certain one angle, we can sign as {p1,p2,p3}.
151 |
152 | ## 4. Draw round angle polygon.
153 | Above code, If we have three sides polygon, we will draw {p1,p2,p3},{p2,p3,p1},{p3,p1,p2}; if we put in a list, there should be like this [p1,p2,p3,p1,p2] ,that means we should add [p1,p2] to the end. so the code of draw round angle polygon will be like this:
154 |
155 | ```dart
156 | Path _drawRoundPolygon(List ps, double distance, Canvas canvas, paint) {
157 | var path = Path();
158 | ps.add(ps[0]);
159 | ps.add(ps[1]);
160 | var p0 = LineInterCircle.intersectionPoint(ps[1], ps[0], distance);
161 | path.moveTo(p0.x, p0.y);
162 | for (int i = 0; i < ps.length - 2; i++) {
163 | var p1 = ps[i];
164 | var p2 = ps[i + 1];
165 | var p3 = ps[i + 2];
166 | var interP1 = LineInterCircle.intersectionPoint(p1, p2, distance);
167 | var interP2 = LineInterCircle.intersectionPoint(p3, p2, distance);
168 | path.lineTo(interP1.x, interP1.y);
169 | path.arcToPoint(
170 | Offset(interP2.x, interP2.y),
171 | radius: Radius.circular(distance * 6),
172 | );
173 | }
174 | return path;
175 | }
176 | ```
177 |
178 | ## 5. Use the function `_drawRoundPolygon`
179 | You can use it now to draw your own round polygon but will handle its size to fit the parent, It doesn't affect the main logic.
180 | ```dart
181 | @override
182 | void paint(Canvas canvas, Size size) {
183 |
184 | if (size.width > 1.0 && size.height > 1.0) {
185 | print(">1.9");
186 | _sizeUtil.logicSize = size;
187 | }
188 | }
189 | void _drawWithPoint(canvas, paint, list, {hasShadow = false}) {
190 | list = _resizePoint(list);
191 | var path = _drawRoundPolygon(list, 4.0, canvas, paint);
192 | if (hasShadow) {
193 | canvas.drawShadow(path, Colors.black26, 10.0, true);
194 | }
195 | canvas.drawPath(path, paint);
196 | }
197 |
198 | List _resizePoint(List list) {
199 | List l = List();
200 | for (var p in list) {
201 | l.add(Point(_sizeUtil.getAxisX(p.x), _sizeUtil.getAxisY(p.y)));
202 | }
203 | return l;
204 | }
205 | ```
206 |
207 | Draw the large polygon in the bottom
208 | ```dart
209 | var paint = Paint()
210 | ..style = PaintingStyle.fill
211 | ..color = BLUE_NORMAL
212 | ..isAntiAlias = true;
213 | List list1 = [
214 | Point(250.0, 0.0),
215 | Point(425.0, 75.0),
216 | Point(500.0, 250.0),
217 | Point(425.0, 425.0),
218 | Point(250.0, 500.0),
219 | Point(75.0, 426.0),
220 | Point(0.0, 250.0),
221 | Point(75.0, 75.0),
222 | ];
223 | paint.color = RED_DARK1;
224 | _drawWithPoint(canvas, paint, list1);
225 | ```
226 |
227 | the large one
228 |
229 | With others
230 | ```dart
231 | @override
232 | void paint(Canvas canvas, Size size) {
233 |
234 | if (size.width > 1.0 && size.height > 1.0) {
235 | print(">1.9");
236 | _sizeUtil.logicSize = size;
237 | }
238 | var paint = Paint()
239 | ..style = PaintingStyle.fill
240 | ..color = BLUE_NORMAL
241 | ..isAntiAlias = true;
242 | List list1 = [
243 | Point(250.0, 0.0),
244 | Point(425.0, 75.0),
245 | Point(500.0, 250.0),
246 | Point(425.0, 425.0),
247 | Point(250.0, 500.0),
248 | Point(75.0, 426.0),
249 | Point(0.0, 250.0),
250 | Point(75.0, 75.0),
251 | ];
252 | paint.color = RED_DARK1;
253 | _drawWithPoint(canvas, paint, list1);
254 | List list2 = [
255 | Point(250.0, 53.0),
256 | Point(392.0, 108.0),
257 | Point(449.0, 250.0),
258 | Point(392.0, 390.0),
259 | Point(250.0, 448.0),
260 | Point(110.0, 390.0),
261 | Point(54.0, 250.0),
262 | Point(110.0, 108.0),
263 | ];
264 | paint.color = RED_DARK2;
265 | _drawWithPoint(canvas, paint, list2, hasShadow: true);
266 |
267 | List list3 = [
268 | Point(250.0, 100.0),
269 | Point(358.0, 143.0),
270 | Point(400.0, 250.0),
271 | Point(355.0, 355.0),
272 | Point(250.0, 400.0),
273 | Point(144.0, 357.0),
274 | Point(100.0, 250.0),
275 | Point(144.0, 144.0),
276 | ];
277 | paint.color = RED_DARK3;
278 | _drawWithPoint(canvas, paint, list3, hasShadow: true);
279 |
280 | List list4 = [
281 | Point(250.0, 150.0),
282 | Point(320.0, 180.0),
283 | Point(348.0, 250.0),
284 | Point(320.0, 320.0),
285 | Point(250.0, 348.0),
286 | Point(180.0, 320.0),
287 | Point(150.0, 250.0),
288 | Point(180.0, 180.0),
289 | ];
290 | paint.color = RED_DARK4;
291 | _drawWithPoint(canvas, paint, list4, hasShadow: true);
292 |
293 | List list5 = [
294 | Point(250.0, 202.0),
295 | Point(286.0, 217.0),
296 | Point(300.0, 250.0),
297 | Point(284.0, 284.0),
298 | Point(250.0, 300.0),
299 | Point(214.0, 282.0),
300 | Point(202.0, 250.0),
301 | Point(216.0, 216.0),
302 | ];
303 | paint.color = RED_DARK5;
304 | _drawWithPoint(canvas, paint, list5, hasShadow: true);
305 |
306 | List listYellow = [
307 | Point(110.0, 104.0),
308 | Point(250.0, 153.0),
309 | Point(358.0, 143.0),
310 | Point(450.0, 252.0),
311 | Point(369.0, 349.0),
312 | Point(250.0, 504.0),
313 | Point(140.0, 353.0),
314 | Point(100.0, 250.0),
315 | ];
316 | paint.color = YELLOW_NORMAL.withOpacity(0.5);
317 | _drawWithPoint(canvas, paint, listYellow);
318 | canvas.save();
319 | canvas.restore();
320 | }
321 | ```
322 |
323 |
324 | ## Conclusion
325 | In this article, we learn how to draw the round angle polygon.
326 | 1. Consider the comply method, how to change the right angle to round angle. If we want to draw the regular polygon, it will a bit different, I will try to comply with this situation in the future.
327 | 2. Certain the two points near the angle, this is very important with our way.
328 | 3. draw the round angle, with three points and a distance we certain the angle.
329 | 4. We use the points of a list to certain the round angle polygon
330 | 5. We handle the size between the logic size and design size, then we use it.
331 | The whole project is here, thanks for a star: https://github.com/FlutterOpen/flutter-canvas
332 | Creat by [Flutter Open](https://www.facebook.com/flutteropen).
333 |
334 | ---
335 |
--------------------------------------------------------------------------------
/pubspec.yaml:
--------------------------------------------------------------------------------
1 | name: flutter_canvas
2 | description: A new Flutter application.
3 |
4 | # The following defines the version and build number for your application.
5 | # A version number is three numbers separated by dots, like 1.2.43
6 | # followed by an optional build number separated by a +.
7 | # Both the version and the builder number may be overridden in flutter
8 | # build by specifying --build-name and --build-number, respectively.
9 | # Read more about versioning at semver.org.
10 | version: 1.0.0+1
11 |
12 | environment:
13 | sdk: ">=2.0.0-dev.68.0 <3.0.0"
14 |
15 | dependencies:
16 | flutter:
17 | sdk: flutter
18 |
19 | # The following adds the Cupertino Icons font to your application.
20 | # Use with the CupertinoIcons class for iOS style icons.
21 | cupertino_icons: ^0.1.2
22 |
23 | dev_dependencies:
24 | flutter_test:
25 | sdk: flutter
26 |
27 |
28 | # For information on the generic Dart part of this file, see the
29 | # following page: https://www.dartlang.org/tools/pub/pubspec
30 |
31 | # The following section is specific to Flutter.
32 | flutter:
33 |
34 | # The following line ensures that the Material Icons font is
35 | # included with your application, so that you can use the icons in
36 | # the material Icons class.
37 | uses-material-design: true
38 | assets:
39 | - images/
40 | # To add assets to your application, add an assets section, like this:
41 | # assets:
42 | # - images/a_dot_burr.jpeg
43 | # - images/a_dot_ham.jpeg
44 |
45 | # An image asset can refer to one or more resolution-specific "variants", see
46 | # https://flutter.io/assets-and-images/#resolution-aware.
47 |
48 | # For details regarding adding assets from package dependencies, see
49 | # https://flutter.io/assets-and-images/#from-packages
50 |
51 | # To add custom fonts to your application, add a fonts section here,
52 | # in this "flutter" section. Each entry in this list should have a
53 | # "family" key with the font family name, and a "fonts" key with a
54 | # list giving the asset and other descriptors for the font. For
55 | # example:
56 | # fonts:
57 | # - family: Schyler
58 | # fonts:
59 | # - asset: fonts/Schyler-Regular.ttf
60 | # - asset: fonts/Schyler-Italic.ttf
61 | # style: italic
62 | # - family: Trajan Pro
63 | # fonts:
64 | # - asset: fonts/TrajanPro.ttf
65 | # - asset: fonts/TrajanPro_Bold.ttf
66 | # weight: 700
67 | #
68 | # For details regarding fonts from package dependencies,
69 | # see https://flutter.io/custom-fonts/#from-packages
70 |
--------------------------------------------------------------------------------
/test/widget_test.dart:
--------------------------------------------------------------------------------
1 | // This is a basic Flutter widget test.
2 | //
3 | // To perform an interaction with a widget in your test, use the WidgetTester
4 | // utility that Flutter provides. For example, you can send tap and scroll
5 | // gestures. You can also use WidgetTester to find child widgets in the widget
6 | // tree, read text, and verify that the values of widget properties are correct.
7 |
8 | import 'package:flutter/material.dart';
9 | import 'package:flutter_test/flutter_test.dart';
10 |
11 | import 'package:flutter_canvas/main.dart';
12 |
13 | void main() {
14 | testWidgets('Counter increments smoke test', (WidgetTester tester) async {
15 | // Build our app and trigger a frame.
16 | await tester.pumpWidget(MyApp());
17 |
18 | // Verify that our counter starts at 0.
19 | expect(find.text('0'), findsOneWidget);
20 | expect(find.text('1'), findsNothing);
21 |
22 | // Tap the '+' icon and trigger a frame.
23 | await tester.tap(find.byIcon(Icons.add));
24 | await tester.pump();
25 |
26 | // Verify that our counter has incremented.
27 | expect(find.text('0'), findsNothing);
28 | expect(find.text('1'), findsOneWidget);
29 | });
30 | }
31 |
--------------------------------------------------------------------------------