FEATURE dialog styling

This commit is contained in:
konrad.lys@eu.equinix.com
2023-06-09 07:49:14 +02:00
parent fab33afc87
commit 421479d280

View File

@@ -19,6 +19,8 @@ import 'package:paperless_mobile/core/global/constants.dart';
import 'package:paperless_mobile/core/navigation/push_routes.dart'; import 'package:paperless_mobile/core/navigation/push_routes.dart';
import 'package:paperless_mobile/core/service/file_description.dart'; import 'package:paperless_mobile/core/service/file_description.dart';
import 'package:paperless_mobile/core/service/file_service.dart'; import 'package:paperless_mobile/core/service/file_service.dart';
import 'package:paperless_mobile/core/widgets/dialog_utils/dialog_cancel_button.dart';
import 'package:paperless_mobile/core/widgets/dialog_utils/dialog_confirm_button.dart';
import 'package:paperless_mobile/features/app_drawer/view/app_drawer.dart'; import 'package:paperless_mobile/features/app_drawer/view/app_drawer.dart';
import 'package:paperless_mobile/features/document_scan/cubit/document_scanner_cubit.dart'; import 'package:paperless_mobile/features/document_scan/cubit/document_scanner_cubit.dart';
import 'package:paperless_mobile/features/document_scan/view/widgets/scanned_image_item.dart'; import 'package:paperless_mobile/features/document_scan/view/widgets/scanned_image_item.dart';
@@ -160,59 +162,67 @@ class _ScannerPageState extends State<ScannerPage>
context: context, context: context,
builder: (BuildContext context) { builder: (BuildContext context) {
return AlertDialog( return AlertDialog(
content: Stack( title: Text(S.of(context)!.export),
children: [ content: FormBuilder(
FormBuilder( key: _downloadFormKey,
key: _downloadFormKey, child: Column(
child: Column( mainAxisSize: MainAxisSize.min,
mainAxisSize: MainAxisSize.min, children: [
children: [ Padding(
Padding( padding: const EdgeInsets.all(8.0),
padding: child: FormBuilderTextField(
const EdgeInsets.all(8.0), autovalidateMode:
child: FormBuilderTextField( AutovalidateMode.always,
autovalidateMode: validator: (value) {
AutovalidateMode.always, if (value?.trim().isEmpty ??
validator: (value) { true) {
if (value?.trim().isEmpty ?? return S
true) { .of(context)!
return S .thisFieldIsRequired;
.of(context)! }
.thisFieldIsRequired; return null;
}
return null;
},
decoration: InputDecoration(
labelText:
S.of(context)!.fileName,
),
name: fkFileName,
)),
TextButton.icon(
label:
Text(S.of(context)!.export),
icon: const Icon(Icons.download),
onPressed: () => {
if (_downloadFormKey
.currentState!
.validate())
{
_onLocalSave().then(
(value) => Navigator.of(
context)
.pop())
}
}, },
) decoration: InputDecoration(
], labelText:
S.of(context)!.fileName,
),
name: fkFileName,
)),
],
),
),
actions: [
const DialogCancelButton(),
ElevatedButton(
child: Text(S.of(context)!.export),
style: ButtonStyle(
backgroundColor:
MaterialStatePropertyAll(
Theme.of(context)
.colorScheme
.primaryContainer,
),
foregroundColor:
MaterialStatePropertyAll(
Theme.of(context)
.colorScheme
.onPrimaryContainer,
), ),
), ),
], onPressed: () => {
), if (_downloadFormKey.currentState!
.validate())
{
_onLocalSave().then((value) =>
Navigator.of(context).pop())
}
},
),
],
); );
}); });
}, },
icon: const Icon(Icons.download), icon: const Icon(Icons.download_outlined),
); );
}, },
), ),