TextFormField/TextField - remove spaces in character counter (#18096)

* TextFormField/TextField - remove spaces in character counter(follow material design guidelines)
This commit is contained in:
Tran Huy Phuc
2018-06-04 23:41:31 +07:00
committed by Hans Muller
parent 609b996846
commit 34933f801f
2 changed files with 7 additions and 7 deletions

View File

@@ -317,7 +317,7 @@ class _TextFieldState extends State<TextField> with AutomaticKeepAliveClientMixi
if (!needsCounter)
return effectiveDecoration;
final String counterText = '${_effectiveController.value.text.runes.length} / ${widget.maxLength}';
final String counterText = '${_effectiveController.value.text.runes.length}/${widget.maxLength}';
if (_effectiveController.value.text.runes.length > widget.maxLength) {
final ThemeData themeData = Theme.of(context);
return effectiveDecoration.copyWith(

View File

@@ -1620,16 +1620,16 @@ void main() {
await tester.pump();
expect(textController.text, '0123456789101112');
expect(find.text('16 / 10'), findsOneWidget);
Text counterTextWidget = tester.widget(find.text('16 / 10'));
expect(find.text('16/10'), findsOneWidget);
Text counterTextWidget = tester.widget(find.text('16/10'));
expect(counterTextWidget.style.color, equals(Colors.deepPurpleAccent));
await tester.enterText(find.byType(TextField), '0123456789');
await tester.pump();
expect(textController.text, '0123456789');
expect(find.text('10 / 10'), findsOneWidget);
counterTextWidget = tester.widget(find.text('10 / 10'));
expect(find.text('10/10'), findsOneWidget);
counterTextWidget = tester.widget(find.text('10/10'));
expect(counterTextWidget.style.color, isNot(equals(Colors.deepPurpleAccent)));
});
@@ -1647,12 +1647,12 @@ void main() {
),
));
expect(find.text('0 / 10'), findsOneWidget);
expect(find.text('0/10'), findsOneWidget);
await tester.enterText(find.byType(TextField), '01234');
await tester.pump();
expect(find.text('5 / 10'), findsOneWidget);
expect(find.text('5/10'), findsOneWidget);
});
testWidgets('TextField identifies as text field in semantics', (WidgetTester tester) async {