Skip to content

Commit

Permalink
🐛 User inputs are not caught by underlying screen when Mask hides
Browse files Browse the repository at this point in the history
Fixes #942
  • Loading branch information
Chralu authored and redDwarf03 committed Jun 4, 2024
1 parent 1654be6 commit fcf4003
Showing 1 changed file with 11 additions and 37 deletions.
48 changes: 11 additions & 37 deletions lib/ui/views/authenticate/lock_overlay.mixin.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,40 +2,6 @@ import 'dart:developer';

import 'package:flutter/material.dart';

class LockOverlay {
LockOverlay(this.child);

final Widget child;

OverlayEntry? _overlayEntry;
static const _logName = 'LockOverlay';

void show(BuildContext context) {
log('Show', name: _logName);
if (_overlayEntry != null) {
log('... already visible. Abort', name: _logName);
return;
}

_overlayEntry = OverlayEntry(
builder: (context) => child,
);
Overlay.of(context).insert(_overlayEntry!);
}

void hide() {
log('Hide', name: _logName);
if (_overlayEntry == null) {
log('... not visible. Abort', name: _logName);
return;
}

_overlayEntry?.remove();
_overlayEntry?.dispose();
_overlayEntry = null;
}
}

mixin LockOverlayMixin {
Widget get child;

Expand All @@ -62,8 +28,16 @@ mixin LockOverlayMixin {
return;
}

_overlayEntry?.remove();
_overlayEntry?.dispose();
_overlayEntry = null;
/// That delay prevent user inputs to be caught by underlying
/// screen during Lock overlay hiding.
/// https://github.com/archethic-foundation/archethic-wallet/issues/942
Future.delayed(
const Duration(milliseconds: 50),
() {
_overlayEntry?.remove();
_overlayEntry?.dispose();
_overlayEntry = null;
},
);
}
}

0 comments on commit fcf4003

Please sign in to comment.