Skip to content

Feat/enable editing in middle #213

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

Open
wants to merge 3 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
26 changes: 26 additions & 0 deletions lib/src/pinput.dart
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ class Pinput extends StatefulWidget {
this.enabled = true,
this.readOnly = false,
this.useNativeKeyboard = true,
this.enableEditingInMiddle = false,
this.toolbarEnabled = true,
this.autofocus = false,
this.obscureText = false,
Expand All @@ -86,6 +87,7 @@ class Pinput extends StatefulWidget {
this.enableSuggestions = true,
this.hapticFeedbackType = HapticFeedbackType.disabled,
this.closeKeyboardWhenCompleted = true,
this.callOnCompletedOnlyOnUnfocus = false,
this.keyboardType = TextInputType.number,
this.textCapitalization = TextCapitalization.none,
this.slideTransitionBeginOffset,
Expand Down Expand Up @@ -141,12 +143,14 @@ class Pinput extends StatefulWidget {
this.enabled = true,
this.readOnly = false,
this.useNativeKeyboard = true,
this.enableEditingInMiddle = false,
this.toolbarEnabled = true,
this.autofocus = false,
this.enableIMEPersonalizedLearning = false,
this.enableSuggestions = true,
this.hapticFeedbackType = HapticFeedbackType.disabled,
this.closeKeyboardWhenCompleted = true,
this.callOnCompletedOnlyOnUnfocus = false,
this.keyboardType = TextInputType.number,
this.textCapitalization = TextCapitalization.none,
this.keyboardAppearance,
Expand Down Expand Up @@ -216,6 +220,10 @@ class Pinput extends StatefulWidget {
/// If true keyboard will be closed
final bool closeKeyboardWhenCompleted;

/// If true, onCompleted will only be called when the field loses focus and all cells are filled.
/// If false (default), onCompleted will be called immediately when all cells are filled during editing.
final bool callOnCompletedOnlyOnUnfocus;

/// Displayed fields count. PIN code length.
final int length;

Expand Down Expand Up @@ -312,6 +320,10 @@ class Pinput extends StatefulWidget {
/// so you should set value of [Pinput]'s [TextEditingController] programmatically
final bool useNativeKeyboard;

/// Whether to enable editing PIN from the middle by tapping on individual PIN positions
/// When enabled, users can tap on any position to place the cursor there and edit from that position
final bool enableEditingInMiddle;

/// If true, paste button will appear on longPress event
final bool toolbarEnabled;

Expand Down Expand Up @@ -508,6 +520,13 @@ class Pinput extends StatefulWidget {
defaultValue: true,
),
);
properties.add(
DiagnosticsProperty<bool>(
'callOnCompletedOnlyOnUnfocus',
callOnCompletedOnlyOnUnfocus,
defaultValue: false,
),
);
properties.add(
DiagnosticsProperty<TextInputType>(
'keyboardType',
Expand Down Expand Up @@ -656,6 +675,13 @@ class Pinput extends StatefulWidget {
defaultValue: true,
),
);
properties.add(
DiagnosticsProperty<bool>(
'enablePinAutofill',
enableEditingInMiddle,
defaultValue: true,
),
);
properties.add(
DiagnosticsProperty<bool>(
'showCursor',
Expand Down
Loading