Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions example/android/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ gradle-wrapper.jar
/.gradle
/captures/
/gradlew
/app/.cxx
/gradlew.bat
/local.properties
GeneratedPluginRegistrant.java
Expand Down
4 changes: 2 additions & 2 deletions example/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ plugins {

android {
namespace = "com.example.example"
compileSdk = 34
ndkVersion = "27.0.12077973"
compileSdk = flutter.compileSdkVersion
ndkVersion = flutter.ndkVersion

compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
Expand Down
1 change: 1 addition & 0 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,7 @@ class _HomePageState extends State<HomePage> {

void _displaySuccessMotionToast() {
MotionToast toast = MotionToast.success(
animationType: AnimationType.slideInFromBottom,
description: const Text(
'This is a description example',
style: TextStyle(fontSize: 12),
Expand Down
22 changes: 0 additions & 22 deletions lib/motion_toast.dart
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ class MotionToast extends StatefulWidget {
this.contentPadding = EdgeInsets.zero,
this.opacity = .9,
}) : super(key: key) {
_initializeAnimationType();
_assertValidValues();
}

Expand Down Expand Up @@ -104,7 +103,6 @@ class MotionToast extends StatefulWidget {
primaryColor = successColor;
secondaryColor = successSideBarColor;
icon = Icons.check_circle_outline;
_initializeAnimationType();
_assertValidValues();
}

Expand Down Expand Up @@ -149,7 +147,6 @@ class MotionToast extends StatefulWidget {
primaryColor = warningColor;
secondaryColor = warningSideBarColor;
icon = Icons.warning;
_initializeAnimationType();
_assertValidValues();
}

Expand Down Expand Up @@ -194,7 +191,6 @@ class MotionToast extends StatefulWidget {
primaryColor = errorColor;
secondaryColor = errorSideBarColor;
icon = Icons.error;
_initializeAnimationType();
_assertValidValues();
}

Expand Down Expand Up @@ -239,7 +235,6 @@ class MotionToast extends StatefulWidget {
primaryColor = infoColor;
secondaryColor = infoSideBarColor;
icon = Icons.info;
_initializeAnimationType();
_assertValidValues();
}

Expand Down Expand Up @@ -287,7 +282,6 @@ class MotionToast extends StatefulWidget {
primaryColor = infoColor;
secondaryColor = infoSideBarColor;
icon = Icons.info;
_initializeAnimationType();
_assertValidValues();
}

Expand All @@ -301,22 +295,6 @@ class MotionToast extends StatefulWidget {
}
}

void _initializeAnimationType() {
if (toastAlignment.y == 1 &&
animationType == AnimationType.slideInFromTop) {
/// position.y == 1 means the toast is displayed at the bottom
/// if the animation type is fromTop it will be changed to fromBottom
// TODO change this to assert
animationType = AnimationType.slideInFromBottom;
} else if (toastAlignment.y == -1 &&
animationType == AnimationType.slideInFromBottom) {
/// position.y == -1 means the toast is displayed at the top
/// if the animation type is fromBottom it will be changed to fromTop
// TODO change this to assert
animationType = AnimationType.slideInFromTop;
}
}

/// the text widget used for description message
final Widget description;

Expand Down