Update text_form_field.dart (#81043)
This commit is contained in:
committed by
GitHub
parent
ec91c6582b
commit
741bb9d329
@@ -228,7 +228,7 @@ class TextFormField extends FormField<String> {
|
|||||||
'minLines and maxLines must be null when expands is true.',
|
'minLines and maxLines must be null when expands is true.',
|
||||||
),
|
),
|
||||||
assert(!obscureText || maxLines == 1, 'Obscured fields cannot be multiline.'),
|
assert(!obscureText || maxLines == 1, 'Obscured fields cannot be multiline.'),
|
||||||
assert(maxLength == null || maxLength > 0),
|
assert(maxLength == null || maxLength == TextField.noMaxLength || maxLength > 0),
|
||||||
assert(enableInteractiveSelection != null),
|
assert(enableInteractiveSelection != null),
|
||||||
super(
|
super(
|
||||||
key: key,
|
key: key,
|
||||||
|
|||||||
@@ -114,6 +114,19 @@ void main() {
|
|||||||
expect(find.byType(CupertinoButton), findsNothing);
|
expect(find.byType(CupertinoButton), findsNothing);
|
||||||
}, variant: const TargetPlatformVariant(<TargetPlatform>{ TargetPlatform.macOS, TargetPlatform.windows, TargetPlatform.linux }), skip: kIsWeb);
|
}, variant: const TargetPlatformVariant(<TargetPlatform>{ TargetPlatform.macOS, TargetPlatform.windows, TargetPlatform.linux }), skip: kIsWeb);
|
||||||
|
|
||||||
|
testWidgets('TextFormField accepts TextField.noMaxLength as value to maxLength parameter', (WidgetTester tester) async {
|
||||||
|
bool asserted;
|
||||||
|
try {
|
||||||
|
TextFormField(
|
||||||
|
maxLength: TextField.noMaxLength,
|
||||||
|
);
|
||||||
|
asserted = false;
|
||||||
|
} catch (e){
|
||||||
|
asserted = true;
|
||||||
|
}
|
||||||
|
expect(asserted, false);
|
||||||
|
});
|
||||||
|
|
||||||
testWidgets('Passes textAlign to underlying TextField', (WidgetTester tester) async {
|
testWidgets('Passes textAlign to underlying TextField', (WidgetTester tester) async {
|
||||||
const TextAlign alignment = TextAlign.center;
|
const TextAlign alignment = TextAlign.center;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user