Commit 071defcd by Karthik Ponnam

7.0.3

parent 26f44d61
## [7.0.3]
- FToast now Fade when showing and hiding the toast
- Toast backgroud now supports transparency
- Bug fixes
## [7.0.2]
- iOS Toast behind keyboard fixed. #203
......
......@@ -32,7 +32,7 @@ This one has limited features and no control over UI
```yaml
# add this line to your dependencies
fluttertoast: ^7.0.2
fluttertoast: ^7.0.3
```
```dart
......@@ -59,9 +59,9 @@ Fluttertoast.showToast(
| 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 |
| timeInSecForIosWeb | int (only for ios) | 1 |
| backgroundColor | Colors.red |Colors.black |
| textcolor | Colors.white |Colors.white |
| fontSize | 16.0 (float) | 16.0 |
| backgroundColor | Colors.red |null |
| textcolor | Colors.white |null |
| fontSize | 16.0 (float) | null |
| webShowClose | false (bool) | false |
| webBgColor | String (hex Color) | linear-gradient(to right, #00b09b, #96c93d) |
| webPosition | String (`left`, `center` or `right`) | right |
......
......@@ -49,7 +49,7 @@ internal class MethodCallHandlerImpl(var context: Context) : MethodCallHandler {
context.resources.getDrawable(R.drawable.corner)
}
if(bgcolor != null && gradientDrawable != null) {
gradientDrawable.setColorFilter(bgcolor.toInt(), PorterDuff.Mode.SRC_ATOP)
gradientDrawable.setColorFilter(bgcolor.toInt(), PorterDuff.Mode.SRC)
}
text.background = gradientDrawable
if(textSize != null) {
......
......@@ -7,42 +7,42 @@ packages:
name: async
url: "https://pub.dartlang.org"
source: hosted
version: "2.4.2"
version: "2.5.0-nullsafety"
boolean_selector:
dependency: transitive
description:
name: boolean_selector
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.0"
version: "2.1.0-nullsafety"
characters:
dependency: transitive
description:
name: characters
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.0"
version: "1.1.0-nullsafety.2"
charcode:
dependency: transitive
description:
name: charcode
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.3"
version: "1.2.0-nullsafety"
clock:
dependency: transitive
description:
name: clock
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.1"
version: "1.1.0-nullsafety"
collection:
dependency: transitive
description:
name: collection
url: "https://pub.dartlang.org"
source: hosted
version: "1.14.13"
version: "1.15.0-nullsafety.2"
cupertino_icons:
dependency: "direct main"
description:
......@@ -56,7 +56,7 @@ packages:
name: fake_async
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.0"
version: "1.1.0-nullsafety"
flutter:
dependency: "direct main"
description: flutter
......@@ -78,28 +78,28 @@ packages:
path: ".."
relative: true
source: path
version: "7.0.2"
version: "7.0.3"
matcher:
dependency: transitive
description:
name: matcher
url: "https://pub.dartlang.org"
source: hosted
version: "0.12.8"
version: "0.12.10-nullsafety"
meta:
dependency: transitive
description:
name: meta
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.8"
version: "1.3.0-nullsafety.2"
path:
dependency: transitive
description:
name: path
url: "https://pub.dartlang.org"
source: hosted
version: "1.7.0"
version: "1.8.0-nullsafety"
sky_engine:
dependency: transitive
description: flutter
......@@ -111,56 +111,56 @@ packages:
name: source_span
url: "https://pub.dartlang.org"
source: hosted
version: "1.7.0"
version: "1.8.0-nullsafety"
stack_trace:
dependency: transitive
description:
name: stack_trace
url: "https://pub.dartlang.org"
source: hosted
version: "1.9.5"
version: "1.10.0-nullsafety"
stream_channel:
dependency: transitive
description:
name: stream_channel
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.0"
version: "2.1.0-nullsafety"
string_scanner:
dependency: transitive
description:
name: string_scanner
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.5"
version: "1.1.0-nullsafety"
term_glyph:
dependency: transitive
description:
name: term_glyph
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.0"
version: "1.2.0-nullsafety"
test_api:
dependency: transitive
description:
name: test_api
url: "https://pub.dartlang.org"
source: hosted
version: "0.2.17"
version: "0.2.19-nullsafety"
typed_data:
dependency: transitive
description:
name: typed_data
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.0"
version: "1.3.0-nullsafety.2"
vector_math:
dependency: transitive
description:
name: vector_math
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.8"
version: "2.1.0-nullsafety.2"
sdks:
dart: ">=2.9.0-14.0.dev <3.0.0"
dart: ">=2.10.0-0.0.dev <2.10.0"
flutter: ">=1.10.0"
......@@ -71,7 +71,10 @@ static NSString *const CHANNEL_NAME = @"PonnamKarthik/fluttertoast";
NSNumber *textcolor = call.arguments[@"textcolor"];
NSNumber *size = call.arguments[@"size"];
NSNumber *fontSize = call.arguments[@"fontSize"];
if(fontSize == nil) {
fontSize = 16.0;
}
CGFloat cgf = [fontSize doubleValue];
int time = 1;
@try {
......
......@@ -19,7 +19,7 @@ class Fluttertoast {
{@required String msg,
Toast toastLength,
int timeInSecForIosWeb = 1,
double fontSize = 16.0,
double fontSize,
ToastGravity gravity,
Color backgroundColor,
Color textColor,
......@@ -94,7 +94,9 @@ class FToast {
Overlay.of(context).insert(_entry);
_timer = Timer(_toastEntry.duration, () {
removeCustomToast();
Future.delayed(Duration(milliseconds: 360), () {
removeCustomToast();
});
});
}
......@@ -119,18 +121,16 @@ class FToast {
ToastGravity gravity,
}) {
OverlayEntry newEntry = OverlayEntry(builder: (context) {
return _getPostionWidgetBasedOnGravity(child, gravity);
return _getPostionWidgetBasedOnGravity(child, gravity, toastDuration);
});
_overlayQueue.add(_ToastEntry(entry: newEntry, duration: toastDuration ?? Duration(seconds: 2)));
if (_timer == null) _showOverlay();
}
_getPostionWidgetBasedOnGravity(Widget child, ToastGravity gravity) {
Widget newChild = Center(
child: Material(
color: Colors.transparent,
child: child,
),
_getPostionWidgetBasedOnGravity(Widget child, ToastGravity gravity, Duration duration) {
Widget newChild = _ToastStateFul(
child,
duration,
);
switch (gravity) {
case ToastGravity.TOP:
......@@ -170,3 +170,69 @@ class _ToastEntry {
_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,
),
),
);
}
}
......@@ -65,9 +65,6 @@ class FluttertoastWebPlugin {
html.querySelector('head').children.addAll(tags);
await Future.wait(loading);
// addHtmlToast();
// addHtmlToast();
}
addHtmlToast(
......
......@@ -7,14 +7,14 @@ packages:
name: characters
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.0"
version: "1.1.0-nullsafety.2"
collection:
dependency: transitive
description:
name: collection
url: "https://pub.dartlang.org"
source: hosted
version: "1.14.13"
version: "1.15.0-nullsafety.2"
flutter:
dependency: "direct main"
description: flutter
......@@ -31,7 +31,7 @@ packages:
name: meta
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.8"
version: "1.3.0-nullsafety.2"
sky_engine:
dependency: transitive
description: flutter
......@@ -43,14 +43,14 @@ packages:
name: typed_data
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.0"
version: "1.3.0-nullsafety.2"
vector_math:
dependency: transitive
description:
name: vector_math
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.8"
version: "2.1.0-nullsafety.2"
sdks:
dart: ">=2.9.0-14.0.dev <3.0.0"
dart: ">=2.10.0-0.0.dev <2.10.0"
flutter: ">=1.10.0"
name: fluttertoast
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
issue_tracker: https://github.com/ponnamkarthik/FlutterToast/issues
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment