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,11 +90,14 @@ class FavoritesController extends GetxController {
),
),
const SizedBox(height: 16),
Obx(() => ListTile(
Obx(
() => ListTile(
leading: Icon(Icons.date_range, color: themeColor),
title: Text(
'按时间排序',
style: TextStyle(color: isDark ? Colors.white : Colors.black87),
style: TextStyle(
color: isDark ? Colors.white : Colors.black87,
),
),
trailing: Icon(
sortByTime.value
@@ -112,12 +112,16 @@ class FavoritesController extends GetxController {
Get.snackbar('提示', '已按时间排序', colorText: themeColor);
});
},
)),
Obx(() => ListTile(
),
),
Obx(
() => ListTile(
leading: Icon(Icons.title, color: themeColor),
title: Text(
'按分类排序',
style: TextStyle(color: isDark ? Colors.white : Colors.black87),
style: TextStyle(
color: isDark ? Colors.white : Colors.black87,
),
),
trailing: Icon(
!sortByTime.value
@@ -132,13 +136,17 @@ class FavoritesController extends GetxController {
Get.snackbar('提示', '已按分类排序', colorText: themeColor);
});
},
)),
),
),
const Divider(color: Colors.grey),
Obx(() => ListTile(
Obx(
() => ListTile(
leading: Icon(Icons.swap_vert, color: themeColor),
title: Text(
likesFirst.value ? '点赞在前' : '笔记在前',
style: TextStyle(color: isDark ? Colors.white : Colors.black87),
style: TextStyle(
color: isDark ? Colors.white : Colors.black87,
),
),
trailing: Icon(Icons.swap_vert, color: themeColor),
onTap: () {
@@ -152,7 +160,8 @@ class FavoritesController extends GetxController {
);
});
},
)),
),
),
],
),
),