Commit f09f28a2 by Zac Chan

Added font size

parent 74a5510f
...@@ -44,6 +44,8 @@ static NSString *const CHANNEL_NAME = @"PonnamKarthik/fluttertoast"; ...@@ -44,6 +44,8 @@ static NSString *const CHANNEL_NAME = @"PonnamKarthik/fluttertoast";
NSNumber *bgcolor = call.arguments[@"bgcolor"]; NSNumber *bgcolor = call.arguments[@"bgcolor"];
NSNumber *textcolor = call.arguments[@"textcolor"]; NSNumber *textcolor = call.arguments[@"textcolor"];
NSNumber *size = call.arguments[@"size"]; NSNumber *size = call.arguments[@"size"];
NSNumber *fontSize = call.arguments[@"fontSize"];
double fontSizeDouble = [fontSize doubleValue];
int time = 1; int time = 1;
@try { @try {
...@@ -57,7 +59,7 @@ static NSString *const CHANNEL_NAME = @"PonnamKarthik/fluttertoast"; ...@@ -57,7 +59,7 @@ static NSString *const CHANNEL_NAME = @"PonnamKarthik/fluttertoast";
CSToastStyle *style = [[CSToastStyle alloc] initWithDefaultStyle]; CSToastStyle *style = [[CSToastStyle alloc] initWithDefaultStyle];
style.messageFont = [UIFont systemFontOfSize:fontSizeDouble];
style.backgroundColor = [self colorWithHex:bgcolor.unsignedIntegerValue]; style.backgroundColor = [self colorWithHex:bgcolor.unsignedIntegerValue];
style.messageColor = [self colorWithHex:textcolor.unsignedIntegerValue]; style.messageColor = [self colorWithHex:textcolor.unsignedIntegerValue];
...@@ -65,7 +67,13 @@ static NSString *const CHANNEL_NAME = @"PonnamKarthik/fluttertoast"; ...@@ -65,7 +67,13 @@ static NSString *const CHANNEL_NAME = @"PonnamKarthik/fluttertoast";
[[UIApplication sharedApplication].delegate.window.rootViewController.view makeToast:msg [[UIApplication sharedApplication].delegate.window.rootViewController.view makeToast:msg
duration:time duration:time
position:CSToastPositionTop position:CSToastPositionTop
style:style]; style:style
completion:^(BOOL didTap){
NSNumber *boolNumber = [NSNumber numberWithBool:didTap];
result(boolNumber);
}];
} 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:time duration:time
...@@ -76,14 +84,18 @@ static NSString *const CHANNEL_NAME = @"PonnamKarthik/fluttertoast"; ...@@ -76,14 +84,18 @@ static NSString *const CHANNEL_NAME = @"PonnamKarthik/fluttertoast";
NSNumber *boolNumber = [NSNumber numberWithBool:didTap]; NSNumber *boolNumber = [NSNumber numberWithBool:didTap];
result(boolNumber); result(boolNumber);
}]; }];
} else { } else {
[[UIApplication sharedApplication].delegate.window.rootViewController.view makeToast:msg [[UIApplication sharedApplication].delegate.window.rootViewController.view makeToast:msg
duration:time duration:time
position:CSToastPositionBottom position:CSToastPositionBottom
style:style]; style:style
completion:^(BOOL didTap){
NSNumber *boolNumber = [NSNumber numberWithBool:didTap];
result(boolNumber);
}];
} }
} else { } else {
......
...@@ -35,6 +35,7 @@ class Fluttertoast { ...@@ -35,6 +35,7 @@ class Fluttertoast {
@required String msg, @required String msg,
Toast toastLength, Toast toastLength,
int timeInSecForIos = 1, int timeInSecForIos = 1,
double fontSize = 16.0,
ToastGravity gravity, ToastGravity gravity,
Color backgroundColor, Color backgroundColor,
Color textColor, Color textColor,
...@@ -68,6 +69,7 @@ class Fluttertoast { ...@@ -68,6 +69,7 @@ class Fluttertoast {
'gravity': gravityToast, 'gravity': gravityToast,
'bgcolor': backgroundColor != null ? backgroundColor.value : null, 'bgcolor': backgroundColor != null ? backgroundColor.value : null,
'textcolor': textColor != null ? textColor.value: null, 'textcolor': textColor != null ? textColor.value: null,
'fontSize': fontSize,
}; };
bool res = await _channel.invokeMethod('showToast', params); bool res = await _channel.invokeMethod('showToast', params);
......
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