Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 16 additions & 15 deletions lib/modal_progress_hud.dart
Original file line number Diff line number Diff line change
Expand Up @@ -48,26 +48,27 @@ 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(
return Stack(
children: [
child,
new Opacity(
child: new ModalBarrier(dismissible: dismissible, color: color),
Opacity(
child: 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,
);
}
}