show method
- required String message,
- SimpleFontelicoProgressDialogType type = SimpleFontelicoProgressDialogType.normal,
- double height = 100,
- double width = 120,
- double radius = 5.0,
- double elevation = 5.0,
- Color backgroundColor = Colors.white,
- Color? indicatorColor,
- bool horizontal = false,
- double separation = 10.0,
- TextStyle textStyle = const TextStyle(fontSize: 14),
- TextAlign textAlign = TextAlign.center,
- bool hideText = false,
- Widget? loadingIndicator,
message: String to indicate a message into the dialog. Required type: Simple dialog type (normal, threeline, multiline, refresh, hurricane, phoenix, iphone) height: Double value to set the dialog height width: Double value to set the dialog width radius: Double value to set the dialog border radius elevation: Double value to set the dialog elevation backgroundColor: Color value to set the dialog background color indicatorColor: Color value to set the indicator color horizontal: Boolean value to set if loading has to show on horizontal separation: Double value to set the separation between loading and text textStyle: Style to customize the text inside dialog hideText: Boolean value to hide the text widget loadingIndicator: Widget to use when type is custom textAlign: Value to align the text
Implementation
void show(
{required String message,
SimpleFontelicoProgressDialogType type =
SimpleFontelicoProgressDialogType.normal,
double height = 100,
double width = 120,
double radius = 5.0,
double elevation = 5.0,
Color backgroundColor = Colors.white,
Color? indicatorColor,
bool horizontal = false,
double separation = 10.0,
TextStyle textStyle = const TextStyle(fontSize: 14),
TextAlign textAlign = TextAlign.center,
bool hideText = false,
Widget? loadingIndicator}) {
_indicatorColor = indicatorColor ?? Colors.blue[600];
if (type == SimpleFontelicoProgressDialogType.custom) {
assert(loadingIndicator != null,
'Loading indicator must not be null when is custom');
_customLoadingIndicator = loadingIndicator;
}
_isOpen = true;
this.message = message;
showDialog(
context: context,
barrierDismissible: barrierDimisable,
useSafeArea: true,
builder: (BuildContext context) {
return WillPopScope(
onWillPop: () => Future.value(barrierDimisable),
child: Dialog(
backgroundColor: Colors.transparent,
insetPadding: EdgeInsets.all(0.0),
child: StatefulBuilder(builder: (context, setState) {
this.setState = setState;
return Center(
child: Container(
height: height,
width: width,
decoration: BoxDecoration(
color: backgroundColor,
borderRadius:
BorderRadius.all(Radius.circular(radius))),
child: !horizontal
? Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisSize: MainAxisSize.min,
children: _getChildren(type, horizontal, separation,
textStyle, textAlign, hideText),
)
: Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisSize: MainAxisSize.min,
children: _getChildren(type, horizontal, separation,
textStyle, textAlign, hideText),
),
),
);
}),
),
);
});
}