feat: 热搜词跳转直播
This commit is contained in:
@ -29,7 +29,7 @@ class SSearchController extends GetxController {
|
||||
// 其他页面跳转过来
|
||||
if (Get.parameters.keys.isNotEmpty) {
|
||||
if (Get.parameters['keyword'] != null) {
|
||||
onClickKeyword(Get.parameters['keyword']!);
|
||||
onClickKeyword(Get.parameters['keyword']!, null);
|
||||
}
|
||||
if (Get.parameters['hintText'] != null) {
|
||||
hintText = Get.parameters['hintText']!;
|
||||
@ -88,7 +88,12 @@ class SSearchController extends GetxController {
|
||||
}
|
||||
|
||||
// 点击热搜关键词
|
||||
void onClickKeyword(String keyword) {
|
||||
void onClickKeyword(String keyword, item) {
|
||||
if (item != null && item.wordType == 7) {
|
||||
Get.toNamed('/liveRoom?roomid=${item.liveId.first}',
|
||||
arguments: {'liveItem': null, 'heroTag': '${item.liveId.first}'});
|
||||
return;
|
||||
}
|
||||
searchKeyWord.value = keyword;
|
||||
controller.value.text = keyword;
|
||||
// 移动光标
|
||||
|
||||
@ -115,8 +115,8 @@ class _SearchPageState extends State<SearchPage> with RouteAware {
|
||||
customBorder: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(4),
|
||||
),
|
||||
onTap: () => ssCtr
|
||||
.onClickKeyword(ssCtr.searchSuggestList[index].term!),
|
||||
onTap: () => ssCtr.onClickKeyword(
|
||||
ssCtr.searchSuggestList[index].term!, null),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(left: 20, top: 9, bottom: 9),
|
||||
child: ssCtr.searchSuggestList[index].textRich,
|
||||
@ -178,11 +178,11 @@ class _SearchPageState extends State<SearchPage> with RouteAware {
|
||||
width: width,
|
||||
// ignore: invalid_use_of_protected_member
|
||||
hotSearchList: _searchController.hotSearchList.value,
|
||||
onClick: (keyword) async {
|
||||
onClick: (keyword, item) async {
|
||||
_searchController.searchFocusNode.unfocus();
|
||||
await Future.delayed(
|
||||
const Duration(milliseconds: 150));
|
||||
_searchController.onClickKeyword(keyword);
|
||||
_searchController.onClickKeyword(keyword, item);
|
||||
},
|
||||
),
|
||||
);
|
||||
@ -193,7 +193,6 @@ class _SearchPageState extends State<SearchPage> with RouteAware {
|
||||
);
|
||||
}
|
||||
} else {
|
||||
// 缓存数据
|
||||
return const SizedBox();
|
||||
}
|
||||
},
|
||||
|
||||
@ -26,7 +26,7 @@ class HotKeyword extends StatelessWidget {
|
||||
borderRadius: BorderRadius.circular(3),
|
||||
clipBehavior: Clip.hardEdge,
|
||||
child: InkWell(
|
||||
onTap: () => onClick!(i.keyword),
|
||||
onTap: () => onClick!(i.keyword, i),
|
||||
child: Padding(
|
||||
padding: EdgeInsets.only(
|
||||
left: 2,
|
||||
|
||||
Reference in New Issue
Block a user