lab_loading_wrapper.dart 973 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. import 'package:flutter/material.dart';
  2. import 'package:flyinsono/lab/color/lab_colors.dart';
  3. class LabLoadingWrapper extends StatelessWidget {
  4. const LabLoadingWrapper({
  5. Key? key,
  6. required this.child,
  7. required this.loading,
  8. this.decoration,
  9. this.margin,
  10. }) : super(key: key);
  11. final Widget child;
  12. final bool loading;
  13. final BoxDecoration? decoration;
  14. final EdgeInsetsGeometry? margin;
  15. @override
  16. Widget build(BuildContext context) {
  17. return Stack(
  18. children: [
  19. child,
  20. if (loading)
  21. Container(
  22. margin: margin,
  23. decoration: BoxDecoration(
  24. color: LabColors.base400.withOpacity(0.1),
  25. borderRadius: decoration?.borderRadius,
  26. ),
  27. child: Center(
  28. child: CircularProgressIndicator(
  29. color: LabColors.base600,
  30. strokeWidth: 2.5,
  31. ),
  32. ),
  33. ),
  34. ],
  35. );
  36. }
  37. }