Add helper widget parameter to InputDecoration (#145157)
This pull request introduces a new field named `helper` to the InputDecoration class. This field allows for specifying a widget containing contextual information about the InputDecorator.child's value. Unlike `helperText`, which accepts a plain string, `helper` supports widgets, enabling functionalities like tappable links for further explanation. This change aligns with the established pattern of `error`, `label`, `prefix`, and `suffix`. fixes [#145163](https://github.com/flutter/flutter/issues/145163)
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
// Copyright 2014 The Flutter Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_api_samples/material/input_decorator/input_decoration.helper.0.dart' as example;
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
void main() {
|
||||
testWidgets('InputDecorator helper', (WidgetTester tester) async {
|
||||
await tester.pumpWidget(
|
||||
const example.HelperExampleApp(),
|
||||
);
|
||||
|
||||
expect(find.byType(TextField), findsOneWidget);
|
||||
expect(find.text('Helper Text '), findsOneWidget);
|
||||
expect(find.byIcon(Icons.help_outline), findsOneWidget);
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user