Commit 653e7dc3 by Karthik

default toast style fix

parent 6b2987a0
## [2.2.1]
* default toast style fix #38
## [2.2.0]
* Background color fixed #29
......
......@@ -11,7 +11,7 @@ Android Toast Library for Flutter
```yaml
# add this line to your dependencies
fluttertoast: ^2.2.0
fluttertoast: ^2.2.1
```
```dart
......
......@@ -7,6 +7,7 @@ import android.graphics.PorterDuff;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.support.v4.content.ContextCompat;
import android.util.Log;
import android.view.Gravity;
import android.widget.TextView;
import android.widget.Toast;
......@@ -22,8 +23,6 @@ public class FluttertoastPlugin implements MethodCallHandler {
Context ctx;
int defaultTextColor = Color.TRANSPARENT;
FluttertoastPlugin(Context context) {
ctx = context;
}
......@@ -43,6 +42,7 @@ public class FluttertoastPlugin implements MethodCallHandler {
Number bgcolor = call.argument("bgcolor");
Number textcolor = call.argument("textcolor");
Toast toast = Toast.makeText(ctx, msg, Toast.LENGTH_SHORT);
toast.setText(msg);
......@@ -66,10 +66,6 @@ public class FluttertoastPlugin implements MethodCallHandler {
TextView text = toast.getView().findViewById(android.R.id.message);
if (defaultTextColor == 0) {
defaultTextColor = text.getCurrentTextColor();
}
if(bgcolor != null) {
Drawable shapeDrawable = ContextCompat.getDrawable(ctx, R.drawable.toast_bg);
......@@ -84,10 +80,8 @@ public class FluttertoastPlugin implements MethodCallHandler {
}
try {
text.setTextColor(textcolor != null ? textcolor.intValue() : defaultTextColor);
} catch (Exception e) {
e.printStackTrace();
if(textcolor != null) {
text.setTextColor(textcolor.intValue());
}
toast.show();
......
......@@ -8,7 +8,7 @@ buildscript {
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.2'
classpath 'com.android.tools.build:gradle:3.2.1'
}
}
......
#Fri Jun 23 08:50:38 CEST 2017
#Thu Dec 20 12:42:32 IST 2018
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip
......@@ -17,8 +17,8 @@ class Fluttertoast {
Toast toastLength,
int timeInSecForIos = 1,
ToastGravity gravity,
Color backgroundColor = const Color.fromARGB(255, 0, 0, 0),
Color textColor = const Color.fromARGB(255, 255, 255, 255),
Color backgroundColor,
Color textColor,
}) async {
String toast = "short";
if (toastLength == Toast.LENGTH_LONG) {
......@@ -39,8 +39,8 @@ class Fluttertoast {
'length': toast,
'time': timeInSecForIos,
'gravity': gravityToast,
'bgcolor': backgroundColor.value,
'textcolor': textColor.value,
'bgcolor': backgroundColor != null ? backgroundColor.value : backgroundColor,
'textcolor': textColor != null ? textColor.value: textColor,
};
String res = await _channel.invokeMethod('showToast', params);
return res;
......
name: fluttertoast
description: Toast Library for FLutter
version: 2.2.0
version: 2.2.1
author: Karthik Ponnam <ponnamkarthik3@gmail.com>
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