From 2730616eb75d209a310f5bbe8dbb3d8a5848b507 Mon Sep 17 00:00:00 2001 From: Mariana Date: Sun, 9 May 2021 11:17:50 -0400 Subject: [PATCH 1/2] improvement - unnecessary var creation removed --- lib/modal_progress_hud.dart | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/lib/modal_progress_hud.dart b/lib/modal_progress_hud.dart index da9186d..2dd1744 100644 --- a/lib/modal_progress_hud.dart +++ b/lib/modal_progress_hud.dart @@ -48,17 +48,6 @@ class ModalProgressHUD extends StatelessWidget { Widget build(BuildContext context) { if (!inAsyncCall) return child; - Widget layOutProgressIndicator; - if (offset == null) - layOutProgressIndicator = Center(child: progressIndicator); - else { - layOutProgressIndicator = Positioned( - child: progressIndicator, - left: offset.dx, - top: offset.dy, - ); - } - return new Stack( children: [ child, @@ -66,8 +55,20 @@ class ModalProgressHUD extends StatelessWidget { child: new ModalBarrier(dismissible: dismissible, color: color), opacity: opacity, ), - layOutProgressIndicator, + _getLayOutProgressIndicator(), ], ); } + + Widget _getLayOutProgressIndicator() { + if (offset == null) { + return Center(child: progressIndicator); + } + + return Positioned( + child: progressIndicator, + left: offset.dx, + top: offset.dy, + ); + } } From 30d8ae9781f575bf7263fd88a6c8a2fac4bbd568 Mon Sep 17 00:00:00 2001 From: Mariana Date: Sun, 9 May 2021 11:27:38 -0400 Subject: [PATCH 2/2] new keyword removed --- lib/modal_progress_hud.dart | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/modal_progress_hud.dart b/lib/modal_progress_hud.dart index 2dd1744..fd031b1 100644 --- a/lib/modal_progress_hud.dart +++ b/lib/modal_progress_hud.dart @@ -48,11 +48,11 @@ class ModalProgressHUD extends StatelessWidget { Widget build(BuildContext context) { if (!inAsyncCall) return child; - return new Stack( + return Stack( children: [ child, - new Opacity( - child: new ModalBarrier(dismissible: dismissible, color: color), + Opacity( + child: ModalBarrier(dismissible: dismissible, color: color), opacity: opacity, ), _getLayOutProgressIndicator(),