feat: 静态页面开发完成
This commit is contained in:
@@ -8,6 +8,7 @@ import '../models/work_order.dart';
|
||||
import '../models/order.dart';
|
||||
import '../theme.dart';
|
||||
import '../l10n/app_localizations.dart';
|
||||
import '../widgets/skeleton.dart';
|
||||
|
||||
class OrderWorkPage extends ConsumerStatefulWidget {
|
||||
final String initialTab;
|
||||
@@ -57,21 +58,50 @@ class _OrderWorkPageState extends ConsumerState<OrderWorkPage>
|
||||
backgroundColor: AppColors.background,
|
||||
appBar: AppBar(
|
||||
title: Text(l10n.ordersAndWorkOrders),
|
||||
bottom: TabBar(
|
||||
controller: _tabController,
|
||||
tabs: [
|
||||
Tab(text: l10n.workOrder),
|
||||
Tab(text: l10n.order),
|
||||
],
|
||||
indicator: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
color: AppColors.primary.withOpacity(0.1),
|
||||
backgroundColor: AppColors.surface,
|
||||
elevation: 0,
|
||||
scrolledUnderElevation: 0,
|
||||
surfaceTintColor: Colors.transparent,
|
||||
bottom: PreferredSize(
|
||||
preferredSize: const Size.fromHeight(52),
|
||||
child: Container(
|
||||
color: AppColors.surface,
|
||||
padding: const EdgeInsets.fromLTRB(16, 0, 16, 12),
|
||||
child: Container(
|
||||
height: 38,
|
||||
decoration: BoxDecoration(
|
||||
color: AppColors.background,
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
child: TabBar(
|
||||
controller: _tabController,
|
||||
tabs: [
|
||||
Tab(text: l10n.workOrder),
|
||||
Tab(text: l10n.order),
|
||||
],
|
||||
indicator: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
color: AppColors.surface,
|
||||
),
|
||||
indicatorSize: TabBarIndicatorSize.tab,
|
||||
indicatorPadding: const EdgeInsets.all(3),
|
||||
labelColor: AppColors.textPrimary,
|
||||
unselectedLabelColor: AppColors.textSecondary,
|
||||
labelStyle: const TextStyle(
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
unselectedLabelStyle: const TextStyle(
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
dividerColor: Colors.transparent,
|
||||
dividerHeight: 0,
|
||||
splashFactory: NoSplash.splashFactory,
|
||||
overlayColor: WidgetStateProperty.all(Colors.transparent),
|
||||
),
|
||||
),
|
||||
),
|
||||
indicatorSize: TabBarIndicatorSize.tab,
|
||||
indicatorPadding: const EdgeInsets.symmetric(horizontal: 32, vertical: 6),
|
||||
labelColor: AppColors.primary,
|
||||
unselectedLabelColor: AppColors.textSecondary,
|
||||
labelStyle: const TextStyle(fontWeight: FontWeight.w600),
|
||||
),
|
||||
),
|
||||
body: TabBarView(
|
||||
@@ -113,7 +143,10 @@ class _WorkOrderTab extends ConsumerWidget {
|
||||
_buildWorkFilterChips(context, l10n),
|
||||
Expanded(
|
||||
child: state.isLoading
|
||||
? const Center(child: CircularProgressIndicator())
|
||||
? SkeletonList(
|
||||
count: 5,
|
||||
itemBuilder: (_) => const WorkOrderCardSkeleton(),
|
||||
)
|
||||
: state.orders.isEmpty
|
||||
? _buildEmptyState(l10n.noWorkOrders)
|
||||
: ListView.builder(
|
||||
@@ -198,7 +231,7 @@ class _WorkOrderTab extends ConsumerWidget {
|
||||
Expanded(
|
||||
child: Text(
|
||||
order.title,
|
||||
style: const TextStyle(
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: AppColors.textPrimary,
|
||||
@@ -227,7 +260,7 @@ class _WorkOrderTab extends ConsumerWidget {
|
||||
order.description,
|
||||
maxLines: 2,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: const TextStyle(
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
color: AppColors.textSecondary,
|
||||
height: 1.4,
|
||||
@@ -240,15 +273,15 @@ class _WorkOrderTab extends ConsumerWidget {
|
||||
const SizedBox(width: 4),
|
||||
Text(
|
||||
'${l10n.creator}: ${order.creatorName}',
|
||||
style: const TextStyle(fontSize: 12, color: AppColors.textTertiary),
|
||||
style: TextStyle(fontSize: 12, color: AppColors.textTertiary),
|
||||
),
|
||||
if (order.assigneeName != null) ...[
|
||||
const SizedBox(width: 12),
|
||||
Icon(Icons.assignment_ind_outlined, size: 14, color: AppColors.textTertiary),
|
||||
const SizedBox(width: 4),
|
||||
Text(
|
||||
'${l10n.assignee}: ${order.assigneeName}',
|
||||
style: const TextStyle(fontSize: 12, color: AppColors.textTertiary),
|
||||
'${order.status == WorkOrderStatus.pending ? l10n.transferDept : l10n.assignee}: ${order.assigneeName}',
|
||||
style: TextStyle(fontSize: 12, color: AppColors.textTertiary),
|
||||
),
|
||||
],
|
||||
const Spacer(),
|
||||
@@ -305,7 +338,7 @@ class _WorkOrderTab extends ConsumerWidget {
|
||||
children: [
|
||||
Icon(Icons.inbox_outlined, size: 64, color: AppColors.textTertiary.withOpacity(0.5)),
|
||||
const SizedBox(height: 16),
|
||||
Text(text, style: const TextStyle(fontSize: 16, color: AppColors.textSecondary)),
|
||||
Text(text, style: TextStyle(fontSize: 16, color: AppColors.textSecondary)),
|
||||
],
|
||||
),
|
||||
);
|
||||
@@ -328,7 +361,10 @@ class _OrderTab extends ConsumerWidget {
|
||||
_buildOrderFilterChips(context, l10n),
|
||||
Expanded(
|
||||
child: state.isLoading
|
||||
? const Center(child: CircularProgressIndicator())
|
||||
? SkeletonList(
|
||||
count: 5,
|
||||
itemBuilder: (_) => const OrderCardSkeleton(),
|
||||
)
|
||||
: state.orders.isEmpty
|
||||
? _buildEmptyState(l10n.noOrders)
|
||||
: ListView.builder(
|
||||
@@ -415,7 +451,7 @@ class _OrderTab extends ConsumerWidget {
|
||||
Expanded(
|
||||
child: Text(
|
||||
order.orderNo,
|
||||
style: const TextStyle(
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: AppColors.textPrimary,
|
||||
@@ -442,7 +478,7 @@ class _OrderTab extends ConsumerWidget {
|
||||
const SizedBox(height: 12),
|
||||
Text(
|
||||
order.productName,
|
||||
style: const TextStyle(
|
||||
style: TextStyle(
|
||||
fontSize: 15,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: AppColors.textPrimary,
|
||||
@@ -455,14 +491,14 @@ class _OrderTab extends ConsumerWidget {
|
||||
const SizedBox(width: 4),
|
||||
Text(
|
||||
order.customerName,
|
||||
style: const TextStyle(fontSize: 13, color: AppColors.textSecondary),
|
||||
style: TextStyle(fontSize: 13, color: AppColors.textSecondary),
|
||||
),
|
||||
const SizedBox(width: 16),
|
||||
Icon(Icons.confirmation_number_outlined, size: 14, color: AppColors.textTertiary),
|
||||
const SizedBox(width: 4),
|
||||
Text(
|
||||
'x${order.quantity}',
|
||||
style: const TextStyle(fontSize: 13, color: AppColors.textSecondary),
|
||||
style: TextStyle(fontSize: 13, color: AppColors.textSecondary),
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -487,7 +523,7 @@ class _OrderTab extends ConsumerWidget {
|
||||
),
|
||||
child: Text(
|
||||
'${l10n.verifyCode}: ${order.verifyCode}',
|
||||
style: const TextStyle(
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
fontFamily: 'monospace',
|
||||
color: AppColors.textSecondary,
|
||||
@@ -509,7 +545,7 @@ class _OrderTab extends ConsumerWidget {
|
||||
children: [
|
||||
Icon(Icons.receipt_long_outlined, size: 64, color: AppColors.textTertiary.withOpacity(0.5)),
|
||||
const SizedBox(height: 16),
|
||||
Text(text, style: const TextStyle(fontSize: 16, color: AppColors.textSecondary)),
|
||||
Text(text, style: TextStyle(fontSize: 16, color: AppColors.textSecondary)),
|
||||
],
|
||||
),
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user