diff --git a/lib/widget/album_importer.dart b/lib/widget/album_importer.dart index 67fa85be..53da65f0 100644 --- a/lib/widget/album_importer.dart +++ b/lib/widget/album_importer.dart @@ -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 { 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); diff --git a/lib/widget/processing_dialog.dart b/lib/widget/processing_dialog.dart new file mode 100644 index 00000000..bdeab6bf --- /dev/null +++ b/lib/widget/processing_dialog.dart @@ -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; +}