velmart-picker/lib/core/widgets/step_indicator.dart
Fibe Agent 5ba2691eac feat: initial Velmart Picker Flutter app
- All 5 batch steps: Picking, Sorting, Clarification, Slots, Handoff
- go_router navigation with step indicator
- graphql_flutter client wired up (endpoint via env var)
- Mock data layer swappable with real GraphQL service
- Item types: normal, cold, frozen, alcohol, clarify
- Storage slot assignment (cell/freezer/fridge)
2026-04-23 21:43:07 +00:00

84 lines
2.4 KiB
Dart

import 'package:flutter/material.dart';
import '../../data/models/models.dart';
import '../theme/app_theme.dart';
class StepIndicator extends StatelessWidget {
final BatchStep currentStep;
const StepIndicator({super.key, required this.currentStep});
@override
Widget build(BuildContext context) {
final steps = BatchStep.values;
return Container(
color: Colors.white,
padding: const EdgeInsets.symmetric(vertical: 8),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: steps.map((step) {
final isActive = step == currentStep;
final isDone = step.index < currentStep.index;
return Expanded(
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
_StepDot(isActive: isActive, isDone: isDone, step: step),
const SizedBox(height: 4),
Text(
step.label,
style: TextStyle(
fontSize: 10,
fontWeight: isActive ? FontWeight.w700 : FontWeight.w400,
color: isActive
? AppColors.primary
: isDone
? AppColors.success
: AppColors.textSecondary,
),
textAlign: TextAlign.center,
),
],
),
);
}).toList(),
),
);
}
}
class _StepDot extends StatelessWidget {
final bool isActive;
final bool isDone;
final BatchStep step;
const _StepDot({required this.isActive, required this.isDone, required this.step});
@override
Widget build(BuildContext context) {
return Container(
width: 28,
height: 28,
decoration: BoxDecoration(
shape: BoxShape.circle,
color: isActive
? AppColors.primary
: isDone
? AppColors.success
: AppColors.divider,
),
child: Center(
child: isDone
? const Icon(Icons.check, color: Colors.white, size: 16)
: Text(
'${step.index + 1}',
style: TextStyle(
color: isActive ? Colors.white : AppColors.textSecondary,
fontSize: 13,
fontWeight: FontWeight.w600,
),
),
),
);
}
}