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
6b2987a0
Commit
6b2987a0
authored
Dec 19, 2018
by
Karthik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Background color fixed
parent
79302e64
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
48 additions
and
26 deletions
+48
-26
CHANGELOG.md
+5
-1
README.md
+1
-1
android/build.gradle
+4
-0
android/src/main/java/io/github/ponnamkarthik/toast/fluttertoast/FluttertoastPlugin.java
+22
-23
android/src/main/res/drawable/toast_bg.xml
+15
-0
pubspec.yaml
+1
-1
No files found.
CHANGELOG.md
View file @
6b2987a0
## [2.2.0]
*
Background color fixed #29
## [2.1.5]
## [2.1.5]
*
Merged PR #36 - Fix Number Cast Error for issue #35
*
Merged PR #36 - Fix Number Cast Error for issue #35
...
@@ -8,7 +12,7 @@
...
@@ -8,7 +12,7 @@
## [2.1.2]
## [2.1.2]
*
iOS Color Fix
*
iOS Color Fix
*
Background color fix in PIE
*
Background color fix in PIE
## [2.1.1]
## [2.1.1]
...
...
README.md
View file @
6b2987a0
...
@@ -11,7 +11,7 @@ Android Toast Library for Flutter
...
@@ -11,7 +11,7 @@ Android Toast Library for Flutter
```
yaml
```
yaml
# add this line to your dependencies
# add this line to your dependencies
fluttertoast
:
^2.
1.5
fluttertoast
:
^2.
2.0
```
```
```
dart
```
dart
...
...
android/build.gradle
View file @
6b2987a0
...
@@ -32,3 +32,7 @@ android {
...
@@ -32,3 +32,7 @@ android {
disable
'InvalidPackage'
disable
'InvalidPackage'
}
}
}
}
dependencies
{
implementation
'com.android.support:appcompat-v7:27.1.1'
}
android/src/main/java/io/github/ponnamkarthik/toast/fluttertoast/FluttertoastPlugin.java
View file @
6b2987a0
package
io
.
github
.
ponnamkarthik
.
toast
.
fluttertoast
;
package
io
.
github
.
ponnamkarthik
.
toast
.
fluttertoast
;
import
io.flutter.plugin.common.MethodCall
;
import
io.flutter.plugin.common.MethodChannel
;
import
io.flutter.plugin.common.MethodChannel.MethodCallHandler
;
import
io.flutter.plugin.common.MethodChannel.Result
;
import
io.flutter.plugin.common.PluginRegistry.Registrar
;
import
android.content.Context
;
import
android.content.Context
;
import
android.content.ContextWrapper
;
import
android.graphics.Color
;
import
android.graphics.Color
;
import
android.graphics.Paint
;
import
android.graphics.PorterDuff
;
import
android.graphics.drawable.ShapeDrawable
;
import
android.graphics.drawable.Drawable
;
import
android.graphics.drawable.shapes.RoundRectShape
;
import
android.os.Build
;
import
android.support.v4.content.ContextCompat
;
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
io.flutter.plugin.common.MethodCall
;
import
io.flutter.plugin.common.MethodChannel
;
import
io.flutter.plugin.common.MethodChannel.MethodCallHandler
;
import
io.flutter.plugin.common.MethodChannel.Result
;
import
io.flutter.plugin.common.PluginRegistry.Registrar
;
/** FluttertoastPlugin */
/** FluttertoastPlugin */
public
class
FluttertoastPlugin
implements
MethodCallHandler
{
public
class
FluttertoastPlugin
implements
MethodCallHandler
{
...
@@ -67,22 +70,18 @@ public class FluttertoastPlugin implements MethodCallHandler {
...
@@ -67,22 +70,18 @@ public class FluttertoastPlugin implements MethodCallHandler {
defaultTextColor
=
text
.
getCurrentTextColor
();
defaultTextColor
=
text
.
getCurrentTextColor
();
}
}
try
{
if
(
bgcolor
!=
null
)
{
RoundRectShape
rectShape
=
new
RoundRectShape
(
new
float
[]
{
100
f
,
100
f
,
100
f
,
100
f
,
100
f
,
100
f
,
100
f
,
100
f
},
null
,
null
);
Drawable
shapeDrawable
=
ContextCompat
.
getDrawable
(
ctx
,
R
.
drawable
.
toast_bg
);
ShapeDrawable
shapeDrawable
=
new
ShapeDrawable
(
rectShape
);
if
(
shapeDrawable
!=
null
)
{
shapeDrawable
.
getPaint
().
setColor
(
bgcolor
!=
null
?
bgcolor
.
intValue
()
:
Color
.
BLACK
);
shapeDrawable
.
setColorFilter
(
bgcolor
.
intValue
(),
PorterDuff
.
Mode
.
SRC_IN
);
shapeDrawable
.
getPaint
().
setStyle
(
Paint
.
Style
.
FILL
);
if
(
Build
.
VERSION
.
SDK_INT
<=
27
)
{
shapeDrawable
.
getPaint
().
setAntiAlias
(
true
);
toast
.
getView
().
setBackground
(
shapeDrawable
);
shapeDrawable
.
getPaint
().
setFlags
(
Paint
.
ANTI_ALIAS_FLAG
);
}
else
{
text
.
setBackground
(
shapeDrawable
);
if
(
android
.
os
.
Build
.
VERSION
.
SDK_INT
<=
27
)
{
}
toast
.
getView
().
setBackground
(
shapeDrawable
);
}
else
{
text
.
setBackground
(
shapeDrawable
);
}
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
}
try
{
try
{
...
...
android/src/main/res/drawable/toast_bg.xml
0 → 100644
View file @
6b2987a0
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:shape=
"rectangle"
>
<corners
android:radius=
"100dp"
>
</corners>
<solid
android:color=
"#000000"
>
</solid>
<padding
android:left=
"24dp"
android:top=
"15dp"
android:right=
"24dp"
android:bottom=
"15dp"
/>
</shape>
\ No newline at end of file
pubspec.yaml
View file @
6b2987a0
name
:
fluttertoast
name
:
fluttertoast
description
:
Toast Library for FLutter
description
:
Toast Library for FLutter
version
:
2.
1.5
version
:
2.
2.0
author
:
Karthik Ponnam <ponnamkarthik3@gmail.com>
author
:
Karthik Ponnam <ponnamkarthik3@gmail.com>
homepage
:
https://github.com/PonnamKarthik/FlutterToast
homepage
:
https://github.com/PonnamKarthik/FlutterToast
...
...
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