feat: 热搜关键词

This commit is contained in:
guozhigq
2023-06-20 10:27:54 +08:00
parent 04704ae8f3
commit 335718b3a0
13 changed files with 483 additions and 8 deletions

View File

@ -0,0 +1,60 @@
// ignore: file_names
import 'package:flutter/material.dart';
class HotKeyword extends StatelessWidget {
final double? width;
final List? hotSearchList;
final Function? onClick;
const HotKeyword({
this.width,
this.hotSearchList,
this.onClick,
super.key,
});
@override
Widget build(BuildContext context) {
return Wrap(
runSpacing: 0.4,
spacing: 5.0,
children: [
for (var i in hotSearchList!)
SizedBox(
width: width! / 2 - 8,
child: Material(
borderRadius: BorderRadius.circular(3),
clipBehavior: Clip.hardEdge,
child: InkWell(
onTap: () => onClick!(i.keyword),
child: Row(
children: [
SizedBox(
width: width! / 2 -
(i.icon != null && i.icon != '' ? 50 : 12),
child: Padding(
padding: const EdgeInsets.fromLTRB(6, 5, 0, 5),
child: Text(
i.keyword!,
overflow: TextOverflow.ellipsis,
maxLines: 1,
style: const TextStyle(fontSize: 14),
),
),
),
if (i.icon != null && i.icon != '')
SizedBox(
width: 40,
child: Image.network(
i.icon!,
height: 15,
),
),
],
),
),
),
),
],
);
}
}