diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 000000000..26d33521a --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/.idea/charts.iml b/.idea/charts.iml new file mode 100644 index 000000000..1a251f560 --- /dev/null +++ b/.idea/charts.iml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 000000000..442a908cd --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/runConfigurations.xml b/.idea/runConfigurations.xml new file mode 100644 index 000000000..797acea53 --- /dev/null +++ b/.idea/runConfigurations.xml @@ -0,0 +1,10 @@ + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 000000000..35eb1ddfb --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/charts_common/CHANGELOG.md b/charts_common/CHANGELOG.md index 94bce64a4..89f2e151e 100644 --- a/charts_common/CHANGELOG.md +++ b/charts_common/CHANGELOG.md @@ -1,3 +1,11 @@ +# 0.11.0 +* Null support +* Update to latest from internal repo + +# 0.10.0 +* Internal bug fixes +* Bump versions of intl due to pull request + # 0.9.0 * Internal bug fixes * Bump versions in Gemlock file due to security alerts diff --git a/charts_common/lib/common.dart b/charts_common/lib/common.dart index 033687c33..30179459f 100644 --- a/charts_common/lib/common.dart +++ b/charts_common/lib/common.dart @@ -22,10 +22,10 @@ export 'src/chart/bar/bar_renderer.dart' show BarRenderer, BarRendererElement, ImmutableBarRendererElement; export 'src/chart/bar/bar_renderer_config.dart' show - BarRendererConfig, - CornerStrategy, - ConstCornerStrategy, - NoCornerStrategy; + BarRendererConfig, + CornerStrategy, + ConstCornerStrategy, + NoCornerStrategy; export 'src/chart/bar/bar_renderer_decorator.dart' show BarRendererDecorator; export 'src/chart/bar/bar_target_line_renderer.dart' show BarTargetLineRenderer; export 'src/chart/bar/bar_target_line_renderer_config.dart' @@ -36,17 +36,54 @@ export 'src/chart/bar/base_bar_renderer_config.dart' show BarGroupingType, BaseBarRendererConfig; export 'src/chart/cartesian/axis/axis.dart' show - domainAxisKey, - measureAxisIdKey, - measureAxisKey, - Axis, - ImmutableAxis, - AxisOrientation, - NumericAxis, - OrdinalAxis, - OrdinalViewport; -export 'src/chart/cartesian/axis/draw_strategy/base_tick_draw_strategy.dart' - show BaseRenderSpec, BaseTickDrawStrategy; + domainAxisKey, + measureAxisIdKey, + measureAxisKey, + Axis, + NumericAxis, + OrdinalAxis, + AxisOrientation, + OrdinalViewport; +export 'src/chart/cartesian/axis/scale.dart' + show + Scale, + Extents, + ScaleOutputExtent, + RangeBandType, + RangeBandConfig, + StepSizeType, + StepSizeConfig, + MutableScale; +export 'src/chart/cartesian/axis/tick_provider.dart' + show + TickProvider, + TickHint, + BaseTickProvider; +export 'src/chart/cartesian/axis/tick_formatter.dart' + show + TickFormatter, + NumericTickFormatter, + OrdinalTickFormatter, + SimpleTickFormatterBase; +export 'src/chart/cartesian/axis/linear/linear_scale.dart' + show + LinearScale; +export 'src/chart/cartesian/axis/tick_formatter.dart' + show + SimpleTickFormatterBase, + OrdinalTickFormatter, + NumericTickFormatter, + TickFormatter; +export 'src/chart/cartesian/axis/tick_provider.dart' + show + BaseTickProvider, + TickProvider; +export 'src/chart/cartesian/axis/static_tick_provider.dart' + show + StaticTickProvider; +export 'src/chart/cartesian/axis/end_points_tick_provider.dart' + show + EndPointsTickProvider; export 'src/chart/cartesian/axis/draw_strategy/gridline_draw_strategy.dart' show GridlineRendererSpec; export 'src/chart/cartesian/axis/draw_strategy/none_draw_strategy.dart' @@ -58,54 +95,55 @@ export 'src/chart/cartesian/axis/draw_strategy/small_tick_draw_strategy.dart' export 'src/chart/cartesian/axis/draw_strategy/tick_draw_strategy.dart' show TickDrawStrategy; export 'src/chart/cartesian/axis/numeric_extents.dart' show NumericExtents; +export 'src/chart/cartesian/axis/tick.dart' show Tick; +export 'src/chart/cartesian/axis/draw_strategy/tick_draw_strategy.dart' show TickDrawStrategy; export 'src/chart/cartesian/axis/spec/axis_spec.dart' show - AxisSpec, - LineStyleSpec, - RenderSpec, - TextStyleSpec, - TickLabelAnchor, - TickLabelJustification, - TickFormatterSpec, - TickProviderSpec; + AxisSpec, + LineStyleSpec, + RenderSpec, + TextStyleSpec, + TickLabelAnchor, + TickLabelJustification, + TickFormatterSpec, + TickProviderSpec; export 'src/chart/cartesian/axis/spec/bucketing_axis_spec.dart' show BucketingAxisSpec, BucketingNumericTickProviderSpec; export 'src/chart/cartesian/axis/spec/date_time_axis_spec.dart' show - DateTimeAxisSpec, - DayTickProviderSpec, - AutoDateTimeTickFormatterSpec, - AutoDateTimeTickProviderSpec, - DateTimeEndPointsTickProviderSpec, - DateTimeTickFormatterSpec, - DateTimeTickProviderSpec, - BasicDateTimeTickFormatterSpec, - TimeFormatterSpec, - StaticDateTimeTickProviderSpec; + DateTimeAxisSpec, + DayTickProviderSpec, + AutoDateTimeTickFormatterSpec, + AutoDateTimeTickProviderSpec, + DateTimeEndPointsTickProviderSpec, + DateTimeTickFormatterSpec, + DateTimeTickProviderSpec, + BasicDateTimeTickFormatterSpec, + TimeFormatterSpec, + StaticDateTimeTickProviderSpec; export 'src/chart/cartesian/axis/spec/end_points_time_axis_spec.dart' show EndPointsTimeAxisSpec; export 'src/chart/cartesian/axis/spec/numeric_axis_spec.dart' show - NumericAxisSpec, - NumericEndPointsTickProviderSpec, - NumericTickProviderSpec, - NumericTickFormatterSpec, - BasicNumericTickFormatterSpec, - BasicNumericTickProviderSpec, - StaticNumericTickProviderSpec; + NumericAxisSpec, + NumericEndPointsTickProviderSpec, + NumericTickProviderSpec, + NumericTickFormatterSpec, + BasicNumericTickFormatterSpec, + BasicNumericTickProviderSpec, + StaticNumericTickProviderSpec; export 'src/chart/cartesian/axis/spec/ordinal_axis_spec.dart' show - BasicOrdinalTickProviderSpec, - BasicOrdinalTickFormatterSpec, - FixedPixelOrdinalScaleSpec, - FixedPixelSpaceOrdinalScaleSpec, - OrdinalAxisSpec, - OrdinalTickFormatterSpec, - OrdinalTickProviderSpec, - OrdinalScaleSpec, - RangeOrdinalTickProviderSpec, - SimpleOrdinalScaleSpec, - StaticOrdinalTickProviderSpec; + BasicOrdinalTickProviderSpec, + BasicOrdinalTickFormatterSpec, + FixedPixelOrdinalScaleSpec, + FixedPixelSpaceOrdinalScaleSpec, + OrdinalAxisSpec, + OrdinalTickFormatterSpec, + OrdinalTickProviderSpec, + OrdinalScaleSpec, + SimpleOrdinalScaleSpec, + StaticOrdinalTickProviderSpec; export 'src/chart/cartesian/axis/spec/percent_axis_spec.dart' show PercentAxisSpec; export 'src/chart/cartesian/axis/spec/range_tick_spec.dart' show RangeTickSpec; @@ -138,10 +176,10 @@ export 'src/chart/common/behavior/calculation/percent_injector.dart' show PercentInjector, PercentInjectorTotalType; export 'src/chart/common/behavior/chart_behavior.dart' show - BehaviorPosition, - ChartBehavior, - InsideJustification, - OutsideJustification; + BehaviorPosition, + ChartBehavior, + InsideJustification, + OutsideJustification; export 'src/chart/common/behavior/chart_title/chart_title.dart' show ChartTitle, ChartTitleDirection; export 'src/chart/common/behavior/domain_highlighter.dart' @@ -160,14 +198,14 @@ export 'src/chart/common/behavior/line_point_highlighter.dart' show LinePointHighlighter, LinePointHighlighterFollowLineType; export 'src/chart/common/behavior/range_annotation.dart' show - AnnotationLabelAnchor, - AnnotationLabelDirection, - AnnotationLabelPosition, - AnnotationSegment, - LineAnnotationSegment, - RangeAnnotation, - RangeAnnotationAxisType, - RangeAnnotationSegment; + AnnotationLabelAnchor, + AnnotationLabelDirection, + AnnotationLabelPosition, + AnnotationSegment, + LineAnnotationSegment, + RangeAnnotation, + RangeAnnotationAxisType, + RangeAnnotationSegment; export 'src/chart/common/behavior/selection/lock_selection.dart' show LockSelection; export 'src/chart/common/behavior/selection/select_nearest.dart' @@ -176,11 +214,11 @@ export 'src/chart/common/behavior/selection/selection_trigger.dart' show SelectionTrigger; export 'src/chart/common/behavior/slider/slider.dart' show - Slider, - SliderHandlePosition, - SliderListenerCallback, - SliderListenerDragState, - SliderStyle; + Slider, + SliderHandlePosition, + SliderListenerCallback, + SliderListenerDragState, + SliderStyle; export 'src/chart/common/behavior/sliding_viewport.dart' show SlidingViewport; export 'src/chart/common/behavior/sunburst_ring_expander.dart' show SunburstRingExpander; @@ -203,10 +241,10 @@ export 'src/chart/common/processed_series.dart' show ImmutableSeries, MutableSeries; export 'src/chart/common/selection_model/selection_model.dart' show - MutableSelectionModel, - SelectionModel, - SelectionModelType, - SelectionModelListener; + MutableSelectionModel, + SelectionModel, + SelectionModelType, + SelectionModelListener; export 'src/chart/common/series_datum.dart' show SeriesDatum, SeriesDatumConfig; export 'src/chart/common/series_renderer.dart' show rendererIdKey, rendererKey, SeriesRenderer; @@ -215,13 +253,13 @@ export 'src/chart/common/series_renderer_config.dart' export 'src/chart/layout/layout_config.dart' show LayoutConfig, MarginSpec; export 'src/chart/layout/layout_view.dart' show - LayoutPosition, - LayoutView, - LayoutViewConfig, - LayoutViewPaintOrder, - LayoutViewPositionOrder, - ViewMargin, - ViewMeasuredSizes; + LayoutPosition, + LayoutView, + LayoutViewConfig, + LayoutViewPaintOrder, + LayoutViewPositionOrder, + ViewMargin, + ViewMeasuredSizes; export 'src/chart/line/line_chart.dart' show LineChart; export 'src/chart/line/line_renderer.dart' show LineRenderer; export 'src/chart/line/line_renderer_config.dart' show LineRendererConfig; @@ -234,12 +272,12 @@ export 'src/chart/scatter_plot/comparison_points_decorator.dart' show ComparisonPointsDecorator; export 'src/chart/scatter_plot/point_renderer.dart' show - boundsLineRadiusPxKey, - boundsLineRadiusPxFnKey, - pointSymbolRendererFnKey, - pointSymbolRendererIdKey, - PointRenderer, - PointRendererElement; + boundsLineRadiusPxKey, + boundsLineRadiusPxFnKey, + pointSymbolRendererFnKey, + pointSymbolRendererIdKey, + PointRenderer, + PointRendererElement; export 'src/chart/scatter_plot/point_renderer_config.dart' show PointRendererConfig; export 'src/chart/scatter_plot/point_renderer_decorator.dart' @@ -278,15 +316,13 @@ export 'src/common/style/material_style.dart' show MaterialStyle; export 'src/common/style/style_factory.dart' show StyleFactory; export 'src/common/symbol_renderer.dart' show - CircleSymbolRenderer, - CylinderSymbolRenderer, - LineSymbolRenderer, - PointSymbolRenderer, - RectSymbolRenderer, - RectangleRangeSymbolRenderer, - RoundedRectSymbolRenderer, - SymbolRenderer, - TriangleSymbolRenderer; + CircleSymbolRenderer, + CylinderSymbolRenderer, + LineSymbolRenderer, + PointSymbolRenderer, + RectSymbolRenderer, + RoundedRectSymbolRenderer, + SymbolRenderer; export 'src/common/text_element.dart' show TextElement, TextDirection, MaxWidthStrategy; export 'src/common/text_measurement.dart' show TextMeasurement; diff --git a/charts_common/lib/src/chart/line/line_renderer.dart b/charts_common/lib/src/chart/line/line_renderer.dart index ffe95bbf2..f866fdc01 100644 --- a/charts_common/lib/src/chart/line/line_renderer.dart +++ b/charts_common/lib/src/chart/line/line_renderer.dart @@ -1600,6 +1600,8 @@ class _Range { _includePointAsDateTime(value); } else if (value is String) { _includePointAsString(value); + } else if (value is Duration) { + _includePointAsDuration(value); } else { throw ArgumentError( 'Unsupported object type for LineRenderer domain value: ' @@ -1627,6 +1629,15 @@ class _Range { } } + /// Extends the range to include value by casting as DateTime objects. + void _includePointAsDuration(D value) { + if ((value as Duration).inMilliseconds < (_start as Duration).inMilliseconds) { + _start = value; + } else if ((value as Duration).inMilliseconds > (_end as Duration).inMilliseconds) { + _end = value; + } + } + /// Extends the range to include value by casting as String objects. /// /// In this case, we assume that the data is ordered in the same order as the diff --git a/charts_common/pubspec.yaml b/charts_common/pubspec.yaml index 396a1eb90..6993fcbe3 100644 --- a/charts_common/pubspec.yaml +++ b/charts_common/pubspec.yaml @@ -1,5 +1,5 @@ name: charts_common -version: 0.9.1 +version: 0.11.0 description: A common library for charting packages. author: Charts Team homepage: https://github.com/google/charts @@ -8,12 +8,12 @@ environment: sdk: '>=2.12.0 <3.0.0' dependencies: - collection: ^1.14.5 + collection: ^1.14.11 intl: ">=0.15.2 < 0.18.0" logging: any - meta: ^1.1.1 + meta: ^1.1.8 vector_math: ^2.0.8 dev_dependencies: + test: ^1.9.0 mockito: ^5.0.0 - test: ^1.5.3 diff --git a/charts_common/test/chart/common/behavior/initial_selection_test.dart b/charts_common/test/chart/common/behavior/initial_selection_test.dart index 0aff9d895..dc9c32dad 100644 --- a/charts_common/test/chart/common/behavior/initial_selection_test.dart +++ b/charts_common/test/chart/common/behavior/initial_selection_test.dart @@ -18,15 +18,14 @@ import 'dart:math'; import 'package:charts_common/src/chart/common/base_chart.dart'; +import 'package:charts_common/src/chart/common/behavior/initial_selection.dart'; import 'package:charts_common/src/chart/common/chart_canvas.dart'; import 'package:charts_common/src/chart/common/datum_details.dart'; -import 'package:charts_common/src/chart/common/behavior/initial_selection.dart'; import 'package:charts_common/src/chart/common/processed_series.dart'; +import 'package:charts_common/src/chart/common/selection_model/selection_model.dart'; import 'package:charts_common/src/chart/common/series_datum.dart'; import 'package:charts_common/src/chart/common/series_renderer.dart'; -import 'package:charts_common/src/chart/common/selection_model/selection_model.dart'; import 'package:charts_common/src/data/series.dart'; - import 'package:test/test.dart'; class FakeRenderer extends BaseSeriesRenderer { diff --git a/charts_common/test/chart/common/behavior/selection/select_nearest_test.dart b/charts_common/test/chart/common/behavior/selection/select_nearest_test.dart index 5cd5f7d06..b416f30c8 100644 --- a/charts_common/test/chart/common/behavior/selection/select_nearest_test.dart +++ b/charts_common/test/chart/common/behavior/selection/select_nearest_test.dart @@ -22,11 +22,10 @@ import 'package:charts_common/src/chart/common/behavior/selection/select_nearest import 'package:charts_common/src/chart/common/behavior/selection/selection_trigger.dart'; import 'package:charts_common/src/chart/common/datum_details.dart'; import 'package:charts_common/src/chart/common/processed_series.dart'; -import 'package:charts_common/src/chart/common/series_datum.dart'; import 'package:charts_common/src/chart/common/selection_model/selection_model.dart'; +import 'package:charts_common/src/chart/common/series_datum.dart'; import 'package:charts_common/src/common/gesture_listener.dart'; import 'package:charts_common/src/data/series.dart'; - import 'package:mockito/mockito.dart'; import 'package:test/test.dart'; diff --git a/charts_flutter/CHANGELOG.md b/charts_flutter/CHANGELOG.md index 466a69083..9de9e12c4 100644 --- a/charts_flutter/CHANGELOG.md +++ b/charts_flutter/CHANGELOG.md @@ -1,3 +1,11 @@ +# 0.11.0 +* Null support +* Update to latest from internal repo + +# 0.10.0 +* Internal bug fixes +* Bump versions of intl due to pull request + # 0.9.0 * Internal bug fixes * Bump versions in Gemlock file due to security alerts diff --git a/charts_flutter/example/.gitignore b/charts_flutter/example/.gitignore new file mode 100644 index 000000000..0fa6b675c --- /dev/null +++ b/charts_flutter/example/.gitignore @@ -0,0 +1,46 @@ +# Miscellaneous +*.class +*.log +*.pyc +*.swp +.DS_Store +.atom/ +.buildlog/ +.history +.svn/ + +# IntelliJ related +*.iml +*.ipr +*.iws +.idea/ + +# The .vscode folder contains launch configuration and tasks you configure in +# VS Code which you may wish to be included in version control, so this line +# is commented out by default. +#.vscode/ + +# Flutter/Dart/Pub related +**/doc/api/ +**/ios/Flutter/.last_build_id +.dart_tool/ +.flutter-plugins +.flutter-plugins-dependencies +.packages +.pub-cache/ +.pub/ +/build/ + +# Web related +lib/generated_plugin_registrant.dart + +# Symbolication related +app.*.symbols + +# Obfuscation related +app.*.map.json + +# Android Studio will place build artifacts here +/android/app/debug +/android/app/profile +/android/app/release diff --git a/charts_flutter/example/.metadata b/charts_flutter/example/.metadata new file mode 100644 index 000000000..ec98142da --- /dev/null +++ b/charts_flutter/example/.metadata @@ -0,0 +1,10 @@ +# This file tracks properties of this Flutter project. +# Used by Flutter tool to assess capabilities and perform upgrades etc. +# +# This file should be version controlled and should not be manually edited. + +version: + revision: d79295af24c3ed621c33713ecda14ad196fd9c31 + channel: stable + +project_type: app diff --git a/charts_flutter/example/README.md b/charts_flutter/example/README.md new file mode 100644 index 000000000..a13562602 --- /dev/null +++ b/charts_flutter/example/README.md @@ -0,0 +1,16 @@ +# example + +A new Flutter project. + +## Getting Started + +This project is a starting point for a Flutter application. + +A few resources to get you started if this is your first Flutter project: + +- [Lab: Write your first Flutter app](https://flutter.dev/docs/get-started/codelab) +- [Cookbook: Useful Flutter samples](https://flutter.dev/docs/cookbook) + +For help getting started with Flutter, view our +[online documentation](https://flutter.dev/docs), which offers tutorials, +samples, guidance on mobile development, and a full API reference. diff --git a/charts_flutter/example/android/.gitignore b/charts_flutter/example/android/.gitignore index 65b7315af..0a741cb43 100644 --- a/charts_flutter/example/android/.gitignore +++ b/charts_flutter/example/android/.gitignore @@ -1,10 +1,11 @@ -*.iml -*.class -.gradle +gradle-wrapper.jar +/.gradle +/captures/ +/gradlew +/gradlew.bat /local.properties -/.idea/workspace.xml -/.idea/libraries -.DS_Store -/build -/captures GeneratedPluginRegistrant.java + +# Remember to never publicly share your keystore. +# See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app +key.properties diff --git a/charts_flutter/example/android/Android_Charts.xml b/charts_flutter/example/android/Android_Charts.xml deleted file mode 100644 index fd24220e3..000000000 --- a/charts_flutter/example/android/Android_Charts.xml +++ /dev/null @@ -1,7 +0,0 @@ - - diff --git a/charts_flutter/example/android/app/build.gradle b/charts_flutter/example/android/app/build.gradle index ca84ef17c..6ca23448e 100644 --- a/charts_flutter/example/android/app/build.gradle +++ b/charts_flutter/example/android/app/build.gradle @@ -11,24 +11,34 @@ if (flutterRoot == null) { throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") } +def flutterVersionCode = localProperties.getProperty('flutter.versionCode') +if (flutterVersionCode == null) { + flutterVersionCode = '1' +} + +def flutterVersionName = localProperties.getProperty('flutter.versionName') +if (flutterVersionName == null) { + flutterVersionName = '1.0' +} + apply plugin: 'com.android.application' +apply plugin: 'kotlin-android' apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" android { - compileSdkVersion 28 + compileSdkVersion 30 - lintOptions { - disable 'InvalidPackage' + sourceSets { + main.java.srcDirs += 'src/main/kotlin' } defaultConfig { // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). - applicationId "com.example.examples" + applicationId "com.example.example" minSdkVersion 16 - targetSdkVersion 28 - versionCode 1 - versionName "1.0" - testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" + targetSdkVersion 30 + versionCode flutterVersionCode.toInteger() + versionName flutterVersionName } buildTypes { @@ -45,7 +55,5 @@ flutter { } dependencies { - testImplementation 'junit:junit:4.12' - androidTestImplementation 'androidx.test.ext:junit:1.1.1' - androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0' + implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" } diff --git a/charts_flutter/example/android/app/src/debug/AndroidManifest.xml b/charts_flutter/example/android/app/src/debug/AndroidManifest.xml new file mode 100644 index 000000000..c208884f3 --- /dev/null +++ b/charts_flutter/example/android/app/src/debug/AndroidManifest.xml @@ -0,0 +1,7 @@ + + + + diff --git a/charts_flutter/example/android/app/src/main/AndroidManifest.xml b/charts_flutter/example/android/app/src/main/AndroidManifest.xml index 9144147c6..34dd77efb 100644 --- a/charts_flutter/example/android/app/src/main/AndroidManifest.xml +++ b/charts_flutter/example/android/app/src/main/AndroidManifest.xml @@ -1,39 +1,41 @@ - - - - - - + - + + android:name="io.flutter.embedding.android.NormalTheme" + android:resource="@style/NormalTheme" + /> + + + + diff --git a/charts_flutter/example/android/app/src/main/java/com/example/examples/MainActivity.java b/charts_flutter/example/android/app/src/main/java/com/example/examples/MainActivity.java deleted file mode 100644 index 89a83b2e9..000000000 --- a/charts_flutter/example/android/app/src/main/java/com/example/examples/MainActivity.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.example.examples; - -import android.os.Bundle; - -import io.flutter.app.FlutterActivity; -import io.flutter.plugins.GeneratedPluginRegistrant; - -/** - * FlutterActivity - */ -public class MainActivity extends FlutterActivity { - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - GeneratedPluginRegistrant.registerWith(this); - } -} diff --git a/charts_flutter/example/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java b/charts_flutter/example/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java index d007606a4..539ab022f 100644 --- a/charts_flutter/example/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java +++ b/charts_flutter/example/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java @@ -1,23 +1,19 @@ package io.flutter.plugins; -import io.flutter.plugin.common.PluginRegistry; +import androidx.annotation.Keep; +import androidx.annotation.NonNull; +import io.flutter.Log; + +import io.flutter.embedding.engine.FlutterEngine; /** * Generated file. Do not edit. + * This file is generated by the Flutter tool based on the + * plugins that support the Android platform. */ +@Keep public final class GeneratedPluginRegistrant { - public static void registerWith(PluginRegistry registry) { - if (alreadyRegisteredWith(registry)) { - return; - } - } - - private static boolean alreadyRegisteredWith(PluginRegistry registry) { - final String key = GeneratedPluginRegistrant.class.getCanonicalName(); - if (registry.hasPlugin(key)) { - return true; - } - registry.registrarFor(key); - return false; + private static final String TAG = "GeneratedPluginRegistrant"; + public static void registerWith(@NonNull FlutterEngine flutterEngine) { } } diff --git a/charts_flutter/example/android/app/src/main/kotlin/com/example/example/MainActivity.kt b/charts_flutter/example/android/app/src/main/kotlin/com/example/example/MainActivity.kt new file mode 100644 index 000000000..e793a000d --- /dev/null +++ b/charts_flutter/example/android/app/src/main/kotlin/com/example/example/MainActivity.kt @@ -0,0 +1,6 @@ +package com.example.example + +import io.flutter.embedding.android.FlutterActivity + +class MainActivity: FlutterActivity() { +} diff --git a/charts_flutter/example/android/app/src/main/res/drawable-v21/launch_background.xml b/charts_flutter/example/android/app/src/main/res/drawable-v21/launch_background.xml new file mode 100644 index 000000000..f74085f3f --- /dev/null +++ b/charts_flutter/example/android/app/src/main/res/drawable-v21/launch_background.xml @@ -0,0 +1,12 @@ + + + + + + + + diff --git a/charts_flutter/example/android/app/src/main/res/values-night/styles.xml b/charts_flutter/example/android/app/src/main/res/values-night/styles.xml new file mode 100644 index 000000000..449a9f930 --- /dev/null +++ b/charts_flutter/example/android/app/src/main/res/values-night/styles.xml @@ -0,0 +1,18 @@ + + + + + + + diff --git a/charts_flutter/example/android/app/src/main/res/values/styles.xml b/charts_flutter/example/android/app/src/main/res/values/styles.xml index 00fa4417c..d74aa35c2 100644 --- a/charts_flutter/example/android/app/src/main/res/values/styles.xml +++ b/charts_flutter/example/android/app/src/main/res/values/styles.xml @@ -1,8 +1,18 @@ - + + diff --git a/charts_flutter/example/android/app/src/profile/AndroidManifest.xml b/charts_flutter/example/android/app/src/profile/AndroidManifest.xml new file mode 100644 index 000000000..c208884f3 --- /dev/null +++ b/charts_flutter/example/android/app/src/profile/AndroidManifest.xml @@ -0,0 +1,7 @@ + + + + diff --git a/charts_flutter/example/android/build.gradle b/charts_flutter/example/android/build.gradle index 6de372893..9b6ed06eb 100644 --- a/charts_flutter/example/android/build.gradle +++ b/charts_flutter/example/android/build.gradle @@ -1,11 +1,13 @@ buildscript { + ext.kotlin_version = '1.3.50' repositories { google() jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:3.5.3' + classpath 'com.android.tools.build:gradle:4.1.0' + classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" } } @@ -19,8 +21,6 @@ allprojects { rootProject.buildDir = '../build' subprojects { project.buildDir = "${rootProject.buildDir}/${project.name}" -} -subprojects { project.evaluationDependsOn(':app') } diff --git a/charts_flutter/example/android/gradle.properties b/charts_flutter/example/android/gradle.properties index 38c8d4544..94adc3a3f 100644 --- a/charts_flutter/example/android/gradle.properties +++ b/charts_flutter/example/android/gradle.properties @@ -1,4 +1,3 @@ org.gradle.jvmargs=-Xmx1536M -android.enableR8=true android.useAndroidX=true android.enableJetifier=true diff --git a/charts_flutter/example/android/gradle/wrapper/gradle-wrapper.properties b/charts_flutter/example/android/gradle/wrapper/gradle-wrapper.properties index 6bb8b5217..bc6a58afd 100644 --- a/charts_flutter/example/android/gradle/wrapper/gradle-wrapper.properties +++ b/charts_flutter/example/android/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Wed Feb 19 15:38:12 AWST 2020 +#Fri Jun 23 08:50:38 CEST 2017 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-all.zip diff --git a/charts_flutter/example/android/gradlew.bat b/charts_flutter/example/android/gradlew.bat index 8a0b282aa..aec99730b 100644 --- a/charts_flutter/example/android/gradlew.bat +++ b/charts_flutter/example/android/gradlew.bat @@ -1,90 +1,90 @@ -@if "%DEBUG%" == "" @echo off -@rem ########################################################################## -@rem -@rem Gradle startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS= - -set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@rem Find java.exe -if defined JAVA_HOME goto findJavaFromJavaHome - -set JAVA_EXE=java.exe -%JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto init - -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -set JAVA_EXE=%JAVA_HOME%/bin/java.exe - -if exist "%JAVA_EXE%" goto init - -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:init -@rem Get command-line arguments, handling Windowz variants - -if not "%OS%" == "Windows_NT" goto win9xME_args -if "%@eval[2+2]" == "4" goto 4NT_args - -:win9xME_args -@rem Slurp the command line arguments. -set CMD_LINE_ARGS= -set _SKIP=2 - -:win9xME_args_slurp -if "x%~1" == "x" goto execute - -set CMD_LINE_ARGS=%* -goto execute - -:4NT_args -@rem Get arguments from the 4NT Shell from JP Software -set CMD_LINE_ARGS=%$ - -:execute -@rem Setup the command line - -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar - -@rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% - -:end -@rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd - -:fail -rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of -rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS= + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto init + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto init + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:init +@rem Get command-line arguments, handling Windowz variants + +if not "%OS%" == "Windows_NT" goto win9xME_args +if "%@eval[2+2]" == "4" goto 4NT_args + +:win9xME_args +@rem Slurp the command line arguments. +set CMD_LINE_ARGS= +set _SKIP=2 + +:win9xME_args_slurp +if "x%~1" == "x" goto execute + +set CMD_LINE_ARGS=%* +goto execute + +:4NT_args +@rem Get arguments from the 4NT Shell from JP Software +set CMD_LINE_ARGS=%$ + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/charts_flutter/example/android/settings.gradle b/charts_flutter/example/android/settings.gradle index 5a2f14fb1..44e62bcf0 100644 --- a/charts_flutter/example/android/settings.gradle +++ b/charts_flutter/example/android/settings.gradle @@ -1,15 +1,11 @@ include ':app' -def flutterProjectRoot = rootProject.projectDir.parentFile.toPath() +def localPropertiesFile = new File(rootProject.projectDir, "local.properties") +def properties = new Properties() -def plugins = new Properties() -def pluginsFile = new File(flutterProjectRoot.toFile(), '.flutter-plugins') -if (pluginsFile.exists()) { - pluginsFile.withReader('UTF-8') { reader -> plugins.load(reader) } -} +assert localPropertiesFile.exists() +localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) } -plugins.each { name, path -> - def pluginDirectory = flutterProjectRoot.resolve(path).resolve('android').toFile() - include ":$name" - project(":$name").projectDir = pluginDirectory -} +def flutterSdkPath = properties.getProperty("flutter.sdk") +assert flutterSdkPath != null, "flutter.sdk not set in local.properties" +apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle" diff --git a/charts_flutter/example/ios/.gitignore b/charts_flutter/example/ios/.gitignore new file mode 100644 index 000000000..151026b91 --- /dev/null +++ b/charts_flutter/example/ios/.gitignore @@ -0,0 +1,33 @@ +*.mode1v3 +*.mode2v3 +*.moved-aside +*.pbxuser +*.perspectivev3 +**/*sync/ +.sconsign.dblite +.tags* +**/.vagrant/ +**/DerivedData/ +Icon? +**/Pods/ +**/.symlinks/ +profile +xcuserdata +**/.generated/ +Flutter/App.framework +Flutter/Flutter.framework +Flutter/Flutter.podspec +Flutter/Generated.xcconfig +Flutter/ephemeral/ +Flutter/app.flx +Flutter/app.zip +Flutter/flutter_assets/ +Flutter/flutter_export_environment.sh +ServiceDefinitions.json +Runner/GeneratedPluginRegistrant.* + +# Exceptions to above rules. +!default.mode1v3 +!default.mode2v3 +!default.pbxuser +!default.perspectivev3 diff --git a/charts_flutter/example/ios/Flutter/flutter_export_environment.sh b/charts_flutter/example/ios/Flutter/flutter_export_environment.sh new file mode 100755 index 000000000..40d26fbc6 --- /dev/null +++ b/charts_flutter/example/ios/Flutter/flutter_export_environment.sh @@ -0,0 +1,13 @@ +#!/bin/sh +# This is a generated file; do not edit or check into version control. +export "FLUTTER_ROOT=/home/pinkfishfrog/snap/flutter/common/flutter" +export "FLUTTER_APPLICATION_PATH=/home/pinkfishfrog/Documents/GitHub/charts/charts_flutter/example" +export "COCOAPODS_PARALLEL_CODE_SIGN=true" +export "FLUTTER_TARGET=lib/main.dart" +export "FLUTTER_BUILD_DIR=build" +export "FLUTTER_BUILD_NAME=1.0.0" +export "FLUTTER_BUILD_NUMBER=1" +export "DART_OBFUSCATION=false" +export "TRACK_WIDGET_CREATION=false" +export "TREE_SHAKE_ICONS=false" +export "PACKAGE_CONFIG=.packages" diff --git a/charts_flutter/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/charts_flutter/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 000000000..18d981003 --- /dev/null +++ b/charts_flutter/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/charts_flutter/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings b/charts_flutter/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings new file mode 100644 index 000000000..f9b0d7c5e --- /dev/null +++ b/charts_flutter/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings @@ -0,0 +1,8 @@ + + + + + PreviewsEnabled + + + diff --git a/charts_flutter/example/ios/Runner.xcworkspace/contents.xcworkspacedata b/charts_flutter/example/ios/Runner.xcworkspace/contents.xcworkspacedata new file mode 100644 index 000000000..1d526a16e --- /dev/null +++ b/charts_flutter/example/ios/Runner.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/charts_flutter/example/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/charts_flutter/example/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 000000000..18d981003 --- /dev/null +++ b/charts_flutter/example/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/charts_flutter/example/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings b/charts_flutter/example/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings new file mode 100644 index 000000000..f9b0d7c5e --- /dev/null +++ b/charts_flutter/example/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings @@ -0,0 +1,8 @@ + + + + + PreviewsEnabled + + + diff --git a/charts_flutter/example/ios/Runner/AppDelegate.swift b/charts_flutter/example/ios/Runner/AppDelegate.swift new file mode 100644 index 000000000..70693e4a8 --- /dev/null +++ b/charts_flutter/example/ios/Runner/AppDelegate.swift @@ -0,0 +1,13 @@ +import UIKit +import Flutter + +@UIApplicationMain +@objc class AppDelegate: FlutterAppDelegate { + override func application( + _ application: UIApplication, + didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? + ) -> Bool { + GeneratedPluginRegistrant.register(with: self) + return super.application(application, didFinishLaunchingWithOptions: launchOptions) + } +} diff --git a/charts_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png b/charts_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png new file mode 100644 index 000000000..dc9ada472 Binary files /dev/null and b/charts_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png differ diff --git a/charts_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png b/charts_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png new file mode 100644 index 000000000..28c6bf030 Binary files /dev/null and b/charts_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png differ diff --git a/charts_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png b/charts_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png new file mode 100644 index 000000000..2ccbfd967 Binary files /dev/null and b/charts_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png differ diff --git a/charts_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png b/charts_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png new file mode 100644 index 000000000..f091b6b0b Binary files /dev/null and b/charts_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png differ diff --git a/charts_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png b/charts_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png new file mode 100644 index 000000000..4cde12118 Binary files /dev/null and b/charts_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png differ diff --git a/charts_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png b/charts_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png new file mode 100644 index 000000000..d0ef06e7e Binary files /dev/null and b/charts_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png differ diff --git a/charts_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png b/charts_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png new file mode 100644 index 000000000..dcdc2306c Binary files /dev/null and b/charts_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png differ diff --git a/charts_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png b/charts_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png new file mode 100644 index 000000000..2ccbfd967 Binary files /dev/null and b/charts_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png differ diff --git a/charts_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png b/charts_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png new file mode 100644 index 000000000..c8f9ed8f5 Binary files /dev/null and b/charts_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png differ diff --git a/charts_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png b/charts_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png new file mode 100644 index 000000000..a6d6b8609 Binary files /dev/null and b/charts_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png differ diff --git a/charts_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png b/charts_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png new file mode 100644 index 000000000..a6d6b8609 Binary files /dev/null and b/charts_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png differ diff --git a/charts_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png b/charts_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png new file mode 100644 index 000000000..75b2d164a Binary files /dev/null and b/charts_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png differ diff --git a/charts_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png b/charts_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png new file mode 100644 index 000000000..c4df70d39 Binary files /dev/null and b/charts_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png differ diff --git a/charts_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png b/charts_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png new file mode 100644 index 000000000..6a84f41e1 Binary files /dev/null and b/charts_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png differ diff --git a/charts_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png b/charts_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png new file mode 100644 index 000000000..d0e1f5853 Binary files /dev/null and b/charts_flutter/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png differ diff --git a/charts_flutter/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json b/charts_flutter/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json new file mode 100644 index 000000000..0bedcf2fd --- /dev/null +++ b/charts_flutter/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "LaunchImage.png", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "LaunchImage@2x.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "filename" : "LaunchImage@3x.png", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} diff --git a/charts_flutter/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png b/charts_flutter/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png new file mode 100644 index 000000000..9da19eaca Binary files /dev/null and b/charts_flutter/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png differ diff --git a/charts_flutter/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png b/charts_flutter/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png new file mode 100644 index 000000000..9da19eaca Binary files /dev/null and b/charts_flutter/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png differ diff --git a/charts_flutter/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png b/charts_flutter/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png new file mode 100644 index 000000000..9da19eaca Binary files /dev/null and b/charts_flutter/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png differ diff --git a/charts_flutter/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md b/charts_flutter/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md new file mode 100644 index 000000000..89c2725b7 --- /dev/null +++ b/charts_flutter/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md @@ -0,0 +1,5 @@ +# Launch Screen Assets + +You can customize the launch screen with your own desired assets by replacing the image files in this directory. + +You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images. \ No newline at end of file diff --git a/charts_flutter/example/ios/Runner/Runner-Bridging-Header.h b/charts_flutter/example/ios/Runner/Runner-Bridging-Header.h new file mode 100644 index 000000000..308a2a560 --- /dev/null +++ b/charts_flutter/example/ios/Runner/Runner-Bridging-Header.h @@ -0,0 +1 @@ +#import "GeneratedPluginRegistrant.h" diff --git a/charts_flutter/example/lib/behaviors/selection_callback_example.dart b/charts_flutter/example/lib/behaviors/selection_callback_example.dart index d46112b91..69a02f5ad 100644 --- a/charts_flutter/example/lib/behaviors/selection_callback_example.dart +++ b/charts_flutter/example/lib/behaviors/selection_callback_example.dart @@ -28,7 +28,7 @@ /// [SelectionModel] updates from hover & click events. // EXCLUDE_FROM_GALLERY_DOCS_START import 'dart:math'; -// EXCLUDE_FROM_GALLERY_DOCS_END + import 'package:charts_flutter/flutter.dart' as charts; import 'package:flutter/material.dart'; @@ -59,14 +59,14 @@ class SelectionCallbackExample extends StatefulWidget { static List> _createRandomData() { final random = new Random(); - final us_data = [ + final usData = [ new TimeSeriesSales(new DateTime(2017, 9, 19), random.nextInt(100)), new TimeSeriesSales(new DateTime(2017, 9, 26), random.nextInt(100)), new TimeSeriesSales(new DateTime(2017, 10, 3), random.nextInt(100)), new TimeSeriesSales(new DateTime(2017, 10, 10), random.nextInt(100)), ]; - final uk_data = [ + final ukData = [ new TimeSeriesSales(new DateTime(2017, 9, 19), random.nextInt(100)), new TimeSeriesSales(new DateTime(2017, 9, 26), random.nextInt(100)), new TimeSeriesSales(new DateTime(2017, 10, 3), random.nextInt(100)), @@ -78,13 +78,13 @@ class SelectionCallbackExample extends StatefulWidget { id: 'US Sales', domainFn: (TimeSeriesSales sales, _) => sales.time, measureFn: (TimeSeriesSales sales, _) => sales.sales, - data: us_data, + data: usData, ), new charts.Series( id: 'UK Sales', domainFn: (TimeSeriesSales sales, _) => sales.time, measureFn: (TimeSeriesSales sales, _) => sales.sales, - data: uk_data, + data: ukData, ) ]; } @@ -97,14 +97,14 @@ class SelectionCallbackExample extends StatefulWidget { /// Create one series with sample hard coded data. static List> _createSampleData() { - final us_data = [ + final usData = [ new TimeSeriesSales(new DateTime(2017, 9, 19), 5), new TimeSeriesSales(new DateTime(2017, 9, 26), 25), new TimeSeriesSales(new DateTime(2017, 10, 3), 78), new TimeSeriesSales(new DateTime(2017, 10, 10), 54), ]; - final uk_data = [ + final ukData = [ new TimeSeriesSales(new DateTime(2017, 9, 19), 15), new TimeSeriesSales(new DateTime(2017, 9, 26), 33), new TimeSeriesSales(new DateTime(2017, 10, 3), 68), @@ -116,13 +116,13 @@ class SelectionCallbackExample extends StatefulWidget { id: 'US Sales', domainFn: (TimeSeriesSales sales, _) => sales.time, measureFn: (TimeSeriesSales sales, _) => sales.sales, - data: us_data, + data: usData, ), new charts.Series( id: 'UK Sales', domainFn: (TimeSeriesSales sales, _) => sales.time, measureFn: (TimeSeriesSales sales, _) => sales.sales, - data: uk_data, + data: ukData, ) ]; } @@ -184,8 +184,8 @@ class _SelectionCallbackState extends State { padding: new EdgeInsets.only(top: 5.0), child: new Text(_time.toString()))); } - _measures.forEach((String series, num value) { - children.add(new Text('${series}: ${value}')); + _measures?.forEach((String series, num value) { + children.add(new Text('$series: $value')); }); return new Column(children: children); diff --git a/charts_flutter/example/lib/behaviors/slider.dart b/charts_flutter/example/lib/behaviors/slider.dart index df45c6b04..efde15d6c 100644 --- a/charts_flutter/example/lib/behaviors/slider.dart +++ b/charts_flutter/example/lib/behaviors/slider.dart @@ -14,7 +14,7 @@ // limitations under the License. // EXCLUDE_FROM_GALLERY_DOCS_START import 'dart:math'; -// EXCLUDE_FROM_GALLERY_DOCS_END + import 'package:charts_flutter/flutter.dart' as charts; import 'package:flutter/material.dart'; import 'package:flutter/rendering.dart'; @@ -169,7 +169,7 @@ class _SliderCallbackState extends State { if (_sliderDomainValue != null) { children.add(new Padding( padding: new EdgeInsets.only(top: 5.0), - child: new Text('Slider domain value: ${_sliderDomainValue}'))); + child: new Text('Slider domain value: $_sliderDomainValue'))); } if (_sliderPosition != null) { children.add(new Padding( @@ -180,7 +180,7 @@ class _SliderCallbackState extends State { if (_sliderDragState != null) { children.add(new Padding( padding: new EdgeInsets.only(top: 5.0), - child: new Text('Slider drag state: ${_sliderDragState}'))); + child: new Text('Slider drag state: $_sliderDragState'))); } return new Column(children: children); diff --git a/charts_flutter/example/linux/.gitignore b/charts_flutter/example/linux/.gitignore new file mode 100644 index 000000000..d3896c984 --- /dev/null +++ b/charts_flutter/example/linux/.gitignore @@ -0,0 +1 @@ +flutter/ephemeral diff --git a/charts_flutter/example/linux/CMakeLists.txt b/charts_flutter/example/linux/CMakeLists.txt new file mode 100644 index 000000000..a558bc458 --- /dev/null +++ b/charts_flutter/example/linux/CMakeLists.txt @@ -0,0 +1,116 @@ +cmake_minimum_required(VERSION 3.10) +project(runner LANGUAGES CXX) + +set(BINARY_NAME "example") +set(APPLICATION_ID "com.example.example") + +cmake_policy(SET CMP0063 NEW) + +set(CMAKE_INSTALL_RPATH "$ORIGIN/lib") + +# Root filesystem for cross-building. +if(FLUTTER_TARGET_PLATFORM_SYSROOT) + set(CMAKE_SYSROOT ${FLUTTER_TARGET_PLATFORM_SYSROOT}) + set(CMAKE_FIND_ROOT_PATH ${CMAKE_SYSROOT}) + set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) + set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) + set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) + set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) +endif() + +# Configure build options. +if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) + set(CMAKE_BUILD_TYPE "Debug" CACHE + STRING "Flutter build mode" FORCE) + set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS + "Debug" "Profile" "Release") +endif() + +# Compilation settings that should be applied to most targets. +function(APPLY_STANDARD_SETTINGS TARGET) + target_compile_features(${TARGET} PUBLIC cxx_std_14) + target_compile_options(${TARGET} PRIVATE -Wall -Werror) + target_compile_options(${TARGET} PRIVATE "$<$>:-O3>") + target_compile_definitions(${TARGET} PRIVATE "$<$>:NDEBUG>") +endfunction() + +set(FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/flutter") + +# Flutter library and tool build rules. +add_subdirectory(${FLUTTER_MANAGED_DIR}) + +# System-level dependencies. +find_package(PkgConfig REQUIRED) +pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0) + +add_definitions(-DAPPLICATION_ID="${APPLICATION_ID}") + +# Application build +add_executable(${BINARY_NAME} + "main.cc" + "my_application.cc" + "${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc" +) +apply_standard_settings(${BINARY_NAME}) +target_link_libraries(${BINARY_NAME} PRIVATE flutter) +target_link_libraries(${BINARY_NAME} PRIVATE PkgConfig::GTK) +add_dependencies(${BINARY_NAME} flutter_assemble) +# Only the install-generated bundle's copy of the executable will launch +# correctly, since the resources must in the right relative locations. To avoid +# people trying to run the unbundled copy, put it in a subdirectory instead of +# the default top-level location. +set_target_properties(${BINARY_NAME} + PROPERTIES + RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/intermediates_do_not_run" +) + +# Generated plugin build rules, which manage building the plugins and adding +# them to the application. +include(flutter/generated_plugins.cmake) + + +# === Installation === +# By default, "installing" just makes a relocatable bundle in the build +# directory. +set(BUILD_BUNDLE_DIR "${PROJECT_BINARY_DIR}/bundle") +if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) + set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE) +endif() + +# Start with a clean build bundle directory every time. +install(CODE " + file(REMOVE_RECURSE \"${BUILD_BUNDLE_DIR}/\") + " COMPONENT Runtime) + +set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data") +set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib") + +install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" + COMPONENT Runtime) + +install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" + COMPONENT Runtime) + +install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" + COMPONENT Runtime) + +if(PLUGIN_BUNDLED_LIBRARIES) + install(FILES "${PLUGIN_BUNDLED_LIBRARIES}" + DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" + COMPONENT Runtime) +endif() + +# Fully re-copy the assets directory on each build to avoid having stale files +# from a previous install. +set(FLUTTER_ASSET_DIR_NAME "flutter_assets") +install(CODE " + file(REMOVE_RECURSE \"${INSTALL_BUNDLE_DATA_DIR}/${FLUTTER_ASSET_DIR_NAME}\") + " COMPONENT Runtime) +install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}" + DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime) + +# Install the AOT library on non-Debug builds only. +if(NOT CMAKE_BUILD_TYPE MATCHES "Debug") + install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" + COMPONENT Runtime) +endif() diff --git a/charts_flutter/example/linux/flutter/CMakeLists.txt b/charts_flutter/example/linux/flutter/CMakeLists.txt new file mode 100644 index 000000000..33fd5801e --- /dev/null +++ b/charts_flutter/example/linux/flutter/CMakeLists.txt @@ -0,0 +1,87 @@ +cmake_minimum_required(VERSION 3.10) + +set(EPHEMERAL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ephemeral") + +# Configuration provided via flutter tool. +include(${EPHEMERAL_DIR}/generated_config.cmake) + +# TODO: Move the rest of this into files in ephemeral. See +# https://github.com/flutter/flutter/issues/57146. + +# Serves the same purpose as list(TRANSFORM ... PREPEND ...), +# which isn't available in 3.10. +function(list_prepend LIST_NAME PREFIX) + set(NEW_LIST "") + foreach(element ${${LIST_NAME}}) + list(APPEND NEW_LIST "${PREFIX}${element}") + endforeach(element) + set(${LIST_NAME} "${NEW_LIST}" PARENT_SCOPE) +endfunction() + +# === Flutter Library === +# System-level dependencies. +find_package(PkgConfig REQUIRED) +pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0) +pkg_check_modules(GLIB REQUIRED IMPORTED_TARGET glib-2.0) +pkg_check_modules(GIO REQUIRED IMPORTED_TARGET gio-2.0) + +set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/libflutter_linux_gtk.so") + +# Published to parent scope for install step. +set(FLUTTER_LIBRARY ${FLUTTER_LIBRARY} PARENT_SCOPE) +set(FLUTTER_ICU_DATA_FILE "${EPHEMERAL_DIR}/icudtl.dat" PARENT_SCOPE) +set(PROJECT_BUILD_DIR "${PROJECT_DIR}/build/" PARENT_SCOPE) +set(AOT_LIBRARY "${PROJECT_DIR}/build/lib/libapp.so" PARENT_SCOPE) + +list(APPEND FLUTTER_LIBRARY_HEADERS + "fl_basic_message_channel.h" + "fl_binary_codec.h" + "fl_binary_messenger.h" + "fl_dart_project.h" + "fl_engine.h" + "fl_json_message_codec.h" + "fl_json_method_codec.h" + "fl_message_codec.h" + "fl_method_call.h" + "fl_method_channel.h" + "fl_method_codec.h" + "fl_method_response.h" + "fl_plugin_registrar.h" + "fl_plugin_registry.h" + "fl_standard_message_codec.h" + "fl_standard_method_codec.h" + "fl_string_codec.h" + "fl_value.h" + "fl_view.h" + "flutter_linux.h" +) +list_prepend(FLUTTER_LIBRARY_HEADERS "${EPHEMERAL_DIR}/flutter_linux/") +add_library(flutter INTERFACE) +target_include_directories(flutter INTERFACE + "${EPHEMERAL_DIR}" +) +target_link_libraries(flutter INTERFACE "${FLUTTER_LIBRARY}") +target_link_libraries(flutter INTERFACE + PkgConfig::GTK + PkgConfig::GLIB + PkgConfig::GIO +) +add_dependencies(flutter flutter_assemble) + +# === Flutter tool backend === +# _phony_ is a non-existent file to force this command to run every time, +# since currently there's no way to get a full input/output list from the +# flutter tool. +add_custom_command( + OUTPUT ${FLUTTER_LIBRARY} ${FLUTTER_LIBRARY_HEADERS} + ${CMAKE_CURRENT_BINARY_DIR}/_phony_ + COMMAND ${CMAKE_COMMAND} -E env + ${FLUTTER_TOOL_ENVIRONMENT} + "${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.sh" + ${FLUTTER_TARGET_PLATFORM} ${CMAKE_BUILD_TYPE} + VERBATIM +) +add_custom_target(flutter_assemble DEPENDS + "${FLUTTER_LIBRARY}" + ${FLUTTER_LIBRARY_HEADERS} +) diff --git a/charts_flutter/example/linux/flutter/generated_plugin_registrant.cc b/charts_flutter/example/linux/flutter/generated_plugin_registrant.cc new file mode 100644 index 000000000..d38195aa0 --- /dev/null +++ b/charts_flutter/example/linux/flutter/generated_plugin_registrant.cc @@ -0,0 +1,9 @@ +// +// Generated file. Do not edit. +// + +#include "generated_plugin_registrant.h" + + +void fl_register_plugins(FlPluginRegistry* registry) { +} diff --git a/charts_flutter/example/linux/flutter/generated_plugin_registrant.h b/charts_flutter/example/linux/flutter/generated_plugin_registrant.h new file mode 100644 index 000000000..9bf747894 --- /dev/null +++ b/charts_flutter/example/linux/flutter/generated_plugin_registrant.h @@ -0,0 +1,13 @@ +// +// Generated file. Do not edit. +// + +#ifndef GENERATED_PLUGIN_REGISTRANT_ +#define GENERATED_PLUGIN_REGISTRANT_ + +#include + +// Registers Flutter plugins. +void fl_register_plugins(FlPluginRegistry* registry); + +#endif // GENERATED_PLUGIN_REGISTRANT_ diff --git a/charts_flutter/example/linux/flutter/generated_plugins.cmake b/charts_flutter/example/linux/flutter/generated_plugins.cmake new file mode 100644 index 000000000..51436ae8c --- /dev/null +++ b/charts_flutter/example/linux/flutter/generated_plugins.cmake @@ -0,0 +1,15 @@ +# +# Generated file, do not edit. +# + +list(APPEND FLUTTER_PLUGIN_LIST +) + +set(PLUGIN_BUNDLED_LIBRARIES) + +foreach(plugin ${FLUTTER_PLUGIN_LIST}) + add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/linux plugins/${plugin}) + target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) + list(APPEND PLUGIN_BUNDLED_LIBRARIES $) + list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) +endforeach(plugin) diff --git a/charts_flutter/example/linux/main.cc b/charts_flutter/example/linux/main.cc new file mode 100644 index 000000000..e7c5c5437 --- /dev/null +++ b/charts_flutter/example/linux/main.cc @@ -0,0 +1,6 @@ +#include "my_application.h" + +int main(int argc, char** argv) { + g_autoptr(MyApplication) app = my_application_new(); + return g_application_run(G_APPLICATION(app), argc, argv); +} diff --git a/charts_flutter/example/linux/my_application.cc b/charts_flutter/example/linux/my_application.cc new file mode 100644 index 000000000..634f4c519 --- /dev/null +++ b/charts_flutter/example/linux/my_application.cc @@ -0,0 +1,105 @@ +#include "my_application.h" + +#include +#ifdef GDK_WINDOWING_X11 +#include +#endif + +#include "flutter/generated_plugin_registrant.h" + +struct _MyApplication { + GtkApplication parent_instance; + char** dart_entrypoint_arguments; +}; + +G_DEFINE_TYPE(MyApplication, my_application, GTK_TYPE_APPLICATION) + +// Implements GApplication::activate. +static void my_application_activate(GApplication* application) { + MyApplication* self = MY_APPLICATION(application); + GtkWindow* window = + GTK_WINDOW(gtk_application_window_new(GTK_APPLICATION(application))); + + // Use a header bar when running in GNOME as this is the common style used + // by applications and is the setup most users will be using (e.g. Ubuntu + // desktop). + // If running on X and not using GNOME then just use a traditional title bar + // in case the window manager does more exotic layout, e.g. tiling. + // If running on Wayland assume the header bar will work (may need changing + // if future cases occur). + gboolean use_header_bar = TRUE; +#ifdef GDK_WINDOWING_X11 + GdkScreen *screen = gtk_window_get_screen(window); + if (GDK_IS_X11_SCREEN(screen)) { + const gchar* wm_name = gdk_x11_screen_get_window_manager_name(screen); + if (g_strcmp0(wm_name, "GNOME Shell") != 0) { + use_header_bar = FALSE; + } + } +#endif + if (use_header_bar) { + GtkHeaderBar *header_bar = GTK_HEADER_BAR(gtk_header_bar_new()); + gtk_widget_show(GTK_WIDGET(header_bar)); + gtk_header_bar_set_title(header_bar, "example"); + gtk_header_bar_set_show_close_button(header_bar, TRUE); + gtk_window_set_titlebar(window, GTK_WIDGET(header_bar)); + } + else { + gtk_window_set_title(window, "example"); + } + + gtk_window_set_default_size(window, 1280, 720); + gtk_widget_show(GTK_WIDGET(window)); + + g_autoptr(FlDartProject) project = fl_dart_project_new(); + fl_dart_project_set_dart_entrypoint_arguments(project, self->dart_entrypoint_arguments); + + FlView* view = fl_view_new(project); + gtk_widget_show(GTK_WIDGET(view)); + gtk_container_add(GTK_CONTAINER(window), GTK_WIDGET(view)); + + fl_register_plugins(FL_PLUGIN_REGISTRY(view)); + + gtk_widget_grab_focus(GTK_WIDGET(view)); +} + +// Implements GApplication::local_command_line. +static gboolean my_application_local_command_line(GApplication* application, gchar ***arguments, int *exit_status) { + MyApplication* self = MY_APPLICATION(application); + // Strip out the first argument as it is the binary name. + self->dart_entrypoint_arguments = g_strdupv(*arguments + 1); + + g_autoptr(GError) error = nullptr; + if (!g_application_register(application, nullptr, &error)) { + g_warning("Failed to register: %s", error->message); + *exit_status = 1; + return TRUE; + } + + g_application_activate(application); + *exit_status = 0; + + return TRUE; +} + +// Implements GObject::dispose. +static void my_application_dispose(GObject *object) { + MyApplication* self = MY_APPLICATION(object); + g_clear_pointer(&self->dart_entrypoint_arguments, g_strfreev); + G_OBJECT_CLASS(my_application_parent_class)->dispose(object); +} + +static void my_application_class_init(MyApplicationClass* klass) { + G_APPLICATION_CLASS(klass)->activate = my_application_activate; + G_APPLICATION_CLASS(klass)->local_command_line = my_application_local_command_line; + G_OBJECT_CLASS(klass)->dispose = my_application_dispose; +} + +static void my_application_init(MyApplication* self) {} + +MyApplication* my_application_new() { + return MY_APPLICATION(g_object_new(my_application_get_type(), + "application-id", APPLICATION_ID, + "flags", G_APPLICATION_NON_UNIQUE, + nullptr)); +} diff --git a/charts_flutter/example/linux/my_application.h b/charts_flutter/example/linux/my_application.h new file mode 100644 index 000000000..72271d5e4 --- /dev/null +++ b/charts_flutter/example/linux/my_application.h @@ -0,0 +1,18 @@ +#ifndef FLUTTER_MY_APPLICATION_H_ +#define FLUTTER_MY_APPLICATION_H_ + +#include + +G_DECLARE_FINAL_TYPE(MyApplication, my_application, MY, APPLICATION, + GtkApplication) + +/** + * my_application_new: + * + * Creates a new Flutter-based application. + * + * Returns: a new #MyApplication. + */ +MyApplication* my_application_new(); + +#endif // FLUTTER_MY_APPLICATION_H_ diff --git a/charts_flutter/example/pubspec.yaml b/charts_flutter/example/pubspec.yaml index 24868e873..6eedae325 100644 --- a/charts_flutter/example/pubspec.yaml +++ b/charts_flutter/example/pubspec.yaml @@ -1,16 +1,16 @@ name: example description: Charts-Flutter Demo environment: - sdk: '>=1.23.0 <3.0.0' + sdk: ">=2.12.0 <3.0.0" dependencies: charts_flutter: path: ../ - cupertino_icons: ^0.1.0 + cupertino_icons: ^1.0.3 flutter: sdk: flutter flutter_test: sdk: flutter - meta: ^1.1.1 - intl: ">=0.15.2 < 0.18.0" + meta: ^1.3.0 + intl: ^0.17.0 flutter: uses-material-design: true diff --git a/charts_flutter/example/web/favicon.png b/charts_flutter/example/web/favicon.png new file mode 100644 index 000000000..8aaa46ac1 Binary files /dev/null and b/charts_flutter/example/web/favicon.png differ diff --git a/charts_flutter/example/web/icons/Icon-192.png b/charts_flutter/example/web/icons/Icon-192.png new file mode 100644 index 000000000..b749bfef0 Binary files /dev/null and b/charts_flutter/example/web/icons/Icon-192.png differ diff --git a/charts_flutter/example/web/icons/Icon-512.png b/charts_flutter/example/web/icons/Icon-512.png new file mode 100644 index 000000000..88cfd48df Binary files /dev/null and b/charts_flutter/example/web/icons/Icon-512.png differ diff --git a/charts_flutter/example/web/index.html b/charts_flutter/example/web/index.html new file mode 100644 index 000000000..0081e1894 --- /dev/null +++ b/charts_flutter/example/web/index.html @@ -0,0 +1,98 @@ + + + + + + + + + + + + + + + + + example + + + + + + + diff --git a/charts_flutter/example/web/manifest.json b/charts_flutter/example/web/manifest.json new file mode 100644 index 000000000..8c012917d --- /dev/null +++ b/charts_flutter/example/web/manifest.json @@ -0,0 +1,23 @@ +{ + "name": "example", + "short_name": "example", + "start_url": ".", + "display": "standalone", + "background_color": "#0175C2", + "theme_color": "#0175C2", + "description": "A new Flutter project.", + "orientation": "portrait-primary", + "prefer_related_applications": false, + "icons": [ + { + "src": "icons/Icon-192.png", + "sizes": "192x192", + "type": "image/png" + }, + { + "src": "icons/Icon-512.png", + "sizes": "512x512", + "type": "image/png" + } + ] +} diff --git a/charts_flutter/lib/flutter.dart b/charts_flutter/lib/flutter.dart index 609e7de85..c9dee6766 100644 --- a/charts_flutter/lib/flutter.dart +++ b/charts_flutter/lib/flutter.dart @@ -121,7 +121,6 @@ export 'package:charts_common/common.dart' PointRendererDecorator, PointRendererElement, PointSymbolRenderer, - QuantumPalette, RangeAnnotationAxisType, RangeAnnotationSegment, RectSymbolRenderer, @@ -164,13 +163,14 @@ export 'package:charts_common/common.dart' export 'src/bar_chart.dart'; export 'src/base_chart.dart' show BaseChart, LayoutConfig; +export 'src/base_chart_state.dart'; export 'src/behaviors/a11y/domain_a11y_explore_behavior.dart' show DomainA11yExploreBehavior; +export 'src/behaviors/calculation/percent_injector.dart' show PercentInjector; export 'src/behaviors/chart_behavior.dart' show ChartBehavior; +export 'src/behaviors/chart_title/chart_title.dart' show ChartTitle; export 'src/behaviors/domain_highlighter.dart' show DomainHighlighter; export 'src/behaviors/initial_selection.dart' show InitialSelection; -export 'src/behaviors/calculation/percent_injector.dart' show PercentInjector; -export 'src/behaviors/chart_title/chart_title.dart' show ChartTitle; export 'src/behaviors/legend/datum_legend.dart' show DatumLegend; export 'src/behaviors/legend/legend_content_builder.dart' show LegendContentBuilder, TabularLegendContentBuilder; @@ -182,12 +182,14 @@ export 'src/behaviors/legend/series_legend.dart' show SeriesLegend; export 'src/behaviors/line_point_highlighter.dart' show LinePointHighlighter; export 'src/behaviors/range_annotation.dart' show RangeAnnotation; export 'src/behaviors/select_nearest.dart' show SelectNearest; -export 'src/behaviors/sliding_viewport.dart' show SlidingViewport; export 'src/behaviors/slider/slider.dart' show Slider; +export 'src/behaviors/sliding_viewport.dart' show SlidingViewport; export 'src/behaviors/zoom/initial_hint_behavior.dart' show InitialHintBehavior; export 'src/behaviors/zoom/pan_and_zoom_behavior.dart' show PanAndZoomBehavior; export 'src/behaviors/zoom/pan_behavior.dart' show PanBehavior; +export 'src/cartesian_chart.dart'; export 'src/combo_chart/combo_chart.dart'; +export 'src/duration_chart.dart'; export 'src/line_chart.dart'; export 'src/pie_chart.dart'; export 'src/scatter_plot_chart.dart'; diff --git a/charts_flutter/lib/src/bar_chart.dart b/charts_flutter/lib/src/bar_chart.dart index db154d049..b7c38f82b 100644 --- a/charts_flutter/lib/src/bar_chart.dart +++ b/charts_flutter/lib/src/bar_chart.dart @@ -31,12 +31,12 @@ import 'behaviors/chart_behavior.dart' show ChartBehavior; import 'package:meta/meta.dart' show immutable; import 'base_chart.dart' show LayoutConfig; import 'base_chart_state.dart' show BaseChartState; -import 'cartesian_chart.dart' show CartesianChart; +import 'cartesian_chart.dart' show BaseCartesianChart; import 'selection_model_config.dart' show SelectionModelConfig; import 'user_managed_state.dart' show UserManagedState; @immutable -class BarChart extends CartesianChart { +class BarChart extends BaseCartesianChart { final bool vertical; final common.BarRendererDecorator? barRendererDecorator; diff --git a/charts_flutter/lib/src/behaviors/a11y/domain_a11y_explore_behavior.dart b/charts_flutter/lib/src/behaviors/a11y/domain_a11y_explore_behavior.dart index ef58bc83b..ae2466cd9 100644 --- a/charts_flutter/lib/src/behaviors/a11y/domain_a11y_explore_behavior.dart +++ b/charts_flutter/lib/src/behaviors/a11y/domain_a11y_explore_behavior.dart @@ -20,6 +20,7 @@ import 'package:charts_common/common.dart' as common VocalizationCallback, ExploreModeTrigger; import 'package:flutter/widgets.dart' show hashValues; + import '../chart_behavior.dart' show ChartBehavior, GestureType; /// Behavior that generates semantic nodes for each domain. @@ -97,7 +98,7 @@ class DomainA11yExploreBehavior extends ChartBehavior { void updateCommonBehavior(common.ChartBehavior commonBehavior) {} @override - String get role => 'DomainA11yExplore-${exploreModeTrigger}'; + String get role => 'DomainA11yExplore-$exploreModeTrigger'; @override bool operator ==(Object o) => diff --git a/charts_flutter/lib/src/behaviors/legend/legend_entry_layout.dart b/charts_flutter/lib/src/behaviors/legend/legend_entry_layout.dart index 5230c4986..fe6e791b7 100644 --- a/charts_flutter/lib/src/behaviors/legend/legend_entry_layout.dart +++ b/charts_flutter/lib/src/behaviors/legend/legend_entry_layout.dart @@ -131,7 +131,7 @@ class SimpleLegendEntryLayout implements LegendEntryLayout { : null; if (isHidden) { // Use a default color for hidden legend entries if none is provided. - color ??= Theme.of(context).textTheme.body1!.color; + color ??= Theme.of(context).textTheme.bodyText2!.color; color = color!.withOpacity(0.26); } diff --git a/charts_flutter/lib/src/behaviors/slider/slider.dart b/charts_flutter/lib/src/behaviors/slider/slider.dart index 7f1e16df3..b6879f665 100644 --- a/charts_flutter/lib/src/behaviors/slider/slider.dart +++ b/charts_flutter/lib/src/behaviors/slider/slider.dart @@ -14,6 +14,7 @@ // limitations under the License. import 'dart:math' show Rectangle; + import 'package:charts_common/common.dart' as common show ChartBehavior, @@ -154,7 +155,8 @@ class Slider extends ChartBehavior { break; default: throw new ArgumentError( - 'Slider does not support the event trigger ' + '"${eventTrigger}"'); + 'Slider does not support the event trigger ' + '"$eventTrigger"'); + break; } return desiredGestures; } diff --git a/charts_flutter/lib/src/cartesian_chart.dart b/charts_flutter/lib/src/cartesian_chart.dart index 6e789fb5b..91ef7299e 100644 --- a/charts_flutter/lib/src/cartesian_chart.dart +++ b/charts_flutter/lib/src/cartesian_chart.dart @@ -33,14 +33,14 @@ import 'selection_model_config.dart' show SelectionModelConfig; import 'user_managed_state.dart' show UserManagedState; @immutable -abstract class CartesianChart extends BaseChart { +abstract class BaseCartesianChart extends BaseChart { final common.AxisSpec? domainAxis; final common.NumericAxisSpec? primaryMeasureAxis; final common.NumericAxisSpec? secondaryMeasureAxis; final LinkedHashMap? disjointMeasureAxes; final bool? flipVerticalAxis; - CartesianChart( + BaseCartesianChart( List> seriesList, { bool? animate, Duration? animationDuration, @@ -76,7 +76,7 @@ abstract class CartesianChart extends BaseChart { BaseChartState chartState) { super.updateCommonChart(baseChart, oldWidget, chartState); - final prev = oldWidget as CartesianChart?; + final prev = oldWidget as BaseCartesianChart?; final chart = baseChart as common.CartesianChart; if (flipVerticalAxis != null) { diff --git a/charts_flutter/lib/src/combo_chart/combo_chart.dart b/charts_flutter/lib/src/combo_chart/combo_chart.dart index e4d30fc94..5734c9bf5 100644 --- a/charts_flutter/lib/src/combo_chart/combo_chart.dart +++ b/charts_flutter/lib/src/combo_chart/combo_chart.dart @@ -25,7 +25,7 @@ import 'package:charts_common/common.dart' as common import '../behaviors/chart_behavior.dart' show ChartBehavior; import '../base_chart.dart' show LayoutConfig; import '../base_chart_state.dart' show BaseChartState; -import '../cartesian_chart.dart' show CartesianChart; +import '../cartesian_chart.dart' show BaseCartesianChart; import '../selection_model_config.dart' show SelectionModelConfig; /// A numeric combo chart supports rendering each series of data with different @@ -34,7 +34,7 @@ import '../selection_model_config.dart' show SelectionModelConfig; /// Note that if you have DateTime data, you should use [TimeSeriesChart]. We do /// not expose a separate DateTimeComboChart because it would just be a copy of /// that chart. -class NumericComboChart extends CartesianChart { +class NumericComboChart extends BaseCartesianChart { NumericComboChart( List> seriesList, { bool? animate, @@ -79,7 +79,7 @@ class NumericComboChart extends CartesianChart { /// An ordinal combo chart supports rendering each series of data with different /// series renderers. -class OrdinalComboChart extends CartesianChart { +class OrdinalComboChart extends BaseCartesianChart { OrdinalComboChart( List> seriesList, { bool? animate, diff --git a/charts_flutter/lib/src/duration_chart.dart b/charts_flutter/lib/src/duration_chart.dart new file mode 100644 index 000000000..e69de29bb diff --git a/charts_flutter/lib/src/line_chart.dart b/charts_flutter/lib/src/line_chart.dart index 8e71b6170..2a0d50d57 100644 --- a/charts_flutter/lib/src/line_chart.dart +++ b/charts_flutter/lib/src/line_chart.dart @@ -28,11 +28,11 @@ import 'behaviors/line_point_highlighter.dart' show LinePointHighlighter; import 'behaviors/chart_behavior.dart' show ChartBehavior; import 'base_chart.dart' show LayoutConfig; import 'base_chart_state.dart' show BaseChartState; -import 'cartesian_chart.dart' show CartesianChart; +import 'cartesian_chart.dart' show BaseCartesianChart; import 'selection_model_config.dart' show SelectionModelConfig; import 'user_managed_state.dart' show UserManagedState; -class LineChart extends CartesianChart { +class LineChart extends BaseCartesianChart { LineChart( List> seriesList, { bool? animate, diff --git a/charts_flutter/lib/src/scatter_plot_chart.dart b/charts_flutter/lib/src/scatter_plot_chart.dart index c35341056..6bc712b40 100644 --- a/charts_flutter/lib/src/scatter_plot_chart.dart +++ b/charts_flutter/lib/src/scatter_plot_chart.dart @@ -27,11 +27,11 @@ import 'package:charts_common/common.dart' as common import 'behaviors/chart_behavior.dart' show ChartBehavior; import 'base_chart.dart' show LayoutConfig; import 'base_chart_state.dart' show BaseChartState; -import 'cartesian_chart.dart' show CartesianChart; +import 'cartesian_chart.dart' show BaseCartesianChart; import 'selection_model_config.dart' show SelectionModelConfig; import 'user_managed_state.dart' show UserManagedState; -class ScatterPlotChart extends CartesianChart { +class ScatterPlotChart extends BaseCartesianChart { ScatterPlotChart( List> seriesList, { bool? animate, diff --git a/charts_flutter/lib/src/time_series_chart.dart b/charts_flutter/lib/src/time_series_chart.dart index 13f7e4ff7..61cb43711 100644 --- a/charts_flutter/lib/src/time_series_chart.dart +++ b/charts_flutter/lib/src/time_series_chart.dart @@ -26,13 +26,13 @@ import 'package:charts_common/common.dart' as common TimeSeriesChart; import 'behaviors/chart_behavior.dart' show ChartBehavior; import 'behaviors/line_point_highlighter.dart' show LinePointHighlighter; -import 'cartesian_chart.dart' show CartesianChart; +import 'cartesian_chart.dart' show BaseCartesianChart; import 'base_chart.dart' show LayoutConfig; import 'base_chart_state.dart' show BaseChartState; import 'selection_model_config.dart' show SelectionModelConfig; import 'user_managed_state.dart' show UserManagedState; -class TimeSeriesChart extends CartesianChart { +class TimeSeriesChart extends BaseCartesianChart { final common.DateTimeFactory? dateTimeFactory; /// Create a [TimeSeriesChart]. diff --git a/charts_flutter/pubspec.yaml b/charts_flutter/pubspec.yaml index fcb0dc001..0cd44333f 100644 --- a/charts_flutter/pubspec.yaml +++ b/charts_flutter/pubspec.yaml @@ -1,5 +1,5 @@ name: charts_flutter -version: 0.9.1 +version: 0.11.0 description: Material Design charting library for flutter. author: Charts Team homepage: https://github.com/google/charts @@ -13,15 +13,19 @@ dependencies: # # The pub version of charts_flutter will point to the pub version of charts_common. # The latest pub version is commented out and shown below as an example. - # charts_common: 0.9.1 + #charts_common: 0.11.0 + #charts_common: + # path: ../charts_common/ charts_common: - path: ../charts_common/ + git: + url: https://github.com/pinkfish/charts.git + path: charts_common collection: ^1.14.5 flutter: sdk: flutter intl: ">=0.15.2 < 0.18.0" logging: any - meta: ^1.1.1 + meta: ^1.1.8 dev_dependencies: @@ -29,4 +33,4 @@ dev_dependencies: build_runner: ^1.11.0 flutter_test: sdk: flutter - test: ^1.3.0 + test: ^1.9.0 diff --git a/docs/Gemfile.lock b/docs/Gemfile.lock index 533245680..356f81171 100644 --- a/docs/Gemfile.lock +++ b/docs/Gemfile.lock @@ -6,8 +6,8 @@ GEM minitest (~> 5.1) thread_safe (~> 0.3, >= 0.3.4) tzinfo (~> 1.1) - addressable (2.6.0) - public_suffix (>= 2.0.2, < 4.0) + addressable (2.8.0) + public_suffix (>= 2.0.2, < 5.0) coffee-script (2.4.1) coffee-script-source execjs @@ -198,20 +198,22 @@ GEM rb-inotify (~> 0.9, >= 0.9.7) ruby_dep (~> 1.2) mercenary (0.3.6) - mini_portile2 (2.4.0) + mini_portile2 (2.6.1) minima (2.5.0) jekyll (~> 3.5) jekyll-feed (~> 0.9) jekyll-seo-tag (~> 2.1) minitest (5.11.3) multipart-post (2.1.1) - nokogiri (1.10.8) - mini_portile2 (~> 2.4.0) + nokogiri (1.12.5) + mini_portile2 (~> 2.6.1) + racc (~> 1.4) octokit (4.14.0) sawyer (~> 0.8.0, >= 0.5.3) pathutil (0.16.2) forwardable-extended (~> 2.6) public_suffix (3.1.1) + racc (1.5.2) rb-fsevent (0.10.3) rb-inotify (0.10.0) ffi (~> 1.0) diff --git a/docs/index.md b/docs/index.md index 8994e4fb8..d54fdefd1 100644 --- a/docs/index.md +++ b/docs/index.md @@ -4,4 +4,7 @@ The charting framework is currently supported for the [Flutter](https://flutter.io) platform. Please see the -[online gallery of Flutter charts](https://google.github.io/charts/flutter/gallery.html). +[charts_flutter page on pub dev](https://pub.dev/packages/charts_flutter) +for reference or the +[online gallery of Flutter charts](https://google.github.io/charts/flutter/gallery.html) +for examples.