fix: Change return type of upload route

This commit is contained in:
Anton Stubenbord
2023-02-18 22:52:20 +01:00
parent 7fc1ffa3bc
commit 644f154dbd
3 changed files with 39 additions and 25 deletions

View File

@@ -156,27 +156,26 @@ class _HomePageState extends State<HomePage> with WidgetsBindingObserver {
final extension = p.extension(mediaFile.path);
if (await File(mediaFile.path).exists()) {
final bytes = File(mediaFile.path).readAsBytesSync();
final success = await Navigator.push<bool>(
context,
MaterialPageRoute(
builder: (context) => BlocProvider.value(
value: DocumentUploadCubit(
documentApi: context.read(),
tagRepository: context.read(),
correspondentRepository: context.read(),
documentTypeRepository: context.read(),
),
child: DocumentUploadPreparationPage(
fileBytes: bytes,
filename: filename,
title: filename,
fileExtension: extension,
),
),
final result = await Navigator.push<DocumentUploadResult>(
context,
MaterialPageRoute(
builder: (context) => BlocProvider.value(
value: DocumentUploadCubit(
documentApi: context.read(),
tagRepository: context.read(),
correspondentRepository: context.read(),
documentTypeRepository: context.read(),
),
) ??
false;
if (success) {
child: DocumentUploadPreparationPage(
fileBytes: bytes,
filename: filename,
title: filename,
fileExtension: extension,
),
),
),
);
if (result?.success ?? false) {
await Fluttertoast.showToast(
msg: S.of(context)!.documentSuccessfullyUploadedProcessing,
);