import 'package:flutter/material.dart';
import 'package:prime_chat/screens/components/ContentLoading.dart';

class ProgressDialog extends StatelessWidget {
  final bool loading;
  final Widget child;
  final String label;

  const ProgressDialog(
      {Key? key,
      required this.loading,
      required this.label,
      required this.child})
      : super(key: key);

  @override
  Widget build(BuildContext context) {
    List<Widget> widgetList = [];
    widgetList.add(child);
    //如果正在加载，则显示加载添加加载中布局
    if (loading) {
      widgetList.add(ContentLoading(label: label));
    }
    return Stack(
      children: widgetList,
    );
  }
}
