141 lines
4.3 KiB
Dart
141 lines
4.3 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:maibu_satabot_v2/core/localization/app_localizations.dart';
|
|
import 'package:maibu_satabot_v2/core/theme/AppTheme.dart';
|
|
|
|
class QuickEntryCard extends StatelessWidget {
|
|
const QuickEntryCard({super.key});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Row(
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
children: [
|
|
Text(
|
|
AppLocalizations.of(context).translate('home_v2.quick_entry'),
|
|
style: TextStyle(
|
|
fontSize: 18,
|
|
fontWeight: FontWeight.bold,
|
|
color: context.appColors.textPrimary,
|
|
),
|
|
),
|
|
Icon(
|
|
Icons.arrow_forward_ios,
|
|
size: 16,
|
|
color: context.appColors.textTertiary,
|
|
),
|
|
],
|
|
),
|
|
const SizedBox(height: 12),
|
|
SizedBox(
|
|
height: 85,
|
|
child: ListView(
|
|
scrollDirection: Axis.horizontal,
|
|
physics: const BouncingScrollPhysics(),
|
|
padding: const EdgeInsets.only(right: 16),
|
|
children: [
|
|
_buildQuickEntryCard(
|
|
context,
|
|
icon: Icons.upload_file,
|
|
label: AppLocalizations.of(
|
|
context,
|
|
).translate('home_v2.device_report'),
|
|
),
|
|
const SizedBox(width: 8),
|
|
_buildQuickEntryCard(
|
|
context,
|
|
icon: Icons.qr_code_scanner,
|
|
label: AppLocalizations.of(
|
|
context,
|
|
).translate('home_v2.scan_qr'),
|
|
),
|
|
const SizedBox(width: 8),
|
|
_buildQuickEntryCard(
|
|
context,
|
|
icon: Icons.assignment,
|
|
label: AppLocalizations.of(
|
|
context,
|
|
).translate('home_v2.work_order'),
|
|
),
|
|
const SizedBox(width: 8),
|
|
_buildQuickEntryCard(
|
|
context,
|
|
icon: Icons.notifications_active,
|
|
label: AppLocalizations.of(
|
|
context,
|
|
).translate('home_v2.alarm_center'),
|
|
),
|
|
const SizedBox(width: 8),
|
|
_buildQuickEntryCard(
|
|
context,
|
|
icon: Icons.map,
|
|
label: AppLocalizations.of(
|
|
context,
|
|
).translate('home_v2.power_plant_map'),
|
|
),
|
|
const SizedBox(width: 8),
|
|
_buildQuickEntryCard(
|
|
context,
|
|
icon: Icons.devices,
|
|
label: AppLocalizations.of(
|
|
context,
|
|
).translate('home_v2.device_list'),
|
|
),
|
|
const SizedBox(width: 8),
|
|
],
|
|
),
|
|
),
|
|
],
|
|
);
|
|
}
|
|
|
|
Widget _buildQuickEntryCard(
|
|
BuildContext context, {
|
|
required IconData icon,
|
|
required String label,
|
|
}) {
|
|
return InkWell(
|
|
onTap: () => print('点击:$label'),
|
|
borderRadius: BorderRadius.circular(12),
|
|
child: SizedBox(
|
|
width: 85,
|
|
height: 85,
|
|
child: Container(
|
|
padding: const EdgeInsets.all(10),
|
|
decoration: BoxDecoration(
|
|
color: context.appColors.cardBackground,
|
|
borderRadius: BorderRadius.circular(12),
|
|
boxShadow: [
|
|
BoxShadow(
|
|
color: context.appColors.cardShadow,
|
|
blurRadius: 4,
|
|
offset: const Offset(0, 2),
|
|
),
|
|
],
|
|
),
|
|
child: Column(
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
children: [
|
|
Icon(icon, color: context.appColors.primary, size: 26),
|
|
const SizedBox(height: 6),
|
|
Text(
|
|
label,
|
|
textAlign: TextAlign.center,
|
|
style: TextStyle(
|
|
color: context.appColors.textSecondary,
|
|
fontSize: 12,
|
|
height: 1.2,
|
|
),
|
|
maxLines: 1,
|
|
overflow: TextOverflow.ellipsis,
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|