关怀模式
This commit is contained in:
@@ -8,6 +8,7 @@ import 'package:platform_info/platform_info.dart';
|
||||
import 'package:flutter_udid/flutter_udid.dart';
|
||||
import '../../../config/app_config.dart';
|
||||
import '../../../constants/app_constants.dart';
|
||||
import '../../../models/colors/theme_colors.dart';
|
||||
import '../../../controllers/shared_preferences_storage_controller.dart';
|
||||
import '../../../services/get/theme_controller.dart';
|
||||
|
||||
@@ -102,6 +103,7 @@ class _AppInfoPageState extends State<AppInfoPage> {
|
||||
Widget build(BuildContext context) {
|
||||
return Obx(() {
|
||||
final isDark = _themeController.isDarkMode;
|
||||
final primaryColor = _themeController.currentThemeColor;
|
||||
return Scaffold(
|
||||
backgroundColor: isDark
|
||||
? const Color(0xFF1A1A1A)
|
||||
@@ -109,16 +111,13 @@ class _AppInfoPageState extends State<AppInfoPage> {
|
||||
appBar: AppBar(
|
||||
title: Text(
|
||||
'应用信息',
|
||||
style: TextStyle(
|
||||
color: AppConstants.primaryColor,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
style: TextStyle(color: primaryColor, fontWeight: FontWeight.bold),
|
||||
),
|
||||
backgroundColor: isDark ? const Color(0xFF2A2A2A) : Colors.white,
|
||||
elevation: 0,
|
||||
centerTitle: true,
|
||||
leading: IconButton(
|
||||
icon: Icon(Icons.arrow_back, color: AppConstants.primaryColor),
|
||||
icon: Icon(Icons.arrow_back, color: primaryColor),
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
),
|
||||
actions: [
|
||||
@@ -139,15 +138,15 @@ class _AppInfoPageState extends State<AppInfoPage> {
|
||||
body: ListView(
|
||||
padding: const EdgeInsets.all(16),
|
||||
children: [
|
||||
_buildHeaderCard(),
|
||||
_buildHeaderCard(primaryColor),
|
||||
const SizedBox(height: 16),
|
||||
_buildTechStackCard(isDark),
|
||||
const SizedBox(height: 16),
|
||||
_buildBuildInfoCard(context, isDark),
|
||||
_buildBuildInfoCard(context, isDark, primaryColor),
|
||||
const SizedBox(height: 16),
|
||||
_buildServerInfoCard(isDark),
|
||||
const SizedBox(height: 16),
|
||||
_buildDeviceInfoCard(context, isDark),
|
||||
_buildDeviceInfoCard(context, isDark, primaryColor),
|
||||
const SizedBox(height: 16),
|
||||
_buildUpdateLogCard(isDark),
|
||||
const SizedBox(height: 16),
|
||||
@@ -160,7 +159,7 @@ class _AppInfoPageState extends State<AppInfoPage> {
|
||||
});
|
||||
}
|
||||
|
||||
Widget _buildHeaderCard() {
|
||||
Widget _buildHeaderCard(Color primaryColor) {
|
||||
return ClipRRect(
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
child: BackdropFilter(
|
||||
@@ -170,9 +169,9 @@ class _AppInfoPageState extends State<AppInfoPage> {
|
||||
decoration: BoxDecoration(
|
||||
gradient: LinearGradient(
|
||||
colors: [
|
||||
AppConstants.primaryColor.withValues(alpha: 0.66),
|
||||
AppConstants.primaryColor.withValues(alpha: 0.7),
|
||||
AppConstants.primaryColor.withValues(alpha: 0.99),
|
||||
primaryColor.withValues(alpha: 0.66),
|
||||
primaryColor.withValues(alpha: 0.7),
|
||||
primaryColor.withValues(alpha: 0.99),
|
||||
],
|
||||
begin: Alignment.topLeft,
|
||||
end: Alignment.bottomRight,
|
||||
@@ -184,7 +183,7 @@ class _AppInfoPageState extends State<AppInfoPage> {
|
||||
),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: AppConstants.primaryColor.withValues(alpha: 0.35),
|
||||
color: primaryColor.withValues(alpha: 0.35),
|
||||
blurRadius: 20,
|
||||
offset: const Offset(0, 4),
|
||||
),
|
||||
@@ -386,7 +385,11 @@ class _AppInfoPageState extends State<AppInfoPage> {
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildBuildInfoCard(BuildContext context, bool isDark) {
|
||||
Widget _buildBuildInfoCard(
|
||||
BuildContext context,
|
||||
bool isDark,
|
||||
Color primaryColor,
|
||||
) {
|
||||
String buildSdk = 'Unknown';
|
||||
try {
|
||||
final String osName = io.Platform.operatingSystem;
|
||||
@@ -435,10 +438,10 @@ class _AppInfoPageState extends State<AppInfoPage> {
|
||||
Container(
|
||||
padding: const EdgeInsets.all(8),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.green.withValues(alpha: 0.1),
|
||||
color: primaryColor.withValues(alpha: 0.1),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
child: Icon(Icons.build, color: Colors.green[700], size: 20),
|
||||
child: Icon(Icons.build, color: primaryColor, size: 20),
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
Text(
|
||||
@@ -474,25 +477,25 @@ class _AppInfoPageState extends State<AppInfoPage> {
|
||||
isDark,
|
||||
),
|
||||
_buildInfoItem('Build SDK', buildSdk, Icons.new_releases, isDark),
|
||||
_buildLicenseItem(context, isDark),
|
||||
_buildLicenseItem(context, isDark, primaryColor),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildLicenseItem(BuildContext context, bool isDark) {
|
||||
Widget _buildLicenseItem(
|
||||
BuildContext context,
|
||||
bool isDark,
|
||||
Color primaryColor,
|
||||
) {
|
||||
return InkWell(
|
||||
onTap: () => _showFlutterLicense(context, isDark),
|
||||
onTap: () => _showFlutterLicense(context, isDark, primaryColor),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 12),
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(
|
||||
Icons.gavel,
|
||||
size: 20,
|
||||
color: isDark ? Colors.grey[400] : Colors.grey[600],
|
||||
),
|
||||
Icon(Icons.gavel, size: 20, color: primaryColor),
|
||||
const SizedBox(width: 12),
|
||||
Expanded(
|
||||
child: Column(
|
||||
@@ -528,7 +531,11 @@ class _AppInfoPageState extends State<AppInfoPage> {
|
||||
);
|
||||
}
|
||||
|
||||
void _showFlutterLicense(BuildContext context, bool isDark) {
|
||||
void _showFlutterLicense(
|
||||
BuildContext context,
|
||||
bool isDark,
|
||||
Color primaryColor,
|
||||
) {
|
||||
final licenses = [
|
||||
{'name': 'Flutter SDK', 'license': 'BSD 3-Clause'},
|
||||
{'name': 'OpenHarmony SDK', 'license': 'Apache 2.0'},
|
||||
@@ -545,7 +552,7 @@ class _AppInfoPageState extends State<AppInfoPage> {
|
||||
backgroundColor: isDark ? const Color(0xFF2A2A2A) : Colors.white,
|
||||
title: Row(
|
||||
children: [
|
||||
Icon(Icons.description, color: AppConstants.primaryColor),
|
||||
Icon(Icons.description, color: primaryColor),
|
||||
const SizedBox(width: 8),
|
||||
Text(
|
||||
'开源框架',
|
||||
@@ -574,14 +581,10 @@ class _AppInfoPageState extends State<AppInfoPage> {
|
||||
Container(
|
||||
padding: const EdgeInsets.all(6),
|
||||
decoration: BoxDecoration(
|
||||
color: AppConstants.primaryColor.withValues(alpha: 0.1),
|
||||
color: primaryColor.withValues(alpha: 0.1),
|
||||
borderRadius: BorderRadius.circular(6),
|
||||
),
|
||||
child: Icon(
|
||||
Icons.widgets,
|
||||
size: 16,
|
||||
color: AppConstants.primaryColor,
|
||||
),
|
||||
child: Icon(Icons.widgets, size: 16, color: primaryColor),
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
Expanded(
|
||||
@@ -618,10 +621,7 @@ class _AppInfoPageState extends State<AppInfoPage> {
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
child: Text(
|
||||
'关闭',
|
||||
style: TextStyle(color: AppConstants.primaryColor),
|
||||
),
|
||||
child: Text('关闭', style: TextStyle(color: primaryColor)),
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -678,7 +678,11 @@ class _AppInfoPageState extends State<AppInfoPage> {
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildDeviceInfoCard(BuildContext context, bool isDark) {
|
||||
Widget _buildDeviceInfoCard(
|
||||
BuildContext context,
|
||||
bool isDark,
|
||||
Color primaryColor,
|
||||
) {
|
||||
final platform = Platform.instance;
|
||||
|
||||
bool isHarmonyOS = false;
|
||||
@@ -793,14 +797,10 @@ class _AppInfoPageState extends State<AppInfoPage> {
|
||||
Container(
|
||||
padding: const EdgeInsets.all(8),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.purple.withValues(alpha: 0.1),
|
||||
color: primaryColor.withValues(alpha: 0.1),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
child: Icon(
|
||||
Icons.devices,
|
||||
color: Colors.purple[700],
|
||||
size: 20,
|
||||
),
|
||||
child: Icon(Icons.devices, color: primaryColor, size: 20),
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
Text(
|
||||
@@ -830,6 +830,7 @@ class _AppInfoPageState extends State<AppInfoPage> {
|
||||
platformName,
|
||||
Icons.phone_iphone,
|
||||
isDark,
|
||||
primaryColor,
|
||||
),
|
||||
if (!isHarmonyOS) ...[
|
||||
_buildGridInfoItem(
|
||||
@@ -837,17 +838,37 @@ class _AppInfoPageState extends State<AppInfoPage> {
|
||||
designStyle,
|
||||
Icons.palette,
|
||||
isDark,
|
||||
primaryColor,
|
||||
),
|
||||
],
|
||||
_buildGridInfoItem('设备类型', deviceType, Icons.devices, isDark),
|
||||
_buildGridInfoItem('构建模式', buildMode, Icons.build, isDark),
|
||||
_buildGridInfoItem('运行环境', runtimeEnv, Icons.code, isDark),
|
||||
_buildGridInfoItem(
|
||||
'设备类型',
|
||||
deviceType,
|
||||
Icons.devices,
|
||||
isDark,
|
||||
primaryColor,
|
||||
),
|
||||
_buildGridInfoItem(
|
||||
'构建模式',
|
||||
buildMode,
|
||||
Icons.build,
|
||||
isDark,
|
||||
primaryColor,
|
||||
),
|
||||
_buildGridInfoItem(
|
||||
'运行环境',
|
||||
runtimeEnv,
|
||||
Icons.code,
|
||||
isDark,
|
||||
primaryColor,
|
||||
),
|
||||
_buildGridCopyableItem(
|
||||
context,
|
||||
'Flutter UUID',
|
||||
_udid,
|
||||
Icons.perm_identity,
|
||||
isDark,
|
||||
primaryColor,
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -1181,6 +1202,7 @@ class _AppInfoPageState extends State<AppInfoPage> {
|
||||
String value,
|
||||
IconData icon,
|
||||
bool isDark,
|
||||
Color primaryColor,
|
||||
) {
|
||||
return Container(
|
||||
padding: const EdgeInsets.all(12),
|
||||
@@ -1198,7 +1220,7 @@ class _AppInfoPageState extends State<AppInfoPage> {
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Icon(icon, size: 18, color: AppConstants.primaryColor),
|
||||
Icon(icon, size: 18, color: primaryColor),
|
||||
const SizedBox(width: 8),
|
||||
Expanded(
|
||||
child: Text(
|
||||
@@ -1236,6 +1258,7 @@ class _AppInfoPageState extends State<AppInfoPage> {
|
||||
String value,
|
||||
IconData icon,
|
||||
bool isDark,
|
||||
Color primaryColor,
|
||||
) {
|
||||
return InkWell(
|
||||
onTap: () => _copyToClipboard(context, value),
|
||||
@@ -1257,11 +1280,7 @@ class _AppInfoPageState extends State<AppInfoPage> {
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Icon(
|
||||
icon,
|
||||
size: 16,
|
||||
color: isDark ? Colors.grey[400] : Colors.grey[600],
|
||||
),
|
||||
Icon(icon, size: 16, color: primaryColor),
|
||||
const SizedBox(width: 6),
|
||||
Expanded(
|
||||
child: Text(
|
||||
@@ -1277,7 +1296,7 @@ class _AppInfoPageState extends State<AppInfoPage> {
|
||||
Icon(
|
||||
Icons.content_copy,
|
||||
size: 14,
|
||||
color: AppConstants.primaryColor.withValues(alpha: 0.6),
|
||||
color: primaryColor.withValues(alpha: 0.6),
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -1397,6 +1416,7 @@ class _AppInfoPageState extends State<AppInfoPage> {
|
||||
|
||||
void _copyToClipboard(BuildContext context, String text) {
|
||||
Clipboard.setData(ClipboardData(text: text));
|
||||
final primaryColor = _themeController.currentThemeColor;
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: Row(
|
||||
@@ -1406,7 +1426,7 @@ class _AppInfoPageState extends State<AppInfoPage> {
|
||||
Text('$text 已复制到剪贴板'),
|
||||
],
|
||||
),
|
||||
backgroundColor: AppConstants.primaryColor,
|
||||
backgroundColor: primaryColor,
|
||||
behavior: SnackBarBehavior.floating,
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)),
|
||||
duration: const Duration(seconds: 2),
|
||||
|
||||
Reference in New Issue
Block a user