fix(app): a phrase field keeps its focus as the app goes and comes back
SecretScreen built its child alone, and a stack around it with the cover while the app was away (iOS), so each switch of apps built the child anew: a phrase field lost its focus, its caret and what the keyboard was composing (the short reading's L4). It always builds the stack now, laid out as the child alone (StackFit.passthrough), the cover in it only while away. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Tizian 「ティツィアーン」 <raisondetredev@pm.me>
This commit is contained in:
parent
87529cd5c6
commit
1ca4e083bb
1 changed files with 44 additions and 10 deletions
|
|
@ -108,18 +108,19 @@ class _SecretScreenState() extends State<SecretScreen> {
|
|||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
if (!(_away && (widget.coversWhenAway ?? Platform.isIOS))) {
|
||||
return widget.child;
|
||||
}
|
||||
return Stack(
|
||||
children: [
|
||||
widget.child,
|
||||
Widget build(BuildContext context) => Stack(
|
||||
// Always the stack, the cover in it only while away: [child] keeps its
|
||||
// place in the tree, so a field in it keeps its focus and what the
|
||||
// keyboard was composing as the app goes and comes back (the short
|
||||
// reading's L4); laid out as without it.
|
||||
fit: StackFit.passthrough,
|
||||
children: [
|
||||
widget.child,
|
||||
if (_away && (widget.coversWhenAway ?? Platform.isIOS))
|
||||
Positioned.fill(
|
||||
key: SecretScreen.coverKey,
|
||||
child: ColoredBox(color: Theme.of(context).colorScheme.surface),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
],
|
||||
);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue