Skip to content

Commit

Permalink
feat: notify user if save pdf failed
Browse files Browse the repository at this point in the history
  • Loading branch information
ibrahimozkn committed Oct 15, 2024
1 parent ba554d4 commit cddebc4
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion app/lib/util/save_pdf.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import 'package:flutter/services.dart';
import 'package:flutter_file_dialog/flutter_file_dialog.dart';
import 'package:pdf/pdf.dart';
import 'package:pdf/widgets.dart' as pw;
import 'package:studyu_app/util/error_handler.dart';
import 'package:studyu_core/core.dart';

Future<String?> savePDF(
BuildContext context,
Expand Down Expand Up @@ -35,7 +37,14 @@ Future<String?> savePDF(

return filePath.split(':')[1];
} catch (e) {
print('Error saving file with FileDialog $e');
StudyULogger.error('An error occurred while saving the PDF: $e');

if (!context.mounted) return null;
ErrorHandler.showSnackbar(
context,
'An error occurred while saving the PDF.',
);

return null;
}
}

0 comments on commit cddebc4

Please sign in to comment.