when a Flash appears, it hides the keyboard
AymanProjects opened this issue · comments
Hi @AymanProjects, Now the code is as expected. Maybe you need add autofocus: true
in TextFormField
or TextField
.
Example:
Form(
child: TextFormField(
controller: editingController,
autofocus: true,
),
)
That solved the problem, Thanks ♥
I have the same issue, how to prevent interrupt the typing when Flash appears?
Any help is appreciated!
Hi @AymanProjects, Now the code is as expected. Maybe you need add
autofocus: true
inTextFormField
orTextField
.Example:
Form( child: TextFormField( controller: editingController, autofocus: true, ), )
@ming-chu example:
Line 421 in 839f8c2
@sososdk Thanks for your reply.
Here is my case:
I use this lib for the top bar notification, maybe with frequency like 20 times/minutes.
when users typing and respond to the msg, this will interrupt the typing.
@sososdk
I am developing a chat app. I use this lib for showing new message notifications.
When Flash
appears, it blocks the entire screen with overlay and closes the keyboard.
The input will focus again after the Flash
is finished, but the process of typing was interrupted which cannot keep typing when the Flash
show up.
It was fine on flash: ^1.3.1
@sososdk Thanks for the reply and here is the code
showFlash(
context: context,
duration: const Duration(seconds: 2),
persistent: true,
builder: (_, controller) {
return Flash(
controller: controller,
backgroundColor: Colors.white,
brightness: Brightness.light,
boxShadows: [BoxShadow(blurRadius: 4)],
barrierBlur: 3.0,
barrierColor: Colors.black38,
barrierDismissible: true,
behavior: FlashBehavior.floating,
position: FlashPosition.top,
child: FlashBar(
title: Text('You have a new msg!'),
content: Text('hello world~'),
),
);
},
);
after I set persistent: false
it got an exception 🤔
E/flutter ( 5759): [ERROR:flutter/lib/ui/ui_dart_state.cc(186)] Unhandled Exception: 'package:flash/flash.dart': Failed assertion: line 98 pos 14: 'overlay != rootOverlay': overlay can't be the root overlay when persistent is false
E/flutter ( 5759): #0 _AssertionError._doThrowNew (dart:core-patch/errors_patch.dart:46:39)
E/flutter ( 5759): #1 _AssertionError._throwNew (dart:core-patch/errors_patch.dart:36:5)
E/flutter ( 5759): #2 new FlashController (package:flash/flash.dart:98:14)
E/flutter ( 5759): #3 showFlash (package:flash/flash.dart:25:10)
@ming-chu try to remove barrierBlur
and barrierColor
, and set persistent: true
.
barrierBlur
and barrierColor
will block the behind view.
@ming-chu try to remove
barrierBlur
andbarrierColor
, and setpersistent: true
.
barrierBlur
andbarrierColor
will block the behind view.
Thanks for the advice, I will try it👍
@sososdk
it works!!! Thank you very much!
You are my hero!