fill
This commit is contained in:
@@ -0,0 +1,156 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import '../../../warehouse/domain/entities/warehouse_entity.dart';
|
||||
import '../../../../core/constants/app_constants.dart';
|
||||
import '../widgets/operation_card.dart';
|
||||
|
||||
/// Operation Selection Page
|
||||
/// Allows users to choose between import and export operations for a selected warehouse
|
||||
class OperationSelectionPage extends ConsumerWidget {
|
||||
final WarehouseEntity warehouse;
|
||||
|
||||
const OperationSelectionPage({
|
||||
super.key,
|
||||
required this.warehouse,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
final theme = Theme.of(context);
|
||||
final colorScheme = theme.colorScheme;
|
||||
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: const Text('Select Operation'),
|
||||
elevation: 0,
|
||||
),
|
||||
body: SafeArea(
|
||||
child: Column(
|
||||
children: [
|
||||
// Warehouse information header
|
||||
Container(
|
||||
width: double.infinity,
|
||||
padding: const EdgeInsets.all(AppConstants.defaultPadding),
|
||||
decoration: BoxDecoration(
|
||||
color: colorScheme.primaryContainer.withValues(alpha: 0.3),
|
||||
border: Border(
|
||||
bottom: BorderSide(
|
||||
color: colorScheme.outline.withValues(alpha: 0.2),
|
||||
),
|
||||
),
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
'Warehouse',
|
||||
style: theme.textTheme.labelMedium?.copyWith(
|
||||
color: colorScheme.onSurfaceVariant,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
Text(
|
||||
warehouse.name,
|
||||
style: theme.textTheme.titleLarge?.copyWith(
|
||||
fontWeight: FontWeight.bold,
|
||||
color: colorScheme.onSurface,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
Row(
|
||||
children: [
|
||||
Icon(
|
||||
Icons.qr_code,
|
||||
size: 16,
|
||||
color: colorScheme.onSurfaceVariant,
|
||||
),
|
||||
const SizedBox(width: 4),
|
||||
Text(
|
||||
'Code: ${warehouse.code}',
|
||||
style: theme.textTheme.bodyMedium?.copyWith(
|
||||
color: colorScheme.onSurfaceVariant,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 16),
|
||||
Icon(
|
||||
Icons.inventory_2_outlined,
|
||||
size: 16,
|
||||
color: colorScheme.onSurfaceVariant,
|
||||
),
|
||||
const SizedBox(width: 4),
|
||||
Text(
|
||||
'Items: ${warehouse.totalCount}',
|
||||
style: theme.textTheme.bodyMedium?.copyWith(
|
||||
color: colorScheme.onSurfaceVariant,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
// Operation cards
|
||||
Expanded(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
vertical: AppConstants.largePadding,
|
||||
),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
// Import Products Card
|
||||
OperationCard(
|
||||
title: 'Import Products',
|
||||
icon: Icons.arrow_downward_rounded,
|
||||
backgroundColor: colorScheme.tertiaryContainer.withValues(alpha: 0.3),
|
||||
iconColor: colorScheme.tertiary,
|
||||
onTap: () => _navigateToProducts(
|
||||
context,
|
||||
warehouse,
|
||||
'import',
|
||||
),
|
||||
),
|
||||
|
||||
const SizedBox(height: AppConstants.defaultPadding),
|
||||
|
||||
// Export Products Card
|
||||
OperationCard(
|
||||
title: 'Export Products',
|
||||
icon: Icons.arrow_upward_rounded,
|
||||
backgroundColor: colorScheme.primaryContainer.withValues(alpha: 0.3),
|
||||
iconColor: colorScheme.primary,
|
||||
onTap: () => _navigateToProducts(
|
||||
context,
|
||||
warehouse,
|
||||
'export',
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/// Navigate to products page with warehouse and operation type
|
||||
void _navigateToProducts(
|
||||
BuildContext context,
|
||||
WarehouseEntity warehouse,
|
||||
String operationType,
|
||||
) {
|
||||
context.goNamed(
|
||||
'products',
|
||||
extra: {
|
||||
'warehouse': warehouse,
|
||||
'warehouseName': warehouse.name,
|
||||
'operationType': operationType,
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import '../../../../core/constants/app_constants.dart';
|
||||
|
||||
/// Reusable operation card widget
|
||||
/// Large, tappable card with icon and text for operation selection
|
||||
class OperationCard extends StatelessWidget {
|
||||
final String title;
|
||||
final IconData icon;
|
||||
final VoidCallback onTap;
|
||||
final Color? backgroundColor;
|
||||
final Color? iconColor;
|
||||
|
||||
const OperationCard({
|
||||
super.key,
|
||||
required this.title,
|
||||
required this.icon,
|
||||
required this.onTap,
|
||||
this.backgroundColor,
|
||||
this.iconColor,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final theme = Theme.of(context);
|
||||
final colorScheme = theme.colorScheme;
|
||||
|
||||
return Card(
|
||||
elevation: 2,
|
||||
margin: const EdgeInsets.symmetric(
|
||||
horizontal: AppConstants.defaultPadding,
|
||||
vertical: AppConstants.smallPadding,
|
||||
),
|
||||
child: InkWell(
|
||||
onTap: onTap,
|
||||
borderRadius: BorderRadius.circular(AppConstants.borderRadius),
|
||||
child: Container(
|
||||
padding: const EdgeInsets.all(AppConstants.largePadding),
|
||||
height: 180,
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
// Icon container with background
|
||||
Container(
|
||||
width: 80,
|
||||
height: 80,
|
||||
decoration: BoxDecoration(
|
||||
color: backgroundColor ??
|
||||
colorScheme.primaryContainer.withValues(alpha: 0.3),
|
||||
shape: BoxShape.circle,
|
||||
),
|
||||
child: Icon(
|
||||
icon,
|
||||
size: 48,
|
||||
color: iconColor ?? colorScheme.primary,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: AppConstants.defaultPadding),
|
||||
|
||||
// Title
|
||||
Text(
|
||||
title,
|
||||
style: theme.textTheme.titleLarge?.copyWith(
|
||||
fontWeight: FontWeight.bold,
|
||||
color: colorScheme.onSurface,
|
||||
),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user