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
60439d3b
Commit
60439d3b
authored
May 19, 2021
by
Karthik Ponnam
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added new parameter for FToast, fixes #287 , #281, #303
parent
c33e5321
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
55 additions
and
32 deletions
+55
-32
CHANGELOG.md
+5
-0
README.md
+1
-1
android/src/main/kotlin/io/github/ponnamkarthik/toast/fluttertoast/MethodCallHandlerImpl.kt
+12
-18
example/ios/Flutter/flutter_export_environment.sh
+4
-4
example/lib/toast_context.dart
+2
-0
example/lib/toast_no_context.dart
+11
-1
example/pubspec.lock
+1
-1
lib/fluttertoast.dart
+18
-6
pubspec.yaml
+1
-1
No files found.
CHANGELOG.md
View file @
60439d3b
## [8.0.7]
-
Added fadeDuration in FToast to set fade animation Duration
-
Fixed Toast behind the screen #287 , #281
-
Fixed #303
## [8.0.6]
## [8.0.6]
-
Only safe (?.) or non-null asserted (!!.) (#300)
-
Only safe (?.) or non-null asserted (!!.) (#300)
...
...
README.md
View file @
60439d3b
...
@@ -34,7 +34,7 @@ This one has limited features and no control over UI
...
@@ -34,7 +34,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
:
^8.0.
6
fluttertoast
:
^8.0.
7
```
```
```
dart
```
dart
...
...
android/src/main/kotlin/io/github/ponnamkarthik/toast/fluttertoast/MethodCallHandlerImpl.kt
View file @
60439d3b
...
@@ -85,26 +85,20 @@ internal class MethodCallHandlerImpl(var context: Context) : MethodCallHandler {
...
@@ -85,26 +85,20 @@ internal class MethodCallHandlerImpl(var context: Context) : MethodCallHandler {
}
}
}
}
}
}
if
(
Build
.
VERSION
.
SDK_INT
<
30
)
{
// if(Build.VERSION.SDK_INT < 30
) {
when
(
mGravity
)
{
when
(
mGravity
)
{
Gravity
.
CENTER
->
{
Gravity
.
CENTER
->
{
mToast
.
setGravity
(
mGravity
,
0
,
0
)
mToast
.
setGravity
(
mGravity
,
0
,
0
)
}
}
Gravity
.
TOP
->
{
Gravity
.
TOP
->
{
mToast
.
setGravity
(
mGravity
,
0
,
100
)
mToast
.
setGravity
(
mGravity
,
0
,
100
)
}
}
else
->
{
else
->
{
mToast
.
setGravity
(
mGravity
,
0
,
100
)
mToast
.
setGravity
(
mGravity
,
0
,
100
)
}
}
}
}
}
// }
// val inputMethodManager = context.getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager
// if(inputMethodManager.isAcceptingText) {
// mToast.setGravity(Gravity.CENTER, 0, 0)
// }
if
(
context
is
Activity
)
{
if
(
context
is
Activity
)
{
(
context
as
Activity
).
runOnUiThread
{
mToast
.
show
()
}
(
context
as
Activity
).
runOnUiThread
{
mToast
.
show
()
}
}
else
{
}
else
{
...
...
example/ios/Flutter/flutter_export_environment.sh
View file @
60439d3b
#!/bin/sh
#!/bin/sh
# This is a generated file; do not edit or check into version control.
# This is a generated file; do not edit or check into version control.
export
"FLUTTER_ROOT=/
usr/local/Caskroom/flutter/1.22.3
/flutter"
export
"FLUTTER_ROOT=/
Users/karthikponnam/Desktop/SDK
/flutter"
export
"FLUTTER_APPLICATION_PATH=/Users/karthikponnam/Desktop/my/plugins/FlutterToast/example"
export
"FLUTTER_APPLICATION_PATH=/Users/karthikponnam/Desktop/my/plugins/FlutterToast/example"
export
"FLUTTER_TARGET=
/Users/karthikponnam/Desktop/my/plugins/FlutterToast/example/
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
"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"
export
"TRACK_WIDGET_CREATION=
tru
e"
export
"TRACK_WIDGET_CREATION=
fals
e"
export
"TREE_SHAKE_ICONS=false"
export
"TREE_SHAKE_ICONS=false"
export
"PACKAGE_CONFIG=
/Users/karthikponnam/Desktop/my/plugins/FlutterToast/example/.dart_tool/package_config.json
"
export
"PACKAGE_CONFIG=
.packages
"
example/lib/toast_context.dart
View file @
60439d3b
import
'dart:async'
;
import
'package:fluttertoast_example/main.dart'
;
import
'package:fluttertoast_example/main.dart'
;
import
'package:flutter/material.dart'
;
import
'package:flutter/material.dart'
;
import
'package:fluttertoast/fluttertoast.dart'
;
import
'package:fluttertoast/fluttertoast.dart'
;
...
...
example/lib/toast_no_context.dart
View file @
60439d3b
import
'package:flutter/material.dart'
;
import
'package:flutter/material.dart'
;
import
'package:fluttertoast/fluttertoast.dart'
;
import
'package:fluttertoast/fluttertoast.dart'
;
class
ToastNoContext
extends
StatelessWidget
{
class
ToastNoContext
extends
StatefulWidget
{
@override
_ToastNoContextState
createState
()
=>
_ToastNoContextState
();
}
class
_ToastNoContextState
extends
State
<
ToastNoContext
>
{
void
showLongToast
()
{
void
showLongToast
()
{
Fluttertoast
.
showToast
(
Fluttertoast
.
showToast
(
msg:
"This is Long Toast"
,
msg:
"This is Long Toast"
,
...
@@ -56,6 +61,11 @@ class ToastNoContext extends StatelessWidget {
...
@@ -56,6 +61,11 @@ class ToastNoContext extends StatelessWidget {
}
}
@override
@override
void
initState
()
{
super
.
initState
();
}
@override
Widget
build
(
BuildContext
context
)
{
Widget
build
(
BuildContext
context
)
{
return
new
MaterialApp
(
return
new
MaterialApp
(
home:
new
Scaffold
(
home:
new
Scaffold
(
...
...
example/pubspec.lock
View file @
60439d3b
...
@@ -78,7 +78,7 @@ packages:
...
@@ -78,7 +78,7 @@ packages:
path: ".."
path: ".."
relative: true
relative: true
source: path
source: path
version: "8.0.
4
"
version: "8.0.
7
"
js:
js:
dependency: transitive
dependency: transitive
description:
description:
...
...
lib/fluttertoast.dart
View file @
60439d3b
...
@@ -177,22 +177,32 @@ class FToast {
...
@@ -177,22 +177,32 @@ class FToast {
/// calls _showOverlay to display toast
/// calls _showOverlay to display toast
///
///
/// Paramenter [child] is requried
/// Paramenter [child] is requried
///
///
fadeDuration default is 350 milliseconds
void
showToast
({
void
showToast
({
required
Widget
child
,
required
Widget
child
,
PositionedToastBuilder
?
positionedToastBuilder
,
PositionedToastBuilder
?
positionedToastBuilder
,
Duration
?
toastDuration
,
Duration
?
toastDuration
,
ToastGravity
?
gravity
,
ToastGravity
?
gravity
,
int
fadeDuration
=
350
,
})
{
})
{
Widget
newChild
=
_ToastStateFul
(
Widget
newChild
=
_ToastStateFul
(
child
,
child
,
toastDuration
??
Duration
(
seconds:
2
),
toastDuration
??
Duration
(
seconds:
2
),
fadeDuration:
fadeDuration
);
);
/// Check for keyboard open
/// If open will ignore the gravity bottom and change it to center
if
(
gravity
==
ToastGravity
.
BOTTOM
)
{
if
(
MediaQuery
.
of
(
context
!).
viewInsets
.
bottom
!=
0
)
{
gravity
=
ToastGravity
.
CENTER
;
}
}
OverlayEntry
newEntry
=
OverlayEntry
(
builder:
(
context
)
{
OverlayEntry
newEntry
=
OverlayEntry
(
builder:
(
context
)
{
if
(
positionedToastBuilder
!=
null
)
if
(
positionedToastBuilder
!=
null
)
return
positionedToastBuilder
(
context
,
newChild
);
return
positionedToastBuilder
(
context
,
newChild
);
return
_getPostionWidgetBasedOnGravity
(
newChild
,
gravity
);
return
_getPostionWidgetBasedOnGravity
(
newChild
,
gravity
);
});
});
_overlayQueue
.
add
(
_ToastEntry
(
_overlayQueue
.
add
(
_ToastEntry
(
entry:
newEntry
,
duration:
toastDuration
??
Duration
(
seconds:
2
)));
entry:
newEntry
,
duration:
toastDuration
??
Duration
(
seconds:
2
)));
if
(
_timer
==
null
)
_showOverlay
();
if
(
_timer
==
null
)
_showOverlay
();
...
@@ -246,10 +256,12 @@ class _ToastEntry {
...
@@ -246,10 +256,12 @@ class _ToastEntry {
/// internal [StatefulWidget] which handles the show and hide
/// internal [StatefulWidget] which handles the show and hide
/// animations for [FToast]
/// animations for [FToast]
class
_ToastStateFul
extends
StatefulWidget
{
class
_ToastStateFul
extends
StatefulWidget
{
_ToastStateFul
(
this
.
child
,
this
.
duration
,
{
Key
?
key
})
:
super
(
key:
key
);
_ToastStateFul
(
this
.
child
,
this
.
duration
,
{
Key
?
key
,
this
.
fadeDuration
=
350
})
:
super
(
key:
key
);
final
Widget
child
;
final
Widget
child
;
final
Duration
duration
;
final
Duration
duration
;
final
int
fadeDuration
;
@override
@override
ToastStateFulState
createState
()
=>
ToastStateFulState
();
ToastStateFulState
createState
()
=>
ToastStateFulState
();
...
@@ -279,7 +291,7 @@ class ToastStateFulState extends State<_ToastStateFul>
...
@@ -279,7 +291,7 @@ class ToastStateFulState extends State<_ToastStateFul>
void
initState
()
{
void
initState
()
{
_animationController
=
AnimationController
(
_animationController
=
AnimationController
(
vsync:
this
,
vsync:
this
,
duration:
const
Duration
(
milliseconds:
350
),
duration:
Duration
(
milliseconds:
widget
.
fadeDuration
),
);
);
_fadeAnimation
=
_fadeAnimation
=
CurvedAnimation
(
parent:
_animationController
!,
curve:
Curves
.
easeIn
);
CurvedAnimation
(
parent:
_animationController
!,
curve:
Curves
.
easeIn
);
...
...
pubspec.yaml
View file @
60439d3b
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
:
8.0.
6
version
:
8.0.
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