Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add canPop() condition #45

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions lib/keyboard.dart
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ class Keyboard extends StatelessWidget {
return Container(
width: keyboardSize.width,
height: keyboardSize.height,
margin: EdgeInsets.only(top: 16),
margin: EdgeInsets.only(top: 26),
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hi, Thanks for the contribution.
Can you please revert this change, since it's not related to a "canPop" functionality?

child: RawKeyboardListener(
focusNode: _focusNode,
autofocus: true,
Expand All @@ -78,7 +78,8 @@ class Keyboard extends StatelessWidget {
onKeyboardTap(event.logicalKey.keyLabel);
return;
}
if (event.logicalKey.keyLabel== 'Backspace' || event.logicalKey.keyLabel == 'Delete') {
if (event.logicalKey.keyLabel == 'Backspace' ||
event.logicalKey.keyLabel == 'Delete') {
onKeyboardTap(Keyboard.deleteButton);
return;
}
Expand Down
7 changes: 6 additions & 1 deletion lib/passcode_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ class PasscodeScreen extends StatefulWidget {
final CancelCallback? cancelCallback;

final Color? backgroundColor;
final AppBar? appBar;
final Widget? bottomWidget;
final List<String>? digits;

Expand All @@ -44,6 +45,7 @@ class PasscodeScreen extends StatefulWidget {
KeyboardUIConfig? keyboardUIConfig,
this.bottomWidget,
this.backgroundColor,
this.appBar,
this.cancelCallback,
this.digits,
}) : circleUIConfig = circleUIConfig ?? const CircleUIConfig(),
Expand Down Expand Up @@ -89,6 +91,7 @@ class _PasscodeScreenState extends State<PasscodeScreen>
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: widget.appBar ?? null,
backgroundColor: widget.backgroundColor ?? Colors.black.withOpacity(0.8),
body: SafeArea(
child: OrientationBuilder(
Expand Down Expand Up @@ -263,7 +266,9 @@ class _PasscodeScreenState extends State<PasscodeScreen>

_showValidation(bool isValid) {
if (isValid) {
Navigator.maybePop(context).then((pop) => _validationCallback());
if (Navigator.canPop(context)) {
Navigator.maybePop(context).then((pop) => _validationCallback());
}
} else {
controller.forward();
}
Expand Down