Commit f09f28a2 by Zac Chan

Added font size

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