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
37a29c8d
Commit
37a29c8d
authored
Apr 20, 2021
by
Karthik Ponnam
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed Unresolved reference: Q
parent
11882aea
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
31 additions
and
4 deletions
+31
-4
CHANGELOG.md
+3
-0
README.md
+1
-1
android/.idea/caches/build_file_checksums.ser
+0
-0
android/src/main/kotlin/io/github/ponnamkarthik/toast/fluttertoast/MethodCallHandlerImpl.kt
+26
-2
pubspec.yaml
+1
-1
No files found.
CHANGELOG.md
View file @
37a29c8d
## [8.0.5]
-
Fixed Unresolved reference: R (Issue with Android API 30)
## [8.0.4]
-
Fixed Unresolved reference: R (Issue with Android API 30)
...
...
README.md
View file @
37a29c8d
...
...
@@ -34,7 +34,7 @@ This one has limited features and no control over UI
```
yaml
# add this line to your dependencies
fluttertoast
:
^8.0.
4
fluttertoast
:
^8.0.
5
```
```
dart
...
...
android/.idea/caches/build_file_checksums.ser
View file @
37a29c8d
No preview for this file type
android/src/main/kotlin/io/github/ponnamkarthik/toast/fluttertoast/MethodCallHandlerImpl.kt
View file @
37a29c8d
...
...
@@ -5,8 +5,12 @@ import android.content.Context
import
android.graphics.PorterDuff
import
android.graphics.drawable.Drawable
import
android.os.Build
import
android.os.Handler
import
android.view.Gravity
import
android.view.LayoutInflater
import
android.view.View
import
android.view.WindowInsets
import
android.view.inputmethod.InputMethodManager
import
android.widget.TextView
import
android.widget.Toast
import
io.flutter.plugin.common.MethodCall
...
...
@@ -42,7 +46,7 @@ internal class MethodCallHandlerImpl(var context: Context) : MethodCallHandler {
Toast
.
LENGTH_SHORT
}
if
(
bgcolor
!=
null
&&
Build
.
VERSION
.
SDK_INT
<
Build
.
VERSION_CODES
.
Q
)
{
if
(
bgcolor
!=
null
&&
Build
.
VERSION
.
SDK_INT
<
29
)
{
val
layout
=
(
context
.
getSystemService
(
Context
.
LAYOUT_INFLATER_SERVICE
)
as
LayoutInflater
).
inflate
(
R
.
layout
.
toast_custom
,
null
)
val
text
=
layout
.
findViewById
<
TextView
>(
R
.
id
.
text
)
text
.
text
=
mMessage
...
...
@@ -67,7 +71,7 @@ internal class MethodCallHandlerImpl(var context: Context) : MethodCallHandler {
mToast
.
view
=
layout
}
else
{
mToast
=
Toast
.
makeText
(
context
,
mMessage
,
mDuration
)
if
(
Build
.
VERSION
.
SDK_INT
<
Build
.
VERSION_CODES
.
Q
)
{
if
(
Build
.
VERSION
.
SDK_INT
<
29
)
{
try
{
val
textView
:
TextView
=
mToast
.
view
!!
.
findViewById
(
android
.
R
.
id
.
message
)
if
(
textSize
!=
null
)
{
...
...
@@ -95,11 +99,19 @@ internal class MethodCallHandlerImpl(var context: Context) : MethodCallHandler {
}
}
// }
// val inputMethodManager = context.getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager
// if(inputMethodManager.isAcceptingText) {
// mToast.setGravity(Gravity.CENTER, 0, 0)
// }
if
(
context
is
Activity
)
{
(
context
as
Activity
).
runOnUiThread
{
mToast
.
show
()
}
}
else
{
mToast
.
show
()
}
result
.
success
(
true
)
}
"cancel"
->
{
...
...
@@ -111,4 +123,16 @@ internal class MethodCallHandlerImpl(var context: Context) : MethodCallHandler {
else
->
result
.
notImplemented
()
}
}
fun
resetToast
()
{
if
(
::
mToast
.
isInitialized
&&
mToast
!=
null
)
{
if
(
mToast
.
view
.
visibility
!=
View
.
VISIBLE
)
{
mToast
}
else
{
Handler
().
postDelayed
(
Runnable
{
resetToast
()
},
1000
);
}
}
}
}
pubspec.yaml
View file @
37a29c8d
name
:
fluttertoast
description
:
Toast Library for Flutter, Easily create toast messages in single line of code
version
:
8.0.
4
version
:
8.0.
5
homepage
:
https://github.com/PonnamKarthik/FlutterToast
issue_tracker
:
https://github.com/ponnamkarthik/FlutterToast/issues
...
...
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