Skip to content

Commit 175d160

Browse files
committed
feat: add disable enter to submit
1 parent 57b75c7 commit 175d160

File tree

3 files changed

+17
-1
lines changed

3 files changed

+17
-1
lines changed

lib/app_flow_systems/steps_bar.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ class StepsBar extends StatelessWidget {
9696
{
9797
rowChildren.add(
9898
SmoothSwap<bool>(
99+
key: ValueKey('${_nextButtonTitle()}:${_finalNextButtonTitle()}'),
99100
value: currentIndex == stepsCount - 1,
100101
builder: (context, isFinalButton)
101102
{

lib/blue_forms/blue_forms.dart

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ class BlueForms extends StatefulWidget {
2121
final String? cancelButtonTitle;
2222
final bool intrinsicHeight;
2323
final bool visuallyMarkRequiredFields;
24+
final bool disableEnterToSubmit;
2425
final Widget? bottomContent;
2526
final Color? labelColor;
2627
final bool clipPagination;
@@ -39,6 +40,7 @@ class BlueForms extends StatefulWidget {
3940
this.intrinsicHeight = false,
4041
this.visuallyMarkRequiredFields = true,
4142
this.clipPagination = true,
43+
this.disableEnterToSubmit = false,
4244
this.bottomContent,
4345
this.labelColor,
4446
required this.pages,
@@ -200,7 +202,15 @@ class _BlueFormsState extends State<BlueForms> {
200202
currentSavedValues: _savedInputs,
201203
externalErrors: widget.externalErrors,
202204
onValidationFailed: () => setState(() {}),
203-
onWidgetRequestedSubmit: _onNext,
205+
onWidgetRequestedSubmit: ()
206+
{
207+
if (widget.disableEnterToSubmit)
208+
{
209+
return;
210+
}
211+
212+
_onNext();
213+
},
204214
onSave: (id, value)
205215
{
206216
_savedInputs[id] = value;

lib/type_extensions/date_time.dart

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,10 @@ extension ExtensionOnDateTime on DateTime {
2727
return thisDate.year == other.year && thisDate.month == other.month && thisDate.day == other.day;
2828
}
2929

30+
int get quarter
31+
{
32+
return ((month - 1) / 3).floor() + 1;
33+
}
34+
3035

3136
}

0 commit comments

Comments
 (0)