├── LICENSE ├── example ├── android │ ├── gradle.properties │ ├── app │ │ ├── src │ │ │ ├── main │ │ │ │ ├── res │ │ │ │ │ ├── mipmap-hdpi │ │ │ │ │ │ └── ic_launcher.png │ │ │ │ │ ├── mipmap-mdpi │ │ │ │ │ │ └── ic_launcher.png │ │ │ │ │ ├── mipmap-xhdpi │ │ │ │ │ │ └── ic_launcher.png │ │ │ │ │ ├── mipmap-xxhdpi │ │ │ │ │ │ └── ic_launcher.png │ │ │ │ │ ├── mipmap-xxxhdpi │ │ │ │ │ │ └── ic_launcher.png │ │ │ │ │ ├── values │ │ │ │ │ │ └── styles.xml │ │ │ │ │ └── drawable │ │ │ │ │ │ └── launch_background.xml │ │ │ │ ├── java │ │ │ │ │ └── com │ │ │ │ │ │ └── example │ │ │ │ │ │ └── example │ │ │ │ │ │ └── MainActivity.java │ │ │ │ └── AndroidManifest.xml │ │ │ ├── debug │ │ │ │ └── AndroidManifest.xml │ │ │ └── profile │ │ │ │ └── AndroidManifest.xml │ │ └── build.gradle │ ├── gradle │ │ └── wrapper │ │ │ └── gradle-wrapper.properties │ ├── settings.gradle │ └── build.gradle ├── ios │ ├── Flutter │ │ ├── Debug.xcconfig │ │ ├── Release.xcconfig │ │ └── AppFrameworkInfo.plist │ ├── Runner │ │ ├── AppDelegate.h │ │ ├── Assets.xcassets │ │ │ ├── LaunchImage.imageset │ │ │ │ ├── LaunchImage.png │ │ │ │ ├── LaunchImage@2x.png │ │ │ │ ├── LaunchImage@3x.png │ │ │ │ ├── README.md │ │ │ │ └── Contents.json │ │ │ └── AppIcon.appiconset │ │ │ │ ├── Icon-App-20x20@1x.png │ │ │ │ ├── Icon-App-20x20@2x.png │ │ │ │ ├── Icon-App-20x20@3x.png │ │ │ │ ├── Icon-App-29x29@1x.png │ │ │ │ ├── Icon-App-29x29@2x.png │ │ │ │ ├── Icon-App-29x29@3x.png │ │ │ │ ├── Icon-App-40x40@1x.png │ │ │ │ ├── Icon-App-40x40@2x.png │ │ │ │ ├── Icon-App-40x40@3x.png │ │ │ │ ├── Icon-App-60x60@2x.png │ │ │ │ ├── Icon-App-60x60@3x.png │ │ │ │ ├── Icon-App-76x76@1x.png │ │ │ │ ├── Icon-App-76x76@2x.png │ │ │ │ ├── Icon-App-1024x1024@1x.png │ │ │ │ ├── Icon-App-83.5x83.5@2x.png │ │ │ │ └── Contents.json │ │ ├── main.m │ │ ├── AppDelegate.m │ │ ├── Info.plist │ │ └── Base.lproj │ │ │ ├── Main.storyboard │ │ │ └── LaunchScreen.storyboard │ ├── Runner.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ │ ├── IDEWorkspaceChecks.plist │ │ │ └── WorkspaceSettings.xcsettings │ └── Runner.xcodeproj │ │ ├── project.xcworkspace │ │ └── contents.xcworkspacedata │ │ ├── xcshareddata │ │ └── xcschemes │ │ │ └── Runner.xcscheme │ │ └── project.pbxproj ├── .metadata ├── README.md ├── test │ └── widget_test.dart ├── .gitignore ├── pubspec.yaml ├── pubspec.lock └── lib │ └── main.dart ├── CHANGELOG.md ├── media └── screen_shot.gif ├── test └── sweet_chart_test.dart ├── lib ├── src │ ├── sweet_data.dart │ ├── sweet_point.dart │ ├── sweet_chart_widget.dart │ ├── sweet_line.dart │ ├── sweet_line_style.dart │ └── sweet_line_chart.dart └── sweet_chart.dart ├── .metadata ├── .gitignore ├── pubspec.yaml ├── README.md └── pubspec.lock /LICENSE: -------------------------------------------------------------------------------- 1 | TODO: Add your license here. 2 | -------------------------------------------------------------------------------- /example/android/gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xmx1536M 2 | -------------------------------------------------------------------------------- /example/ios/Flutter/Debug.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Generated.xcconfig" 2 | -------------------------------------------------------------------------------- /example/ios/Flutter/Release.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Generated.xcconfig" 2 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ## [0.0.1] - TODO: Add release date. 2 | 3 | * TODO: Describe initial release. 4 | -------------------------------------------------------------------------------- /media/screen_shot.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zakiso/flutter-sweet-chart/HEAD/media/screen_shot.gif -------------------------------------------------------------------------------- /test/sweet_chart_test.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter_test/flutter_test.dart'; 2 | 3 | 4 | void main() { 5 | 6 | } 7 | -------------------------------------------------------------------------------- /example/ios/Runner/AppDelegate.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | 4 | @interface AppDelegate : FlutterAppDelegate 5 | 6 | @end 7 | -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zakiso/flutter-sweet-chart/HEAD/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zakiso/flutter-sweet-chart/HEAD/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zakiso/flutter-sweet-chart/HEAD/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zakiso/flutter-sweet-chart/HEAD/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zakiso/flutter-sweet-chart/HEAD/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zakiso/flutter-sweet-chart/HEAD/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zakiso/flutter-sweet-chart/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zakiso/flutter-sweet-chart/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zakiso/flutter-sweet-chart/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zakiso/flutter-sweet-chart/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zakiso/flutter-sweet-chart/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zakiso/flutter-sweet-chart/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zakiso/flutter-sweet-chart/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zakiso/flutter-sweet-chart/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zakiso/flutter-sweet-chart/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zakiso/flutter-sweet-chart/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zakiso/flutter-sweet-chart/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zakiso/flutter-sweet-chart/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zakiso/flutter-sweet-chart/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zakiso/flutter-sweet-chart/HEAD/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zakiso/flutter-sweet-chart/HEAD/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zakiso/flutter-sweet-chart/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zakiso/flutter-sweet-chart/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png -------------------------------------------------------------------------------- /example/ios/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /lib/src/sweet_data.dart: -------------------------------------------------------------------------------- 1 | import 'dart:ui'; 2 | 3 | class SweetData { 4 | String title; 5 | String subTitle; 6 | Color color; 7 | num value; 8 | 9 | SweetData(this.title, this.subTitle, this.color, this.value); 10 | } 11 | -------------------------------------------------------------------------------- /example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /lib/sweet_chart.dart: -------------------------------------------------------------------------------- 1 | library sweet_chart; 2 | 3 | export 'src/sweet_chart_widget.dart'; 4 | export 'src/sweet_data.dart'; 5 | export 'src/sweet_line_chart.dart'; 6 | export 'src/sweet_line.dart'; 7 | export 'src/sweet_point.dart'; 8 | export 'src/sweet_line_style.dart'; 9 | -------------------------------------------------------------------------------- /example/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 | -------------------------------------------------------------------------------- /example/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 | -------------------------------------------------------------------------------- /example/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /example/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | BuildSystemType 6 | Original 7 | 8 | 9 | -------------------------------------------------------------------------------- /.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: 7a4c33425ddd78c54aba07d86f3f9a4a0051769b 8 | channel: stable 9 | 10 | project_type: package 11 | -------------------------------------------------------------------------------- /example/.metadata: -------------------------------------------------------------------------------- 1 | # This file tracks properties of this Flutter project. 2 | # Used by Flutter tool to assess capabilities and perform upgrades etc. 3 | # 4 | # This file should be version controlled and should not be manually edited. 5 | 6 | version: 7 | revision: 7a4c33425ddd78c54aba07d86f3f9a4a0051769b 8 | channel: stable 9 | 10 | project_type: app 11 | -------------------------------------------------------------------------------- /lib/src/sweet_point.dart: -------------------------------------------------------------------------------- 1 | import 'dart:ui'; 2 | import 'package:flutter/material.dart'; 3 | 4 | class SweetPoint { 5 | String title; 6 | String subTitle; 7 | Color color; 8 | num value; 9 | 10 | SweetPoint({ 11 | @required this.value, 12 | this.title, 13 | this.subTitle, 14 | this.color, 15 | }) : assert(value != null, "the value must not null"); 16 | } 17 | -------------------------------------------------------------------------------- /example/android/app/src/debug/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /example/android/app/src/profile/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md: -------------------------------------------------------------------------------- 1 | # Launch Screen Assets 2 | 3 | You can customize the launch screen with your own desired assets by replacing the image files in this directory. 4 | 5 | You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images. -------------------------------------------------------------------------------- /example/android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | -------------------------------------------------------------------------------- /example/android/app/src/main/java/com/example/example/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.example.example; 2 | 3 | import android.os.Bundle; 4 | import io.flutter.app.FlutterActivity; 5 | import io.flutter.plugins.GeneratedPluginRegistrant; 6 | 7 | public class MainActivity extends FlutterActivity { 8 | @Override 9 | protected void onCreate(Bundle savedInstanceState) { 10 | super.onCreate(savedInstanceState); 11 | GeneratedPluginRegistrant.registerWith(this); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /example/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 | -------------------------------------------------------------------------------- /example/android/app/src/main/res/drawable/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "filename" : "LaunchImage.png", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "universal", 10 | "filename" : "LaunchImage@2x.png", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "universal", 15 | "filename" : "LaunchImage@3x.png", 16 | "scale" : "3x" 17 | } 18 | ], 19 | "info" : { 20 | "version" : 1, 21 | "author" : "xcode" 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /example/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 | -------------------------------------------------------------------------------- /example/README.md: -------------------------------------------------------------------------------- 1 | # example 2 | 3 | A new Flutter project. 4 | 5 | ## Getting Started 6 | 7 | This project is a starting point for a Flutter application. 8 | 9 | A few resources to get you started if this is your first Flutter project: 10 | 11 | - [Lab: Write your first Flutter app](https://flutter.dev/docs/get-started/codelab) 12 | - [Cookbook: Useful Flutter samples](https://flutter.dev/docs/cookbook) 13 | 14 | For help getting started with Flutter, view our 15 | [online documentation](https://flutter.dev/docs), which offers tutorials, 16 | samples, guidance on mobile development, and a full API reference. 17 | -------------------------------------------------------------------------------- /example/android/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | repositories { 3 | google() 4 | jcenter() 5 | } 6 | 7 | dependencies { 8 | classpath 'com.android.tools.build:gradle:3.2.1' 9 | } 10 | } 11 | 12 | allprojects { 13 | repositories { 14 | google() 15 | jcenter() 16 | } 17 | } 18 | 19 | rootProject.buildDir = '../build' 20 | subprojects { 21 | project.buildDir = "${rootProject.buildDir}/${project.name}" 22 | } 23 | subprojects { 24 | project.evaluationDependsOn(':app') 25 | } 26 | 27 | task clean(type: Delete) { 28 | delete rootProject.buildDir 29 | } 30 | -------------------------------------------------------------------------------- /lib/src/sweet_chart_widget.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/widgets.dart'; 2 | import 'package:sweet_chart/src/sweet_data.dart'; 3 | import 'package:sweet_chart/src/sweet_line_chart.dart'; 4 | 5 | 6 | enum SweetChartType { 7 | Line, 8 | Bar, 9 | Pie, 10 | } 11 | 12 | class SweetChart extends StatelessWidget { 13 | final SweetChartType type; 14 | 15 | final List dataList; 16 | 17 | SweetChart({@required this.type, @required this.dataList}); 18 | 19 | @override 20 | Widget build(BuildContext context) { 21 | return LayoutBuilder(builder: (context, constraint) { 22 | // return 23 | // if(type == SweetChartType.Line){ 24 | // return SweetLineChart(dataList); 25 | // } 26 | }); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /example/ios/Flutter/AppFrameworkInfo.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | App 9 | CFBundleIdentifier 10 | io.flutter.flutter.app 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | App 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1.0 23 | MinimumOSVersion 24 | 8.0 25 | 26 | 27 | -------------------------------------------------------------------------------- /lib/src/sweet_line.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:sweet_chart/src/sweet_line_style.dart'; 3 | import 'package:sweet_chart/src/sweet_point.dart'; 4 | 5 | class SweetLine { 6 | List points; 7 | 8 | //线样式 9 | LineStyle style; 10 | 11 | num _maxYAxisValue; 12 | num _minYAxisValue; 13 | 14 | num get minYAxisValue => _minYAxisValue; 15 | 16 | num get maxYAxisValue => _maxYAxisValue; 17 | 18 | SweetLine(this.points, {this.style}) 19 | : assert(points != null && points.length > 1) { 20 | _initData(); 21 | style = style ?? LineStyle(); 22 | } 23 | 24 | _initData() { 25 | _maxYAxisValue = points[0].value; 26 | _minYAxisValue = points[0].value; 27 | for (var i = 0; i < points.length; i++) { 28 | SweetPoint p = points[i]; 29 | 30 | if (p.value > _maxYAxisValue) { 31 | _maxYAxisValue = p.value; 32 | } 33 | if (p.value < _minYAxisValue) { 34 | _minYAxisValue = p.value; 35 | } 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /example/test/widget_test.dart: -------------------------------------------------------------------------------- 1 | // This is a basic Flutter widget test. 2 | // 3 | // To perform an interaction with a widget in your test, use the WidgetTester 4 | // utility 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:example/main.dart'; 9 | import 'package:flutter/material.dart'; 10 | import 'package:flutter_test/flutter_test.dart'; 11 | 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 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Miscellaneous 2 | *.class 3 | *.log 4 | *.pyc 5 | *.swp 6 | .DS_Store 7 | .atom/ 8 | .buildlog/ 9 | .history 10 | .svn/ 11 | 12 | # IntelliJ related 13 | *.iml 14 | *.ipr 15 | *.iws 16 | .idea/ 17 | 18 | # Visual Studio Code related 19 | .vscode/ 20 | 21 | # Flutter/Dart/Pub related 22 | **/doc/api/ 23 | .dart_tool/ 24 | .flutter-plugins 25 | .packages 26 | .pub-cache/ 27 | .pub/ 28 | build/ 29 | 30 | # Android related 31 | **/android/**/gradle-wrapper.jar 32 | **/android/.gradle 33 | **/android/captures/ 34 | **/android/gradlew 35 | **/android/gradlew.bat 36 | **/android/local.properties 37 | **/android/**/GeneratedPluginRegistrant.java 38 | 39 | # iOS/XCode related 40 | **/ios/**/*.mode1v3 41 | **/ios/**/*.mode2v3 42 | **/ios/**/*.moved-aside 43 | **/ios/**/*.pbxuser 44 | **/ios/**/*.perspectivev3 45 | **/ios/**/*sync/ 46 | **/ios/**/.sconsign.dblite 47 | **/ios/**/.tags* 48 | **/ios/**/.vagrant/ 49 | **/ios/**/DerivedData/ 50 | **/ios/**/Icon? 51 | **/ios/**/Pods/ 52 | **/ios/**/.symlinks/ 53 | **/ios/**/profile 54 | **/ios/**/xcuserdata 55 | **/ios/.generated/ 56 | **/ios/Flutter/App.framework 57 | **/ios/Flutter/Flutter.framework 58 | **/ios/Flutter/Generated.xcconfig 59 | **/ios/Flutter/app.flx 60 | **/ios/Flutter/app.zip 61 | **/ios/Flutter/flutter_assets/ 62 | **/ios/ServiceDefinitions.json 63 | **/ios/Runner/GeneratedPluginRegistrant.* 64 | 65 | # Exceptions to above rules. 66 | !**/ios/**/default.mode1v3 67 | !**/ios/**/default.mode2v3 68 | !**/ios/**/default.pbxuser 69 | !**/ios/**/default.perspectivev3 70 | !/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages 71 | -------------------------------------------------------------------------------- /example/.gitignore: -------------------------------------------------------------------------------- 1 | # Miscellaneous 2 | *.class 3 | *.log 4 | *.pyc 5 | *.swp 6 | .DS_Store 7 | .atom/ 8 | .buildlog/ 9 | .history 10 | .svn/ 11 | 12 | # IntelliJ related 13 | *.iml 14 | *.ipr 15 | *.iws 16 | .idea/ 17 | 18 | # Visual Studio Code related 19 | .vscode/ 20 | 21 | # Flutter/Dart/Pub related 22 | **/doc/api/ 23 | .dart_tool/ 24 | .flutter-plugins 25 | .packages 26 | .pub-cache/ 27 | .pub/ 28 | /build/ 29 | 30 | # Android related 31 | **/android/**/gradle-wrapper.jar 32 | **/android/.gradle 33 | **/android/captures/ 34 | **/android/gradlew 35 | **/android/gradlew.bat 36 | **/android/local.properties 37 | **/android/**/GeneratedPluginRegistrant.java 38 | 39 | # iOS/XCode related 40 | **/ios/**/*.mode1v3 41 | **/ios/**/*.mode2v3 42 | **/ios/**/*.moved-aside 43 | **/ios/**/*.pbxuser 44 | **/ios/**/*.perspectivev3 45 | **/ios/**/*sync/ 46 | **/ios/**/.sconsign.dblite 47 | **/ios/**/.tags* 48 | **/ios/**/.vagrant/ 49 | **/ios/**/DerivedData/ 50 | **/ios/**/Icon? 51 | **/ios/**/Pods/ 52 | **/ios/**/.symlinks/ 53 | **/ios/**/profile 54 | **/ios/**/xcuserdata 55 | **/ios/.generated/ 56 | **/ios/Flutter/App.framework 57 | **/ios/Flutter/Flutter.framework 58 | **/ios/Flutter/Generated.xcconfig 59 | **/ios/Flutter/app.flx 60 | **/ios/Flutter/app.zip 61 | **/ios/Flutter/flutter_assets/ 62 | **/ios/ServiceDefinitions.json 63 | **/ios/Runner/GeneratedPluginRegistrant.* 64 | 65 | # Exceptions to above rules. 66 | !**/ios/**/default.mode1v3 67 | !**/ios/**/default.mode2v3 68 | !**/ios/**/default.pbxuser 69 | !**/ios/**/default.perspectivev3 70 | !/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages 71 | -------------------------------------------------------------------------------- /example/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 | example 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 | -------------------------------------------------------------------------------- /example/ios/Runner/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: sweet_chart 2 | description: A new Flutter package. 3 | version: 0.0.1 4 | author: 5 | homepage: 6 | 7 | environment: 8 | sdk: ">=2.1.0 <3.0.0" 9 | 10 | dependencies: 11 | flutter: 12 | sdk: flutter 13 | 14 | dev_dependencies: 15 | flutter_test: 16 | sdk: flutter 17 | 18 | # For information on the generic Dart part of this file, see the 19 | # following page: https://www.dartlang.org/tools/pub/pubspec 20 | 21 | # The following section is specific to Flutter. 22 | flutter: 23 | 24 | # To add assets to your package, add an assets section, like this: 25 | # assets: 26 | # - images/a_dot_burr.jpeg 27 | # - images/a_dot_ham.jpeg 28 | # 29 | # For details regarding assets in packages, see 30 | # https://flutter.dev/assets-and-images/#from-packages 31 | # 32 | # An image asset can refer to one or more resolution-specific "variants", see 33 | # https://flutter.dev/assets-and-images/#resolution-aware. 34 | 35 | # To add custom fonts to your package, add a fonts section here, 36 | # in this "flutter" section. Each entry in this list should have a 37 | # "family" key with the font family name, and a "fonts" key with a 38 | # list giving the asset and other descriptors for the font. For 39 | # example: 40 | # fonts: 41 | # - family: Schyler 42 | # fonts: 43 | # - asset: fonts/Schyler-Regular.ttf 44 | # - asset: fonts/Schyler-Italic.ttf 45 | # style: italic 46 | # - family: Trajan Pro 47 | # fonts: 48 | # - asset: fonts/TrajanPro.ttf 49 | # - asset: fonts/TrajanPro_Bold.ttf 50 | # weight: 700 51 | # 52 | # For details regarding fonts in packages, see 53 | # https://flutter.dev/custom-fonts/#from-packages 54 | -------------------------------------------------------------------------------- /example/android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 9 | 13 | 20 | 24 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /example/android/app/build.gradle: -------------------------------------------------------------------------------- 1 | def localProperties = new Properties() 2 | def localPropertiesFile = rootProject.file('local.properties') 3 | if (localPropertiesFile.exists()) { 4 | localPropertiesFile.withReader('UTF-8') { reader -> 5 | localProperties.load(reader) 6 | } 7 | } 8 | 9 | def flutterRoot = localProperties.getProperty('flutter.sdk') 10 | if (flutterRoot == null) { 11 | throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") 12 | } 13 | 14 | def flutterVersionCode = localProperties.getProperty('flutter.versionCode') 15 | if (flutterVersionCode == null) { 16 | flutterVersionCode = '1' 17 | } 18 | 19 | def flutterVersionName = localProperties.getProperty('flutter.versionName') 20 | if (flutterVersionName == null) { 21 | flutterVersionName = '1.0' 22 | } 23 | 24 | apply plugin: 'com.android.application' 25 | apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" 26 | 27 | android { 28 | compileSdkVersion 28 29 | 30 | lintOptions { 31 | disable 'InvalidPackage' 32 | } 33 | 34 | defaultConfig { 35 | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). 36 | applicationId "com.example.example" 37 | minSdkVersion 16 38 | targetSdkVersion 28 39 | versionCode flutterVersionCode.toInteger() 40 | versionName flutterVersionName 41 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 42 | } 43 | 44 | buildTypes { 45 | release { 46 | // TODO: Add your own signing config for the release build. 47 | // Signing with the debug keys for now, so `flutter run --release` works. 48 | signingConfig signingConfigs.debug 49 | } 50 | } 51 | } 52 | 53 | flutter { 54 | source '../..' 55 | } 56 | 57 | dependencies { 58 | testImplementation 'junit:junit:4.12' 59 | androidTestImplementation 'com.android.support.test:runner:1.0.2' 60 | androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2' 61 | } 62 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # flutter_sweet_chart 2 | 3 | A flutter chart package. 4 | 5 | ### ScreenShot 6 | 7 | ![1563122544617537.2019-07-15 00_53_50](./media/screen_shot.gif) 8 | 9 | ### Getting Started 10 | 11 | `pubspec.yaml` add dependence 12 | 13 | ``` 14 | sweet_chart: 15 | git: 16 | url: git@github.com:zakiso/flutter-sweet-chart.git 17 | ``` 18 | 19 | 20 | 21 | ### Basic Usage 22 | 23 | ```Dart 24 | @override 25 | Widget build(BuildContext context) { 26 | //define your lines set 27 | var lines = []; 28 | //define your data set 29 | List points = []; 30 | var rng = Random(); 31 | for (var i = 0; i < 7; i++) { 32 | points.add(SweetPoint( 33 | //title and subtitle will show on user tap the point 34 | value: rng.nextInt(300), title: "title", subTitle: "subtitle")); 35 | } 36 | 37 | //define your chart line style, 38 | //A chart can be include multiple lines 39 | //so you can set different style for different line. 40 | var lineStyle = LineStyle( 41 | color: Colors.green[200]); // you can run the example for view more option. 42 | SweetLine line = SweetLine(points, style: lineStyle); 43 | lines.add(line); 44 | // chart style 45 | chartStyle = LineChartStyle(showXAxis: true, showYAxis: true); 46 | 47 | return Container( 48 | color: Colors.white, 49 | width: MediaQuery.of(context).size.width, 50 | height: 200, 51 | child: SweetLineChart( 52 | lines: lines, 53 | chartStyle: chartStyle, 54 | //you can custom x and y axis title 55 | xTitles: {0: "18", 2: "20", 4: "30", 5: "08/01", 6: "02"}, 56 | yTitles: {0: "0k", 1: "5k", 5: "25k",6: "30k" }, 57 | ), 58 | ); 59 | } 60 | ``` 61 | 62 | 63 | 64 | ### Feature 65 | 66 | 1. show or hide x or y axis 67 | 2. Custom x or y axis title 68 | 3. show curve or strait line 69 | 4. Fill gradient color 70 | 5. show popup tips on click point 71 | 6. Multi line 72 | 7. …..and so on 73 | 74 | 75 | 76 | **Want to get more info please download project and run it .** 77 | 78 | **Welcome PR and star** 79 | 80 | -------------------------------------------------------------------------------- /example/ios/Runner/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /example/pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: example 2 | description: A new Flutter project. 3 | 4 | # The following defines the version and build number for your application. 5 | # A version number is three numbers separated by dots, like 1.2.43 6 | # followed by an optional build number separated by a +. 7 | # Both the version and the builder number may be overridden in flutter 8 | # build by specifying --build-name and --build-number, respectively. 9 | # In Android, build-name is used as versionName while build-number used as versionCode. 10 | # Read more about Android versioning at https://developer.android.com/studio/publish/versioning 11 | # In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion. 12 | # Read more about iOS versioning at 13 | # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html 14 | version: 1.0.0+1 15 | 16 | environment: 17 | sdk: ">=2.1.0 <3.0.0" 18 | 19 | dependencies: 20 | flutter: 21 | sdk: flutter 22 | 23 | sweet_chart: 24 | path: ../ 25 | 26 | # The following adds the Cupertino Icons font to your application. 27 | # Use with the CupertinoIcons class for iOS style icons. 28 | cupertino_icons: ^0.1.2 29 | 30 | dev_dependencies: 31 | flutter_test: 32 | sdk: flutter 33 | 34 | 35 | # For information on the generic Dart part of this file, see the 36 | # following page: https://www.dartlang.org/tools/pub/pubspec 37 | 38 | # The following section is specific to Flutter. 39 | flutter: 40 | 41 | # The following line ensures that the Material Icons font is 42 | # included with your application, so that you can use the icons in 43 | # the material Icons class. 44 | uses-material-design: true 45 | 46 | # To add assets to your application, add an assets section, like this: 47 | # assets: 48 | # - images/a_dot_burr.jpeg 49 | # - images/a_dot_ham.jpeg 50 | 51 | # An image asset can refer to one or more resolution-specific "variants", see 52 | # https://flutter.dev/assets-and-images/#resolution-aware. 53 | 54 | # For details regarding adding assets from package dependencies, see 55 | # https://flutter.dev/assets-and-images/#from-packages 56 | 57 | # To add custom fonts to your application, add a fonts section here, 58 | # in this "flutter" section. Each entry in this list should have a 59 | # "family" key with the font family name, and a "fonts" key with a 60 | # list giving the asset and other descriptors for the font. For 61 | # example: 62 | # fonts: 63 | # - family: Schyler 64 | # fonts: 65 | # - asset: fonts/Schyler-Regular.ttf 66 | # - asset: fonts/Schyler-Italic.ttf 67 | # style: italic 68 | # - family: Trajan Pro 69 | # fonts: 70 | # - asset: fonts/TrajanPro.ttf 71 | # - asset: fonts/TrajanPro_Bold.ttf 72 | # weight: 700 73 | # 74 | # For details regarding fonts from package dependencies, 75 | # see https://flutter.dev/custom-fonts/#from-packages 76 | -------------------------------------------------------------------------------- /example/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 | -------------------------------------------------------------------------------- /example/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 | -------------------------------------------------------------------------------- /pubspec.lock: -------------------------------------------------------------------------------- 1 | # Generated by pub 2 | # See https://www.dartlang.org/tools/pub/glossary#lockfile 3 | packages: 4 | async: 5 | dependency: transitive 6 | description: 7 | name: async 8 | url: "https://pub.flutter-io.cn" 9 | source: hosted 10 | version: "2.1.0" 11 | boolean_selector: 12 | dependency: transitive 13 | description: 14 | name: boolean_selector 15 | url: "https://pub.flutter-io.cn" 16 | source: hosted 17 | version: "1.0.4" 18 | charcode: 19 | dependency: transitive 20 | description: 21 | name: charcode 22 | url: "https://pub.flutter-io.cn" 23 | source: hosted 24 | version: "1.1.2" 25 | collection: 26 | dependency: transitive 27 | description: 28 | name: collection 29 | url: "https://pub.flutter-io.cn" 30 | source: hosted 31 | version: "1.14.11" 32 | flutter: 33 | dependency: "direct main" 34 | description: flutter 35 | source: sdk 36 | version: "0.0.0" 37 | flutter_test: 38 | dependency: "direct dev" 39 | description: flutter 40 | source: sdk 41 | version: "0.0.0" 42 | matcher: 43 | dependency: transitive 44 | description: 45 | name: matcher 46 | url: "https://pub.flutter-io.cn" 47 | source: hosted 48 | version: "0.12.5" 49 | meta: 50 | dependency: transitive 51 | description: 52 | name: meta 53 | url: "https://pub.flutter-io.cn" 54 | source: hosted 55 | version: "1.1.6" 56 | path: 57 | dependency: transitive 58 | description: 59 | name: path 60 | url: "https://pub.flutter-io.cn" 61 | source: hosted 62 | version: "1.6.2" 63 | pedantic: 64 | dependency: transitive 65 | description: 66 | name: pedantic 67 | url: "https://pub.flutter-io.cn" 68 | source: hosted 69 | version: "1.5.0" 70 | quiver: 71 | dependency: transitive 72 | description: 73 | name: quiver 74 | url: "https://pub.flutter-io.cn" 75 | source: hosted 76 | version: "2.0.2" 77 | sky_engine: 78 | dependency: transitive 79 | description: flutter 80 | source: sdk 81 | version: "0.0.99" 82 | source_span: 83 | dependency: transitive 84 | description: 85 | name: source_span 86 | url: "https://pub.flutter-io.cn" 87 | source: hosted 88 | version: "1.5.5" 89 | stack_trace: 90 | dependency: transitive 91 | description: 92 | name: stack_trace 93 | url: "https://pub.flutter-io.cn" 94 | source: hosted 95 | version: "1.9.3" 96 | stream_channel: 97 | dependency: transitive 98 | description: 99 | name: stream_channel 100 | url: "https://pub.flutter-io.cn" 101 | source: hosted 102 | version: "2.0.0" 103 | string_scanner: 104 | dependency: transitive 105 | description: 106 | name: string_scanner 107 | url: "https://pub.flutter-io.cn" 108 | source: hosted 109 | version: "1.0.4" 110 | term_glyph: 111 | dependency: transitive 112 | description: 113 | name: term_glyph 114 | url: "https://pub.flutter-io.cn" 115 | source: hosted 116 | version: "1.1.0" 117 | test_api: 118 | dependency: transitive 119 | description: 120 | name: test_api 121 | url: "https://pub.flutter-io.cn" 122 | source: hosted 123 | version: "0.2.4" 124 | typed_data: 125 | dependency: transitive 126 | description: 127 | name: typed_data 128 | url: "https://pub.flutter-io.cn" 129 | source: hosted 130 | version: "1.1.6" 131 | vector_math: 132 | dependency: transitive 133 | description: 134 | name: vector_math 135 | url: "https://pub.flutter-io.cn" 136 | source: hosted 137 | version: "2.0.8" 138 | sdks: 139 | dart: ">=2.2.0 <3.0.0" 140 | -------------------------------------------------------------------------------- /example/pubspec.lock: -------------------------------------------------------------------------------- 1 | # Generated by pub 2 | # See https://dart.dev/tools/pub/glossary#lockfile 3 | packages: 4 | async: 5 | dependency: transitive 6 | description: 7 | name: async 8 | url: "https://pub.flutter-io.cn" 9 | source: hosted 10 | version: "2.2.0" 11 | boolean_selector: 12 | dependency: transitive 13 | description: 14 | name: boolean_selector 15 | url: "https://pub.flutter-io.cn" 16 | source: hosted 17 | version: "1.0.4" 18 | charcode: 19 | dependency: transitive 20 | description: 21 | name: charcode 22 | url: "https://pub.flutter-io.cn" 23 | source: hosted 24 | version: "1.1.2" 25 | collection: 26 | dependency: transitive 27 | description: 28 | name: collection 29 | url: "https://pub.flutter-io.cn" 30 | source: hosted 31 | version: "1.14.11" 32 | cupertino_icons: 33 | dependency: "direct main" 34 | description: 35 | name: cupertino_icons 36 | url: "https://pub.flutter-io.cn" 37 | source: hosted 38 | version: "0.1.2" 39 | flutter: 40 | dependency: "direct main" 41 | description: flutter 42 | source: sdk 43 | version: "0.0.0" 44 | flutter_test: 45 | dependency: "direct dev" 46 | description: flutter 47 | source: sdk 48 | version: "0.0.0" 49 | matcher: 50 | dependency: transitive 51 | description: 52 | name: matcher 53 | url: "https://pub.flutter-io.cn" 54 | source: hosted 55 | version: "0.12.5" 56 | meta: 57 | dependency: transitive 58 | description: 59 | name: meta 60 | url: "https://pub.flutter-io.cn" 61 | source: hosted 62 | version: "1.1.6" 63 | path: 64 | dependency: transitive 65 | description: 66 | name: path 67 | url: "https://pub.flutter-io.cn" 68 | source: hosted 69 | version: "1.6.2" 70 | pedantic: 71 | dependency: transitive 72 | description: 73 | name: pedantic 74 | url: "https://pub.flutter-io.cn" 75 | source: hosted 76 | version: "1.7.0" 77 | quiver: 78 | dependency: transitive 79 | description: 80 | name: quiver 81 | url: "https://pub.flutter-io.cn" 82 | source: hosted 83 | version: "2.0.3" 84 | sky_engine: 85 | dependency: transitive 86 | description: flutter 87 | source: sdk 88 | version: "0.0.99" 89 | source_span: 90 | dependency: transitive 91 | description: 92 | name: source_span 93 | url: "https://pub.flutter-io.cn" 94 | source: hosted 95 | version: "1.5.5" 96 | stack_trace: 97 | dependency: transitive 98 | description: 99 | name: stack_trace 100 | url: "https://pub.flutter-io.cn" 101 | source: hosted 102 | version: "1.9.3" 103 | stream_channel: 104 | dependency: transitive 105 | description: 106 | name: stream_channel 107 | url: "https://pub.flutter-io.cn" 108 | source: hosted 109 | version: "2.0.0" 110 | string_scanner: 111 | dependency: transitive 112 | description: 113 | name: string_scanner 114 | url: "https://pub.flutter-io.cn" 115 | source: hosted 116 | version: "1.0.4" 117 | sweet_chart: 118 | dependency: "direct main" 119 | description: 120 | path: ".." 121 | relative: true 122 | source: path 123 | version: "0.0.1" 124 | term_glyph: 125 | dependency: transitive 126 | description: 127 | name: term_glyph 128 | url: "https://pub.flutter-io.cn" 129 | source: hosted 130 | version: "1.1.0" 131 | test_api: 132 | dependency: transitive 133 | description: 134 | name: test_api 135 | url: "https://pub.flutter-io.cn" 136 | source: hosted 137 | version: "0.2.5" 138 | typed_data: 139 | dependency: transitive 140 | description: 141 | name: typed_data 142 | url: "https://pub.flutter-io.cn" 143 | source: hosted 144 | version: "1.1.6" 145 | vector_math: 146 | dependency: transitive 147 | description: 148 | name: vector_math 149 | url: "https://pub.flutter-io.cn" 150 | source: hosted 151 | version: "2.0.8" 152 | sdks: 153 | dart: ">=2.2.2 <3.0.0" 154 | -------------------------------------------------------------------------------- /lib/src/sweet_line_style.dart: -------------------------------------------------------------------------------- 1 | import 'dart:ui'; 2 | import 'package:flutter/material.dart'; 3 | 4 | enum ChartAliment { StartEnd, Center } 5 | 6 | class LineChartStyle { 7 | // 默认横纵坐标的指标个数 8 | static const int defaultAxisPieceCount = 5; 9 | 10 | // 轴与文本之间的距离 11 | static const int defaultAxisToTitleSpace = 8; 12 | 13 | // y轴文本文本的自身padding值 14 | static const int yAxisTitleInsetPadding = 2; 15 | 16 | // x轴颜色 17 | Color xAxisColor; 18 | 19 | // x轴线粗细 20 | num xAxisHeight; 21 | 22 | // x轴标题对齐方式 23 | ChartAliment aliment; 24 | 25 | // x轴文本样式 26 | TextStyle xAxisTitleStyle; 27 | 28 | // y轴颜色 29 | Color yAxisColor; 30 | 31 | // y轴线粗细 32 | num yAxisWidth; 33 | 34 | // y轴文本样式 35 | TextStyle yAxisTitleStyle; 36 | 37 | // 是否显示x轴 38 | bool showXAxis; 39 | 40 | // 是否显示y轴 41 | bool showYAxis; 42 | 43 | // Y轴显示在图表中 44 | bool innerYAxis; 45 | 46 | // y轴数据分多少格 47 | int yAxisPieceCount; 48 | 49 | // x轴数据起始值大小,不设置默认取 数据源中最小值 50 | num xStartValue; 51 | 52 | // x轴数据结束值大小,不设置默认取 数据源中最大值 53 | num xEndValue; 54 | 55 | // x轴数据起始值大小,不设置默认取 数据源中最小值 56 | num yStartValue; 57 | 58 | // x轴数据结束值大小,不设置默认取 数据源中最大值 59 | num yEndValue; 60 | 61 | num xAxisToTitleSpace; 62 | num yAxisToTitleSpace; 63 | 64 | LineChartStyle({ 65 | this.xAxisColor, 66 | this.xAxisHeight, 67 | this.xAxisTitleStyle, 68 | this.xAxisToTitleSpace = defaultAxisToTitleSpace, 69 | this.yAxisColor, 70 | this.yAxisWidth, 71 | this.yAxisTitleStyle, 72 | this.yAxisToTitleSpace = defaultAxisToTitleSpace, 73 | this.showXAxis = true, 74 | this.showYAxis = true, 75 | this.innerYAxis = false, 76 | this.yAxisPieceCount = defaultAxisPieceCount, 77 | this.xStartValue, 78 | this.xEndValue, 79 | this.yStartValue, 80 | this.yEndValue, 81 | this.aliment, 82 | }) : assert(yAxisPieceCount > 1) { 83 | xAxisColor = xAxisColor ?? Colors.grey[300]; 84 | xAxisHeight = xAxisHeight ?? 1; 85 | xAxisTitleStyle = xAxisTitleStyle ?? 86 | TextStyle( 87 | color: Colors.grey, 88 | decoration: TextDecoration.none, 89 | fontSize: 16, 90 | ); 91 | yAxisColor = yAxisColor ?? xAxisColor; 92 | yAxisWidth = yAxisWidth ?? xAxisHeight; 93 | yAxisTitleStyle = yAxisTitleStyle ?? xAxisTitleStyle; 94 | aliment = aliment ?? ChartAliment.StartEnd; 95 | } 96 | } 97 | 98 | // Curve or straight line 99 | enum LineType { 100 | // 曲线 101 | Curve, 102 | // 直线 103 | Straight 104 | } 105 | 106 | // 折线图中间是否填充颜色 107 | class FillColor { 108 | // 渐变填充 开始颜色 109 | Color startColor; 110 | 111 | // 渐变填充 结束颜色 112 | Color endColor; 113 | 114 | FillColor({@required this.startColor, @required this.endColor}) 115 | : assert(startColor != null && endColor != null, 116 | "start color and end color must set of all"); 117 | } 118 | 119 | class PointTitle { 120 | int index; 121 | String title; 122 | 123 | PointTitle({@required this.index, @required this.title}) 124 | : assert( 125 | index != null && title != null, "index and title must not be null"); 126 | } 127 | 128 | class LineStyle { 129 | // 线条颜色 130 | Color color; 131 | 132 | // 填充颜色 133 | FillColor fillColor; 134 | 135 | bool showPoint; 136 | 137 | PointStyle pointStyle; 138 | 139 | bool showPopTips; 140 | PopTipStyle popTipStyle; 141 | 142 | // 线条的粗细 143 | double width; 144 | 145 | // 线条样式,平滑曲线还是折线 146 | LineType type; 147 | 148 | LineStyle( 149 | {this.color, 150 | this.fillColor, 151 | this.width, 152 | this.type, 153 | this.showPoint, 154 | this.pointStyle, 155 | this.showPopTips, 156 | this.popTipStyle}) { 157 | color = color ?? Colors.redAccent; 158 | type = type ?? LineType.Straight; 159 | width = width ?? 1; 160 | showPoint = showPoint ?? false; 161 | showPopTips = showPopTips ?? false; 162 | 163 | pointStyle = pointStyle ?? PointStyle(); 164 | popTipStyle = popTipStyle ?? PopTipStyle(); 165 | } 166 | } 167 | 168 | class PointStyle { 169 | Color color; 170 | Color borderColor; 171 | double borderWidth; 172 | double size; 173 | 174 | PointStyle({this.color, this.size, this.borderColor, this.borderWidth}) { 175 | size = size ?? 2.0; 176 | borderWidth = borderWidth ?? 0.0; 177 | } 178 | } 179 | 180 | class PopTipStyle { 181 | Color color; 182 | double radius; 183 | TextStyle titleStyle; 184 | TextStyle subTitleStyle; 185 | 186 | // double padding; 187 | EdgeInsets padding; 188 | double lineSpace; 189 | double pointToTipSpace; 190 | bool showSubTitle; 191 | 192 | PopTipStyle( 193 | {this.color, 194 | this.radius, 195 | this.titleStyle, 196 | this.showSubTitle, 197 | this.subTitleStyle, 198 | this.padding, 199 | this.lineSpace, 200 | this.pointToTipSpace}) { 201 | titleStyle = titleStyle ?? TextStyle(color: Colors.white, fontSize: 16); 202 | subTitleStyle = 203 | subTitleStyle ?? TextStyle(color: Colors.white, fontSize: 13); 204 | radius = radius ?? 4; 205 | lineSpace = lineSpace ?? 2; 206 | pointToTipSpace = pointToTipSpace ?? 4; 207 | showSubTitle = showSubTitle ?? true; 208 | padding = EdgeInsets.only(left: 6, right: 6, top: 2, bottom: 2); 209 | } 210 | } 211 | -------------------------------------------------------------------------------- /example/lib/main.dart: -------------------------------------------------------------------------------- 1 | import 'dart:math'; 2 | 3 | import 'package:flutter/material.dart'; 4 | import 'package:sweet_chart/sweet_chart.dart'; 5 | 6 | void main() => runApp(MyApp()); 7 | 8 | class MyApp extends StatelessWidget { 9 | // This widget is the root of your application. 10 | @override 11 | Widget build(BuildContext context) { 12 | return MaterialApp( 13 | title: 'Flutter Demo', 14 | theme: ThemeData( 15 | // This is the theme of your application. 16 | // 17 | // Try running your application with "flutter run". You'll see the 18 | // application has a blue toolbar. Then, without quitting the app, try 19 | // changing the primarySwatch below to Colors.green and then invoke 20 | // "hot reload" (press "r" in the console where you ran "flutter run", 21 | // or simply save your changes to "hot reload" in a Flutter IDE). 22 | // Notice that the counter didn't reset back to zero; the application 23 | // is not restarted. 24 | primarySwatch: Colors.blue, 25 | ), 26 | home: MyHomePage(title: 'Flutter Demo Home Page'), 27 | ); 28 | } 29 | } 30 | 31 | class MyHomePage extends StatefulWidget { 32 | MyHomePage({Key key, this.title}) : super(key: key); 33 | 34 | // This widget is the home page of your application. It is stateful, meaning 35 | // that it has a State object (defined below) that contains fields that affect 36 | // how it looks. 37 | 38 | // This class is the configuration for the state. It holds the values (in this 39 | // case the title) provided by the parent (in this case the App widget) and 40 | // used by the build method of the State. Fields in a Widget subclass are 41 | // always marked "final". 42 | 43 | final String title; 44 | 45 | @override 46 | _MyHomePageState createState() => _MyHomePageState(); 47 | } 48 | 49 | class _MyHomePageState extends State { 50 | List lines = []; 51 | LineChartStyle chartStyle; 52 | 53 | @override 54 | void initState() { 55 | super.initState(); 56 | 57 | List points = []; 58 | var rng = Random(); 59 | for (var i = 0; i < 7; i++) { 60 | points.add(SweetPoint( 61 | value: rng.nextInt(300), title: "title", subTitle: "subtitle")); 62 | } 63 | 64 | var lineStyle = LineStyle( 65 | type: LineType.Curve, 66 | color: Colors.green[200], 67 | width: 2, 68 | showPoint: true, 69 | showPopTips: true, 70 | popTipStyle: PopTipStyle(showSubTitle: true), 71 | pointStyle: PointStyle( 72 | color: Colors.white, 73 | borderColor: Colors.green[200], 74 | borderWidth: 2, 75 | size: 2)); 76 | SweetLine line = SweetLine(points, style: lineStyle); 77 | lines.add(line); 78 | 79 | chartStyle = LineChartStyle(showXAxis: true, showYAxis: true); 80 | } 81 | 82 | @override 83 | Widget build(BuildContext context) { 84 | // This method is rerun every time setState is called, for instance as done 85 | // by the _incrementCounter method above. 86 | // 87 | // The Flutter framework has been optimized to make rerunning build methods 88 | // fast, so that you can just rebuild anything that needs updating rather 89 | // than having to individually change instances of widgets. 90 | return Scaffold( 91 | appBar: AppBar( 92 | // Here we take the value from the MyHomePage object that was created by 93 | // the App.build method, and use it to set our appbar title. 94 | title: Text(widget.title), 95 | ), 96 | body: Column( 97 | children: [ 98 | Wrap( 99 | direction: Axis.horizontal, 100 | spacing: 5, 101 | children: [ 102 | RaisedButton( 103 | child: Text("显示/隐藏x轴文本"), 104 | onPressed: () { 105 | setState(() { 106 | chartStyle.showXAxis = !chartStyle.showXAxis; 107 | }); 108 | }), 109 | RaisedButton( 110 | child: Text("显示/隐藏Y轴文本"), 111 | onPressed: () { 112 | setState(() { 113 | chartStyle.showYAxis = !chartStyle.showYAxis; 114 | }); 115 | }), 116 | RaisedButton( 117 | child: Text("Y轴文本显示于图表内/外"), 118 | onPressed: () { 119 | setState(() { 120 | chartStyle.innerYAxis = !chartStyle.innerYAxis; 121 | }); 122 | }), 123 | RaisedButton( 124 | child: Text("居中/左右填满对齐"), 125 | onPressed: () { 126 | setState(() { 127 | chartStyle.aliment = 128 | chartStyle.aliment == ChartAliment.StartEnd 129 | ? ChartAliment.Center 130 | : ChartAliment.StartEnd; 131 | }); 132 | }), 133 | RaisedButton( 134 | //默认Y轴数据起始为数据最小值,顶点为数据最大值,可以通过设置yStartValue和yEndValue进行自定义 135 | child: Text("自定义Y轴起始值和最大值"), 136 | onPressed: () { 137 | setState(() { 138 | //如果不设置 x和y轴大最大值和最小值,则自动根据line的point中最大值最小值中获取 139 | chartStyle.yStartValue = 140 | chartStyle.yStartValue == null ? 0 : null; 141 | chartStyle.yEndValue = 142 | chartStyle.yEndValue == null ? 500 : null; 143 | }); 144 | }), 145 | RaisedButton( 146 | child: Text("图表内填充颜色"), 147 | onPressed: () { 148 | setState(() { 149 | //如果不设置 x和y轴大最大值和最小值,则自动根据line的point中最大值最小值中获取 150 | lines[0].style.fillColor = lines[0].style.fillColor != 151 | null 152 | ? null 153 | : FillColor( 154 | startColor: lines[0].style.color.withAlpha(80), 155 | endColor: lines[0].style.color.withAlpha(10)); 156 | }); 157 | }), 158 | RaisedButton( 159 | child: Text("平滑曲线"), 160 | onPressed: () { 161 | setState(() { 162 | lines.forEach((line) { 163 | line.style.type = line.style.type == LineType.Curve 164 | ? LineType.Straight 165 | : LineType.Curve; 166 | }); 167 | }); 168 | }), 169 | RaisedButton( 170 | child: Text("增加1个Y轴刻度"), 171 | onPressed: () { 172 | setState(() { 173 | chartStyle.yAxisPieceCount += 1; 174 | }); 175 | }), 176 | RaisedButton( 177 | child: Text("减少1个Y轴刻度"), 178 | onPressed: () { 179 | setState(() { 180 | chartStyle.yAxisPieceCount -= 1; 181 | }); 182 | }), 183 | RaisedButton( 184 | child: Text("显示圆点"), 185 | onPressed: () { 186 | setState(() { 187 | lines[0].style.showPoint = !lines[0].style.showPoint; 188 | }); 189 | }), 190 | RaisedButton( 191 | child: Text("显示/隐藏点击弹出提示"), 192 | onPressed: () { 193 | setState(() { 194 | lines[0].style.showPopTips = !lines[0].style.showPopTips; 195 | }); 196 | }), 197 | RaisedButton( 198 | child: Text("弹出提示不显示子标题"), 199 | onPressed: () { 200 | setState(() { 201 | lines[0].style.popTipStyle.showSubTitle = 202 | !lines[0].style.popTipStyle.showSubTitle; 203 | }); 204 | }), 205 | RaisedButton( 206 | child: Text("增加/减少一条曲线"), 207 | onPressed: () { 208 | setState(() { 209 | if (lines.length > 1) { 210 | lines.removeLast(); 211 | } else { 212 | lines.add(_makeNewLine()); 213 | } 214 | }); 215 | }), 216 | ], 217 | ), 218 | SizedBox( 219 | height: 12, 220 | ), 221 | Container( 222 | color: Colors.white, 223 | width: MediaQuery.of(context).size.width, 224 | height: 200, 225 | child: SweetLineChart( 226 | lines: lines, 227 | chartStyle: chartStyle, 228 | xTitles: {0: "18", 2: "20", 4: "30", 5: "08/01", 6: "02"}, 229 | yTitles: { 230 | 0: "0k", 231 | 1: "5k", 232 | 2: "10k", 233 | 3: "15k", 234 | 4: "20k", 235 | 5: "25k", 236 | 6: "30k" 237 | }, 238 | ), 239 | ), 240 | ], 241 | ), 242 | ); 243 | } 244 | 245 | SweetLine _makeNewLine() { 246 | List points = []; 247 | var rng = Random(); 248 | for (var i = 0; i < 7; i++) { 249 | points.add(SweetPoint(value: rng.nextInt(300))); 250 | } 251 | SweetLine line = SweetLine(points, 252 | style: LineStyle( 253 | fillColor: FillColor( 254 | startColor: Colors.red[200].withAlpha(30), 255 | endColor: Colors.red[200].withAlpha(10)), 256 | type: LineType.Straight, 257 | color: Colors.red[200], 258 | width: 2)); 259 | return line; 260 | } 261 | } 262 | -------------------------------------------------------------------------------- /lib/src/sweet_line_chart.dart: -------------------------------------------------------------------------------- 1 | import 'dart:math'; 2 | import 'dart:core'; 3 | import 'package:flutter/material.dart'; 4 | import 'package:sweet_chart/src/sweet_line.dart'; 5 | import 'package:sweet_chart/src/sweet_line_style.dart'; 6 | import 'package:sweet_chart/sweet_chart.dart'; 7 | import 'dart:ui' as ui; 8 | 9 | class SweetLineChart extends StatefulWidget { 10 | final List lines; 11 | 12 | final LineChartStyle chartStyle; 13 | final Map xTitles; 14 | final Map yTitles; 15 | 16 | SweetLineChart( 17 | {@required this.lines, 18 | @required this.xTitles, 19 | this.yTitles, 20 | this.chartStyle}) 21 | : assert(lines != null && lines.length > 0, 22 | "lines must contains one element at least"); 23 | 24 | @override 25 | State createState() { 26 | return SweetLineChartState(); 27 | } 28 | } 29 | 30 | class SweetLineChartState extends State 31 | with SingleTickerProviderStateMixin { 32 | List lines; 33 | LineChartStyle chartStyle; 34 | AnimationController _controller; 35 | Animation _animation; 36 | Offset tapPoint; 37 | 38 | @override 39 | void initState() { 40 | super.initState(); 41 | lines = widget.lines; 42 | chartStyle = widget.chartStyle ?? LineChartStyle(); 43 | _controller = 44 | AnimationController(vsync: this, duration: Duration(milliseconds: 500)); 45 | _animation = Tween(begin: 0.0, end: 1.0).animate(_controller) 46 | ..addListener(() { 47 | setState(() {}); 48 | }); 49 | _controller.forward(); 50 | } 51 | 52 | @override 53 | Widget build(BuildContext context) { 54 | return GestureDetector( 55 | onTapUp: (tapDetail) { 56 | setState(() { 57 | tapPoint = tapDetail.localPosition; 58 | }); 59 | }, 60 | onHorizontalDragStart: (detail) { 61 | setState(() { 62 | tapPoint = detail.localPosition; 63 | }); 64 | }, 65 | onHorizontalDragUpdate: (detail) { 66 | setState(() { 67 | tapPoint = detail.localPosition; 68 | }); 69 | }, 70 | child: CustomPaint( 71 | painter: SweetLineChartPainter(lines, chartStyle, _animation.value, 72 | widget.xTitles, widget.yTitles, this.tapPoint), 73 | ), 74 | ); 75 | } 76 | } 77 | 78 | class SweetLineChartPainter extends CustomPainter { 79 | List lines; 80 | LineChartStyle chartStyle; 81 | double animationValue; 82 | Map xTitles; 83 | Map yTitles; 84 | Offset tapPoint; 85 | 86 | SweetLineChartPainter(this.lines, this.chartStyle, this.animationValue, 87 | this.xTitles, this.yTitles, this.tapPoint); 88 | 89 | var maxPointCount; 90 | var maxYAxisValue; 91 | var minYAxisValue; 92 | 93 | var pen = Paint() 94 | ..isAntiAlias = true 95 | ..style = PaintingStyle.fill; 96 | 97 | @override 98 | void paint(Canvas canvas, Size size) { 99 | //计算横纵坐标的最大值最小值 100 | _calculateValue(); 101 | //绘制横纵坐标 102 | Size axisSize = _drawAxis(canvas, size); 103 | //绘制图表 104 | _drawChart(canvas, size, axisSize); 105 | } 106 | 107 | _calculateValue() { 108 | //计算纵坐标的最大坐标和最小坐标 109 | maxPointCount = 0; 110 | maxYAxisValue = chartStyle.yEndValue ?? lines[0].maxYAxisValue; 111 | minYAxisValue = chartStyle.yStartValue ?? lines[0].minYAxisValue; 112 | lines.forEach((line) { 113 | if (line.maxYAxisValue > maxYAxisValue) { 114 | maxYAxisValue = line.maxYAxisValue; 115 | } 116 | if (line.minYAxisValue < minYAxisValue) { 117 | minYAxisValue = line.minYAxisValue; 118 | } 119 | var count = line.points.length; 120 | maxPointCount = maxPointCount > count ? maxPointCount : count; 121 | }); 122 | } 123 | 124 | ///绘制坐标轴 125 | Size _drawAxis(Canvas canvas, Size size) { 126 | TextStyle yAxisTitleStyle = chartStyle.yAxisTitleStyle; 127 | TextStyle xAxisTitleStyle = chartStyle.xAxisTitleStyle; 128 | 129 | int yAxisPieceCount = 130 | chartStyle.yAxisPieceCount > 1 ? chartStyle.yAxisPieceCount : 2; 131 | 132 | //——x轴总高度,包含文本宽度和本身的padding 133 | double xAxisHeight = chartStyle.showXAxis 134 | ? xAxisTitleStyle.fontSize + chartStyle.xAxisToTitleSpace 135 | : 0.0; 136 | 137 | double spaceY = (size.height - xAxisHeight) / (yAxisPieceCount - 1); 138 | double spaceYValue = 139 | (maxYAxisValue - minYAxisValue) / (yAxisPieceCount - 1); 140 | 141 | double yAxisWidth = 0.0; 142 | //画y轴文本 143 | if (chartStyle.showYAxis) { 144 | for (int i = 0; i < yAxisPieceCount; i++) { 145 | var title; 146 | if (yTitles != null && yTitles.length > 0) { 147 | title = yTitles[i] ?? ""; 148 | } else { 149 | title = "${(minYAxisValue + (spaceYValue * i)).toInt()}"; 150 | } 151 | TextSpan span = new TextSpan(style: yAxisTitleStyle, text: title); 152 | TextPainter tp = new TextPainter( 153 | text: span, 154 | textAlign: TextAlign.left, 155 | textDirection: TextDirection.ltr); 156 | tp.layout(); 157 | var y = chartStyle.innerYAxis 158 | ? size.height - xAxisHeight - (spaceY * i) - tp.height 159 | : size.height - xAxisHeight - (spaceY * i) - (tp.height / 2); 160 | if (i == 0 && !chartStyle.innerYAxis) { 161 | y = y - (tp.height / 2); 162 | } else if (i == yAxisPieceCount - 1) { 163 | y = chartStyle.innerYAxis ? y + tp.height : y + (tp.height / 2); 164 | } 165 | tp.paint(canvas, Offset(0, y)); 166 | if (tp.size.width > yAxisWidth) { 167 | yAxisWidth = tp.size.width; 168 | } 169 | } 170 | } 171 | //|y轴总宽度,包含文本宽度和本身的padding 172 | yAxisWidth += chartStyle.showYAxis ? chartStyle.yAxisToTitleSpace : 0.0; 173 | yAxisWidth = chartStyle.innerYAxis ? 0 : yAxisWidth; 174 | //画x轴横线 175 | for (int i = 0; i < yAxisPieceCount; i++) { 176 | pen 177 | ..style = PaintingStyle.stroke 178 | ..color = Colors.black12 179 | ..strokeWidth = 0.5; 180 | var y = size.height - xAxisHeight - (spaceY * i); 181 | canvas.drawLine(Offset(yAxisWidth, y), Offset(size.width, y), pen); 182 | } 183 | 184 | var aliStartEnd = chartStyle.aliment == ChartAliment.StartEnd; 185 | var xPiece = aliStartEnd ? maxPointCount - 1 : maxPointCount; 186 | double spaceX = (size.width - yAxisWidth) / (xPiece); 187 | //画x轴标题 188 | if (chartStyle.showXAxis && xTitles != null && xTitles.length > 0) { 189 | for (var i = 0; i < maxPointCount; i++) { 190 | //画x轴文本 191 | var title = xTitles[i] ?? ""; 192 | TextSpan span = new TextSpan(style: xAxisTitleStyle, text: title); 193 | TextPainter tp = new TextPainter( 194 | text: span, 195 | textAlign: TextAlign.left, 196 | textDirection: TextDirection.ltr); 197 | tp.layout(); 198 | 199 | var y = size.height - tp.height; 200 | //注意x轴如果是最后一个点需要再减去自身文本宽度 201 | var x; 202 | if (!aliStartEnd) { 203 | x = yAxisWidth + spaceX * i + spaceX / 2 - (tp.size.width / 2); 204 | } else { 205 | x = yAxisWidth + (spaceX * i) - (tp.size.width / 2); 206 | if (i == 0) { 207 | x = yAxisWidth + (spaceX * i); 208 | } 209 | if (i == (maxPointCount - 1)) { 210 | x = yAxisWidth + (spaceX * i) - tp.size.width; 211 | } 212 | } 213 | tp.paint(canvas, Offset(x, y)); 214 | } 215 | } 216 | //返回x轴高度和y轴占用的宽度,用于画图表内容时,获取正确的面积 217 | return Size(yAxisWidth, xAxisHeight); 218 | } 219 | 220 | ///绘制数据 221 | void _drawChart(Canvas canvas, Size size, Size axisSize) { 222 | //画折线图上的点 223 | var startX = axisSize.width; //y轴的宽度 224 | var startY = size.height - axisSize.height; //totalHeight - axis height 225 | double availableWidth = size.width - axisSize.width; 226 | double availableHeight = size.height - axisSize.height; 227 | 228 | var aliStartEnd = chartStyle.aliment == ChartAliment.StartEnd; 229 | var xPiece = aliStartEnd ? maxPointCount - 1 : maxPointCount; 230 | 231 | double xPerValue = availableWidth / xPiece; 232 | double yPerValue = availableHeight / (maxYAxisValue - minYAxisValue); 233 | 234 | for (var line in lines) { 235 | Path path = Path(); 236 | Paint paint = Paint(); 237 | paint.color = line.style.color; 238 | paint.strokeWidth = line.style.width; 239 | paint.style = PaintingStyle.stroke; 240 | 241 | //calculate all point 242 | List points = []; 243 | for (int i = 0; i < line.points.length; i++) { 244 | var point = line.points[i]; 245 | var x; 246 | if (!aliStartEnd) { 247 | x = startX + (i * xPerValue) + xPerValue / 2; 248 | } else { 249 | x = startX + (i * xPerValue); 250 | } 251 | var y = startY - 252 | (((point.value - minYAxisValue) * yPerValue) * animationValue); 253 | points.add(Offset(x, y)); 254 | } 255 | 256 | path.moveTo(points[0].dx, points[0].dy); 257 | if (line.style.type == LineType.Curve) { 258 | _makeCurveLine(points, path, canvas); 259 | } 260 | if (line.style.type == LineType.Straight) { 261 | _makeStraightLine(points, path, canvas); 262 | } 263 | canvas.drawPath(path, paint); 264 | 265 | // draw point 266 | if (line.style.showPoint) { 267 | _drawPoint(points, line, canvas); 268 | } 269 | 270 | // draw line gradient shape 271 | if (line.style.fillColor != null) { 272 | path.lineTo(points.last.dx, startY); 273 | path.lineTo(points.first.dx, startY); 274 | path.close(); 275 | Paint bodyPaint = Paint(); 276 | var gradientTop = availableHeight - line.minYAxisValue * yPerValue; 277 | bodyPaint.shader = ui.Gradient.linear( 278 | Offset(0.0, gradientTop), Offset(0.0, size.height), [ 279 | line.style.fillColor.startColor, 280 | line.style.fillColor.endColor, 281 | ]); 282 | canvas.drawPath(path, bodyPaint); 283 | } 284 | if (line.style.showPopTips) { 285 | var pointIndex = getTouchPoint(points); 286 | if (pointIndex != -1) { 287 | _drawTips( 288 | points[pointIndex], line.points[pointIndex], line, canvas, size); 289 | } 290 | } 291 | } 292 | } 293 | 294 | int getTouchPoint(List points) { 295 | var touchArea = 10; 296 | if (tapPoint == null) { 297 | return -1; 298 | } 299 | for (var i = 0; i < points.length; i++) { 300 | var offset = points[i]; 301 | //判断是否在点击区域中 302 | if (tapPoint.dx > offset.dx - touchArea && 303 | tapPoint.dx < offset.dx + touchArea) { 304 | return i; 305 | } 306 | } 307 | return -1; 308 | } 309 | 310 | _drawPoint(List points, SweetLine line, Canvas canvas) { 311 | var pointPaint = Paint(); 312 | points.forEach((p) { 313 | pointPaint.style = PaintingStyle.fill; 314 | pointPaint.color = line.style.pointStyle.color ?? line.style.color; 315 | canvas.drawCircle(p, line.style.pointStyle.size, pointPaint); 316 | if (line.style.pointStyle.borderWidth > 0) { 317 | pointPaint.style = PaintingStyle.stroke; 318 | pointPaint.color = 319 | line.style.pointStyle.borderColor ?? line.style.color; 320 | pointPaint.strokeWidth = line.style.pointStyle.borderWidth; 321 | var size = 322 | line.style.pointStyle.size + line.style.pointStyle.borderWidth / 2; 323 | canvas.drawCircle(p, size, pointPaint); 324 | } 325 | }); 326 | } 327 | 328 | _drawTips(Offset offset, SweetPoint point, SweetLine line, Canvas canvas, 329 | Size size) { 330 | var triangleSize = 8; 331 | TextSpan span = new TextSpan( 332 | style: line.style.popTipStyle.titleStyle, text: point.title ?? ""); 333 | TextPainter tp = new TextPainter( 334 | text: span, 335 | textAlign: TextAlign.left, 336 | textDirection: TextDirection.ltr); 337 | tp.layout(); 338 | 339 | TextSpan subSpan = new TextSpan( 340 | style: line.style.popTipStyle.subTitleStyle, 341 | text: point.subTitle ?? ""); 342 | double subTpWidth = 0, subTpHeight = 0; 343 | TextPainter subTp; 344 | if (line.style.popTipStyle.showSubTitle) { 345 | subTp = new TextPainter( 346 | text: subSpan, 347 | textAlign: TextAlign.left, 348 | textDirection: TextDirection.ltr); 349 | subTp.layout(); 350 | subTpWidth = subTp.width; 351 | subTpHeight = subTp.height; 352 | } 353 | 354 | double width = (tp.width > subTpWidth ? tp.width : subTpWidth) + 355 | (line.style.popTipStyle.padding.left + 356 | line.style.popTipStyle.padding.right); 357 | double height = tp.height + 358 | subTpHeight + 359 | line.style.popTipStyle.padding.top + 360 | line.style.popTipStyle.padding.bottom + 361 | line.style.popTipStyle.lineSpace; 362 | double left, top, right, bottom; 363 | 364 | if (offset.dx < width / 2) { 365 | left = 0; 366 | right = 0 + width; 367 | } else if ((size.width - offset.dx) < width / 2) { 368 | right = size.width; 369 | left = size.width - width; 370 | } else { 371 | left = offset.dx - width / 2; 372 | right = offset.dx + width / 2; 373 | } 374 | 375 | int popIsUpDirection = -1; 376 | //弹出框向上 377 | if (offset.dy > 378 | (height + triangleSize + line.style.popTipStyle.pointToTipSpace)) { 379 | popIsUpDirection = -1; 380 | top = offset.dy - 381 | line.style.popTipStyle.pointToTipSpace - 382 | triangleSize - 383 | height; 384 | bottom = top + height; 385 | } else { 386 | //弹出框向下 387 | popIsUpDirection = 1; 388 | top = offset.dy + line.style.popTipStyle.pointToTipSpace + triangleSize; 389 | bottom = top + height; 390 | } 391 | 392 | //draw pop tips 393 | Paint paint = Paint() 394 | ..style = PaintingStyle.fill 395 | ..color = line.style.popTipStyle.color ?? line.style.color; 396 | Path p = Path(); 397 | p.moveTo(offset.dx, 398 | offset.dy + line.style.popTipStyle.pointToTipSpace * popIsUpDirection); 399 | var triWidth = triangleSize + line.style.popTipStyle.radius * 2; 400 | p.lineTo( 401 | offset.dx - triWidth / 2, 402 | (popIsUpDirection == -1 ? bottom : top) + 403 | line.style.popTipStyle.radius * popIsUpDirection); 404 | p.lineTo( 405 | offset.dx + triWidth / 2, 406 | (popIsUpDirection == -1 ? bottom : top) + 407 | line.style.popTipStyle.radius * popIsUpDirection); 408 | p.close(); 409 | canvas.drawPath(p, paint); 410 | 411 | var radius = Radius.circular(line.style.popTipStyle.radius); 412 | var rect = RRect.fromLTRBAndCorners(left, top, right, bottom, 413 | topLeft: radius, 414 | topRight: radius, 415 | bottomLeft: radius, 416 | bottomRight: radius); 417 | canvas.drawRRect(rect, paint); 418 | var titleX, subTitleX; 419 | if (tp.width > subTpWidth) { 420 | titleX = left + line.style.popTipStyle.padding.left; 421 | subTitleX = subTp == null ? 0 : titleX + (tp.width / 2) - subTp.width / 2; 422 | } else { 423 | subTitleX = left + line.style.popTipStyle.padding.left; 424 | titleX = subTitleX + (subTpWidth / 2) - tp.width / 2; 425 | } 426 | 427 | tp.paint(canvas, Offset(titleX, top + line.style.popTipStyle.padding.top)); 428 | 429 | subTp?.paint( 430 | canvas, 431 | Offset( 432 | subTitleX, 433 | top + 434 | line.style.popTipStyle.padding.top + 435 | tp.height + 436 | line.style.popTipStyle.lineSpace)); 437 | } 438 | 439 | _makeStraightLine(List points, Path path, Canvas canvas) { 440 | points.forEach((p) { 441 | path.lineTo(p.dx, p.dy); 442 | }); 443 | } 444 | 445 | _makeCurveLine(List points, Path path, Canvas canvas) { 446 | var scale = 0.1; 447 | //draw bezier curve 448 | //control points A B 449 | points.asMap().forEach((index, p) { 450 | if (index >= points.length - 1) { 451 | return; 452 | } 453 | var preIndex = index == 0 ? 0 : index - 1; 454 | var ax = p.dx + scale * (points[index + 1].dx - points[preIndex].dx); 455 | var ay = p.dy + scale * (points[index + 1].dy - points[preIndex].dy); 456 | var nexIndex = index == (points.length - 2) ? index + 1 : index + 2; 457 | var bx = points[index + 1].dx - scale * (points[nexIndex].dx - p.dx); 458 | var by = points[index + 1].dy - scale * (points[nexIndex].dy - p.dy); 459 | path.cubicTo(ax, ay, bx, by, points[index + 1].dx, points[index + 1].dy); 460 | }); 461 | } 462 | 463 | @override 464 | bool shouldRepaint(SweetLineChartPainter oldDelegate) { 465 | return oldDelegate != this || 466 | oldDelegate.animationValue != this.animationValue || 467 | oldDelegate.tapPoint != this.tapPoint; 468 | } 469 | } 470 | -------------------------------------------------------------------------------- /example/ios/Runner.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; }; 11 | 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; 12 | 3B80C3941E831B6300D905FE /* App.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; }; 13 | 3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 14 | 9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; }; 15 | 9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 16 | 9740EEB41CF90195004384FC /* Debug.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = 9740EEB21CF90195004384FC /* Debug.xcconfig */; }; 17 | 978B8F6F1D3862AE00F588F7 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */; }; 18 | 97C146F31CF9000F007C117D /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 97C146F21CF9000F007C117D /* main.m */; }; 19 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; 20 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; 21 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; 22 | /* End PBXBuildFile section */ 23 | 24 | /* Begin PBXCopyFilesBuildPhase section */ 25 | 9705A1C41CF9048500538489 /* Embed Frameworks */ = { 26 | isa = PBXCopyFilesBuildPhase; 27 | buildActionMask = 2147483647; 28 | dstPath = ""; 29 | dstSubfolderSpec = 10; 30 | files = ( 31 | 3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */, 32 | 9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */, 33 | ); 34 | name = "Embed Frameworks"; 35 | runOnlyForDeploymentPostprocessing = 0; 36 | }; 37 | /* End PBXCopyFilesBuildPhase section */ 38 | 39 | /* Begin PBXFileReference section */ 40 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; }; 41 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; }; 42 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; 43 | 3B80C3931E831B6300D905FE /* App.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = App.framework; path = Flutter/App.framework; sourceTree = ""; }; 44 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; 45 | 7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 46 | 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 47 | 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; }; 48 | 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; }; 49 | 9740EEBA1CF902C7004384FC /* Flutter.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Flutter.framework; path = Flutter/Flutter.framework; sourceTree = ""; }; 50 | 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; }; 51 | 97C146F21CF9000F007C117D /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 52 | 97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 53 | 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 54 | 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 55 | 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 56 | /* End PBXFileReference section */ 57 | 58 | /* Begin PBXFrameworksBuildPhase section */ 59 | 97C146EB1CF9000F007C117D /* Frameworks */ = { 60 | isa = PBXFrameworksBuildPhase; 61 | buildActionMask = 2147483647; 62 | files = ( 63 | 9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */, 64 | 3B80C3941E831B6300D905FE /* App.framework in Frameworks */, 65 | ); 66 | runOnlyForDeploymentPostprocessing = 0; 67 | }; 68 | /* End PBXFrameworksBuildPhase section */ 69 | 70 | /* Begin PBXGroup section */ 71 | 9740EEB11CF90186004384FC /* Flutter */ = { 72 | isa = PBXGroup; 73 | children = ( 74 | 3B80C3931E831B6300D905FE /* App.framework */, 75 | 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */, 76 | 9740EEBA1CF902C7004384FC /* Flutter.framework */, 77 | 9740EEB21CF90195004384FC /* Debug.xcconfig */, 78 | 7AFA3C8E1D35360C0083082E /* Release.xcconfig */, 79 | 9740EEB31CF90195004384FC /* Generated.xcconfig */, 80 | ); 81 | name = Flutter; 82 | sourceTree = ""; 83 | }; 84 | 97C146E51CF9000F007C117D = { 85 | isa = PBXGroup; 86 | children = ( 87 | 9740EEB11CF90186004384FC /* Flutter */, 88 | 97C146F01CF9000F007C117D /* Runner */, 89 | 97C146EF1CF9000F007C117D /* Products */, 90 | ); 91 | sourceTree = ""; 92 | }; 93 | 97C146EF1CF9000F007C117D /* Products */ = { 94 | isa = PBXGroup; 95 | children = ( 96 | 97C146EE1CF9000F007C117D /* Runner.app */, 97 | ); 98 | name = Products; 99 | sourceTree = ""; 100 | }; 101 | 97C146F01CF9000F007C117D /* Runner */ = { 102 | isa = PBXGroup; 103 | children = ( 104 | 7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */, 105 | 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */, 106 | 97C146FA1CF9000F007C117D /* Main.storyboard */, 107 | 97C146FD1CF9000F007C117D /* Assets.xcassets */, 108 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */, 109 | 97C147021CF9000F007C117D /* Info.plist */, 110 | 97C146F11CF9000F007C117D /* Supporting Files */, 111 | 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */, 112 | 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */, 113 | ); 114 | path = Runner; 115 | sourceTree = ""; 116 | }; 117 | 97C146F11CF9000F007C117D /* Supporting Files */ = { 118 | isa = PBXGroup; 119 | children = ( 120 | 97C146F21CF9000F007C117D /* main.m */, 121 | ); 122 | name = "Supporting Files"; 123 | sourceTree = ""; 124 | }; 125 | /* End PBXGroup section */ 126 | 127 | /* Begin PBXNativeTarget section */ 128 | 97C146ED1CF9000F007C117D /* Runner */ = { 129 | isa = PBXNativeTarget; 130 | buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; 131 | buildPhases = ( 132 | 9740EEB61CF901F6004384FC /* Run Script */, 133 | 97C146EA1CF9000F007C117D /* Sources */, 134 | 97C146EB1CF9000F007C117D /* Frameworks */, 135 | 97C146EC1CF9000F007C117D /* Resources */, 136 | 9705A1C41CF9048500538489 /* Embed Frameworks */, 137 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */, 138 | ); 139 | buildRules = ( 140 | ); 141 | dependencies = ( 142 | ); 143 | name = Runner; 144 | productName = Runner; 145 | productReference = 97C146EE1CF9000F007C117D /* Runner.app */; 146 | productType = "com.apple.product-type.application"; 147 | }; 148 | /* End PBXNativeTarget section */ 149 | 150 | /* Begin PBXProject section */ 151 | 97C146E61CF9000F007C117D /* Project object */ = { 152 | isa = PBXProject; 153 | attributes = { 154 | LastUpgradeCheck = 0910; 155 | ORGANIZATIONNAME = "The Chromium Authors"; 156 | TargetAttributes = { 157 | 97C146ED1CF9000F007C117D = { 158 | CreatedOnToolsVersion = 7.3.1; 159 | DevelopmentTeam = MB49F9C6PJ; 160 | }; 161 | }; 162 | }; 163 | buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */; 164 | compatibilityVersion = "Xcode 3.2"; 165 | developmentRegion = English; 166 | hasScannedForEncodings = 0; 167 | knownRegions = ( 168 | en, 169 | Base, 170 | ); 171 | mainGroup = 97C146E51CF9000F007C117D; 172 | productRefGroup = 97C146EF1CF9000F007C117D /* Products */; 173 | projectDirPath = ""; 174 | projectRoot = ""; 175 | targets = ( 176 | 97C146ED1CF9000F007C117D /* Runner */, 177 | ); 178 | }; 179 | /* End PBXProject section */ 180 | 181 | /* Begin PBXResourcesBuildPhase section */ 182 | 97C146EC1CF9000F007C117D /* Resources */ = { 183 | isa = PBXResourcesBuildPhase; 184 | buildActionMask = 2147483647; 185 | files = ( 186 | 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */, 187 | 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */, 188 | 9740EEB41CF90195004384FC /* Debug.xcconfig in Resources */, 189 | 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */, 190 | 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */, 191 | ); 192 | runOnlyForDeploymentPostprocessing = 0; 193 | }; 194 | /* End PBXResourcesBuildPhase section */ 195 | 196 | /* Begin PBXShellScriptBuildPhase section */ 197 | 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { 198 | isa = PBXShellScriptBuildPhase; 199 | buildActionMask = 2147483647; 200 | files = ( 201 | ); 202 | inputPaths = ( 203 | ); 204 | name = "Thin Binary"; 205 | outputPaths = ( 206 | ); 207 | runOnlyForDeploymentPostprocessing = 0; 208 | shellPath = /bin/sh; 209 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" thin"; 210 | }; 211 | 9740EEB61CF901F6004384FC /* Run Script */ = { 212 | isa = PBXShellScriptBuildPhase; 213 | buildActionMask = 2147483647; 214 | files = ( 215 | ); 216 | inputPaths = ( 217 | ); 218 | name = "Run Script"; 219 | outputPaths = ( 220 | ); 221 | runOnlyForDeploymentPostprocessing = 0; 222 | shellPath = /bin/sh; 223 | shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; 224 | }; 225 | /* End PBXShellScriptBuildPhase section */ 226 | 227 | /* Begin PBXSourcesBuildPhase section */ 228 | 97C146EA1CF9000F007C117D /* Sources */ = { 229 | isa = PBXSourcesBuildPhase; 230 | buildActionMask = 2147483647; 231 | files = ( 232 | 978B8F6F1D3862AE00F588F7 /* AppDelegate.m in Sources */, 233 | 97C146F31CF9000F007C117D /* main.m in Sources */, 234 | 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */, 235 | ); 236 | runOnlyForDeploymentPostprocessing = 0; 237 | }; 238 | /* End PBXSourcesBuildPhase section */ 239 | 240 | /* Begin PBXVariantGroup section */ 241 | 97C146FA1CF9000F007C117D /* Main.storyboard */ = { 242 | isa = PBXVariantGroup; 243 | children = ( 244 | 97C146FB1CF9000F007C117D /* Base */, 245 | ); 246 | name = Main.storyboard; 247 | sourceTree = ""; 248 | }; 249 | 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */ = { 250 | isa = PBXVariantGroup; 251 | children = ( 252 | 97C147001CF9000F007C117D /* Base */, 253 | ); 254 | name = LaunchScreen.storyboard; 255 | sourceTree = ""; 256 | }; 257 | /* End PBXVariantGroup section */ 258 | 259 | /* Begin XCBuildConfiguration section */ 260 | 249021D3217E4FDB00AE95B9 /* Profile */ = { 261 | isa = XCBuildConfiguration; 262 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 263 | buildSettings = { 264 | ALWAYS_SEARCH_USER_PATHS = NO; 265 | CLANG_ANALYZER_NONNULL = YES; 266 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 267 | CLANG_CXX_LIBRARY = "libc++"; 268 | CLANG_ENABLE_MODULES = YES; 269 | CLANG_ENABLE_OBJC_ARC = YES; 270 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 271 | CLANG_WARN_BOOL_CONVERSION = YES; 272 | CLANG_WARN_COMMA = YES; 273 | CLANG_WARN_CONSTANT_CONVERSION = YES; 274 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 275 | CLANG_WARN_EMPTY_BODY = YES; 276 | CLANG_WARN_ENUM_CONVERSION = YES; 277 | CLANG_WARN_INFINITE_RECURSION = YES; 278 | CLANG_WARN_INT_CONVERSION = YES; 279 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 280 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 281 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 282 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 283 | CLANG_WARN_STRICT_PROTOTYPES = YES; 284 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 285 | CLANG_WARN_UNREACHABLE_CODE = YES; 286 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 287 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 288 | COPY_PHASE_STRIP = NO; 289 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 290 | ENABLE_NS_ASSERTIONS = NO; 291 | ENABLE_STRICT_OBJC_MSGSEND = YES; 292 | GCC_C_LANGUAGE_STANDARD = gnu99; 293 | GCC_NO_COMMON_BLOCKS = YES; 294 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 295 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 296 | GCC_WARN_UNDECLARED_SELECTOR = YES; 297 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 298 | GCC_WARN_UNUSED_FUNCTION = YES; 299 | GCC_WARN_UNUSED_VARIABLE = YES; 300 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 301 | MTL_ENABLE_DEBUG_INFO = NO; 302 | SDKROOT = iphoneos; 303 | TARGETED_DEVICE_FAMILY = "1,2"; 304 | VALIDATE_PRODUCT = YES; 305 | }; 306 | name = Profile; 307 | }; 308 | 249021D4217E4FDB00AE95B9 /* Profile */ = { 309 | isa = XCBuildConfiguration; 310 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 311 | buildSettings = { 312 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 313 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 314 | DEVELOPMENT_TEAM = MB49F9C6PJ; 315 | ENABLE_BITCODE = NO; 316 | FRAMEWORK_SEARCH_PATHS = ( 317 | "$(inherited)", 318 | "$(PROJECT_DIR)/Flutter", 319 | ); 320 | INFOPLIST_FILE = Runner/Info.plist; 321 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 322 | LIBRARY_SEARCH_PATHS = ( 323 | "$(inherited)", 324 | "$(PROJECT_DIR)/Flutter", 325 | ); 326 | PRODUCT_BUNDLE_IDENTIFIER = com.example.example; 327 | PRODUCT_NAME = "$(TARGET_NAME)"; 328 | VERSIONING_SYSTEM = "apple-generic"; 329 | }; 330 | name = Profile; 331 | }; 332 | 97C147031CF9000F007C117D /* Debug */ = { 333 | isa = XCBuildConfiguration; 334 | baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; 335 | buildSettings = { 336 | ALWAYS_SEARCH_USER_PATHS = NO; 337 | CLANG_ANALYZER_NONNULL = YES; 338 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 339 | CLANG_CXX_LIBRARY = "libc++"; 340 | CLANG_ENABLE_MODULES = YES; 341 | CLANG_ENABLE_OBJC_ARC = YES; 342 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 343 | CLANG_WARN_BOOL_CONVERSION = YES; 344 | CLANG_WARN_COMMA = YES; 345 | CLANG_WARN_CONSTANT_CONVERSION = YES; 346 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 347 | CLANG_WARN_EMPTY_BODY = YES; 348 | CLANG_WARN_ENUM_CONVERSION = YES; 349 | CLANG_WARN_INFINITE_RECURSION = YES; 350 | CLANG_WARN_INT_CONVERSION = YES; 351 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 352 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 353 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 354 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 355 | CLANG_WARN_STRICT_PROTOTYPES = YES; 356 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 357 | CLANG_WARN_UNREACHABLE_CODE = YES; 358 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 359 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 360 | COPY_PHASE_STRIP = NO; 361 | DEBUG_INFORMATION_FORMAT = dwarf; 362 | ENABLE_STRICT_OBJC_MSGSEND = YES; 363 | ENABLE_TESTABILITY = YES; 364 | GCC_C_LANGUAGE_STANDARD = gnu99; 365 | GCC_DYNAMIC_NO_PIC = NO; 366 | GCC_NO_COMMON_BLOCKS = YES; 367 | GCC_OPTIMIZATION_LEVEL = 0; 368 | GCC_PREPROCESSOR_DEFINITIONS = ( 369 | "DEBUG=1", 370 | "$(inherited)", 371 | ); 372 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 373 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 374 | GCC_WARN_UNDECLARED_SELECTOR = YES; 375 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 376 | GCC_WARN_UNUSED_FUNCTION = YES; 377 | GCC_WARN_UNUSED_VARIABLE = YES; 378 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 379 | MTL_ENABLE_DEBUG_INFO = YES; 380 | ONLY_ACTIVE_ARCH = YES; 381 | SDKROOT = iphoneos; 382 | TARGETED_DEVICE_FAMILY = "1,2"; 383 | }; 384 | name = Debug; 385 | }; 386 | 97C147041CF9000F007C117D /* Release */ = { 387 | isa = XCBuildConfiguration; 388 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 389 | buildSettings = { 390 | ALWAYS_SEARCH_USER_PATHS = NO; 391 | CLANG_ANALYZER_NONNULL = YES; 392 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 393 | CLANG_CXX_LIBRARY = "libc++"; 394 | CLANG_ENABLE_MODULES = YES; 395 | CLANG_ENABLE_OBJC_ARC = YES; 396 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 397 | CLANG_WARN_BOOL_CONVERSION = YES; 398 | CLANG_WARN_COMMA = YES; 399 | CLANG_WARN_CONSTANT_CONVERSION = YES; 400 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 401 | CLANG_WARN_EMPTY_BODY = YES; 402 | CLANG_WARN_ENUM_CONVERSION = YES; 403 | CLANG_WARN_INFINITE_RECURSION = YES; 404 | CLANG_WARN_INT_CONVERSION = YES; 405 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 406 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 407 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 408 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 409 | CLANG_WARN_STRICT_PROTOTYPES = YES; 410 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 411 | CLANG_WARN_UNREACHABLE_CODE = YES; 412 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 413 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 414 | COPY_PHASE_STRIP = NO; 415 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 416 | ENABLE_NS_ASSERTIONS = NO; 417 | ENABLE_STRICT_OBJC_MSGSEND = YES; 418 | GCC_C_LANGUAGE_STANDARD = gnu99; 419 | GCC_NO_COMMON_BLOCKS = YES; 420 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 421 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 422 | GCC_WARN_UNDECLARED_SELECTOR = YES; 423 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 424 | GCC_WARN_UNUSED_FUNCTION = YES; 425 | GCC_WARN_UNUSED_VARIABLE = YES; 426 | IPHONEOS_DEPLOYMENT_TARGET = 8.0; 427 | MTL_ENABLE_DEBUG_INFO = NO; 428 | SDKROOT = iphoneos; 429 | TARGETED_DEVICE_FAMILY = "1,2"; 430 | VALIDATE_PRODUCT = YES; 431 | }; 432 | name = Release; 433 | }; 434 | 97C147061CF9000F007C117D /* Debug */ = { 435 | isa = XCBuildConfiguration; 436 | baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; 437 | buildSettings = { 438 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 439 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 440 | DEVELOPMENT_TEAM = MB49F9C6PJ; 441 | ENABLE_BITCODE = NO; 442 | FRAMEWORK_SEARCH_PATHS = ( 443 | "$(inherited)", 444 | "$(PROJECT_DIR)/Flutter", 445 | ); 446 | INFOPLIST_FILE = Runner/Info.plist; 447 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 448 | LIBRARY_SEARCH_PATHS = ( 449 | "$(inherited)", 450 | "$(PROJECT_DIR)/Flutter", 451 | ); 452 | PRODUCT_BUNDLE_IDENTIFIER = com.example.example; 453 | PRODUCT_NAME = "$(TARGET_NAME)"; 454 | VERSIONING_SYSTEM = "apple-generic"; 455 | }; 456 | name = Debug; 457 | }; 458 | 97C147071CF9000F007C117D /* Release */ = { 459 | isa = XCBuildConfiguration; 460 | baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; 461 | buildSettings = { 462 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 463 | CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; 464 | DEVELOPMENT_TEAM = MB49F9C6PJ; 465 | ENABLE_BITCODE = NO; 466 | FRAMEWORK_SEARCH_PATHS = ( 467 | "$(inherited)", 468 | "$(PROJECT_DIR)/Flutter", 469 | ); 470 | INFOPLIST_FILE = Runner/Info.plist; 471 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 472 | LIBRARY_SEARCH_PATHS = ( 473 | "$(inherited)", 474 | "$(PROJECT_DIR)/Flutter", 475 | ); 476 | PRODUCT_BUNDLE_IDENTIFIER = com.example.example; 477 | PRODUCT_NAME = "$(TARGET_NAME)"; 478 | VERSIONING_SYSTEM = "apple-generic"; 479 | }; 480 | name = Release; 481 | }; 482 | /* End XCBuildConfiguration section */ 483 | 484 | /* Begin XCConfigurationList section */ 485 | 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = { 486 | isa = XCConfigurationList; 487 | buildConfigurations = ( 488 | 97C147031CF9000F007C117D /* Debug */, 489 | 97C147041CF9000F007C117D /* Release */, 490 | 249021D3217E4FDB00AE95B9 /* Profile */, 491 | ); 492 | defaultConfigurationIsVisible = 0; 493 | defaultConfigurationName = Release; 494 | }; 495 | 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */ = { 496 | isa = XCConfigurationList; 497 | buildConfigurations = ( 498 | 97C147061CF9000F007C117D /* Debug */, 499 | 97C147071CF9000F007C117D /* Release */, 500 | 249021D4217E4FDB00AE95B9 /* Profile */, 501 | ); 502 | defaultConfigurationIsVisible = 0; 503 | defaultConfigurationName = Release; 504 | }; 505 | /* End XCConfigurationList section */ 506 | }; 507 | rootObject = 97C146E61CF9000F007C117D /* Project object */; 508 | } 509 | --------------------------------------------------------------------------------