Commit 16f0592a by sun

fix ios run error

parent 5c47854f
...@@ -26,26 +26,29 @@ static NSString *const CHANNEL_NAME = @"PonnamKarthik/fluttertoast"; ...@@ -26,26 +26,29 @@ static NSString *const CHANNEL_NAME = @"PonnamKarthik/fluttertoast";
NSString *gravity = call.arguments[@"gravity"]; NSString *gravity = call.arguments[@"gravity"];
NSString *durationTime = call.arguments[@"time"]; NSString *durationTime = call.arguments[@"time"];
int time = 1;
@try{
time = [durationTime intValue];
} @catch(NSException *e){
time = 3;
}
if(time > 10 ) time = 10;
else if(time < 1) time = 1;
if((durationTime == (id)[NSNull null] || durationTime.length == 0 )) {
[[UIApplication sharedApplication].delegate.window.rootViewController.view makeToast:msg
duration: 3
position:CSToastPositionBottom];
} else {
if([gravity isEqualToString:@"top"]) { if([gravity isEqualToString:@"top"]) {
[[UIApplication sharedApplication].delegate.window.rootViewController.view makeToast:msg [[UIApplication sharedApplication].delegate.window.rootViewController.view makeToast:msg
duration: [durationTime intValue] duration: time
position:CSToastPositionTop]; position:CSToastPositionTop];
} else if([gravity isEqualToString:@"center"]) { } else if([gravity isEqualToString:@"center"]) {
[[UIApplication sharedApplication].delegate.window.rootViewController.view makeToast:msg [[UIApplication sharedApplication].delegate.window.rootViewController.view makeToast:msg
duration: [durationTime intValue] duration: time
position:CSToastPositionCenter]; position:CSToastPositionCenter];
} else { } else {
[[UIApplication sharedApplication].delegate.window.rootViewController.view makeToast:msg [[UIApplication sharedApplication].delegate.window.rootViewController.view makeToast:msg
duration: [durationTime intValue] duration: time
position:CSToastPositionBottom]; position:CSToastPositionBottom];
} }
}
result(@"done"); result(@"done");
} else { } else {
......
...@@ -3,8 +3,8 @@ ...@@ -3,8 +3,8 @@
# #
Pod::Spec.new do |s| Pod::Spec.new do |s|
s.name = 'fluttertoast' s.name = 'fluttertoast'
s.version = '0.0.1' s.version = '0.0.2'
s.summary = 'Toast Library for FLutter' s.summary = 'Toast Library for Flutter'
s.description = <<-DESC s.description = <<-DESC
Toast Library for FLutter Toast Library for FLutter
DESC DESC
......
...@@ -24,7 +24,7 @@ class Fluttertoast { ...@@ -24,7 +24,7 @@ class Fluttertoast {
static Future<String> showToast ({ static Future<String> showToast ({
@required String msg, @required String msg,
Toast toastLength, Toast toastLength,
int timeInSecForIos, int timeInSecForIos = 1,
ToastGravity gravity ToastGravity gravity
}) async { }) async {
String toast = "short"; String toast = "short";
......
name: fluttertoast name: fluttertoast
description: Toast Library for FLutter description: Toast Library for FLutter
version: 2.0.2 version: 2.0.3
author: Karthik Ponnam <ponnamkarthik3@gmail.com> author: Karthik Ponnam <ponnamkarthik3@gmail.com>
homepage: https://github.com/PonnamKarthik/FlutterToast homepage: https://github.com/PonnamKarthik/FlutterToast
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment