Unverified Commit 6636da40 authored by Michael Goderbauer's avatar Michael Goderbauer Committed by GitHub

Show Search Button on keyboard for search widget (#19011)

Also:
 * Export TextInputAction from `text_field.dart` to parallel `TextInputType`.
parent 1cd09e54
......@@ -412,11 +412,11 @@ class _SearchPageState<T> extends State<_SearchPage<T>> {
textTheme: theme.primaryTextTheme,
brightness: theme.primaryColorBrightness,
leading: widget.delegate.buildLeading(context),
// TODO(goderbauer): Show the search key (instead of enter) on keyboard, https://github.com/flutter/flutter/issues/17525
title: new TextField(
controller: queryTextController,
focusNode: widget.delegate._focusNode,
style: theme.textTheme.title,
textInputAction: TextInputAction.search,
onSubmitted: (String _) {
widget.delegate.showResults(context);
},
......
......@@ -17,7 +17,7 @@ import 'material.dart';
import 'text_selection.dart';
import 'theme.dart';
export 'package:flutter/services.dart' show TextInputType;
export 'package:flutter/services.dart' show TextInputType, TextInputAction;
/// A material design text field.
///
......
......@@ -463,6 +463,20 @@ void main() {
expect(nestedSearchResults, <String>[null]);
expect(selectedResults, <String>['Result Foo']);
});
testWidgets('keyboard show search button', (WidgetTester tester) async {
final _TestSearchDelegate delegate = new _TestSearchDelegate();
await tester.pumpWidget(new TestHomePage(
delegate: delegate,
));
await tester.tap(find.byTooltip('Search'));
await tester.pumpAndSettle();
await tester.showKeyboard(find.byType(TextField));
expect(tester.testTextInput.setClientArgs['inputAction'], TextInputAction.search.toString());
});
}
class TestHomePage extends StatelessWidget {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment