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 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/keyboard.dart
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,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: AlignedGrid(
keyboardSize: keyboardSize,
children: List.generate(10, (index) {
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 @@ -259,7 +262,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