show search rcmd reason

Closes #921

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2025-08-01 18:32:55 +08:00
parent 53ef4219eb
commit 05bb27ee2b
3 changed files with 14 additions and 1 deletions

View File

@@ -3,12 +3,14 @@ class SearchTrendingItemModel {
String? showName; String? showName;
String? icon; String? icon;
bool? showLiveIcon; bool? showLiveIcon;
String? recommendReason;
SearchTrendingItemModel({ SearchTrendingItemModel({
this.keyword, this.keyword,
this.showName, this.showName,
this.icon, this.icon,
this.showLiveIcon, this.showLiveIcon,
this.recommendReason,
}); });
factory SearchTrendingItemModel.fromJson(Map<String, dynamic> json) => factory SearchTrendingItemModel.fromJson(Map<String, dynamic> json) =>
@@ -17,5 +19,9 @@ class SearchTrendingItemModel {
showName: json['show_name'] as String?, showName: json['show_name'] as String?,
icon: json['icon'] as String?, icon: json['icon'] as String?,
showLiveIcon: json['show_live_icon'] as bool?, showLiveIcon: json['show_live_icon'] as bool?,
recommendReason: (json['recommend_reason'] as String?)?.replaceFirst(
'·',
' ',
),
); );
} }

View File

@@ -77,6 +77,7 @@ class HomeController extends GetxController
var res = await Request().get(Api.searchDefault); var res = await Request().get(Api.searchDefault);
if (res.data['code'] == 0) { if (res.data['code'] == 0) {
defaultSearch.value = res.data['data']?['name'] ?? ''; defaultSearch.value = res.data['data']?['name'] ?? '';
// defaultSearch.value = res.data['data']?['show_name'] ?? '';
} }
} catch (_) {} } catch (_) {}
} }

View File

@@ -17,6 +17,10 @@ class HotKeyword extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
late final style = TextStyle(
fontSize: 14,
color: Theme.of(context).colorScheme.outline,
);
return Wrap( return Wrap(
runSpacing: 0.4, runSpacing: 0.4,
spacing: 5.0, spacing: 5.0,
@@ -63,7 +67,9 @@ class HotKeyword extends StatelessWidget {
width: 48, width: 48,
height: 15, height: 15,
), ),
), )
else if (i.recommendReason?.isNotEmpty == true)
Text(i.recommendReason!, style: style),
], ],
), ),
), ),