Jonny Borges
Committed by GitHub

New release

... ... @@ -48,7 +48,7 @@
## [1.4.0]
- Added Get.removeRoute // remove one route.
- Added Get.removeRoute // ability to remove one route.
Get.until // back repeatedly until the predicate returns true.
Get.offUntil // go to next route and remove all the previous routes until the predicate returns true.
Get.offNamedUntil // go to next named route and remove all the previous routes until the predicate returns true.
... ... @@ -85,3 +85,21 @@
## [1.6.3]
- Clean code.
## [1.6.4]
- Improve performance.
## [1.7.0]
- Improve geral performance. Get.to Wrap now consumes even less RAM and CPU. In an application with 20 screens, it obtained 82% less RAM usage compared to the traditional method Navigator.push and had a CPU normalization of 23% in a Moto z2, against 64% CPU usage in Navigator.push with MaterialPageRoute. Test it for yourself!
- Added BottomSheet with no context
- Added modern Blur Snackbar
- Added customs transitions
- Improve dialogs performance
## [1.7.1]
-Fix docs
... ...
... ... @@ -15,7 +15,7 @@ Add this to your package's pubspec.yaml file:
```
dependencies:
get: ^1.6.3
get: ^1.7.1
```
And import it:
... ... @@ -68,6 +68,17 @@ ex:
```dart
if(data == 'sucess') madeAnything();
```
Others methods:
Get.removeRoute // remove one route.
Get.until // back repeatedly until the predicate returns true.
Get.offUntil // go to next route and remove all the previous routes until the predicate returns true.
Get.offNamedUntil // go to next named route and remove all the previous routes until the predicate returns true.
To show a modern snackbar:
```dart
Get.snackbar('Hi', 'i am a modern snackbar');
To open dialog:
```dart
... ... @@ -91,25 +102,23 @@ To open default dialog:
```
To have a simple SnackBar with Flutter, you must get the context of Scaffold, or you must use a GlobalKey attached to your Scaffold,
but with Get, all you have to do is call your SnackBar from anywhere in your code! No context, no cliche code!
but with Get, all you have to do is call your SnackBar from anywhere in your code and and customize it however you want!
```dart
GetBar(
title: "Hey i'm a Get SnackBar!",
message:
"It's unbelievable! I'm using SnackBar without context, without boilerplate, without Scaffold, it is something truly amazing!",
icon: Icon(Icons.alarm),
shouldIconPulse: true,
onTap:(){},
barBlur: 20,
isDismissible: true,
duration: Duration(seconds: 3),
)..show();
```
Plus, the default SnackBar is completely inflexible, while GetBar lets you change the color, shape, opacity, and anything else you want!
Others methods:
Get.removeRoute // remove one route.
Get.until // back repeatedly until the predicate returns true.
Get.offUntil // go to next route and remove all the previous routes until the predicate returns true.
Get.offNamedUntil // go to next named route and remove all the previous routes until the predicate returns true.
### That's it, you've learned how to navigate between routes the default way.
However, for people who like more organized code who want to navigate with named routes, or for Flutter_web Developers who want the url to show exactly which route is being shown, and want the page refresh not to affect the state of the routes. On your site, we give you a much more elegant and functional solution. Yeah, the default navigation doesn't fully support Flutter_web, but Get does !!!!
... ... @@ -192,7 +201,9 @@ class FirstRoute extends StatelessWidget {
icon: Icon(Icons.add),
onPressed: () {
GetBar(
title: "Hi!", message: "i'm a Get SnackBar!",
title: "Hey i'm a Get SnackBar!",
message:
"It's unbelievable! I'm using SnackBar without context, without boilerplate, without Scaffold, it is something truly amazing!",
duration: Duration(seconds: 3),
)..show();
},
... ...
... ... @@ -3,4 +3,5 @@ library get;
export 'src/getroute.dart';
export 'src/routes.dart';
export 'src/snack.dart';
export 'src/bottomsheet.dart';
export 'src/snack_route.dart';
... ...
import 'package:flutter/material.dart';
class GetModalBottomSheetRoute<T> extends PopupRoute<T> {
GetModalBottomSheetRoute({
this.builder,
this.theme,
this.barrierLabel,
this.backgroundColor,
this.elevation,
this.shape,
this.clipBehavior,
this.modalBarrierColor,
this.isDismissible = true,
this.enableDrag = true,
@required this.isScrollControlled,
RouteSettings settings,
}) : assert(isScrollControlled != null),
assert(isDismissible != null),
assert(enableDrag != null),
super(settings: settings);
final WidgetBuilder builder;
final ThemeData theme;
final bool isScrollControlled;
final Color backgroundColor;
final double elevation;
final ShapeBorder shape;
final Clip clipBehavior;
final Color modalBarrierColor;
final bool isDismissible;
final bool enableDrag;
@override
Duration get transitionDuration => Duration(milliseconds: 700);
@override
bool get barrierDismissible => isDismissible;
@override
final String barrierLabel;
@override
Color get barrierColor => modalBarrierColor ?? Colors.black54;
AnimationController _animationController;
@override
AnimationController createAnimationController() {
assert(_animationController == null);
_animationController =
BottomSheet.createAnimationController(navigator.overlay);
return _animationController;
}
@override
Widget buildPage(BuildContext context, Animation<double> animation,
Animation<double> secondaryAnimation) {
final BottomSheetThemeData sheetTheme =
theme?.bottomSheetTheme ?? Theme.of(context).bottomSheetTheme;
// By definition, the bottom sheet is aligned to the bottom of the page
// and isn't exposed to the top padding of the MediaQuery.
Widget bottomSheet = MediaQuery.removePadding(
context: context,
removeTop: true,
child: _GetModalBottomSheet<T>(
route: this,
backgroundColor: backgroundColor ??
sheetTheme?.modalBackgroundColor ??
sheetTheme?.backgroundColor,
elevation:
elevation ?? sheetTheme?.modalElevation ?? sheetTheme?.elevation,
shape: shape,
clipBehavior: clipBehavior,
isScrollControlled: isScrollControlled,
enableDrag: enableDrag,
),
);
if (theme != null) bottomSheet = Theme(data: theme, child: bottomSheet);
return bottomSheet;
}
}
class _GetModalBottomSheet<T> extends StatefulWidget {
const _GetModalBottomSheet({
Key key,
this.route,
this.backgroundColor,
this.elevation,
this.shape,
this.clipBehavior,
this.isScrollControlled = false,
this.enableDrag = true,
}) : assert(isScrollControlled != null),
assert(enableDrag != null),
super(key: key);
final GetModalBottomSheetRoute<T> route;
final bool isScrollControlled;
final Color backgroundColor;
final double elevation;
final ShapeBorder shape;
final Clip clipBehavior;
final bool enableDrag;
@override
_GetModalBottomSheetState<T> createState() => _GetModalBottomSheetState<T>();
}
class _GetModalBottomSheetState<T> extends State<_GetModalBottomSheet<T>> {
String _getRouteLabel(MaterialLocalizations localizations) {
switch (Theme.of(context).platform) {
case TargetPlatform.iOS:
case TargetPlatform.macOS:
return '';
case TargetPlatform.android:
case TargetPlatform.fuchsia:
return localizations.dialogLabel;
}
return null;
}
@override
Widget build(BuildContext context) {
assert(debugCheckHasMediaQuery(context));
assert(debugCheckHasMaterialLocalizations(context));
final MediaQueryData mediaQuery = MediaQuery.of(context);
final MaterialLocalizations localizations =
MaterialLocalizations.of(context);
final String routeLabel = _getRouteLabel(localizations);
return AnimatedBuilder(
animation: widget.route.animation,
builder: (BuildContext context, Widget child) {
// Disable the initial animation when accessible navigation is on so
// that the semantics are added to the tree at the correct time.
final double animationValue = mediaQuery.accessibleNavigation
? 1.0
: widget.route.animation.value;
return Semantics(
scopesRoute: true,
namesRoute: true,
label: routeLabel,
explicitChildNodes: true,
child: ClipRect(
child: CustomSingleChildLayout(
delegate: _GetModalBottomSheetLayout(
animationValue, widget.isScrollControlled),
child: BottomSheet(
animationController: widget.route._animationController,
onClosing: () {
if (widget.route.isCurrent) {
Navigator.pop(context);
}
},
builder: widget.route.builder,
backgroundColor: widget.backgroundColor,
elevation: widget.elevation,
shape: widget.shape,
clipBehavior: widget.clipBehavior,
enableDrag: widget.enableDrag,
),
),
),
);
},
);
}
}
class _GetModalBottomSheetLayout extends SingleChildLayoutDelegate {
_GetModalBottomSheetLayout(this.progress, this.isScrollControlled);
final double progress;
final bool isScrollControlled;
@override
BoxConstraints getConstraintsForChild(BoxConstraints constraints) {
return BoxConstraints(
minWidth: constraints.maxWidth,
maxWidth: constraints.maxWidth,
minHeight: 0.0,
maxHeight: isScrollControlled
? constraints.maxHeight
: constraints.maxHeight * 9.0 / 16.0,
);
}
@override
Offset getPositionForChild(Size size, Size childSize) {
return Offset(0.0, size.height - childSize.height * progress);
}
@override
bool shouldRelayout(_GetModalBottomSheetLayout oldDelegate) {
return progress != oldDelegate.progress;
}
}
... ...
import 'package:flutter/material.dart';
import 'package:get/src/routes.dart';
class DialogGet extends StatelessWidget {
final Widget child;
final color;
final double opacity;
const DialogGet({Key key, this.child, this.color, this.opacity = 0.5})
: super(key: key);
@override
Widget build(BuildContext context) {
return GestureDetector(
onTap: () => Get.back(),
child: Container(
color: (color == null)
? Theme.of(context).accentColor.withOpacity(opacity)
: color,
child: GestureDetector(onTap: () => null, child: child),
),
);
}
}
import 'routes.dart';
class DefaultDialogGet extends StatelessWidget {
final color;
... ... @@ -43,21 +21,95 @@ class DefaultDialogGet extends StatelessWidget {
@override
Widget build(BuildContext context) {
return GestureDetector(
onTap: () => Get.back(),
child: Container(
color: (color == null)
? Theme.of(context).accentColor.withOpacity(opacity)
: color,
child: GestureDetector(
onTap: () => null,
child: AlertDialog(
return AlertDialog(
title: Text(title, textAlign: TextAlign.center),
content: content,
actions: <Widget>[cancel, confirm],
),
),
),
);
}
}
Future<T> getShowGeneralDialog<T>({
@required RoutePageBuilder pageBuilder,
bool barrierDismissible,
String barrierLabel,
Color barrierColor,
Duration transitionDuration,
RouteTransitionsBuilder transitionBuilder,
bool useRootNavigator = true,
}) {
assert(pageBuilder != null);
assert(useRootNavigator != null);
assert(!barrierDismissible || barrierLabel != null);
return Get.key.currentState.push<T>(_DialogRoute<T>(
pageBuilder: pageBuilder,
barrierDismissible: barrierDismissible,
barrierLabel: barrierLabel,
barrierColor: barrierColor,
transitionDuration: transitionDuration,
transitionBuilder: transitionBuilder,
));
}
class _DialogRoute<T> extends PopupRoute<T> {
_DialogRoute({
@required RoutePageBuilder pageBuilder,
bool barrierDismissible = true,
String barrierLabel,
Color barrierColor = const Color(0x80000000),
Duration transitionDuration = const Duration(milliseconds: 200),
RouteTransitionsBuilder transitionBuilder,
RouteSettings settings,
}) : assert(barrierDismissible != null),
_pageBuilder = pageBuilder,
_barrierDismissible = barrierDismissible,
_barrierLabel = barrierLabel,
_barrierColor = barrierColor,
_transitionDuration = transitionDuration,
_transitionBuilder = transitionBuilder,
super(settings: settings);
final RoutePageBuilder _pageBuilder;
@override
bool get barrierDismissible => _barrierDismissible;
final bool _barrierDismissible;
@override
String get barrierLabel => _barrierLabel;
final String _barrierLabel;
@override
Color get barrierColor => _barrierColor;
final Color _barrierColor;
@override
Duration get transitionDuration => _transitionDuration;
final Duration _transitionDuration;
final RouteTransitionsBuilder _transitionBuilder;
@override
Widget buildPage(BuildContext context, Animation<double> animation,
Animation<double> secondaryAnimation) {
return Semantics(
child: _pageBuilder(context, animation, secondaryAnimation),
scopesRoute: true,
explicitChildNodes: true,
);
}
@override
Widget buildTransitions(BuildContext context, Animation<double> animation,
Animation<double> secondaryAnimation, Widget child) {
if (_transitionBuilder == null) {
return FadeTransition(
opacity: CurvedAnimation(
parent: animation,
curve: Curves.linear,
),
child: child);
} // Some default transition
return _transitionBuilder(context, animation, secondaryAnimation, child);
}
}
... ...
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
class GetRoute<T> extends PageRoute<T> {
/// Construct a MaterialPageRoute whose contents are defined by [builder].
///
/// The values of [builder], [maintainState], and [fullScreenDialog] must not
class GetRoute<T> extends PageRouteBuilder<T> {
/// Construct a Modified PageRoute whose contents are defined by child.
/// The values of [child], [maintainState], [opaque], and [fullScreenDialog] must not
/// be null.
GetRoute({
@required this.builder,
Key key,
RouteSettings settings,
this.opaque = false,
this.maintainState = true,
@required this.child,
@required this.transition,
this.curve = Curves.linear,
this.alignment,
this.duration = const Duration(milliseconds: 300),
bool fullscreenDialog = false,
}) : assert(builder != null),
}) : assert(child != null),
assert(maintainState != null),
assert(fullscreenDialog != null),
assert(opaque != null),
super(settings: settings, fullscreenDialog: fullscreenDialog);
/// Builds the primary contents of the route.
final WidgetBuilder builder;
super(
fullscreenDialog: fullscreenDialog,
pageBuilder: (BuildContext context, Animation<double> animation,
Animation<double> secondaryAnimation) {
return child;
},
transitionDuration: duration,
settings: settings,
transitionsBuilder: (BuildContext context,
Animation<double> animation,
Animation<double> secondaryAnimation,
Widget child) {
switch (transition) {
case Transition.fade:
return FadeTransition(opacity: animation, child: child);
break;
case Transition.rightToLeft:
return SlideTransition(
transformHitTests: false,
position: new Tween<Offset>(
begin: const Offset(1.0, 0.0),
end: Offset.zero,
).animate(animation),
child: new SlideTransition(
position: new Tween<Offset>(
begin: Offset.zero,
end: const Offset(-1.0, 0.0),
).animate(secondaryAnimation),
child: child,
),
);
break;
case Transition.leftToRight:
return SlideTransition(
transformHitTests: false,
position: Tween<Offset>(
begin: const Offset(-1.0, 0.0),
end: Offset.zero,
).animate(animation),
child: new SlideTransition(
position: new Tween<Offset>(
begin: Offset.zero,
end: const Offset(1.0, 0.0),
).animate(secondaryAnimation),
child: child,
),
);
break;
case Transition.upToDown:
return SlideTransition(
transformHitTests: false,
position: Tween<Offset>(
begin: const Offset(0.0, -1.0),
end: Offset.zero,
).animate(animation),
child: new SlideTransition(
position: new Tween<Offset>(
begin: Offset.zero,
end: const Offset(0.0, 1.0),
).animate(secondaryAnimation),
child: child,
),
);
break;
case Transition.downToUp:
return SlideTransition(
transformHitTests: false,
position: Tween<Offset>(
begin: const Offset(0.0, 1.0),
end: Offset.zero,
).animate(animation),
child: new SlideTransition(
position: new Tween<Offset>(
begin: Offset.zero,
end: const Offset(0.0, -1.0),
).animate(secondaryAnimation),
child: child,
),
);
break;
case Transition.scale:
return ScaleTransition(
alignment: alignment,
scale: CurvedAnimation(
parent: animation,
curve: Interval(
0.00,
0.50,
curve: curve,
),
),
child: child,
);
break;
case Transition.rotate:
return new RotationTransition(
alignment: alignment,
turns: animation,
child: new ScaleTransition(
alignment: alignment,
scale: animation,
child: FadeTransition(
opacity: animation,
child: child,
),
),
);
break;
case Transition.size:
return Align(
alignment: alignment,
child: SizeTransition(
sizeFactor: CurvedAnimation(
parent: animation,
curve: curve,
),
child: child,
),
);
break;
case Transition.rightToLeftWithFade:
return SlideTransition(
position: Tween<Offset>(
begin: const Offset(1.0, 0.0),
end: Offset.zero,
).animate(animation),
child: FadeTransition(
opacity: animation,
child: SlideTransition(
position: Tween<Offset>(
begin: Offset.zero,
end: const Offset(-1.0, 0.0),
).animate(secondaryAnimation),
child: child,
),
),
);
break;
case Transition.leftToRightWithFade:
return SlideTransition(
position: Tween<Offset>(
begin: const Offset(-1.0, 0.0),
end: Offset.zero,
).animate(animation),
child: FadeTransition(
opacity: animation,
child: SlideTransition(
position: Tween<Offset>(
begin: Offset.zero,
end: const Offset(1.0, 0.0),
).animate(secondaryAnimation),
child: child,
),
),
);
break;
default:
return FadeTransition(opacity: animation, child: child);
}
});
@override
final bool maintainState;
... ... @@ -37,50 +196,41 @@ class GetRoute<T> extends PageRoute<T> {
@override
String get barrierLabel => null;
@override
bool canTransitionFrom(TransitionRoute<dynamic> previousRoute) {
return previousRoute is GetRoute || previousRoute is CupertinoPageRoute;
}
// @override
// bool canTransitionFrom(TransitionRoute<dynamic> previousRoute) {
// return previousRoute is GetRoute || previousRoute is CupertinoPageRoute;
// }
@override
bool canTransitionTo(TransitionRoute<dynamic> nextRoute) {
// Don't perform outgoing animation if the next route is a fullscreen dialog.
return (nextRoute is GetRoute && !nextRoute.fullscreenDialog) ||
(nextRoute is CupertinoPageRoute && !nextRoute.fullscreenDialog);
}
// @override
// bool canTransitionTo(TransitionRoute<dynamic> nextRoute) {
// // Don't perform outgoing animation if the next route is a fullscreen dialog.
// return (nextRoute is GetRoute && !nextRoute.fullscreenDialog) ||
// (nextRoute is CupertinoPageRoute && !nextRoute.fullscreenDialog);
// }
@override
Widget buildPage(
BuildContext context,
Animation<double> animation,
Animation<double> secondaryAnimation,
) {
final Widget result = builder(context);
assert(() {
if (result == null) {
throw FlutterError.fromParts(<DiagnosticsNode>[
ErrorSummary(
'The builder for route "${settings.name}" returned null.'),
ErrorDescription('Route builders must never return null.')
]);
}
return true;
}());
return Semantics(
scopesRoute: true,
explicitChildNodes: true,
child: result,
);
}
String get debugLabel => '${super.debugLabel}(${settings.name})';
@override
Widget buildTransitions(BuildContext context, Animation<double> animation,
Animation<double> secondaryAnimation, Widget child) {
final PageTransitionsTheme theme = Theme.of(context).pageTransitionsTheme;
return theme.buildTransitions<T>(
this, context, animation, secondaryAnimation, child);
}
final Widget child;
@override
String get debugLabel => '${super.debugLabel}(${settings.name})';
final Transition transition;
final Curve curve;
final Alignment alignment;
final Duration duration;
}
enum Transition {
fade,
rightToLeft,
leftToRight,
upToDown,
downToUp,
scale,
rotate,
size,
rightToLeftWithFade,
leftToRightWithFade,
}
... ...
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
import 'bottomsheet.dart';
import 'dialog.dart';
import 'snack.dart';
import 'getroute.dart';
class Get {
... ... @@ -29,9 +30,10 @@ class Get {
/// It replaces Navigator.push, but needs no context, and it doesn't have the Navigator.push
/// routes rebuild bug present in Flutter. If for some strange reason you want the default behavior
/// of rebuilding every app after a route, use rebuildRoutes = true as the parameter.
static to(Widget page, {bool rebuildRoutes = false}) {
return key.currentState
.push(GetRoute(opaque: rebuildRoutes, builder: (_) => page));
static to(Widget page,
{bool rebuildRoutes = false, Transition transition = Transition.fade}) {
return key.currentState.push(
GetRoute(opaque: rebuildRoutes, child: page, transition: transition));
}
/// It replaces Navigator.pushNamed, but needs no context, and it doesn't have the Navigator.pushNamed
... ... @@ -84,37 +86,135 @@ class Get {
/// It replaces Navigator.pushReplacement, but needs no context, and it doesn't have the Navigator.pushReplacement
/// routes rebuild bug present in Flutter. If for some strange reason you want the default behavior
/// of rebuilding every app after a route, use rebuildRoutes = true as the parameter.
static off(Widget page, {bool rebuildRoutes = false}) {
return key.currentState
.pushReplacement(GetRoute(opaque: rebuildRoutes, builder: (_) => page));
static off(Widget page,
{bool rebuildRoutes = false,
Transition transition = Transition.rightToLeft}) {
return key.currentState.pushReplacement(
GetRoute(opaque: rebuildRoutes, child: page, transition: transition));
}
/// It replaces Navigator.pushAndRemoveUntil, but needs no context
static offAll(Widget page, RoutePredicate predicate,
{bool rebuildRoutes = false,
Transition transition = Transition.rightToLeft}) {
return key.currentState.pushAndRemoveUntil(
GetRoute(opaque: rebuildRoutes, child: page, transition: transition),
predicate);
}
/// Show a dialog. You can choose color and opacity of background
static dialog(Widget page, {Color color, double opacity = 0.5}) {
Get.to(DialogGet(child: page, color: color, opacity: opacity));
static Future<T> dialog<T>(
Widget child, {
bool barrierDismissible = true,
// WidgetBuilder builder,
bool useRootNavigator = true,
}) {
assert(child == null
// || builder == null
);
assert(useRootNavigator != null);
// assert(debugCheckHasMaterialLocalizations(context));
final ThemeData theme =
Theme.of(Get.key.currentContext, shadowThemeOnly: true);
return getShowGeneralDialog(
pageBuilder: (BuildContext buildContext, Animation<double> animation,
Animation<double> secondaryAnimation) {
final Widget pageChild = child; // ?? Builder(builder: builder);
return SafeArea(
child: Builder(builder: (BuildContext context) {
return theme != null
? Theme(data: theme, child: pageChild)
: pageChild;
}),
);
},
barrierDismissible: barrierDismissible,
barrierLabel: MaterialLocalizations.of(Get.key.currentContext)
.modalBarrierDismissLabel,
barrierColor: Colors.black54,
transitionDuration: const Duration(milliseconds: 150),
// transitionBuilder: _buildMaterialDialogTransitions,
useRootNavigator: useRootNavigator,
);
}
static defaultDialog(
{Color color,
double opacity = 0.5,
double opacity = 0.2,
String title = "Alert dialog",
Widget content,
Widget cancel,
Widget confirm}) {
Get.to(DefaultDialogGet(
final child = DefaultDialogGet(
color: color,
opacity: opacity,
title: title,
content: content,
cancel: cancel,
confirm: confirm,
);
dialog(child);
}
static Future<T> bottomSheet<T>({
@required WidgetBuilder builder,
Color backgroundColor,
double elevation,
ShapeBorder shape,
Clip clipBehavior,
Color barrierColor,
bool isScrollControlled = false,
bool useRootNavigator = false,
bool isDismissible = true,
bool enableDrag = true,
}) {
assert(builder != null);
assert(isScrollControlled != null);
assert(useRootNavigator != null);
assert(isDismissible != null);
assert(enableDrag != null);
return Get.key.currentState.push<T>(GetModalBottomSheetRoute<T>(
builder: builder,
theme: Theme.of(Get.key.currentContext, shadowThemeOnly: true),
isScrollControlled: isScrollControlled,
barrierLabel: MaterialLocalizations.of(Get.key.currentContext)
.modalBarrierDismissLabel,
backgroundColor: backgroundColor,
elevation: elevation,
shape: shape,
clipBehavior: clipBehavior,
isDismissible: isDismissible,
modalBarrierColor: barrierColor,
enableDrag: enableDrag,
));
}
/// It replaces Navigator.pushAndRemoveUntil, but needs no context
static offAll(Widget page, RoutePredicate predicate,
{bool rebuildRoutes = false}) {
return key.currentState.pushAndRemoveUntil(
GetRoute(opaque: rebuildRoutes, builder: (_) => page), predicate);
static snackbar(title, message,
{Color colorText, Duration duration, SnackPosition snackPosition}) {
return GetBar(
titleText: Text(
title,
style: TextStyle(
color: colorText ?? Theme.of(Get.key.currentContext).accentColor,
fontWeight: FontWeight.w800,
fontSize: 16),
),
messageText: Text(
message,
style: TextStyle(
color: colorText ?? Theme.of(Get.key.currentContext).accentColor,
fontWeight: FontWeight.w300,
fontSize: 14),
),
snackPosition: snackPosition ?? SnackPosition.TOP,
borderRadius: 15,
margin: EdgeInsets.symmetric(horizontal: 10),
duration: duration ?? Duration(seconds: 3),
barBlur: 7.0,
backgroundColor: Colors.grey.withOpacity(0.2),
)..show();
}
}
... ...
... ... @@ -2,7 +2,7 @@ import 'dart:async';
import 'dart:ui';
import 'package:flutter/material.dart';
import 'package:flutter/scheduler.dart';
import 'package:get/get.dart';
import 'routes.dart';
import 'snack_route.dart' as route;
typedef void SnackStatusCallback(SnackStatus status);
... ... @@ -216,7 +216,6 @@ class GetBar<T extends Object> extends StatefulWidget {
_snackRoute = route.showSnack<T>(
snack: this,
);
return await Get.key.currentState.push(_snackRoute);
}
... ...
name: get
description: A consistent navigation library that lets you navigate between screens, open dialogs, and display snackbars with no context.
version: 1.6.3
author: Jonny Borges <jonataborges01@gmail.com>
version: 1.7.1
homepage: https://github.com/jonataslaw/get
environment:
... ...