关怀模式
This commit is contained in:
@@ -3,6 +3,7 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:get/get.dart';
|
||||
import '../../constants/app_constants.dart';
|
||||
import '../../models/colors/theme_colors.dart';
|
||||
import '../../services/get/history_controller.dart';
|
||||
import '../../services/get/theme_controller.dart';
|
||||
|
||||
@@ -16,11 +17,12 @@ class HistoryPage extends StatelessWidget {
|
||||
|
||||
return Obx(() {
|
||||
final isDark = themeController.isDarkMode;
|
||||
final primaryColor = themeController.currentThemeColor;
|
||||
return Scaffold(
|
||||
backgroundColor: isDark
|
||||
? const Color(0xFF1A1A1A)
|
||||
: const Color(0xFFF2F2F7),
|
||||
appBar: _buildAppBar(controller, isDark),
|
||||
appBar: _buildAppBar(controller, isDark, primaryColor),
|
||||
body: Column(
|
||||
children: [
|
||||
_buildSearchBar(controller, isDark),
|
||||
@@ -32,22 +34,26 @@ class HistoryPage extends StatelessWidget {
|
||||
? _buildLoadingWidget(isDark)
|
||||
: controller.filteredHistoryList.isEmpty
|
||||
? _buildEmptyWidget(isDark)
|
||||
: _buildHistoryList(controller, isDark),
|
||||
: _buildHistoryList(controller, isDark, primaryColor),
|
||||
),
|
||||
),
|
||||
_buildPagination(controller, isDark),
|
||||
_buildPagination(controller, isDark, primaryColor),
|
||||
],
|
||||
),
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
PreferredSizeWidget _buildAppBar(HistoryController controller, bool isDark) {
|
||||
PreferredSizeWidget _buildAppBar(
|
||||
HistoryController controller,
|
||||
bool isDark,
|
||||
Color primaryColor,
|
||||
) {
|
||||
return AppBar(
|
||||
title: Text(
|
||||
'历史记录',
|
||||
style: TextStyle(
|
||||
color: AppConstants.primaryColor,
|
||||
color: primaryColor,
|
||||
fontWeight: FontWeight.w600,
|
||||
fontSize: 17,
|
||||
),
|
||||
@@ -96,18 +102,12 @@ class HistoryPage extends StatelessWidget {
|
||||
CupertinoButton(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 8),
|
||||
onPressed: controller.showStatsDialog,
|
||||
child: const Icon(
|
||||
CupertinoIcons.chart_bar,
|
||||
color: AppConstants.primaryColor,
|
||||
),
|
||||
child: Icon(CupertinoIcons.chart_bar, color: primaryColor),
|
||||
),
|
||||
CupertinoButton(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 8),
|
||||
onPressed: controller.exportHistory,
|
||||
child: const Icon(
|
||||
CupertinoIcons.share,
|
||||
color: AppConstants.primaryColor,
|
||||
),
|
||||
child: Icon(CupertinoIcons.share, color: primaryColor),
|
||||
),
|
||||
],
|
||||
);
|
||||
@@ -361,7 +361,11 @@ class HistoryPage extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildHistoryList(HistoryController controller, bool isDark) {
|
||||
Widget _buildHistoryList(
|
||||
HistoryController controller,
|
||||
bool isDark,
|
||||
Color primaryColor,
|
||||
) {
|
||||
final currentPageData = controller.getCurrentPageData();
|
||||
|
||||
return ListView.separated(
|
||||
@@ -380,6 +384,7 @@ class HistoryPage extends StatelessWidget {
|
||||
item,
|
||||
actualIndex,
|
||||
isDark,
|
||||
primaryColor,
|
||||
);
|
||||
},
|
||||
);
|
||||
@@ -391,6 +396,7 @@ class HistoryPage extends StatelessWidget {
|
||||
Map<String, dynamic> item,
|
||||
int actualIndex,
|
||||
bool isDark,
|
||||
Color primaryColor,
|
||||
) {
|
||||
return Container(
|
||||
decoration: BoxDecoration(
|
||||
@@ -412,7 +418,7 @@ class HistoryPage extends StatelessWidget {
|
||||
width: 44,
|
||||
height: 44,
|
||||
decoration: BoxDecoration(
|
||||
color: AppConstants.primaryColor.withValues(alpha: 0.1),
|
||||
color: primaryColor.withValues(alpha: 0.1),
|
||||
borderRadius: BorderRadius.circular(22),
|
||||
),
|
||||
child: Center(
|
||||
@@ -420,7 +426,7 @@ class HistoryPage extends StatelessWidget {
|
||||
'${actualIndex + 1}',
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
color: AppConstants.primaryColor,
|
||||
color: primaryColor,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
@@ -526,7 +532,11 @@ class HistoryPage extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildPagination(HistoryController controller, bool isDark) {
|
||||
Widget _buildPagination(
|
||||
HistoryController controller,
|
||||
bool isDark,
|
||||
Color primaryColor,
|
||||
) {
|
||||
return Obx(
|
||||
() => Visibility(
|
||||
visible: controller.totalPages.value > 1,
|
||||
@@ -555,7 +565,7 @@ class HistoryPage extends StatelessWidget {
|
||||
vertical: 8,
|
||||
),
|
||||
color: controller.currentPage.value > 1
|
||||
? AppConstants.primaryColor
|
||||
? primaryColor
|
||||
: (isDark ? Colors.grey[800] : CupertinoColors.systemGrey5),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
child: Row(
|
||||
@@ -602,7 +612,7 @@ class HistoryPage extends StatelessWidget {
|
||||
),
|
||||
color:
|
||||
controller.currentPage.value < controller.totalPages.value
|
||||
? AppConstants.primaryColor
|
||||
? primaryColor
|
||||
: (isDark ? Colors.grey[800] : CupertinoColors.systemGrey5),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
child: Row(
|
||||
|
||||
Reference in New Issue
Block a user