fix(mobile): fix text search (#14873)
* fix(mobile): fix text search * chore(mobile): add tests for SearchPage * fix(mobile): fix render overflow for small screens Needed for SearchPage test to not throw overflow error * chore(mobile): update import_rule_openapi * styling * preserve styling and skip a test --------- Co-authored-by: Alex <alex.tran1502@gmail.com>
This commit is contained in:
@@ -266,8 +266,8 @@ class SearchFilter {
|
||||
AssetType? mediaType,
|
||||
}) {
|
||||
return SearchFilter(
|
||||
context: context,
|
||||
filename: filename,
|
||||
context: context ?? this.context,
|
||||
filename: filename ?? this.filename,
|
||||
people: people ?? this.people,
|
||||
location: location ?? this.location,
|
||||
camera: camera ?? this.camera,
|
||||
|
||||
@@ -441,19 +441,15 @@ class SearchPage extends HookConsumerWidget {
|
||||
}
|
||||
|
||||
handleTextSubmitted(String value) {
|
||||
if (value.isEmpty) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (isContextualSearch.value) {
|
||||
filter.value = filter.value.copyWith(
|
||||
filename: null,
|
||||
filename: '',
|
||||
context: value,
|
||||
);
|
||||
} else {
|
||||
filter.value = filter.value.copyWith(
|
||||
filename: value,
|
||||
context: null,
|
||||
context: '',
|
||||
);
|
||||
}
|
||||
|
||||
@@ -468,6 +464,7 @@ class SearchPage extends HookConsumerWidget {
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(right: 14.0),
|
||||
child: IconButton(
|
||||
key: const Key('contextual_search_button'),
|
||||
icon: isContextualSearch.value
|
||||
? const Icon(Icons.abc_rounded)
|
||||
: const Icon(Icons.image_search_rounded),
|
||||
@@ -496,6 +493,7 @@ class SearchPage extends HookConsumerWidget {
|
||||
),
|
||||
),
|
||||
child: TextField(
|
||||
key: const Key('search_text_field'),
|
||||
controller: textSearchController,
|
||||
decoration: InputDecoration(
|
||||
contentPadding: prefilter != null
|
||||
@@ -551,6 +549,7 @@ class SearchPage extends HookConsumerWidget {
|
||||
child: SizedBox(
|
||||
height: 50,
|
||||
child: ListView(
|
||||
key: const Key('search_filter_chip_list'),
|
||||
shrinkWrap: true,
|
||||
scrollDirection: Axis.horizontal,
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16),
|
||||
@@ -580,6 +579,7 @@ class SearchPage extends HookConsumerWidget {
|
||||
currentFilter: dateRangeCurrentFilterWidget.value,
|
||||
),
|
||||
SearchFilterChip(
|
||||
key: const Key('media_type_chip'),
|
||||
icon: Icons.video_collection_outlined,
|
||||
onTap: showMediaTypePicker,
|
||||
label: 'search_filter_media_type'.tr(),
|
||||
|
||||
@@ -53,6 +53,7 @@ class FilterBottomSheetScaffold extends StatelessWidget {
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
ElevatedButton(
|
||||
key: const Key('search_filter_apply'),
|
||||
onPressed: () {
|
||||
onSearch();
|
||||
context.pop();
|
||||
|
||||
@@ -17,6 +17,7 @@ class MediaTypePicker extends HookWidget {
|
||||
shrinkWrap: true,
|
||||
children: [
|
||||
RadioListTile(
|
||||
key: const Key("search_filter_media_type_all"),
|
||||
title: const Text("search_filter_media_type_all").tr(),
|
||||
value: AssetType.other,
|
||||
onChanged: (value) {
|
||||
@@ -26,6 +27,7 @@ class MediaTypePicker extends HookWidget {
|
||||
groupValue: selectedMediaType.value,
|
||||
),
|
||||
RadioListTile(
|
||||
key: const Key("search_filter_media_type_image"),
|
||||
title: const Text("search_filter_media_type_image").tr(),
|
||||
value: AssetType.image,
|
||||
onChanged: (value) {
|
||||
@@ -35,6 +37,7 @@ class MediaTypePicker extends HookWidget {
|
||||
groupValue: selectedMediaType.value,
|
||||
),
|
||||
RadioListTile(
|
||||
key: const Key("search_filter_media_type_video"),
|
||||
title: const Text("search_filter_media_type_video").tr(),
|
||||
value: AssetType.video,
|
||||
onChanged: (value) {
|
||||
|
||||
Reference in New Issue
Block a user