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
071defcd
Commit
071defcd
authored
Aug 29, 2020
by
Karthik Ponnam
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
7.0.3
parent
26f44d61
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
117 additions
and
45 deletions
+117
-45
CHANGELOG.md
+6
-0
README.md
+4
-4
android/src/main/kotlin/io/github/ponnamkarthik/toast/fluttertoast/MethodCallHandlerImpl.kt
+1
-1
example/pubspec.lock
+20
-20
ios/Classes/FluttertoastPlugin.m
+4
-1
lib/fluttertoast.dart
+75
-9
lib/fluttertoast_web.dart
+0
-3
pubspec.lock
+6
-6
pubspec.yaml
+1
-1
screenshot/toast_deprecated_setview.png
+0
-0
No files found.
CHANGELOG.md
View file @
071defcd
## [7.0.3]
-
FToast now Fade when showing and hiding the toast
-
Toast backgroud now supports transparency
-
Bug fixes
## [7.0.2]
## [7.0.2]
-
iOS Toast behind keyboard fixed. #203
-
iOS Toast behind keyboard fixed. #203
...
...
README.md
View file @
071defcd
...
@@ -32,7 +32,7 @@ This one has limited features and no control over UI
...
@@ -32,7 +32,7 @@ This one has limited features and no control over UI
```
yaml
```
yaml
# add this line to your dependencies
# add this line to your dependencies
fluttertoast
:
^7.0.
2
fluttertoast
:
^7.0.
3
```
```
```
dart
```
dart
...
@@ -59,9 +59,9 @@ Fluttertoast.showToast(
...
@@ -59,9 +59,9 @@ Fluttertoast.showToast(
| toastLength | Toast.LENGTH_SHORT or Toast.LENGTH_LONG (optional) |Toast.LENGTH_SHORT |
| toastLength | Toast.LENGTH_SHORT or Toast.LENGTH_LONG (optional) |Toast.LENGTH_SHORT |
| gravity | ToastGravity.TOP (or) ToastGravity.CENTER (or) ToastGravity.BOTTOM (Web Only supports top, bottom) | ToastGravity.BOTTOM |
| gravity | ToastGravity.TOP (or) ToastGravity.CENTER (or) ToastGravity.BOTTOM (Web Only supports top, bottom) | ToastGravity.BOTTOM |
| timeInSecForIosWeb | int (only for ios) | 1 |
| timeInSecForIosWeb | int (only for ios) | 1 |
| backgroundColor | Colors.red |
Colors.black
|
| backgroundColor | Colors.red |
null
|
| textcolor | Colors.white |
Colors.white
|
| textcolor | Colors.white |
null
|
| fontSize | 16.0 (float) |
16.0
|
| fontSize | 16.0 (float) |
null
|
| webShowClose | false (bool) | false |
| webShowClose | false (bool) | false |
| webBgColor | String (hex Color) | linear-gradient(to right, #00b09b, #96c93d) |
| webBgColor | String (hex Color) | linear-gradient(to right, #00b09b, #96c93d) |
| webPosition | String (
`left`
,
`center`
or
`right`
) | right |
| webPosition | String (
`left`
,
`center`
or
`right`
) | right |
...
...
android/src/main/kotlin/io/github/ponnamkarthik/toast/fluttertoast/MethodCallHandlerImpl.kt
View file @
071defcd
...
@@ -49,7 +49,7 @@ internal class MethodCallHandlerImpl(var context: Context) : MethodCallHandler {
...
@@ -49,7 +49,7 @@ internal class MethodCallHandlerImpl(var context: Context) : MethodCallHandler {
context
.
resources
.
getDrawable
(
R
.
drawable
.
corner
)
context
.
resources
.
getDrawable
(
R
.
drawable
.
corner
)
}
}
if
(
bgcolor
!=
null
&&
gradientDrawable
!=
null
)
{
if
(
bgcolor
!=
null
&&
gradientDrawable
!=
null
)
{
gradientDrawable
.
setColorFilter
(
bgcolor
.
toInt
(),
PorterDuff
.
Mode
.
SRC
_ATOP
)
gradientDrawable
.
setColorFilter
(
bgcolor
.
toInt
(),
PorterDuff
.
Mode
.
SRC
)
}
}
text
.
background
=
gradientDrawable
text
.
background
=
gradientDrawable
if
(
textSize
!=
null
)
{
if
(
textSize
!=
null
)
{
...
...
example/pubspec.lock
View file @
071defcd
...
@@ -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.
4.2
"
version: "2.
5.0-nullsafety
"
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.
0.0
"
version: "2.
1.0-nullsafety
"
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.
0.0
"
version: "1.
1.0-nullsafety.2
"
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.
1.3
"
version: "1.
2.0-nullsafety
"
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.
0.1
"
version: "1.
1.0-nullsafety
"
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.1
4.13
"
version: "1.1
5.0-nullsafety.2
"
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.1.0"
version: "1.1.0
-nullsafety
"
flutter:
flutter:
dependency: "direct main"
dependency: "direct main"
description: flutter
description: flutter
...
@@ -78,28 +78,28 @@ packages:
...
@@ -78,28 +78,28 @@ packages:
path: ".."
path: ".."
relative: true
relative: true
source: path
source: path
version: "7.0.
2
"
version: "7.0.
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.
8
"
version: "0.12.
10-nullsafety
"
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.
1.8
"
version: "1.
3.0-nullsafety.2
"
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.
7.0
"
version: "1.
8.0-nullsafety
"
sky_engine:
sky_engine:
dependency: transitive
dependency: transitive
description: flutter
description: flutter
...
@@ -111,56 +111,56 @@ packages:
...
@@ -111,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.
7.0
"
version: "1.
8.0-nullsafety
"
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.
9.5
"
version: "1.
10.0-nullsafety
"
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.
0.0
"
version: "2.
1.0-nullsafety
"
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.
0.5
"
version: "1.
1.0-nullsafety
"
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.
1.0
"
version: "1.
2.0-nullsafety
"
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.1
7
"
version: "0.2.1
9-nullsafety
"
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.
2.0
"
version: "1.
3.0-nullsafety.2
"
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.
0.8
"
version: "2.
1.0-nullsafety.2
"
sdks:
sdks:
dart: ">=2.
9.0-14.0.dev <3.
0.0"
dart: ">=2.
10.0-0.0.dev <2.1
0.0"
flutter: ">=1.10.0"
flutter: ">=1.10.0"
ios/Classes/FluttertoastPlugin.m
View file @
071defcd
...
@@ -71,7 +71,10 @@ static NSString *const CHANNEL_NAME = @"PonnamKarthik/fluttertoast";
...
@@ -71,7 +71,10 @@ static NSString *const CHANNEL_NAME = @"PonnamKarthik/fluttertoast";
NSNumber
*
textcolor
=
call
.
arguments
[
@"textcolor"
];
NSNumber
*
textcolor
=
call
.
arguments
[
@"textcolor"
];
NSNumber
*
size
=
call
.
arguments
[
@"size"
];
NSNumber
*
size
=
call
.
arguments
[
@"size"
];
NSNumber
*
fontSize
=
call
.
arguments
[
@"fontSize"
];
NSNumber
*
fontSize
=
call
.
arguments
[
@"fontSize"
];
if
(
fontSize
==
nil
)
{
fontSize
=
16
.
0
;
}
CGFloat
cgf
=
[
fontSize
doubleValue
];
CGFloat
cgf
=
[
fontSize
doubleValue
];
int
time
=
1
;
int
time
=
1
;
@try
{
@try
{
...
...
lib/fluttertoast.dart
View file @
071defcd
...
@@ -19,7 +19,7 @@ class Fluttertoast {
...
@@ -19,7 +19,7 @@ class Fluttertoast {
{
@required
String
msg
,
{
@required
String
msg
,
Toast
toastLength
,
Toast
toastLength
,
int
timeInSecForIosWeb
=
1
,
int
timeInSecForIosWeb
=
1
,
double
fontSize
=
16.0
,
double
fontSize
,
ToastGravity
gravity
,
ToastGravity
gravity
,
Color
backgroundColor
,
Color
backgroundColor
,
Color
textColor
,
Color
textColor
,
...
@@ -94,7 +94,9 @@ class FToast {
...
@@ -94,7 +94,9 @@ class FToast {
Overlay
.
of
(
context
).
insert
(
_entry
);
Overlay
.
of
(
context
).
insert
(
_entry
);
_timer
=
Timer
(
_toastEntry
.
duration
,
()
{
_timer
=
Timer
(
_toastEntry
.
duration
,
()
{
removeCustomToast
();
Future
.
delayed
(
Duration
(
milliseconds:
360
),
()
{
removeCustomToast
();
});
});
});
}
}
...
@@ -119,18 +121,16 @@ class FToast {
...
@@ -119,18 +121,16 @@ class FToast {
ToastGravity
gravity
,
ToastGravity
gravity
,
})
{
})
{
OverlayEntry
newEntry
=
OverlayEntry
(
builder:
(
context
)
{
OverlayEntry
newEntry
=
OverlayEntry
(
builder:
(
context
)
{
return
_getPostionWidgetBasedOnGravity
(
child
,
gravity
);
return
_getPostionWidgetBasedOnGravity
(
child
,
gravity
,
toastDuration
);
});
});
_overlayQueue
.
add
(
_ToastEntry
(
entry:
newEntry
,
duration:
toastDuration
??
Duration
(
seconds:
2
)));
_overlayQueue
.
add
(
_ToastEntry
(
entry:
newEntry
,
duration:
toastDuration
??
Duration
(
seconds:
2
)));
if
(
_timer
==
null
)
_showOverlay
();
if
(
_timer
==
null
)
_showOverlay
();
}
}
_getPostionWidgetBasedOnGravity
(
Widget
child
,
ToastGravity
gravity
)
{
_getPostionWidgetBasedOnGravity
(
Widget
child
,
ToastGravity
gravity
,
Duration
duration
)
{
Widget
newChild
=
Center
(
Widget
newChild
=
_ToastStateFul
(
child:
Material
(
child
,
color:
Colors
.
transparent
,
duration
,
child:
child
,
),
);
);
switch
(
gravity
)
{
switch
(
gravity
)
{
case
ToastGravity
.
TOP
:
case
ToastGravity
.
TOP
:
...
@@ -170,3 +170,69 @@ class _ToastEntry {
...
@@ -170,3 +170,69 @@ class _ToastEntry {
_ToastEntry
({
this
.
entry
,
this
.
duration
});
_ToastEntry
({
this
.
entry
,
this
.
duration
});
}
}
class
_ToastStateFul
extends
StatefulWidget
{
_ToastStateFul
(
this
.
child
,
this
.
duration
,
{
Key
key
})
:
super
(
key:
key
);
final
Widget
child
;
final
Duration
duration
;
@override
ToastStateFulState
createState
()
=>
ToastStateFulState
();
}
class
ToastStateFulState
extends
State
<
_ToastStateFul
>
with
SingleTickerProviderStateMixin
{
bool
_visible
=
false
;
showIt
()
{
_animationController
.
forward
();
}
hideIt
()
{
_animationController
.
reverse
();
}
AnimationController
_animationController
;
Animation
_fadeAnimation
;
@override
void
initState
()
{
_animationController
=
AnimationController
(
vsync:
this
,
duration:
const
Duration
(
milliseconds:
350
),
);
_fadeAnimation
=
CurvedAnimation
(
parent:
_animationController
,
curve:
Curves
.
easeIn
);
super
.
initState
();
showIt
();
Future
.
delayed
(
widget
.
duration
,
()
{
hideIt
();
});
}
@override
void
deactivate
()
{
_animationController
.
stop
();
super
.
deactivate
();
}
@override
void
dispose
()
{
_animationController
?.
dispose
();
super
.
dispose
();
}
@override
Widget
build
(
BuildContext
context
)
{
return
FadeTransition
(
opacity:
_fadeAnimation
,
child:
Center
(
child:
Material
(
color:
Colors
.
transparent
,
child:
widget
.
child
,
),
),
);
}
}
lib/fluttertoast_web.dart
View file @
071defcd
...
@@ -65,9 +65,6 @@ class FluttertoastWebPlugin {
...
@@ -65,9 +65,6 @@ class FluttertoastWebPlugin {
html
.
querySelector
(
'head'
).
children
.
addAll
(
tags
);
html
.
querySelector
(
'head'
).
children
.
addAll
(
tags
);
await
Future
.
wait
(
loading
);
await
Future
.
wait
(
loading
);
// addHtmlToast();
// addHtmlToast();
}
}
addHtmlToast
(
addHtmlToast
(
...
...
pubspec.lock
View file @
071defcd
...
@@ -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.
0.0
"
version: "1.
1.0-nullsafety.2
"
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.1
4.13
"
version: "1.1
5.0-nullsafety.2
"
flutter:
flutter:
dependency: "direct main"
dependency: "direct main"
description: flutter
description: flutter
...
@@ -31,7 +31,7 @@ packages:
...
@@ -31,7 +31,7 @@ packages:
name: meta
name: meta
url: "https://pub.dartlang.org"
url: "https://pub.dartlang.org"
source: hosted
source: hosted
version: "1.
1.8
"
version: "1.
3.0-nullsafety.2
"
sky_engine:
sky_engine:
dependency: transitive
dependency: transitive
description: flutter
description: flutter
...
@@ -43,14 +43,14 @@ packages:
...
@@ -43,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.
2.0
"
version: "1.
3.0-nullsafety.2
"
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.
0.8
"
version: "2.
1.0-nullsafety.2
"
sdks:
sdks:
dart: ">=2.
9.0-14.0.dev <3.
0.0"
dart: ">=2.
10.0-0.0.dev <2.1
0.0"
flutter: ">=1.10.0"
flutter: ">=1.10.0"
pubspec.yaml
View file @
071defcd
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.0.
2
version
:
7.0.
3
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
...
...
screenshot/toast_deprecated_setview.png
0 → 100644
View file @
071defcd
36.9 KB
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