icon优化
This commit is contained in:
@@ -7,6 +7,8 @@ class FavoritesController extends GetxController {
|
||||
var isGridView = true.obs;
|
||||
var currentTabIndex = 0.obs;
|
||||
var searchQuery = ''.obs;
|
||||
var sortByTime = true.obs; // true: 按时间排序, false: 按分类排序
|
||||
var likesFirst = true.obs; // true: 点赞在前, false: 笔记在前
|
||||
|
||||
void toggleViewMode() {
|
||||
isGridView.value = !isGridView.value;
|
||||
@@ -34,24 +36,61 @@ class FavoritesController extends GetxController {
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
const Text(
|
||||
'筛选选项',
|
||||
'排序选项',
|
||||
style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold),
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.date_range),
|
||||
title: const Text('按时间排序'),
|
||||
trailing: Obx(
|
||||
() => Icon(
|
||||
sortByTime.value
|
||||
? Icons.radio_button_checked
|
||||
: Icons.radio_button_unchecked,
|
||||
color: AppConstants.primaryColor,
|
||||
),
|
||||
),
|
||||
onTap: () {
|
||||
Navigator.pop(context);
|
||||
Get.snackbar('提示', '按时间排序');
|
||||
sortByTime.value = true;
|
||||
Get.snackbar('提示', '已按时间排序');
|
||||
// 触发排序更新
|
||||
update();
|
||||
},
|
||||
),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.title),
|
||||
title: const Text('按标题排序'),
|
||||
title: const Text('按分类排序'),
|
||||
trailing: Obx(
|
||||
() => Icon(
|
||||
!sortByTime.value
|
||||
? Icons.radio_button_checked
|
||||
: Icons.radio_button_unchecked,
|
||||
color: AppConstants.primaryColor,
|
||||
),
|
||||
),
|
||||
onTap: () {
|
||||
Navigator.pop(context);
|
||||
Get.snackbar('提示', '按标题排序');
|
||||
sortByTime.value = false;
|
||||
Get.snackbar('提示', '已按分类排序');
|
||||
// 触发排序更新
|
||||
update();
|
||||
},
|
||||
),
|
||||
const Divider(),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.swap_vert),
|
||||
title: Text(likesFirst.value ? '点赞在前' : '笔记在前'),
|
||||
trailing: Obx(
|
||||
() => Icon(Icons.swap_vert, color: AppConstants.primaryColor),
|
||||
),
|
||||
onTap: () {
|
||||
Navigator.pop(context);
|
||||
likesFirst.value = !likesFirst.value;
|
||||
Get.snackbar('提示', likesFirst.value ? '点赞在前' : '笔记在前');
|
||||
// 触发顺序更新
|
||||
update();
|
||||
},
|
||||
),
|
||||
],
|
||||
@@ -61,10 +100,13 @@ class FavoritesController extends GetxController {
|
||||
}
|
||||
|
||||
void navigateToSearch() {
|
||||
Get.toNamed('/search', arguments: searchQuery.value.isEmpty ? null : searchQuery.value);
|
||||
Get.toNamed(
|
||||
'/search',
|
||||
arguments: searchQuery.value.isEmpty ? null : searchQuery.value,
|
||||
);
|
||||
}
|
||||
|
||||
void navigateToCollectNotes() {
|
||||
Get.toNamed('/collect-notes');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user