Skip to content

Commit

Permalink
i2 - Add option maxWidth for input date field
Browse files Browse the repository at this point in the history
  • Loading branch information
dab246 committed Mar 21, 2023
1 parent ba21cbb commit 609fce1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
4 changes: 4 additions & 0 deletions lib/multiple_view_date_range_picker.dart
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ class MultipleViewDateRangePicker extends StatefulWidget {
final DateTime? endDate;
final List<Widget>? customDateRangeButtons;
final double? radius;
final double? tabletInputFieldMaxWidth;
final bool autoClose;

const MultipleViewDateRangePicker({
Expand All @@ -55,6 +56,7 @@ class MultipleViewDateRangePicker extends StatefulWidget {
this.endDateInputController,
this.customDateRangeButtons,
this.radius,
this.tabletInputFieldMaxWidth,
this.autoClose = true
}) : super(key: key);

Expand Down Expand Up @@ -331,6 +333,7 @@ class _MultipleViewDateRangePickerState extends State<MultipleViewDateRangePicke
},
textInputAction: TextInputAction.next,
hintText: 'dd/mm/yyyy',
maxWidth: double.infinity,
keyboardType: TextInputType.number,
inputFormatters: [DateInputFormatter()],
),
Expand Down Expand Up @@ -494,6 +497,7 @@ class _MultipleViewDateRangePickerState extends State<MultipleViewDateRangePicke
}
},
hintText: 'dd/mm/yyyy',
maxWidth: widget.tabletInputFieldMaxWidth,
textInputAction: TextInputAction.next,
keyboardType: TextInputType.number,
inputFormatters: [DateInputFormatter()],
Expand Down
4 changes: 3 additions & 1 deletion lib/widgets/text_field_builder.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ class TextFieldBuilder extends StatelessWidget {
final bool autoFocus;
final FocusNode? focusNode;
final double borderRadius;
final double? maxWidth;
final String? hintText;
final List<TextInputFormatter>? inputFormatters;

Expand All @@ -31,6 +32,7 @@ class TextFieldBuilder extends StatelessWidget {
this.focusNode,
this.borderRadius = 12.0,
this.hintText,
this.maxWidth,
this.inputFormatters
}) : super(key: key);

Expand Down Expand Up @@ -79,7 +81,7 @@ class TextFieldBuilder extends StatelessWidget {
fontSize: 16,
fontWeight: FontWeight.normal),
filled: true,
constraints: const BoxConstraints(maxWidth: 120),
constraints: BoxConstraints(maxWidth: maxWidth ?? 130),
fillColor: ColorsUtils.colorDefault
),
keyboardAppearance: Brightness.light,
Expand Down

0 comments on commit 609fce1

Please sign in to comment.