import 'package:comwell_key_app/check_out/bloc/check_out_cubit.dart';
import 'package:comwell_key_app/check_out/bloc/check_out_state.dart';
import 'package:comwell_key_app/check_out/components/check_out_countdown.dart';
import 'package:comwell_key_app/routing/app_routes.dart';
import 'package:comwell_key_app/themes/light_theme.dart';
import 'package:comwell_key_app/utils/l10n_utils.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:go_router/go_router.dart';
class CheckOutSuccessPage extends StatelessWidget {
final bool digitalCard;
const CheckOutSuccessPage({super.key, required this.digitalCard});
@override
Widget build(BuildContext context) {
return BlocBuilder<CheckoutCubit, CheckoutState>(
builder: (context, state) {
final cubit = context.read<CheckoutCubit>();
return Scaffold(
backgroundColor: sandColor[80],
body: Padding(
padding: const EdgeInsets.symmetric(horizontal: 16.0),
child: Padding(
padding: const EdgeInsets.symmetric(vertical: 40.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
const SizedBox(),
digitalCard ? const CheckOutCountdown() : const SizedBox(),
Column(
children: [
Text(
context.strings.checkout_page_processing_success_title,
style: Theme.of(
context,
).textTheme.headlineMedium?.copyWith(color: colorBackground),
),
Text(
digitalCard
? context.strings.checkout_page_processing_success_subtitle
: context
.strings
.checkout_page_processing_success_subtitle_no_digital_card,
textAlign: TextAlign.center,
style: Theme.of(context).textTheme.bodySmall?.copyWith(color: colorDivider),
),
],
),
Row(
children: [
Expanded(
child: ElevatedButton(
onPressed: () {
context.go(AppRoutes.overview);
context.push(AppRoutes.bookingDetails, extra: cubit.booking);
},
style: const ButtonStyle(
backgroundColor: WidgetStatePropertyAll(colorBackground),
),
child: Padding(
padding: const EdgeInsets.all(16.0),
child: Text(
context.strings.generic_ok,
style: const TextStyle(color: colorTertiary),
),
),
),
),
],
),
],
),
),
),
);
},
);
}
}