Extract processing dialog widget

This commit is contained in:
Ming Ming 2021-07-03 03:44:05 +08:00
parent decf78f9b7
commit 77461ded3a
2 changed files with 31 additions and 13 deletions

View file

@ -20,6 +20,7 @@ import 'package:nc_photos/use_case/create_album.dart';
import 'package:nc_photos/use_case/populate_album.dart';
import 'package:nc_photos/use_case/update_dynamic_album_cover.dart';
import 'package:nc_photos/use_case/update_dynamic_album_time.dart';
import 'package:nc_photos/widget/processing_dialog.dart';
import 'package:path/path.dart' as path;
class AlbumImporterArguments {
@ -210,19 +211,8 @@ class _AlbumImporterState extends State<AlbumImporter> {
showDialog(
barrierDismissible: false,
context: context,
builder: (context) => WillPopScope(
onWillPop: () => Future.value(false),
child: AlertDialog(
content: Row(
mainAxisSize: MainAxisSize.min,
children: [
CircularProgressIndicator(),
const SizedBox(width: 24),
Text(AppLocalizations.of(context).albumImporterProgressText),
],
),
),
),
builder: (context) => ProcessingDialog(
text: AppLocalizations.of(context).albumImporterProgressText),
);
try {
await _createAllAlbums(context);

View file

@ -0,0 +1,28 @@
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
class ProcessingDialog extends StatelessWidget {
ProcessingDialog({
Key key,
@required this.text,
});
@override
build(BuildContext context) {
return WillPopScope(
onWillPop: () => Future.value(false),
child: AlertDialog(
content: Row(
mainAxisSize: MainAxisSize.min,
children: [
CircularProgressIndicator(),
const SizedBox(width: 24),
Text(text),
],
),
),
);
}
final String text;
}