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
44a47619
Commit
44a47619
authored
Feb 18, 2021
by
Karthik Ponnam
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug fixes & PR Merged
parent
9403dab9
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
49 additions
and
47 deletions
+49
-47
README.md
+10
-2
android/.idea/caches/build_file_checksums.ser
+0
-0
android/build.gradle
+1
-1
android/src/main/kotlin/io/github/ponnamkarthik/toast/fluttertoast/MethodCallHandlerImpl.kt
+9
-1
assets/toastify.css
+0
-2
example/ios/Flutter/flutter_export_environment.sh
+2
-0
example/pubspec.lock
+20
-27
pubspec.lock
+6
-13
pubspec.yaml
+1
-1
No files found.
README.md
View file @
44a47619
...
@@ -41,7 +41,7 @@ fluttertoast: ^7.1.6
...
@@ -41,7 +41,7 @@ fluttertoast: ^7.1.6
import
'package:fluttertoast/fluttertoast.dart'
;
import
'package:fluttertoast/fluttertoast.dart'
;
```
```
## Toast with No Build Context
## Toast with No Build Context
(Android & iOS)
```
dart
```
dart
Fluttertoast
.
showToast
(
Fluttertoast
.
showToast
(
...
@@ -74,6 +74,14 @@ Fluttertoast.showToast(
...
@@ -74,6 +74,14 @@ Fluttertoast.showToast(
Fluttertoast
.
cancel
()
Fluttertoast
.
cancel
()
```
```
### Note Android
<img
src=
"https://raw.githubusercontent.com/ponnamkarthik/FlutterToast/master/screenshot/toast_deprecated_setview.png"
height=
"200px"
/>
> Custom Toast will not work on android 11 and above, it will only use *msg* and *toastLength* remaining all properties are ignored
### Custom Toast For Android
### Custom Toast For Android
Create a file named
`toast_custom.xml`
in your project
`app/res/layout`
folder and do custom styling
Create a file named
`toast_custom.xml`
in your project
`app/res/layout`
folder and do custom styling
...
@@ -104,7 +112,7 @@ Create a file named `toast_custom.xml` in your project `app/res/layout` folder a
...
@@ -104,7 +112,7 @@ Create a file named `toast_custom.xml` in your project `app/res/layout` folder a
</FrameLayout>
</FrameLayout>
```
```
## Toast with BuildContext
## Toast with BuildContext
(All Platforms)
```
dart
```
dart
FToast
fToast
;
FToast
fToast
;
...
...
android/.idea/caches/build_file_checksums.ser
View file @
44a47619
No preview for this file type
android/build.gradle
View file @
44a47619
...
@@ -25,7 +25,7 @@ apply plugin: 'com.android.library'
...
@@ -25,7 +25,7 @@ apply plugin: 'com.android.library'
apply
plugin:
'kotlin-android'
apply
plugin:
'kotlin-android'
android
{
android
{
compileSdkVersion
28
compileSdkVersion
30
sourceSets
{
sourceSets
{
main
.
java
.
srcDirs
+=
'src/main/kotlin'
main
.
java
.
srcDirs
+=
'src/main/kotlin'
...
...
android/src/main/kotlin/io/github/ponnamkarthik/toast/fluttertoast/MethodCallHandlerImpl.kt
View file @
44a47619
...
@@ -28,18 +28,21 @@ internal class MethodCallHandlerImpl(var context: Context) : MethodCallHandler {
...
@@ -28,18 +28,21 @@ internal class MethodCallHandlerImpl(var context: Context) : MethodCallHandler {
val
textcolor
=
call
.
argument
<
Number
>(
"textcolor"
)
val
textcolor
=
call
.
argument
<
Number
>(
"textcolor"
)
val
textSize
=
call
.
argument
<
Number
>(
"fontSize"
)
val
textSize
=
call
.
argument
<
Number
>(
"fontSize"
)
val
mGravity
:
Int
val
mGravity
:
Int
mGravity
=
when
(
gravity
)
{
mGravity
=
when
(
gravity
)
{
"top"
->
Gravity
.
TOP
"top"
->
Gravity
.
TOP
"center"
->
Gravity
.
CENTER
"center"
->
Gravity
.
CENTER
else
->
Gravity
.
BOTTOM
else
->
Gravity
.
BOTTOM
}
}
val
mDuration
:
Int
val
mDuration
:
Int
mDuration
=
if
(
length
==
"long"
)
{
mDuration
=
if
(
length
==
"long"
)
{
Toast
.
LENGTH_LONG
Toast
.
LENGTH_LONG
}
else
{
}
else
{
Toast
.
LENGTH_SHORT
Toast
.
LENGTH_SHORT
}
}
if
(
bgcolor
!=
null
)
{
if
(
bgcolor
!=
null
&&
Build
.
VERSION
.
SDK_INT
<
Build
.
VERSION_CODES
.
R
)
{
val
layout
=
(
context
.
getSystemService
(
Context
.
LAYOUT_INFLATER_SERVICE
)
as
LayoutInflater
).
inflate
(
R
.
layout
.
toast_custom
,
null
)
val
layout
=
(
context
.
getSystemService
(
Context
.
LAYOUT_INFLATER_SERVICE
)
as
LayoutInflater
).
inflate
(
R
.
layout
.
toast_custom
,
null
)
val
text
=
layout
.
findViewById
<
TextView
>(
R
.
id
.
text
)
val
text
=
layout
.
findViewById
<
TextView
>(
R
.
id
.
text
)
text
.
text
=
mMessage
text
.
text
=
mMessage
...
@@ -64,6 +67,7 @@ internal class MethodCallHandlerImpl(var context: Context) : MethodCallHandler {
...
@@ -64,6 +67,7 @@ internal class MethodCallHandlerImpl(var context: Context) : MethodCallHandler {
mToast
.
view
=
layout
mToast
.
view
=
layout
}
else
{
}
else
{
mToast
=
Toast
.
makeText
(
context
,
mMessage
,
mDuration
)
mToast
=
Toast
.
makeText
(
context
,
mMessage
,
mDuration
)
if
(
Build
.
VERSION
.
SDK_INT
<
Build
.
VERSION_CODES
.
R
)
{
try
{
try
{
val
textView
:
TextView
=
mToast
.
view
!!
.
findViewById
(
android
.
R
.
id
.
message
)
val
textView
:
TextView
=
mToast
.
view
!!
.
findViewById
(
android
.
R
.
id
.
message
)
if
(
textSize
!=
null
)
{
if
(
textSize
!=
null
)
{
...
@@ -76,6 +80,9 @@ internal class MethodCallHandlerImpl(var context: Context) : MethodCallHandler {
...
@@ -76,6 +80,9 @@ internal class MethodCallHandlerImpl(var context: Context) : MethodCallHandler {
}
}
}
}
}
if
(
Build
.
VERSION
.
SDK_INT
<
Build
.
VERSION_CODES
.
R
)
{
when
(
mGravity
)
{
when
(
mGravity
)
{
Gravity
.
CENTER
->
{
Gravity
.
CENTER
->
{
mToast
.
setGravity
(
mGravity
,
0
,
0
)
mToast
.
setGravity
(
mGravity
,
0
,
0
)
...
@@ -87,6 +94,7 @@ internal class MethodCallHandlerImpl(var context: Context) : MethodCallHandler {
...
@@ -87,6 +94,7 @@ internal class MethodCallHandlerImpl(var context: Context) : MethodCallHandler {
mToast
.
setGravity
(
mGravity
,
0
,
100
)
mToast
.
setGravity
(
mGravity
,
0
,
100
)
}
}
}
}
}
if
(
context
is
Activity
)
{
if
(
context
is
Activity
)
{
(
context
as
Activity
).
runOnUiThread
{
mToast
.
show
()
}
(
context
as
Activity
).
runOnUiThread
{
mToast
.
show
()
}
}
else
{
}
else
{
...
...
assets/toastify.css
View file @
44a47619
...
@@ -12,4 +12,3 @@
...
@@ -12,4 +12,3 @@
* Copyright (C) 2018 Varun A P
* Copyright (C) 2018 Varun A P
*/
*/
.toastify
{
padding
:
12px
20px
;
color
:
#fff
;
display
:
inline-block
;
box-shadow
:
0
3px
6px
-1px
rgba
(
0
,
0
,
0
,
.12
),
0
10px
36px
-4px
rgba
(
77
,
96
,
232
,
.3
);
background
:
-webkit-linear-gradient
(
315deg
,
#73a5ff
,
#5477f5
);
background
:
linear-gradient
(
135deg
,
#73a5ff
,
#5477f5
);
position
:
fixed
;
opacity
:
0
;
transition
:
all
.4s
cubic-bezier
(
.215
,
.61
,
.355
,
1
);
border-radius
:
2px
;
cursor
:
pointer
;
text-decoration
:
none
;
max-width
:
calc
(
50%
-
20px
);
z-index
:
2147483647
}
.toastify.on
{
opacity
:
1
}
.toast-close
{
opacity
:
.4
;
padding
:
0
5px
}
.toastify-right
{
right
:
15px
}
.toastify-left
{
left
:
15px
}
.toastify-top
{
top
:
-150px
}
.toastify-bottom
{
bottom
:
-150px
}
.toastify-rounded
{
border-radius
:
25px
}
.toastify-avatar
{
width
:
1.5em
;
height
:
1.5em
;
margin
:
-7px
5px
;
border-radius
:
2px
}
.toastify-center
{
margin-left
:
auto
;
margin-right
:
auto
;
left
:
0
;
right
:
0
;
max-width
:
fit-content
;
max-width
:
-moz-fit-content
}
@media
only
screen
and
(
max-width
:
360px
){
.toastify-left
,
.toastify-right
{
margin-left
:
auto
;
margin-right
:
auto
;
left
:
0
;
right
:
0
;
max-width
:
fit-content
}}
.toastify
{
padding
:
12px
20px
;
color
:
#fff
;
display
:
inline-block
;
box-shadow
:
0
3px
6px
-1px
rgba
(
0
,
0
,
0
,
.12
),
0
10px
36px
-4px
rgba
(
77
,
96
,
232
,
.3
);
background
:
-webkit-linear-gradient
(
315deg
,
#73a5ff
,
#5477f5
);
background
:
linear-gradient
(
135deg
,
#73a5ff
,
#5477f5
);
position
:
fixed
;
opacity
:
0
;
transition
:
all
.4s
cubic-bezier
(
.215
,
.61
,
.355
,
1
);
border-radius
:
2px
;
cursor
:
pointer
;
text-decoration
:
none
;
max-width
:
calc
(
50%
-
20px
);
z-index
:
2147483647
}
.toastify.on
{
opacity
:
1
}
.toast-close
{
opacity
:
.4
;
padding
:
0
5px
}
.toastify-right
{
right
:
15px
}
.toastify-left
{
left
:
15px
}
.toastify-top
{
top
:
-150px
}
.toastify-bottom
{
bottom
:
-150px
}
.toastify-rounded
{
border-radius
:
25px
}
.toastify-avatar
{
width
:
1.5em
;
height
:
1.5em
;
margin
:
-7px
5px
;
border-radius
:
2px
}
.toastify-center
{
margin-left
:
auto
;
margin-right
:
auto
;
left
:
0
;
right
:
0
;
max-width
:
fit-content
;
max-width
:
-moz-fit-content
}
@media
only
screen
and
(
max-width
:
360px
){
.toastify-left
,
.toastify-right
{
margin-left
:
auto
;
margin-right
:
auto
;
left
:
0
;
right
:
0
;
max-width
:
fit-content
}}
/*# sourceMappingURL=/sm/40f738e33ed5dbe7907b48c3be4b63e977eab6cb49c8df4f76f3edc3f1f2fb0d.map */
\ No newline at end of file
example/ios/Flutter/flutter_export_environment.sh
View file @
44a47619
...
@@ -5,6 +5,8 @@ export "FLUTTER_APPLICATION_PATH=/Users/karthikponnam/Desktop/my/plugins/Flutter
...
@@ -5,6 +5,8 @@ export "FLUTTER_APPLICATION_PATH=/Users/karthikponnam/Desktop/my/plugins/Flutter
export
"FLUTTER_TARGET=lib/main.dart"
export
"FLUTTER_TARGET=lib/main.dart"
export
"FLUTTER_BUILD_DIR=build"
export
"FLUTTER_BUILD_DIR=build"
export
"SYMROOT=
${
SOURCE_ROOT
}
/../build/ios"
export
"SYMROOT=
${
SOURCE_ROOT
}
/../build/ios"
export
"OTHER_LDFLAGS=
$(
inherited
)
-framework Flutter"
export
"FLUTTER_FRAMEWORK_DIR=/usr/local/Caskroom/flutter/1.22.3/flutter/bin/cache/artifacts/engine/ios"
export
"FLUTTER_BUILD_NAME=1.0.0"
export
"FLUTTER_BUILD_NAME=1.0.0"
export
"FLUTTER_BUILD_NUMBER=1"
export
"FLUTTER_BUILD_NUMBER=1"
export
"DART_OBFUSCATION=false"
export
"DART_OBFUSCATION=false"
...
...
example/pubspec.lock
View file @
44a47619
...
@@ -7,42 +7,42 @@ packages:
...
@@ -7,42 +7,42 @@ packages:
name: async
name: async
url: "https://pub.dartlang.org"
url: "https://pub.dartlang.org"
source: hosted
source: hosted
version: "2.5.0-nullsafety.
3
"
version: "2.5.0-nullsafety.
1
"
boolean_selector:
boolean_selector:
dependency: transitive
dependency: transitive
description:
description:
name: boolean_selector
name: boolean_selector
url: "https://pub.dartlang.org"
url: "https://pub.dartlang.org"
source: hosted
source: hosted
version: "2.1.0-nullsafety.
3
"
version: "2.1.0-nullsafety.
1
"
characters:
characters:
dependency: transitive
dependency: transitive
description:
description:
name: characters
name: characters
url: "https://pub.dartlang.org"
url: "https://pub.dartlang.org"
source: hosted
source: hosted
version: "1.1.0-nullsafety.
5
"
version: "1.1.0-nullsafety.
3
"
charcode:
charcode:
dependency: transitive
dependency: transitive
description:
description:
name: charcode
name: charcode
url: "https://pub.dartlang.org"
url: "https://pub.dartlang.org"
source: hosted
source: hosted
version: "1.2.0-nullsafety.
3
"
version: "1.2.0-nullsafety.
1
"
clock:
clock:
dependency: transitive
dependency: transitive
description:
description:
name: clock
name: clock
url: "https://pub.dartlang.org"
url: "https://pub.dartlang.org"
source: hosted
source: hosted
version: "1.1.0-nullsafety.
3
"
version: "1.1.0-nullsafety.
1
"
collection:
collection:
dependency: transitive
dependency: transitive
description:
description:
name: collection
name: collection
url: "https://pub.dartlang.org"
url: "https://pub.dartlang.org"
source: hosted
source: hosted
version: "1.15.0-nullsafety.
5
"
version: "1.15.0-nullsafety.
3
"
cupertino_icons:
cupertino_icons:
dependency: "direct main"
dependency: "direct main"
description:
description:
...
@@ -56,7 +56,7 @@ packages:
...
@@ -56,7 +56,7 @@ packages:
name: fake_async
name: fake_async
url: "https://pub.dartlang.org"
url: "https://pub.dartlang.org"
source: hosted
source: hosted
version: "1.2.0-nullsafety.
3
"
version: "1.2.0-nullsafety.
1
"
flutter:
flutter:
dependency: "direct main"
dependency: "direct main"
description: flutter
description: flutter
...
@@ -78,35 +78,28 @@ packages:
...
@@ -78,35 +78,28 @@ packages:
path: ".."
path: ".."
relative: true
relative: true
source: path
source: path
version: "7.1.6"
version: "7.1.7"
js:
dependency: transitive
description:
name: js
url: "https://pub.dartlang.org"
source: hosted
version: "0.6.3-nullsafety.3"
matcher:
matcher:
dependency: transitive
dependency: transitive
description:
description:
name: matcher
name: matcher
url: "https://pub.dartlang.org"
url: "https://pub.dartlang.org"
source: hosted
source: hosted
version: "0.12.10-nullsafety.
3
"
version: "0.12.10-nullsafety.
1
"
meta:
meta:
dependency: transitive
dependency: transitive
description:
description:
name: meta
name: meta
url: "https://pub.dartlang.org"
url: "https://pub.dartlang.org"
source: hosted
source: hosted
version: "1.3.0-nullsafety.
6
"
version: "1.3.0-nullsafety.
3
"
path:
path:
dependency: transitive
dependency: transitive
description:
description:
name: path
name: path
url: "https://pub.dartlang.org"
url: "https://pub.dartlang.org"
source: hosted
source: hosted
version: "1.8.0-nullsafety.
3
"
version: "1.8.0-nullsafety.
1
"
sky_engine:
sky_engine:
dependency: transitive
dependency: transitive
description: flutter
description: flutter
...
@@ -118,56 +111,56 @@ packages:
...
@@ -118,56 +111,56 @@ packages:
name: source_span
name: source_span
url: "https://pub.dartlang.org"
url: "https://pub.dartlang.org"
source: hosted
source: hosted
version: "1.8.0-nullsafety.
4
"
version: "1.8.0-nullsafety.
2
"
stack_trace:
stack_trace:
dependency: transitive
dependency: transitive
description:
description:
name: stack_trace
name: stack_trace
url: "https://pub.dartlang.org"
url: "https://pub.dartlang.org"
source: hosted
source: hosted
version: "1.10.0-nullsafety.
6
"
version: "1.10.0-nullsafety.
1
"
stream_channel:
stream_channel:
dependency: transitive
dependency: transitive
description:
description:
name: stream_channel
name: stream_channel
url: "https://pub.dartlang.org"
url: "https://pub.dartlang.org"
source: hosted
source: hosted
version: "2.1.0-nullsafety.
3
"
version: "2.1.0-nullsafety.
1
"
string_scanner:
string_scanner:
dependency: transitive
dependency: transitive
description:
description:
name: string_scanner
name: string_scanner
url: "https://pub.dartlang.org"
url: "https://pub.dartlang.org"
source: hosted
source: hosted
version: "1.1.0-nullsafety.
3
"
version: "1.1.0-nullsafety.
1
"
term_glyph:
term_glyph:
dependency: transitive
dependency: transitive
description:
description:
name: term_glyph
name: term_glyph
url: "https://pub.dartlang.org"
url: "https://pub.dartlang.org"
source: hosted
source: hosted
version: "1.2.0-nullsafety.
3
"
version: "1.2.0-nullsafety.
1
"
test_api:
test_api:
dependency: transitive
dependency: transitive
description:
description:
name: test_api
name: test_api
url: "https://pub.dartlang.org"
url: "https://pub.dartlang.org"
source: hosted
source: hosted
version: "0.2.19-nullsafety.
6
"
version: "0.2.19-nullsafety.
2
"
typed_data:
typed_data:
dependency: transitive
dependency: transitive
description:
description:
name: typed_data
name: typed_data
url: "https://pub.dartlang.org"
url: "https://pub.dartlang.org"
source: hosted
source: hosted
version: "1.3.0-nullsafety.
5
"
version: "1.3.0-nullsafety.
3
"
vector_math:
vector_math:
dependency: transitive
dependency: transitive
description:
description:
name: vector_math
name: vector_math
url: "https://pub.dartlang.org"
url: "https://pub.dartlang.org"
source: hosted
source: hosted
version: "2.1.0-nullsafety.
5
"
version: "2.1.0-nullsafety.
3
"
sdks:
sdks:
dart: ">=2.1
2.0-0.0 <3.0
.0"
dart: ">=2.1
0.0-110 <2.11
.0"
flutter: ">=1.10.0"
flutter: ">=1.10.0"
pubspec.lock
View file @
44a47619
...
@@ -7,14 +7,14 @@ packages:
...
@@ -7,14 +7,14 @@ packages:
name: characters
name: characters
url: "https://pub.dartlang.org"
url: "https://pub.dartlang.org"
source: hosted
source: hosted
version: "1.1.0-nullsafety.
5
"
version: "1.1.0-nullsafety.
3
"
collection:
collection:
dependency: transitive
dependency: transitive
description:
description:
name: collection
name: collection
url: "https://pub.dartlang.org"
url: "https://pub.dartlang.org"
source: hosted
source: hosted
version: "1.15.0-nullsafety.
5
"
version: "1.15.0-nullsafety.
3
"
flutter:
flutter:
dependency: "direct main"
dependency: "direct main"
description: flutter
description: flutter
...
@@ -25,20 +25,13 @@ packages:
...
@@ -25,20 +25,13 @@ packages:
description: flutter
description: flutter
source: sdk
source: sdk
version: "0.0.0"
version: "0.0.0"
js:
dependency: transitive
description:
name: js
url: "https://pub.dartlang.org"
source: hosted
version: "0.6.3-nullsafety.3"
meta:
meta:
dependency: transitive
dependency: transitive
description:
description:
name: meta
name: meta
url: "https://pub.dartlang.org"
url: "https://pub.dartlang.org"
source: hosted
source: hosted
version: "1.3.0-nullsafety.
6
"
version: "1.3.0-nullsafety.
3
"
sky_engine:
sky_engine:
dependency: transitive
dependency: transitive
description: flutter
description: flutter
...
@@ -50,14 +43,14 @@ packages:
...
@@ -50,14 +43,14 @@ packages:
name: typed_data
name: typed_data
url: "https://pub.dartlang.org"
url: "https://pub.dartlang.org"
source: hosted
source: hosted
version: "1.3.0-nullsafety.
5
"
version: "1.3.0-nullsafety.
3
"
vector_math:
vector_math:
dependency: transitive
dependency: transitive
description:
description:
name: vector_math
name: vector_math
url: "https://pub.dartlang.org"
url: "https://pub.dartlang.org"
source: hosted
source: hosted
version: "2.1.0-nullsafety.
5
"
version: "2.1.0-nullsafety.
3
"
sdks:
sdks:
dart: ">=2.1
2.0-0 <3.0
.0"
dart: ">=2.1
0.0-110 <2.11
.0"
flutter: ">=1.10.0"
flutter: ">=1.10.0"
pubspec.yaml
View file @
44a47619
name
:
fluttertoast
name
:
fluttertoast
description
:
Toast Library for Flutter, Easily create toast messages in single line of code
description
:
Toast Library for Flutter, Easily create toast messages in single line of code
version
:
7.1.
6
version
:
7.1.
7
homepage
:
https://github.com/PonnamKarthik/FlutterToast
homepage
:
https://github.com/PonnamKarthik/FlutterToast
issue_tracker
:
https://github.com/ponnamkarthik/FlutterToast/issues
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