Skip to content

Commit

Permalink
Pop route if importing was unsuccessful
Browse files Browse the repository at this point in the history
  • Loading branch information
CodeDoctorDE committed Dec 27, 2024
1 parent 8208505 commit f5bc161
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions app/lib/services/import.dart
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,7 @@ class ImportService {
builder: (context) => NameDialog(
title: AppLocalizations.of(context).password,
button: AppLocalizations.of(context).open,
obscureText: true,
),
);
if (password == null) return null;
Expand Down
5 changes: 5 additions & 0 deletions app/lib/views/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'package:go_router/go_router.dart';
import 'package:lw_file_system/lw_file_system.dart';
import 'package:material_leap/material_leap.dart';
import 'package:phosphor_flutter/phosphor_flutter.dart';
Expand Down Expand Up @@ -188,6 +189,10 @@ class _ProjectPageState extends State<ProjectPage> {
document ??= await globalImportService.load(
type: widget.type.isEmpty ? (fileType ?? widget.type) : widget.type,
data: data);
if (document == null) {
GoRouter.of(context).pop();
return;
}
}
final name = absolute ? location!.fileName : '';
NoteData? defaultDocument;
Expand Down

0 comments on commit f5bc161

Please sign in to comment.