补充
This commit is contained in:
@@ -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,66 +90,78 @@ class FavoritesController extends GetxController {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(height: 16),
|
const SizedBox(height: 16),
|
||||||
Obx(() => ListTile(
|
Obx(
|
||||||
leading: Icon(Icons.date_range, color: themeColor),
|
() => ListTile(
|
||||||
title: Text(
|
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
|
||||||
|
? 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
|
Obx(
|
||||||
? Icons.radio_button_checked
|
() => ListTile(
|
||||||
: Icons.radio_button_unchecked,
|
leading: Icon(Icons.title, color: themeColor),
|
||||||
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),
|
const Divider(color: Colors.grey),
|
||||||
Obx(() => ListTile(
|
Obx(
|
||||||
leading: Icon(Icons.swap_vert, color: themeColor),
|
() => ListTile(
|
||||||
title: Text(
|
leading: Icon(Icons.swap_vert, color: themeColor),
|
||||||
likesFirst.value ? '点赞在前' : '笔记在前',
|
title: Text(
|
||||||
style: TextStyle(color: isDark ? Colors.white : Colors.black87),
|
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,
|
|
||||||
);
|
|
||||||
});
|
|
||||||
},
|
|
||||||
)),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
Reference in New Issue
Block a user