Commit eb80de17 by Ben Getsug

updating android plugin to reflect changes made in dart

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