This commit is contained in:
Developer
2026-04-21 02:30:26 +08:00
parent 7efe7d604f
commit 3738f5a0a3

View File

@@ -6,6 +6,8 @@ import 'theme_controller.dart';
class FavoritesController extends GetxController {
static const String _isGridViewKey = 'favorites_is_grid_view';
final ThemeController _themeController = Get.find<ThemeController>();
var categories = ['全部', '点赞', '笔记', '推送', '每日一句'].obs;
var isGridView = true.obs;
var currentTabIndex = 0.obs;
@@ -52,17 +54,12 @@ class FavoritesController extends GetxController {
Future<void> refreshContent() async {
await Future.delayed(const Duration(milliseconds: 500));
Get.snackbar(
'提示',
'内容已刷新',
colorText: Get.find<ThemeController>().currentThemeColor,
);
Get.snackbar('提示', '内容已刷新', colorText: _themeController.currentThemeColor);
}
void showFilterOptions(BuildContext context) {
final themeController = Get.find<ThemeController>();
final isDark = themeController.isDarkMode;
final themeColor = themeController.currentThemeColor;
final isDark = _themeController.isDarkMode;
final themeColor = _themeController.currentThemeColor;
showModalBottomSheet(
context: context,
@@ -93,66 +90,78 @@ class FavoritesController extends GetxController {
),
),
const SizedBox(height: 16),
Obx(() => ListTile(
leading: Icon(Icons.date_range, color: themeColor),
title: Text(
'按时间排序',
style: TextStyle(color: isDark ? Colors.white : Colors.black87),
Obx(
() => ListTile(
leading: Icon(Icons.date_range, color: themeColor),
title: Text(
'按时间排序',
style: TextStyle(
color: isDark ? Colors.white : Colors.black87,
),
),
trailing: Icon(
sortByTime.value
? Icons.radio_button_checked
: Icons.radio_button_unchecked,
color: themeColor,
),
onTap: () {
Navigator.pop(context);
sortByTime.value = true;
Future.delayed(const Duration(milliseconds: 100), () {
Get.snackbar('提示', '已按时间排序', colorText: themeColor);
});
},
),
trailing: Icon(
sortByTime.value
? Icons.radio_button_checked
: Icons.radio_button_unchecked,
color: themeColor,
),
Obx(
() => ListTile(
leading: Icon(Icons.title, color: themeColor),
title: Text(
'按分类排序',
style: TextStyle(
color: isDark ? Colors.white : Colors.black87,
),
),
trailing: Icon(
!sortByTime.value
? Icons.radio_button_checked
: Icons.radio_button_unchecked,
color: themeColor,
),
onTap: () {
Navigator.pop(context);
sortByTime.value = false;
Future.delayed(const Duration(milliseconds: 100), () {
Get.snackbar('提示', '已按分类排序', colorText: themeColor);
});
},
),
onTap: () {
Navigator.pop(context);
sortByTime.value = true;
Future.delayed(const Duration(milliseconds: 100), () {
Get.snackbar('提示', '已按时间排序', colorText: themeColor);
});
},
)),
Obx(() => ListTile(
leading: Icon(Icons.title, color: themeColor),
title: Text(
'按分类排序',
style: TextStyle(color: isDark ? Colors.white : Colors.black87),
),
trailing: Icon(
!sortByTime.value
? Icons.radio_button_checked
: Icons.radio_button_unchecked,
color: themeColor,
),
onTap: () {
Navigator.pop(context);
sortByTime.value = false;
Future.delayed(const Duration(milliseconds: 100), () {
Get.snackbar('提示', '已按分类排序', colorText: themeColor);
});
},
)),
),
const Divider(color: Colors.grey),
Obx(() => ListTile(
leading: Icon(Icons.swap_vert, color: themeColor),
title: Text(
likesFirst.value ? '点赞在前' : '笔记在前',
style: TextStyle(color: isDark ? Colors.white : Colors.black87),
Obx(
() => ListTile(
leading: Icon(Icons.swap_vert, color: themeColor),
title: Text(
likesFirst.value ? '点赞在前' : '笔记在前',
style: TextStyle(
color: isDark ? Colors.white : Colors.black87,
),
),
trailing: Icon(Icons.swap_vert, color: themeColor),
onTap: () {
Navigator.pop(context);
likesFirst.value = !likesFirst.value;
Future.delayed(const Duration(milliseconds: 100), () {
Get.snackbar(
'提示',
likesFirst.value ? '点赞在前' : '笔记在前',
colorText: themeColor,
);
});
},
),
trailing: Icon(Icons.swap_vert, color: themeColor),
onTap: () {
Navigator.pop(context);
likesFirst.value = !likesFirst.value;
Future.delayed(const Duration(milliseconds: 100), () {
Get.snackbar(
'提示',
likesFirst.value ? '点赞在前' : '笔记在前',
colorText: themeColor,
);
});
},
)),
),
],
),
),