From c88e1be660db9f0ff4f425c547220234bdcc0983 Mon Sep 17 00:00:00 2001 From: "Aaron.kang" Date: Tue, 17 Oct 2023 19:57:37 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E8=87=AA=E5=AE=9A=E4=B9=89toast?= =?UTF-8?q?=E4=BD=8D=E7=BD=AE=E5=92=8C=E6=97=B6=E9=95=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/src/easy_loading.dart | 6 ++++++ lib/src/widgets/container.dart | 29 +++++++++++++++++------------ 2 files changed, 23 insertions(+), 12 deletions(-) diff --git a/lib/src/easy_loading.dart b/lib/src/easy_loading.dart index 1193f48..c90a4d6 100644 --- a/lib/src/easy_loading.dart +++ b/lib/src/easy_loading.dart @@ -251,6 +251,8 @@ class EasyLoading { Widget? indicator, EasyLoadingMaskType? maskType, bool? dismissOnTap, + Duration? duration, + double? indicatorTop, }) { Widget w = indicator ?? (_instance.indicatorWidget ?? LoadingIndicator()); return _instance._show( @@ -258,6 +260,8 @@ class EasyLoading { maskType: maskType, dismissOnTap: dismissOnTap, w: w, + duration: duration, + indicatorTop: indicatorTop, ); } @@ -420,6 +424,7 @@ class EasyLoading { EasyLoadingMaskType? maskType, bool? dismissOnTap, EasyLoadingToastPosition? toastPosition, + double? indicatorTop, }) async { assert( overlayEntry != null, @@ -472,6 +477,7 @@ class EasyLoading { maskType: maskType, dismissOnTap: dismissOnTap, completer: completer, + indicatorTop: indicatorTop, ); completer.future.whenComplete(() { _callback(EasyLoadingStatus.show); diff --git a/lib/src/widgets/container.dart b/lib/src/widgets/container.dart index 8cd8cbf..ae507dc 100644 --- a/lib/src/widgets/container.dart +++ b/lib/src/widgets/container.dart @@ -39,6 +39,7 @@ class EasyLoadingContainer extends StatefulWidget { final EasyLoadingMaskType? maskType; final Completer? completer; final bool animation; + final double? indicatorTop; const EasyLoadingContainer({ Key? key, @@ -49,6 +50,7 @@ class EasyLoadingContainer extends StatefulWidget { this.maskType, this.completer, this.animation = true, + this.indicatorTop, }) : super(key: key); @override @@ -165,18 +167,21 @@ class EasyLoadingContainerState extends State ); }, ), - AnimatedBuilder( - animation: _animationController, - builder: (BuildContext context, Widget? child) { - return EasyLoadingTheme.loadingAnimation.buildWidget( - _Indicator( - status: _status, - indicator: widget.indicator, - ), - _animationController, - _alignment, - ); - }, + Positioned( + top: widget.indicatorTop, + child: AnimatedBuilder( + animation: _animationController, + builder: (BuildContext context, Widget? child) { + return EasyLoadingTheme.loadingAnimation.buildWidget( + _Indicator( + status: _status, + indicator: widget.indicator, + ), + _animationController, + _alignment, + ); + }, + ), ), ], );