关怀模式
This commit is contained in:
@@ -72,8 +72,10 @@ class _FavoritesPageState extends State<FavoritesPage>
|
||||
tabBarScrollable: true,
|
||||
tabLabelPadding: const EdgeInsets.symmetric(horizontal: 10),
|
||||
backgroundColor: isDark ? const Color(0xFF1A1A1A) : Colors.white,
|
||||
foregroundColor: isDark ? Colors.white : Colors.black87,
|
||||
actions: _buildAppBarActions(controller),
|
||||
foregroundColor: isDark
|
||||
? Colors.white
|
||||
: themeController.currentThemeColor,
|
||||
actions: _buildAppBarActions(controller, context),
|
||||
),
|
||||
body: Column(
|
||||
children: [
|
||||
@@ -93,12 +95,20 @@ class _FavoritesPageState extends State<FavoritesPage>
|
||||
}
|
||||
|
||||
// 构建AppBar操作按钮
|
||||
List<Widget> _buildAppBarActions(FavoritesController controller) {
|
||||
final currentCategory =
|
||||
controller.categories[controller.currentTabIndex.value];
|
||||
List<Widget> _buildAppBarActions(
|
||||
FavoritesController controller,
|
||||
BuildContext context,
|
||||
) {
|
||||
final isDark = themeController.isDarkMode;
|
||||
|
||||
List<Widget> actions = [
|
||||
// 统一显示添加笔记按钮
|
||||
IconButton(
|
||||
icon: Icon(Icons.add, color: isDark ? Colors.white70 : null),
|
||||
onPressed: () {
|
||||
Get.to(const CollectNotesPage());
|
||||
},
|
||||
),
|
||||
IconButton(
|
||||
icon: Icon(
|
||||
controller.isGridView.value ? Icons.view_list : Icons.grid_view,
|
||||
@@ -108,23 +118,15 @@ class _FavoritesPageState extends State<FavoritesPage>
|
||||
),
|
||||
IconButton(
|
||||
icon: Icon(Icons.filter_list, color: isDark ? Colors.white70 : null),
|
||||
onPressed: () => controller.showFilterOptions(context),
|
||||
onPressed: () {
|
||||
// 使用 Get.context 而不是传递的 context
|
||||
if (Get.context != null) {
|
||||
controller.showFilterOptions(Get.context!);
|
||||
}
|
||||
},
|
||||
),
|
||||
];
|
||||
|
||||
// 只在笔记页面显示添加笔记按钮
|
||||
if (currentCategory == '笔记') {
|
||||
actions.insert(
|
||||
0,
|
||||
IconButton(
|
||||
icon: Icon(Icons.add, color: isDark ? Colors.white70 : null),
|
||||
onPressed: () {
|
||||
Get.to(const CollectNotesPage());
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
return actions;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user