feat: up搜索

This commit is contained in:
guozhigq
2024-02-08 21:27:22 +08:00
parent 0d5d33a365
commit fb8b2de115
8 changed files with 286 additions and 2 deletions

View File

@ -37,6 +37,29 @@ class _FollowPageState extends State<FollowPage> {
: '${_followController.name}的关注',
style: Theme.of(context).textTheme.titleMedium,
),
actions: [
IconButton(
onPressed: () => Get.toNamed('/followSearch?mid=$mid'),
icon: const Icon(Icons.search_outlined),
),
PopupMenuButton(
icon: const Icon(Icons.more_vert),
itemBuilder: (BuildContext context) => <PopupMenuEntry>[
PopupMenuItem(
onTap: () => Get.toNamed('/blackListPage'),
child: const Row(
mainAxisSize: MainAxisSize.min,
children: [
Icon(Icons.block, size: 19),
SizedBox(width: 10),
Text('黑名单管理'),
],
),
)
],
),
const SizedBox(width: 6),
],
),
body: Obx(
() => !_followController.isOwner.value
@ -87,3 +110,22 @@ class _FollowPageState extends State<FollowPage> {
);
}
}
class _FakeAPI {
static const List<String> _kOptions = <String>[
'aardvark',
'bobcat',
'chameleon',
];
// Searches the options, but injects a fake "network" delay.
static Future<Iterable<String>> search(String query) async {
await Future<void>.delayed(
const Duration(seconds: 1)); // Fake 1 second delay.
if (query == '') {
return const Iterable<String>.empty();
}
return _kOptions.where((String option) {
return option.contains(query.toLowerCase());
});
}
}

View File

@ -42,7 +42,7 @@ class FollowItem extends StatelessWidget {
overflow: TextOverflow.ellipsis,
),
dense: true,
trailing: ctr!.isOwner.value
trailing: ctr != null && ctr!.isOwner.value
? SizedBox(
height: 34,
child: TextButton(