Skip to content
Open
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
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,14 @@ Fluttertoast.showToast(
Fluttertoast.cancel()
```

### Note Android Proguard

If you are using proguard in your app, you must add the following rules to your `proguard-rules.pro` file. Otherwise, toasts will not be visible in a release build.

```
-keep class io.github.ponnamkarthik.toast.** { *; }
```

### Note Android

<img src="https://raw.githubusercontent.com/ponnamkarthik/FlutterToast/master/screenshot/toast_deprecated_setview.png" height="200px" />
Expand Down
8 changes: 7 additions & 1 deletion ios/fluttertoast/Sources/fluttertoast/UIView+Toast.m
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,13 @@ - (void)makeToastActivity:(id)position {
activityView.layer.shadowOffset = style.shadowOffset;
}

UIActivityIndicatorView *activityIndicatorView = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge];
UIActivityIndicatorView *activityIndicatorView;
if (@available(iOS 13.0, *)) {
activityIndicatorView = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleLarge];
activityIndicatorView.color = [UIColor whiteColor];
} else {
activityIndicatorView = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge];
}
activityIndicatorView.center = CGPointMake(activityView.bounds.size.width / 2, activityView.bounds.size.height / 2);
[activityView addSubview:activityIndicatorView];
[activityIndicatorView startAnimating];
Expand Down
14 changes: 12 additions & 2 deletions lib/fluttertoast.dart
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,12 @@ class Fluttertoast {
/// Let say you have an active show
/// Use this method to hide the toast immediately
static Future<bool?> cancel() async {
bool? res = await _channel.invokeMethod("cancel");
bool? res;
try {
res = await _channel.invokeMethod("cancel");
} on MissingPluginException {
// Ignore MissingPluginException for unsupported platforms like Windows
}
isCurrentlyShowingToast = false; // Update variable
return res;
}
Expand Down Expand Up @@ -119,7 +124,12 @@ class Fluttertoast {

isCurrentlyShowingToast = true; // Update variable

bool? res = await _channel.invokeMethod('showToast', params);
bool? res;
try {
res = await _channel.invokeMethod('showToast', params);
} on MissingPluginException {
// Ignore MissingPluginException for unsupported platforms like Windows
}

// Assuming the platform will invoke 'cancel' method after showing toast
Future.delayed(Duration(seconds: timeInSecForIosWeb), () {
Expand Down
Loading