diff --git a/apps/weblibre/lib/features/geckoview/features/search/presentation/widgets/search_field.dart b/apps/weblibre/lib/features/geckoview/features/search/presentation/widgets/search_field.dart index 1ff8d0d9..f8afd37d 100644 --- a/apps/weblibre/lib/features/geckoview/features/search/presentation/widgets/search_field.dart +++ b/apps/weblibre/lib/features/geckoview/features/search/presentation/widgets/search_field.dart @@ -127,13 +127,16 @@ class SearchField extends HookConsumerWidget { controller: textEditingController, suggestion: suggestion.value, acceptSuggestionOnSubmit: acceptSuggestionOnSubmit, + enableSuggestions: false, + autocorrect: false, enableIMEPersonalizedLearning: !incognitoEnabled, focusNode: safeFocusNode, maxLines: maxLines, textFieldKey: textFieldKey, + keyboardType: TextInputType.webSearch, textInputAction: (maxLines == null || maxLines! > 1) ? TextInputAction.done - : TextInputAction.search, + : TextInputAction.send, minLines: minLines, autofocus: autofocus, onSuggestionDismiss: () { diff --git a/apps/weblibre/lib/features/web_search/presentation/widgets/search_field.dart b/apps/weblibre/lib/features/web_search/presentation/widgets/search_field.dart deleted file mode 100644 index 1307ebd1..00000000 --- a/apps/weblibre/lib/features/web_search/presentation/widgets/search_field.dart +++ /dev/null @@ -1,80 +0,0 @@ -import 'package:flutter/material.dart'; - -class WebSearchField extends StatelessWidget { - final TextEditingController controller; - final bool enabled; - final Future Function(String query) onSubmitted; - final VoidCallback onClear; - - const WebSearchField({ - super.key, - required this.controller, - required this.enabled, - required this.onSubmitted, - required this.onClear, - }); - - @override - Widget build(BuildContext context) { - final colorScheme = Theme.of(context).colorScheme; - - return Container( - height: 60, - padding: const EdgeInsets.only(left: 20, right: 6), - decoration: BoxDecoration( - color: colorScheme.surfaceContainerLow, - borderRadius: BorderRadius.circular(30), - border: Border.all(color: colorScheme.outlineVariant), - ), - child: Row( - children: [ - Icon(Icons.search, color: colorScheme.onSurfaceVariant), - const SizedBox(width: 16), - Expanded( - child: TextField( - controller: controller, - enabled: enabled, - minLines: 1, - maxLines: 5, - keyboardType: TextInputType.multiline, - textInputAction: TextInputAction.search, - style: Theme.of( - context, - ).textTheme.bodyLarge?.copyWith(color: colorScheme.onSurface), - decoration: InputDecoration( - border: InputBorder.none, - hintText: 'Search the web...', - hintStyle: TextStyle(color: colorScheme.onSurfaceVariant), - isDense: true, - ), - onSubmitted: enabled ? onSubmitted : null, - ), - ), - ValueListenableBuilder( - valueListenable: controller, - builder: (context, value, child) { - if (value.text.isEmpty) { - return const SizedBox.shrink(); - } - - return IconButton( - tooltip: 'Clear', - onPressed: enabled ? onClear : null, - icon: Icon(Icons.close, color: colorScheme.onSurfaceVariant), - ); - }, - ), - const SizedBox(width: 4), - FilledButton( - onPressed: enabled ? () => onSubmitted(controller.text) : null, - style: FilledButton.styleFrom( - elevation: 0, - padding: const EdgeInsets.symmetric(horizontal: 24, vertical: 12), - ), - child: const Text('Search'), - ), - ], - ), - ); - } -} diff --git a/apps/weblibre/lib/presentation/widgets/auto_suggest_text_field.dart b/apps/weblibre/lib/presentation/widgets/auto_suggest_text_field.dart index dff8a224..7e41d915 100644 --- a/apps/weblibre/lib/presentation/widgets/auto_suggest_text_field.dart +++ b/apps/weblibre/lib/presentation/widgets/auto_suggest_text_field.dart @@ -51,6 +51,7 @@ class AutoSuggestTextField extends HookWidget { final TapRegionCallback? onTapOutside; final VoidCallback? onTap; final VoidCallback? onSuggestionDismiss; + final bool enableSuggestions; final bool autocorrect; final GlobalKey? textFieldKey; @@ -86,6 +87,7 @@ class AutoSuggestTextField extends HookWidget { this.onTapOutside, this.onTap, this.onSuggestionDismiss, + this.enableSuggestions = false, this.autocorrect = false, this.textFieldKey, this.acceptSuggestionOnSubmit = false, @@ -217,6 +219,7 @@ class AutoSuggestTextField extends HookWidget { onChanged: onChanged, onEditingComplete: onEditingComplete, validator: validator, + enableSuggestions: enableSuggestions, autocorrect: autocorrect, onFieldSubmitted: onSubmitted.mapNotNull( (onSubmitted) => (value) {