@@ -288,12 +288,13 @@ class _ContentInput extends StatefulWidget {
288
288
State <_ContentInput > createState () => _ContentInputState ();
289
289
}
290
290
291
- class _ContentInputState extends State <_ContentInput > {
291
+ class _ContentInputState extends State <_ContentInput > with WidgetsBindingObserver {
292
292
@override
293
293
void initState () {
294
294
super .initState ();
295
295
widget.controller.addListener (_contentChanged);
296
296
widget.focusNode.addListener (_focusChanged);
297
+ WidgetsBinding .instance.addObserver (this );
297
298
}
298
299
299
300
@override
@@ -313,6 +314,7 @@ class _ContentInputState extends State<_ContentInput> {
313
314
void dispose () {
314
315
widget.controller.removeListener (_contentChanged);
315
316
widget.focusNode.removeListener (_focusChanged);
317
+ WidgetsBinding .instance.removeObserver (this );
316
318
super .dispose ();
317
319
}
318
320
@@ -337,6 +339,22 @@ class _ContentInputState extends State<_ContentInput> {
337
339
store.typingNotifier.stoppedComposing ();
338
340
}
339
341
342
+ @override
343
+ void didChangeAppLifecycleState (AppLifecycleState state) {
344
+ switch (state) {
345
+ // For AppLifecycleState changes, only signal the end of typing when
346
+ // > [the] application is not currently visible to the user, and not
347
+ // > responding to user input.
348
+ case AppLifecycleState .hidden:
349
+ case AppLifecycleState .paused:
350
+ final store = PerAccountStoreWidget .of (context);
351
+ store.typingNotifier.stoppedComposing ();
352
+ case AppLifecycleState .detached:
353
+ case AppLifecycleState .inactive:
354
+ case AppLifecycleState .resumed:
355
+ }
356
+ }
357
+
340
358
@override
341
359
Widget build (BuildContext context) {
342
360
ColorScheme colorScheme = Theme .of (context).colorScheme;
0 commit comments