Commit b2444366 by Ben Getsug

attempt fixing ios background color

parent f79f305e
...@@ -20,14 +20,15 @@ static NSString *const CHANNEL_NAME = @"PonnamKarthik/fluttertoast"; ...@@ -20,14 +20,15 @@ static NSString *const CHANNEL_NAME = @"PonnamKarthik/fluttertoast";
} }
- (UIColor *)getUIColorObjectFromInt:(unsigned int)value { - (UIColor*) colorWithHex: (NSUInteger)hex {
UIColor *color = CGFloat red, green, blue, alpha;
[UIColor colorWithRed:((CGFloat) ((value & 0xFF) << 16)) / 255
green:((CGFloat) ((value & 0xFF) << 8)) / 255 red = ((CGFloat)((hex >> 16) & 0xFF)) / ((CGFloat)0xFF);
blue:((CGFloat) ((value & 0xFF) << 0)) / 255 green = ((CGFloat)((hex >> 8) & 0xFF)) / ((CGFloat)0xFF);
alpha:((CGFloat) ((value & 0xFF) << 24)) / 255]; blue = ((CGFloat)((hex >> 0) & 0xFF)) / ((CGFloat)0xFF);
alpha = hex > 0xFFFFFF ? ((CGFloat)((hex >> 24) & 0xFF)) / ((CGFloat)0xFF) : 1;
return color;
return [UIColor colorWithRed: red green:green blue:blue alpha:alpha];
} }
- (void)handleMethodCall:(FlutterMethodCall *)call result:(FlutterResult)result { - (void)handleMethodCall:(FlutterMethodCall *)call result:(FlutterResult)result {
...@@ -51,8 +52,8 @@ static NSString *const CHANNEL_NAME = @"PonnamKarthik/fluttertoast"; ...@@ -51,8 +52,8 @@ static NSString *const CHANNEL_NAME = @"PonnamKarthik/fluttertoast";
CSToastStyle *style = [[CSToastStyle alloc] initWithDefaultStyle]; CSToastStyle *style = [[CSToastStyle alloc] initWithDefaultStyle];
style.backgroundColor = [self getUIColorObjectFromInt:bgcolor.unsignedIntValue]; style.backgroundColor = [self colorWithHex:bgcolor.unsignedIntegerValue];
style.messageColor = [self getUIColorObjectFromInt:textcolor.unsignedIntValue]; style.messageColor = [self colorWithHex:textcolor.unsignedIntegerValue];
if ([gravity isEqualToString:@"top"]) { if ([gravity isEqualToString:@"top"]) {
[[UIApplication sharedApplication].delegate.window.rootViewController.view makeToast:msg [[UIApplication sharedApplication].delegate.window.rootViewController.view makeToast:msg
......
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