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