Created
April 18, 2019 09:27
-
-
Save mono0926/49d43958933964ea01887f632a504ee1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
class HUD { | |
BuildContext hudContext; | |
void show(BuildContext context) { | |
showGeneralDialog( | |
context: context, | |
pageBuilder: (hudContext, _a, _sa) { | |
this.hudContext = hudContext; | |
return const Center(child: CircularProgressIndicator()); | |
}, | |
barrierDismissible: false, | |
barrierLabel: MaterialLocalizations.of(context).modalBarrierDismissLabel, | |
barrierColor: Colors.black26, | |
transitionDuration: const Duration(milliseconds: 150), | |
transitionBuilder: (_c, animation, _sa, child) => FadeTransition( | |
opacity: CurvedAnimation( | |
parent: animation, | |
curve: Curves.easeOut, | |
), | |
child: child, | |
), | |
); | |
} | |
void dismiss() { | |
if (hudContext == null) { | |
assert(false, 'hudContext should not be null.'); | |
return; | |
} | |
Navigator.of(hudContext)?.pop(); | |
} | |
} |
Author
mono0926
commented
Apr 18, 2019
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment