storage_progress_widget.dart 648 B

123456789101112131415161718192021222324252627
  1. import 'package:flutter/material.dart';
  2. class StorageProgressWidget extends StatelessWidget {
  3. final Color color;
  4. final double fractionOfStorage;
  5. const StorageProgressWidget({
  6. required this.color,
  7. required this.fractionOfStorage,
  8. super.key,
  9. });
  10. @override
  11. Widget build(BuildContext context) {
  12. return LayoutBuilder(
  13. builder: (context, constrains) {
  14. return Container(
  15. decoration: BoxDecoration(
  16. borderRadius: BorderRadius.circular(2),
  17. color: color,
  18. ),
  19. width: constrains.maxWidth * fractionOfStorage,
  20. height: 4,
  21. );
  22. },
  23. );
  24. }
  25. }