diff --git a/example/android/app/build.gradle b/example/android/app/build.gradle index a9339df..f987638 100644 --- a/example/android/app/build.gradle +++ b/example/android/app/build.gradle @@ -25,7 +25,7 @@ apply plugin: 'com.android.application' apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" android { - compileSdkVersion 27 + compileSdkVersion 28 lintOptions { disable 'InvalidPackage' diff --git a/example/android/gradle.properties b/example/android/gradle.properties index 8bd86f6..4d3226a 100644 --- a/example/android/gradle.properties +++ b/example/android/gradle.properties @@ -1 +1,3 @@ org.gradle.jvmargs=-Xmx1536M +android.useAndroidX=true +android.enableJetifier=true \ No newline at end of file diff --git a/lib/button_stagger_animation.dart b/lib/button_stagger_animation.dart index 57ba1a7..3e73123 100644 --- a/lib/button_stagger_animation.dart +++ b/lib/button_stagger_animation.dart @@ -2,26 +2,26 @@ import 'package:flutter/material.dart'; class ButtonStaggerAnimation extends StatelessWidget { // Animation fields - final AnimationController controller; + final controller; // Display fields - final Color color; - final Color progressIndicatorColor; - final double progressIndicatorSize; - final BorderRadius borderRadius; + final Color? color; + final Color? progressIndicatorColor; + final double? progressIndicatorSize; + final BorderRadius? borderRadius; final double strokeWidth; - final Function(AnimationController) onPressed; - final Widget child; + final Function(AnimationController)? onPressed; + final Widget? child; ButtonStaggerAnimation({ - Key key, + Key? key, this.controller, this.color, this.progressIndicatorColor, this.progressIndicatorSize, this.borderRadius, this.onPressed, - this.strokeWidth, + this.strokeWidth = 0.0, this.child, }) : super(key: key); @@ -30,16 +30,16 @@ class ButtonStaggerAnimation extends StatelessWidget { return LayoutBuilder(builder: _progressAnimatedBuilder); } - Widget _buttonChild() { - if (controller.isAnimating) { + Widget? _buttonChild() { + if (controller!.isAnimating) { return Container(); - } else if (controller.isCompleted) { + } else if (controller!.isCompleted) { return OverflowBox( maxWidth: progressIndicatorSize, maxHeight: progressIndicatorSize, child: CircularProgressIndicator( strokeWidth: strokeWidth, - valueColor: AlwaysStoppedAnimation(progressIndicatorColor), + valueColor: AlwaysStoppedAnimation(progressIndicatorColor!), ), ); } @@ -83,7 +83,7 @@ class ButtonStaggerAnimation extends StatelessWidget { color: color, child: _buttonChild(), onPressed: () { - this.onPressed(controller); + this.onPressed!(controller); }, ), ); diff --git a/lib/progress_button.dart b/lib/progress_button.dart index 7039236..cd905ea 100644 --- a/lib/progress_button.dart +++ b/lib/progress_button.dart @@ -1,7 +1,8 @@ library progress_button; import 'package:flutter/material.dart'; -import 'package:progress_indicator_button/button_stagger_animation.dart'; + +import 'button_stagger_animation.dart'; class ProgressButton extends StatefulWidget { /// The background color of the button. @@ -21,9 +22,9 @@ class ProgressButton extends StatefulWidget { /// /// This will grant access to its [AnimationController] so /// that the animation can be controlled based on the need. - final Function(AnimationController) onPressed; + final Function(AnimationController)? onPressed; /// The child to display on the button. - final Widget child; + final Widget? child; ProgressButton({ @required this.child, @@ -42,7 +43,7 @@ class ProgressButton extends StatefulWidget { class _ProgressButtonState extends State with TickerProviderStateMixin { - AnimationController _controller; + var _controller; @override void initState() { diff --git a/pubspec.yaml b/pubspec.yaml index cbc0389..367508d 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,11 +1,11 @@ name: progress_indicator_button description: A simple button which can transform and show a progress indicator. -version: 0.0.3 +version: 0.0.4 author: Pascal Brosinski homepage: https://github.com/PascalAC/progress_button environment: - sdk: ">=2.0.0-dev.68.0 <3.0.0" + sdk: ">=2.12.0 <3.0.0" dependencies: flutter: