File tree 5 files changed +17
-5
lines changed
5 files changed +17
-5
lines changed Original file line number Diff line number Diff line change @@ -362,4 +362,6 @@ class CurrentIndexCubit extends Cubit<CurrentIndex> {
362
362
emit (state.copyWith (
363
363
location: location ?? state.location, saved: saved ?? state.saved));
364
364
}
365
+
366
+ void resetInput () {}
365
367
}
Original file line number Diff line number Diff line change @@ -6,8 +6,8 @@ import 'package:butterfly/models/document.dart';
6
6
import 'package:butterfly/models/template.dart' ;
7
7
import 'package:flutter/material.dart' ;
8
8
import 'package:flutter_bloc/flutter_bloc.dart' ;
9
- import 'package:go_router/go_router.dart' ;
10
9
import 'package:flutter_gen/gen_l10n/app_localizations.dart' ;
10
+ import 'package:go_router/go_router.dart' ;
11
11
import 'package:phosphor_flutter/phosphor_flutter.dart' ;
12
12
13
13
import '../../api/format_date_time.dart' ;
@@ -164,7 +164,6 @@ class _CreateStartViewState extends State<_CreateStartView> {
164
164
createdAt: DateTime .now (),
165
165
);
166
166
167
- bloc.clearHistory ();
168
167
transformCubit.reset ();
169
168
currentIndexCubit.reset (document);
170
169
bloc.emit (DocumentLoadSuccess (document,
@@ -175,6 +174,7 @@ class _CreateStartViewState extends State<_CreateStartView> {
175
174
'' ),
176
175
currentIndexCubit: currentIndexCubit,
177
176
settingsCubit: settingsCubit));
177
+ bloc.clearHistory ();
178
178
await bloc.load ();
179
179
});
180
180
},
Original file line number Diff line number Diff line change @@ -26,7 +26,7 @@ import 'setup.dart' if (dart.library.html) 'setup_web.dart';
26
26
import 'theme/manager.dart' ;
27
27
import 'views/main.dart' ;
28
28
29
- const kFileVersion = 6 ;
29
+ const kFileVersion = 5 ;
30
30
Future <void > main ([List <String > args = const []]) async {
31
31
WidgetsFlutterBinding .ensureInitialized ();
32
32
Original file line number Diff line number Diff line change @@ -21,7 +21,8 @@ class MainViewViewport extends StatefulWidget {
21
21
22
22
enum _MouseState { normal, inverse, scale }
23
23
24
- class _MainViewViewportState extends State <MainViewViewport > {
24
+ class _MainViewViewportState extends State <MainViewViewport >
25
+ with WidgetsBindingObserver {
25
26
double size = 1.0 ;
26
27
GlobalKey paintKey = GlobalKey ();
27
28
_MouseState _mouseState = _MouseState .normal;
@@ -40,6 +41,15 @@ class _MainViewViewportState extends State<MainViewViewport> {
40
41
super .dispose ();
41
42
}
42
43
44
+ @override
45
+ void didChangeAppLifecycleState (AppLifecycleState state) {
46
+ if (state == AppLifecycleState .resumed) {
47
+ context.read <DocumentBloc >().refresh ();
48
+ } else {
49
+ context.read <CurrentIndexCubit >().resetInput ();
50
+ }
51
+ }
52
+
43
53
void _handleKey (RawKeyEvent event) {
44
54
if (event.data.isShiftPressed) {
45
55
_mouseState = _MouseState .inverse;
Original file line number Diff line number Diff line change @@ -68,7 +68,7 @@ dev_dependencies:
68
68
freezed : ^2.1.0+1
69
69
build_runner : ^2.2.0
70
70
json_serializable : ^6.3.1
71
- espresso : ^0.2.0+3
71
+ espresso : ^0.2.0+4
72
72
73
73
# For information on the generic Dart part of this file, see the
74
74
# following page: https://dart.dev/tools/pub/pubspec
You can’t perform that action at this time.
0 commit comments