Skip to content

Commit

Permalink
🐛 Fixed a bug where the image display was deleted after previewing th…
Browse files Browse the repository at this point in the history
…e image
  • Loading branch information
ilgnefz committed Jul 28, 2024
1 parent a19d172 commit 02e63a6
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions lib/views/content_bar/rename/view_mode/preview_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import 'package:flutter/services.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:once_power/core/core.dart';
import 'package:once_power/model/model.dart';
import 'package:once_power/provider/file.dart';

import 'err_image.dart';

Expand Down Expand Up @@ -51,8 +52,12 @@ class _PreviewImageViewState extends ConsumerState<PreviewImageView> {
void delete() {
String id = widget.files[index].id;
deleteOne(ref, id);
next();
setState(() {});
if (ref.watch(fileListProvider).isNotEmpty) {
next();
setState(() {});
} else {
Navigator.pop(context);
}
}

void onKeyEvent(KeyEvent e) {
Expand Down

0 comments on commit 02e63a6

Please sign in to comment.