linear_progress_dialog.dart 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. import 'package:flutter/material.dart';
  2. import 'package:photos/ente_theme_data.dart';
  3. class LinearProgressDialog extends StatefulWidget {
  4. final String message;
  5. const LinearProgressDialog(this.message, {Key key}) : super(key: key);
  6. @override
  7. LinearProgressDialogState createState() => LinearProgressDialogState();
  8. }
  9. class LinearProgressDialogState extends State<LinearProgressDialog> {
  10. double _progress;
  11. @override
  12. void initState() {
  13. _progress = 0;
  14. super.initState();
  15. }
  16. void setProgress(double progress) {
  17. setState(() {
  18. _progress = progress;
  19. });
  20. }
  21. @override
  22. Widget build(BuildContext context) {
  23. return WillPopScope(
  24. onWillPop: () async => false,
  25. child: AlertDialog(
  26. title: Text(
  27. widget.message,
  28. style: const TextStyle(
  29. fontSize: 16,
  30. ),
  31. textAlign: TextAlign.center,
  32. ),
  33. content: LinearProgressIndicator(
  34. value: _progress,
  35. valueColor: AlwaysStoppedAnimation<Color>(
  36. Theme.of(context).colorScheme.greenAlternative,
  37. ),
  38. ),
  39. ),
  40. );
  41. }
  42. }