ContentLoading.dart 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. import 'package:flutter/material.dart';
  2. class ContentLoading extends StatelessWidget {
  3. final String label;
  4. const ContentLoading({Key? key, required this.label}) : super(key: key);
  5. @override
  6. Widget build(BuildContext context) {
  7. return LayoutBuilder(
  8. builder: (BuildContext context, BoxConstraints constraints) {
  9. var width = constraints.maxWidth;
  10. var height = constraints.maxHeight;
  11. var min = width < height ? width : height;
  12. var theme = Theme.of(context);
  13. return Center(
  14. child: Column(
  15. children: [
  16. Expanded(child: Container()),
  17. SizedBox(
  18. width: min / 2,
  19. height: min / 2,
  20. child: false
  21. ? Icon(Icons.refresh, color: Colors.grey[100])
  22. : CircularProgressIndicator(
  23. color: theme.colorScheme.secondary,
  24. backgroundColor: Colors.grey[100],
  25. ),
  26. ),
  27. Container(height: min / 10),
  28. Text(label, style: TextStyle(fontSize: min / 15)),
  29. Expanded(child: Container()),
  30. ],
  31. ),
  32. );
  33. },
  34. );
  35. }
  36. }