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
import
'package:fluttertoast/fluttertoast.dart'
;
```
## Toast with No Build Context
## Toast with No Build Context
(Android & iOS)
```
dart
Fluttertoast
.
showToast
(
...
...
@@ -74,6 +74,14 @@ Fluttertoast.showToast(
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
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
</FrameLayout>
```
## Toast with BuildContext
## Toast with BuildContext
(All Platforms)
```
dart
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'
apply
plugin:
'kotlin-android'
android
{
compileSdkVersion
28
compileSdkVersion
30
sourceSets
{
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 {
val
textcolor
=
call
.
argument
<
Number
>(
"textcolor"
)
val
textSize
=
call
.
argument
<
Number
>(
"fontSize"
)
val
mGravity
:
Int
mGravity
=
when
(
gravity
)
{
"top"
->
Gravity
.
TOP
"center"
->
Gravity
.
CENTER
else
->
Gravity
.
BOTTOM
}
val
mDuration
:
Int
mDuration
=
if
(
length
==
"long"
)
{
Toast
.
LENGTH_LONG
}
else
{
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
text
=
layout
.
findViewById
<
TextView
>(
R
.
id
.
text
)
text
.
text
=
mMessage
...
...
@@ -64,6 +67,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
.
R
)
{
try
{
val
textView
:
TextView
=
mToast
.
view
!!
.
findViewById
(
android
.
R
.
id
.
message
)
if
(
textSize
!=
null
)
{
...
...
@@ -76,6 +80,9 @@ internal class MethodCallHandlerImpl(var context: Context) : MethodCallHandler {
}
}
}
if
(
Build
.
VERSION
.
SDK_INT
<
Build
.
VERSION_CODES
.
R
)
{
when
(
mGravity
)
{
Gravity
.
CENTER
->
{
mToast
.
setGravity
(
mGravity
,
0
,
0
)
...
...
@@ -87,6 +94,7 @@ internal class MethodCallHandlerImpl(var context: Context) : MethodCallHandler {
mToast
.
setGravity
(
mGravity
,
0
,
100
)
}
}
}
if
(
context
is
Activity
)
{
(
context
as
Activity
).
runOnUiThread
{
mToast
.
show
()
}
}
else
{
...
...
assets/toastify.css
View file @
44a47619
...
...
@@ -12,4 +12,3 @@
* 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
}}
\ No newline at end of file
/*# 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
export
"FLUTTER_TARGET=lib/main.dart"
export
"FLUTTER_BUILD_DIR=build"
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_NUMBER=1"
export
"DART_OBFUSCATION=false"
...
...
example/pubspec.lock
View file @
44a47619
...
...
@@ -7,42 +7,42 @@ packages:
name: async
url: "https://pub.dartlang.org"
source: hosted
version: "2.5.0-nullsafety.
3
"
version: "2.5.0-nullsafety.
1
"
boolean_selector:
dependency: transitive
description:
name: boolean_selector
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.0-nullsafety.
3
"
version: "2.1.0-nullsafety.
1
"
characters:
dependency: transitive
description:
name: characters
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.0-nullsafety.
5
"
version: "1.1.0-nullsafety.
3
"
charcode:
dependency: transitive
description:
name: charcode
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.0-nullsafety.
3
"
version: "1.2.0-nullsafety.
1
"
clock:
dependency: transitive
description:
name: clock
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.0-nullsafety.
3
"
version: "1.1.0-nullsafety.
1
"
collection:
dependency: transitive
description:
name: collection
url: "https://pub.dartlang.org"
source: hosted
version: "1.15.0-nullsafety.
5
"
version: "1.15.0-nullsafety.
3
"
cupertino_icons:
dependency: "direct main"
description:
...
...
@@ -56,7 +56,7 @@ packages:
name: fake_async
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.0-nullsafety.
3
"
version: "1.2.0-nullsafety.
1
"
flutter:
dependency: "direct main"
description: flutter
...
...
@@ -78,35 +78,28 @@ packages:
path: ".."
relative: true
source: path
version: "7.1.6"
js:
dependency: transitive
description:
name: js
url: "https://pub.dartlang.org"
source: hosted
version: "0.6.3-nullsafety.3"
version: "7.1.7"
matcher:
dependency: transitive
description:
name: matcher
url: "https://pub.dartlang.org"
source: hosted
version: "0.12.10-nullsafety.
3
"
version: "0.12.10-nullsafety.
1
"
meta:
dependency: transitive
description:
name: meta
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.0-nullsafety.
6
"
version: "1.3.0-nullsafety.
3
"
path:
dependency: transitive
description:
name: path
url: "https://pub.dartlang.org"
source: hosted
version: "1.8.0-nullsafety.
3
"
version: "1.8.0-nullsafety.
1
"
sky_engine:
dependency: transitive
description: flutter
...
...
@@ -118,56 +111,56 @@ packages:
name: source_span
url: "https://pub.dartlang.org"
source: hosted
version: "1.8.0-nullsafety.
4
"
version: "1.8.0-nullsafety.
2
"
stack_trace:
dependency: transitive
description:
name: stack_trace
url: "https://pub.dartlang.org"
source: hosted
version: "1.10.0-nullsafety.
6
"
version: "1.10.0-nullsafety.
1
"
stream_channel:
dependency: transitive
description:
name: stream_channel
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.0-nullsafety.
3
"
version: "2.1.0-nullsafety.
1
"
string_scanner:
dependency: transitive
description:
name: string_scanner
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.0-nullsafety.
3
"
version: "1.1.0-nullsafety.
1
"
term_glyph:
dependency: transitive
description:
name: term_glyph
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.0-nullsafety.
3
"
version: "1.2.0-nullsafety.
1
"
test_api:
dependency: transitive
description:
name: test_api
url: "https://pub.dartlang.org"
source: hosted
version: "0.2.19-nullsafety.
6
"
version: "0.2.19-nullsafety.
2
"
typed_data:
dependency: transitive
description:
name: typed_data
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.0-nullsafety.
5
"
version: "1.3.0-nullsafety.
3
"
vector_math:
dependency: transitive
description:
name: vector_math
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.0-nullsafety.
5
"
version: "2.1.0-nullsafety.
3
"
sdks:
dart: ">=2.1
2.0-0.0 <3.0
.0"
dart: ">=2.1
0.0-110 <2.11
.0"
flutter: ">=1.10.0"
pubspec.lock
View file @
44a47619
...
...
@@ -7,14 +7,14 @@ packages:
name: characters
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.0-nullsafety.
5
"
version: "1.1.0-nullsafety.
3
"
collection:
dependency: transitive
description:
name: collection
url: "https://pub.dartlang.org"
source: hosted
version: "1.15.0-nullsafety.
5
"
version: "1.15.0-nullsafety.
3
"
flutter:
dependency: "direct main"
description: flutter
...
...
@@ -25,20 +25,13 @@ packages:
description: flutter
source: sdk
version: "0.0.0"
js:
dependency: transitive
description:
name: js
url: "https://pub.dartlang.org"
source: hosted
version: "0.6.3-nullsafety.3"
meta:
dependency: transitive
description:
name: meta
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.0-nullsafety.
6
"
version: "1.3.0-nullsafety.
3
"
sky_engine:
dependency: transitive
description: flutter
...
...
@@ -50,14 +43,14 @@ packages:
name: typed_data
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.0-nullsafety.
5
"
version: "1.3.0-nullsafety.
3
"
vector_math:
dependency: transitive
description:
name: vector_math
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.0-nullsafety.
5
"
version: "2.1.0-nullsafety.
3
"
sdks:
dart: ">=2.1
2.0-0 <3.0
.0"
dart: ">=2.1
0.0-110 <2.11
.0"
flutter: ">=1.10.0"
pubspec.yaml
View file @
44a47619
name
:
fluttertoast
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
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