Files
mitra-corporate/lib/widgets/stepper_registrasi.dart
2024-10-01 09:37:38 +07:00

64 lines
2.2 KiB
Dart

import 'package:flutter/material.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'package:mitra_corporate/provider/registrasi_provider.dart';
import '../app/constant.dart';
class StepperRegistrasi extends HookConsumerWidget {
final int _currentStep = 0;
StepperType stepperType = StepperType.horizontal;
StepperRegistrasi({super.key});
@override
Widget build(BuildContext context, WidgetRef ref) {
final step = ref.watch(registrasiProvider);
final tempRegistrationData = ref.watch(registrationDataProvider);
final selectedTest = ref.watch(selectedTestProvider);
final orderLoading = ref.watch(addOrderLoadingProvider);
return Scaffold(
body: Stepper(
elevation: 0,
type: stepperType,
physics: const ScrollPhysics(),
currentStep: step,
onStepTapped: !orderLoading
? (value) {
if ((value) != 3) {
ref.read(registrasiProvider.notifier).state = value;
}
}
: null,
steps: <Step>[
Step(
title: Text('Data Pasien',
style: Constant.caption1_400(context: context)
.copyWith(color: Constant.textBlack)),
content: Container(),
isActive: step == 0,
state: tempRegistrationData.patientData?.name != null
? StepState.complete
: StepState.disabled,
),
Step(
title: Text('Pemeriksaan',
style: Constant.caption1_400(context: context)
.copyWith(color: Constant.textBlack)),
content: Container(),
isActive: step == 1,
state: tempRegistrationData.tests != null
? StepState.complete
: StepState.disabled,
),
Step(
title: Text('Detail Order',
style: Constant.caption1_400(context: context)
.copyWith(color: Constant.textBlack)),
content: Container(),
isActive: step == 2,
state: step - 1 >= 2 ? StepState.complete : StepState.disabled,
),
]));
}
}