showLoadingDialogWithCustomWidget static method

YYDialog showLoadingDialogWithCustomWidget(
  1. BuildContext context, {
  2. String? message = "",
  3. Widget? widgetContent,
  4. String loadingMsg = "Loading...",
  5. double totalHeight = 200,
  6. double totalWidth = 300,
})

Implementation

static YYDialog showLoadingDialogWithCustomWidget(
  BuildContext context, {
  String? message = "",
  Widget? widgetContent,
  String loadingMsg = "Loading...",
  double totalHeight = 200,
  double totalWidth = 300,
}) {
  totalHeight = MediaQuery.of(Get.context!).size.height;
  totalWidth = MediaQuery.of(Get.context!).size.width;

  YYDialog yydialog = YYDialog();

  Widget defaultWidget = Container(
    // color: Colors.red,
    width: totalWidth,
    height: totalHeight,
    color: Colors.black12,
    child: const Center(
      child: CircularProgressIndicator(
        valueColor: AlwaysStoppedAnimation<Color>(Colors.blue), // 设置颜色为蓝色
        // backgroundColor: Colors.grey, // 设置背景颜色为灰色
      ),
    ),
  );

  yydialog = YYDialog().build(context)
    ..width = totalWidth
    ..height = totalHeight
    ..borderRadius = 20.r
    ..backgroundColor = Colors.transparent
    ..widget(widgetContent ?? defaultWidget)
    ..show();
  return yydialog;
}