Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
F
fluttertoast
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
songyanzhi
fluttertoast
Commits
eb80de17
Commit
eb80de17
authored
Dec 02, 2018
by
Ben Getsug
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
updating android plugin to reflect changes made in dart
parent
b2444366
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
10 deletions
+7
-10
android/build.gradle
+1
-1
android/src/main/java/io/github/ponnamkarthik/toast/fluttertoast/FluttertoastPlugin.java
+4
-7
example/lib/main.dart
+2
-2
No files found.
android/build.gradle
View file @
eb80de17
...
...
@@ -8,7 +8,7 @@ buildscript {
}
dependencies
{
classpath
'com.android.tools.build:gradle:3.
1.2
'
classpath
'com.android.tools.build:gradle:3.
2.1
'
}
}
...
...
android/src/main/java/io/github/ponnamkarthik/toast/fluttertoast/FluttertoastPlugin.java
View file @
eb80de17
...
...
@@ -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
[]
{
100
f
,
100
f
,
100
f
,
100
f
,
100
f
,
100
f
,
100
f
,
100
f
},
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
();
}
...
...
example/lib/main.dart
View file @
eb80de17
...
...
@@ -25,8 +25,8 @@ class _MyAppState extends State<MyApp> {
Fluttertoast
.
showToast
(
msg:
"This is Colored Toast"
,
toastLength:
Toast
.
LENGTH_SHORT
,
b
gcolor:
"#e74c3c"
,
text
color:
'#ffffff'
);
b
ackgroundColor:
Colors
.
red
,
text
Color:
Colors
.
white
);
}
void
showShortToast
()
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment