Skip to content

Commit

Permalink
upd
Browse files Browse the repository at this point in the history
  • Loading branch information
witwash committed Jun 28, 2024
1 parent 3237da2 commit f832fda
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
4 changes: 4 additions & 0 deletions optimus/lib/src/form/input_field.dart
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,10 @@ class OptimusInputField extends StatefulWidget {
final int? maxCharacters;

/// {@macro flutter.widgets.editableText.minLines}
///
/// If the input is multi-lined we recommend you to set the [keyboardType] to
/// [TextInputType.multiline] otherwise the move to the next line won't work
/// properly.
final int? minLines;
final TextEditingController? controller;
final String? error;
Expand Down
21 changes: 20 additions & 1 deletion storybook/lib/stories/input.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import 'package:flutter/widgets.dart';
import 'package:flutter/material.dart';
import 'package:optimus/optimus.dart';
import 'package:storybook/utils.dart';
import 'package:storybook_flutter/storybook_flutter.dart';
Expand Down Expand Up @@ -45,6 +45,11 @@ final Story inputStory = Story(
}
final minLines =
k.sliderInt(label: 'Min lines', initial: 1, min: 1, max: 10);
final keyboardType = k.options(
label: 'Keyboard Type:',
initial: null,
options: KeyboardType.values.toOptions().withEmpty(),
);
final inline = k.boolean(label: 'Inline', initial: false);
final autoCollapse = k.boolean(label: 'Auto Collapse', initial: true);

Expand All @@ -65,6 +70,7 @@ final Story inputStory = Story(
maxCharacters: maxChars,
minLines: minLines,
maxLines: minLines,
keyboardType: keyboardType?.inputType,
prefix: prefix.isNotEmpty ? Text(prefix) : null,
suffix: suffix.isNotEmpty ? Text(suffix) : null,
leading: leadingIcon == null ? null : Icon(leadingIcon),
Expand Down Expand Up @@ -92,3 +98,16 @@ final Story inputStory = Story(
);
},
);

enum KeyboardType {
text(TextInputType.text),
multiline(TextInputType.multiline),
number(TextInputType.number),
phone(TextInputType.phone),
datetime(TextInputType.datetime),
emailAddress(TextInputType.emailAddress),
url(TextInputType.url);

const KeyboardType(this.inputType);
final TextInputType inputType;
}

0 comments on commit f832fda

Please sign in to comment.