From a13b40441a85750d67cca015ba70bc77b766ecb4 Mon Sep 17 00:00:00 2001 From: jinosh05 Date: Tue, 4 May 2021 11:54:47 +0530 Subject: [PATCH 1/2] Null safety migrated --- .../ios/Flutter/flutter_export_environment.sh | 13 ++++ lib/configurable_expansion_tile.dart | 41 ++++++------ pubspec.lock | 62 ++++++++++++------- pubspec.yaml | 2 +- test/configurable_expansion_tile_test.dart | 5 -- 5 files changed, 72 insertions(+), 51 deletions(-) create mode 100755 example/ios/Flutter/flutter_export_environment.sh delete mode 100644 test/configurable_expansion_tile_test.dart diff --git a/example/ios/Flutter/flutter_export_environment.sh b/example/ios/Flutter/flutter_export_environment.sh new file mode 100755 index 0000000..ae42c20 --- /dev/null +++ b/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/jinosh/Documents/flutter_2.0.4/flutter" +export "FLUTTER_APPLICATION_PATH=/home/jinosh/Programming/My_Packages/configurable_expansion_tile/example" +export "FLUTTER_TARGET=lib/main.dart" +export "FLUTTER_BUILD_DIR=build" +export "SYMROOT=${SOURCE_ROOT}/../build/ios" +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/lib/configurable_expansion_tile.dart b/lib/configurable_expansion_tile.dart index 1e17512..302d85d 100644 --- a/lib/configurable_expansion_tile.dart +++ b/lib/configurable_expansion_tile.dart @@ -15,12 +15,12 @@ class ConfigurableExpansionTile extends StatefulWidget { /// be specified for the animated transitions/states. [children] are revealed /// when the expansion tile is expanded. const ConfigurableExpansionTile( - {Key key, + {Key? key, this.headerBackgroundColorStart = Colors.transparent, this.onExpansionChanged, this.children = const [], this.initiallyExpanded = false, - @required this.header, + required this.header, this.animatedWidgetFollowingHeader, this.animatedWidgetPrecedingHeader, this.expandedBackgroundColor, @@ -35,15 +35,14 @@ class ConfigurableExpansionTile extends StatefulWidget { this.borderAnimationTween, this.animatedWidgetTurnTween, this.animatedWidgetTween}) - : assert(initiallyExpanded != null), - super(key: key); + : super(key: key); /// Called when the tile expands or collapses. /// /// When the tile starts expanding, this function is called with the value /// true. When the tile starts collapsing, this function is called with /// the value false. - final ValueChanged onExpansionChanged; + final ValueChanged? onExpansionChanged; /// The widgets that are displayed when the tile expands. /// @@ -56,10 +55,10 @@ class ConfigurableExpansionTile extends StatefulWidget { final Color headerBackgroundColorStart; /// The [Color] the header will transition to on expand - final Color headerBackgroundColorEnd; + final Color? headerBackgroundColorEnd; /// The [Color] of the background of the [children] when expanded - final Color expandedBackgroundColor; + final Color? expandedBackgroundColor; /// Specifies if the list tile is initially expanded (true) or collapsed (false, the default). final bool initiallyExpanded; @@ -68,13 +67,13 @@ class ConfigurableExpansionTile extends StatefulWidget { final Widget header; /// An optional widget to replace [header] with if the list is expanded - final Widget headerExpanded; + final Widget? headerExpanded; /// A widget to rotate following the [header] (ie an arrow) - final Widget animatedWidgetFollowingHeader; + final Widget? animatedWidgetFollowingHeader; /// A widget to rotate preceding the [header] (ie an arrow) - final Widget animatedWidgetPrecedingHeader; + final Widget? animatedWidgetPrecedingHeader; /// The duration of the animations final Duration kExpand; @@ -92,16 +91,16 @@ class ConfigurableExpansionTile extends StatefulWidget { final bool bottomBorderOn; /// Header transition tween - final Animatable headerAnimationTween; + final Animatable? headerAnimationTween; /// Border animation tween - final Animatable borderAnimationTween; + final Animatable? borderAnimationTween; /// Tween for turning [animatedWidgetFollowingHeader] and [animatedWidgetPrecedingHeader] - final Animatable animatedWidgetTurnTween; + final Animatable? animatedWidgetTurnTween; /// [animatedWidgetFollowingHeader] and [animatedWidgetPrecedingHeader] transition tween - final Animatable animatedWidgetTween; + final Animatable? animatedWidgetTween; static final Animatable _easeInTween = CurveTween(curve: Curves.easeIn); @@ -117,12 +116,12 @@ class ConfigurableExpansionTile extends StatefulWidget { class _ConfigurableExpansionTileState extends State with SingleTickerProviderStateMixin { - AnimationController _controller; - Animation _iconTurns; - Animation _heightFactor; + late AnimationController _controller; + late Animation _iconTurns; + late Animation _heightFactor; - Animation _borderColor; - Animation _headerColor; + late Animation _borderColor; + Animation? _headerColor; final ColorTween _borderColorTween = ColorTween(); final ColorTween _headerColorTween = ColorTween(); @@ -175,10 +174,10 @@ class _ConfigurableExpansionTileState extends State PageStorage.of(context)?.writeState(context, _isExpanded); }); if (widget.onExpansionChanged != null) - widget.onExpansionChanged(_isExpanded); + widget.onExpansionChanged!(_isExpanded); } - Widget _buildChildren(BuildContext context, Widget child) { + Widget _buildChildren(BuildContext context, Widget? child) { final Color borderSideColor = _borderColor.value ?? widget.borderColorStart; final Color headerColor = _headerColor?.value ?? widget.headerBackgroundColorStart; diff --git a/pubspec.lock b/pubspec.lock index 224c7bb..49a0ce6 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -1,5 +1,5 @@ # Generated by pub -# See https://www.dartlang.org/tools/pub/glossary#lockfile +# See https://dart.dev/tools/pub/glossary#lockfile packages: async: dependency: transitive @@ -7,28 +7,49 @@ packages: name: async url: "https://pub.dartlang.org" source: hosted - version: "2.0.8" + version: "2.5.0" boolean_selector: dependency: transitive description: name: boolean_selector url: "https://pub.dartlang.org" source: hosted - version: "1.0.4" + version: "2.1.0" + characters: + dependency: transitive + description: + name: characters + url: "https://pub.dartlang.org" + source: hosted + version: "1.1.0" charcode: dependency: transitive description: name: charcode url: "https://pub.dartlang.org" source: hosted - version: "1.1.2" + version: "1.2.0" + clock: + dependency: transitive + description: + name: clock + url: "https://pub.dartlang.org" + source: hosted + version: "1.1.0" collection: dependency: transitive description: name: collection url: "https://pub.dartlang.org" source: hosted - version: "1.14.11" + version: "1.15.0" + fake_async: + dependency: transitive + description: + name: fake_async + url: "https://pub.dartlang.org" + source: hosted + version: "1.2.0" flutter: dependency: "direct main" description: flutter @@ -45,28 +66,21 @@ packages: name: matcher url: "https://pub.dartlang.org" source: hosted - version: "0.12.3+1" + version: "0.12.10" meta: dependency: transitive description: name: meta url: "https://pub.dartlang.org" source: hosted - version: "1.1.6" + version: "1.3.0" path: dependency: transitive description: name: path url: "https://pub.dartlang.org" source: hosted - version: "1.6.2" - quiver: - dependency: transitive - description: - name: quiver - url: "https://pub.dartlang.org" - source: hosted - version: "2.0.1" + version: "1.8.0" sky_engine: dependency: transitive description: flutter @@ -78,55 +92,55 @@ packages: name: source_span url: "https://pub.dartlang.org" source: hosted - version: "1.4.1" + version: "1.8.0" stack_trace: dependency: transitive description: name: stack_trace url: "https://pub.dartlang.org" source: hosted - version: "1.9.3" + version: "1.10.0" stream_channel: dependency: transitive description: name: stream_channel url: "https://pub.dartlang.org" source: hosted - version: "1.6.8" + version: "2.1.0" string_scanner: dependency: transitive description: name: string_scanner url: "https://pub.dartlang.org" source: hosted - version: "1.0.4" + version: "1.1.0" term_glyph: dependency: transitive description: name: term_glyph url: "https://pub.dartlang.org" source: hosted - version: "1.0.1" + version: "1.2.0" test_api: dependency: transitive description: name: test_api url: "https://pub.dartlang.org" source: hosted - version: "0.2.1" + version: "0.2.19" typed_data: dependency: transitive description: name: typed_data url: "https://pub.dartlang.org" source: hosted - version: "1.1.6" + version: "1.3.0" vector_math: dependency: transitive description: name: vector_math url: "https://pub.dartlang.org" source: hosted - version: "2.0.8" + version: "2.1.0" sdks: - dart: ">=2.0.0 <3.0.0" + dart: ">=2.12.0 <3.0.0" diff --git a/pubspec.yaml b/pubspec.yaml index 515cc4b..120bd19 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -5,7 +5,7 @@ author: Tyler Matthews homepage: https://github.com/matthewstyler/configurable_expansion_tile environment: - sdk: ">=2.0.0-dev.68.0 <3.0.0" + sdk: '>=2.12.0 <3.0.0' dependencies: flutter: diff --git a/test/configurable_expansion_tile_test.dart b/test/configurable_expansion_tile_test.dart deleted file mode 100644 index 200d707..0000000 --- a/test/configurable_expansion_tile_test.dart +++ /dev/null @@ -1,5 +0,0 @@ -import 'package:flutter_test/flutter_test.dart'; - -import 'package:configurable_expansion_tile/configurable_expansion_tile.dart'; - -void main() {} From 0b888574a2922a26a8976d0c9ee75c02b080028a Mon Sep 17 00:00:00 2001 From: jinosh05 Date: Tue, 4 May 2021 11:55:45 +0530 Subject: [PATCH 2/2] null safety applied --- example/android/gradle/wrapper/gradle-wrapper.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/example/android/gradle/wrapper/gradle-wrapper.properties b/example/android/gradle/wrapper/gradle-wrapper.properties index 2819f02..bc6a58a 100644 --- a/example/android/gradle/wrapper/gradle-wrapper.properties +++ b/example/android/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-all.zip