mirror of
https://github.com/GitJournal/GitJournal.git
synced 2025-06-29 10:17:16 +08:00
FocusMode: Do not accept inputs on the hidden elements
Setting the opacity to 0 doesn't meant we cannot interact with them.
This commit is contained in:
@ -58,9 +58,8 @@ class _EditorScaffoldState extends State<EditorScaffold> {
|
|||||||
return Scaffold(
|
return Scaffold(
|
||||||
body: Column(
|
body: Column(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
AnimatedOpacity(
|
_AnimatedOpacityIgnorePointer(
|
||||||
duration: const Duration(milliseconds: 500),
|
visible: !hideUIElements,
|
||||||
opacity: hideUIElements ? 0.0 : 1.0,
|
|
||||||
child: EditorAppBar(
|
child: EditorAppBar(
|
||||||
editor: widget.editor,
|
editor: widget.editor,
|
||||||
editorState: widget.editorState,
|
editorState: widget.editorState,
|
||||||
@ -81,9 +80,8 @@ class _EditorScaffoldState extends State<EditorScaffold> {
|
|||||||
behavior: HitTestBehavior.translucent,
|
behavior: HitTestBehavior.translucent,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
AnimatedOpacity(
|
_AnimatedOpacityIgnorePointer(
|
||||||
duration: const Duration(milliseconds: 500),
|
visible: !hideUIElements,
|
||||||
opacity: hideUIElements ? 0.0 : 1.0,
|
|
||||||
child: EditorBottomBar(
|
child: EditorBottomBar(
|
||||||
editor: widget.editor,
|
editor: widget.editor,
|
||||||
editorState: widget.editorState,
|
editorState: widget.editorState,
|
||||||
@ -107,3 +105,23 @@ class _EditorScaffoldState extends State<EditorScaffold> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class _AnimatedOpacityIgnorePointer extends StatelessWidget {
|
||||||
|
final bool visible;
|
||||||
|
final Widget child;
|
||||||
|
|
||||||
|
_AnimatedOpacityIgnorePointer({@required this.visible, @required this.child});
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
var opacity = visible ? 1.0 : 0.0;
|
||||||
|
return IgnorePointer(
|
||||||
|
ignoring: !visible,
|
||||||
|
child: AnimatedOpacity(
|
||||||
|
duration: const Duration(milliseconds: 500),
|
||||||
|
opacity: opacity,
|
||||||
|
child: child,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Reference in New Issue
Block a user