showLoading method
Future<void>
showLoading(
- BuildContext context, {
- Color? colorBackground,
- double? sizeBackground,
- double? backgroundRadius,
- Color? borderColor,
- double? borderWidth,
- Color? colorSpin,
- double? sizeSpin,
- String? text,
- TextStyle? textStyle,
})
Implementation
Future<void> showLoading(BuildContext context,
{Color? colorBackground,
double? sizeBackground,
double? backgroundRadius,
Color? borderColor,
double? borderWidth,
Color? colorSpin,
double? sizeSpin,
String? text,
TextStyle? textStyle}) async {
final children = <Widget>[
SpinKitRing(
lineWidth: 3.0,
color: colorSpin ?? Colors.white,
duration: const Duration(milliseconds: 1000),
size: sizeSpin ?? 40.0,
)
];
if (text != null && text.isNotEmpty) {
children.addAll(<Widget>[
SizedBox(height: 10.0),
Text(text,
overflow: TextOverflow.ellipsis,
style: textStyle ?? regularTextStyle())
]);
}
showCustomDialog(
context,
Center(
child: Container(
width: sizeBackground ?? 100.0,
height: sizeBackground ?? 100.0,
decoration: BoxDecoration(
color: colorBackground ?? Colors.grey,
borderRadius:
BorderRadius.all(Radius.circular(backgroundRadius ?? 5.0)),
border: Border.all(
color: borderColor ?? Colors.grey,
width: borderWidth ?? 2.0,
),
),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: children,
),
),
));
}