Commit eb80de17 by Ben Getsug

updating android plugin to reflect changes made in dart

parent b2444366
......@@ -8,7 +8,7 @@ buildscript {
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.2'
classpath 'com.android.tools.build:gradle:3.2.1'
}
}
......
......@@ -8,14 +8,11 @@ import io.flutter.plugin.common.PluginRegistry.Registrar;
import android.content.Context;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.ShapeDrawable;
import android.graphics.drawable.shapes.RoundRectShape;
import android.os.Build;
import android.view.Gravity;
import android.widget.TextView;
import android.widget.Toast;
import android.util.Log;
/** FluttertoastPlugin */
public class FluttertoastPlugin implements MethodCallHandler {
......@@ -40,8 +37,8 @@ public class FluttertoastPlugin implements MethodCallHandler {
String msg = call.argument("msg").toString();
String length = call.argument("length").toString();
String gravity = call.argument("gravity").toString();
String bgcolor = call.argument("bgcolor").toString();
String textcolor = call.argument("textcolor").toString();
Integer bgcolor = call.argument("bgcolor");
Integer textcolor = call.argument("textcolor");
Toast toast = Toast.makeText(ctx, msg, Toast.LENGTH_SHORT);
toast.setText(msg);
......@@ -72,7 +69,7 @@ public class FluttertoastPlugin implements MethodCallHandler {
RoundRectShape rectShape = new RoundRectShape(new float[] {100f, 100f, 100f, 100f, 100f, 100f, 100f, 100f}, null, null);
ShapeDrawable shapeDrawable = new ShapeDrawable(rectShape);
shapeDrawable.getPaint().setColor(Color.parseColor(bgcolor));
shapeDrawable.getPaint().setColor(bgcolor);
shapeDrawable.getPaint().setStyle(Paint.Style.FILL);
shapeDrawable.getPaint().setAntiAlias(true);
shapeDrawable.getPaint().setFlags(Paint.ANTI_ALIAS_FLAG);
......@@ -89,7 +86,7 @@ public class FluttertoastPlugin implements MethodCallHandler {
if (!textcolor.equals("null")) {
try {
text.setTextColor(Color.parseColor(textcolor));
text.setTextColor(textcolor);
} catch (Exception e) {
e.printStackTrace();
}
......
......@@ -25,8 +25,8 @@ class _MyAppState extends State<MyApp> {
Fluttertoast.showToast(
msg: "This is Colored Toast",
toastLength: Toast.LENGTH_SHORT,
bgcolor: "#e74c3c",
textcolor: '#ffffff');
backgroundColor: Colors.red,
textColor: Colors.white);
}
void showShortToast() {
......
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