forked from eatvio/eatvio_app
97 lines
4.1 KiB
Dart
97 lines
4.1 KiB
Dart
import 'package:eatvio_app/core/theme/custom_text_style.dart';
|
|
import 'package:eatvio_app/core/theme/theme_helper.dart';
|
|
import 'package:eatvio_app/features/chat/presentation/bloc/chat_room_cubit/chat_room_cubit.dart';
|
|
import 'package:eatvio_app/features/chat/presentation/pages/payment_screen.dart';
|
|
import 'package:eatvio_app/features/chat/presentation/widgets/chose_plan_date_widget.dart';
|
|
import 'package:eatvio_app/generated/l10n.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
|
import 'package:flutter_svg/svg.dart';
|
|
import 'package:go_router/go_router.dart';
|
|
|
|
class NotificationBanner extends StatelessWidget {
|
|
const NotificationBanner({super.key, required this.bannerType});
|
|
final BannerType bannerType;
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final size = MediaQuery.sizeOf(context);
|
|
final s = S.of(context);
|
|
return Container(
|
|
decoration: BoxDecoration(
|
|
color: appTheme.gray50,
|
|
borderRadius: BorderRadius.circular(20),
|
|
),
|
|
child: Row(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Padding(
|
|
padding: const EdgeInsets.only(top: 12, right: 8, left: 12),
|
|
child: SvgPicture.asset('assets/icons/reversed_exclamation_mark.svg', height: 68, width: 68),
|
|
),
|
|
Padding(
|
|
padding: const EdgeInsets.only(top: 16),
|
|
child: Column(
|
|
mainAxisSize: MainAxisSize.min,
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: switch (bannerType) {
|
|
BannerType.date => [
|
|
SizedBox(
|
|
width: size.width * 0.6,
|
|
child: Text(s.choose_plan_start_date, style: TextStyles.textMMedium.copyWith(color: appTheme.black)),
|
|
),
|
|
const SizedBox(height: 12),
|
|
GestureDetector(
|
|
onTap: () {
|
|
final cubit = context.read<ChatRoomCubit>();
|
|
showModalBottomSheet(
|
|
context: context,
|
|
builder: (context) => ChosePlanDateWidget(
|
|
chatCubit: cubit,
|
|
),
|
|
);
|
|
},
|
|
child: Text(s.choose_date, style: TextStyles.textLSemibold.copyWith(color: appTheme.blueA400)),
|
|
),
|
|
const SizedBox(height: 16),
|
|
],
|
|
BannerType.card => [
|
|
SizedBox(
|
|
width: size.width * 0.6,
|
|
child: Text(s.can_not_choose_start_date, style: TextStyles.textMMedium.copyWith(color: appTheme.black)),
|
|
),
|
|
const SizedBox(height: 12),
|
|
GestureDetector(
|
|
onTap: () {},
|
|
child: Text(s.add_card, style: TextStyles.textLSemibold.copyWith(color: appTheme.blueA400)),
|
|
),
|
|
const SizedBox(height: 16),
|
|
],
|
|
BannerType.payment => [
|
|
SizedBox(
|
|
width: size.width * 0.6,
|
|
child: Text(s.tap_on_link_to_pay, style: TextStyles.textMMedium.copyWith(color: appTheme.black)),
|
|
),
|
|
const SizedBox(height: 12),
|
|
GestureDetector(
|
|
onTap: () async {
|
|
final paymentLink = await context.read<ChatRoomCubit>().getPaymentLink();
|
|
if (paymentLink != null) {
|
|
if (!context.mounted) return;
|
|
GoRouter.of(context).push(PaymentScreen.path, extra: paymentLink);
|
|
}
|
|
},
|
|
child: Text(s.pay, style: TextStyles.textLSemibold.copyWith(color: appTheme.blueA400)),
|
|
),
|
|
const SizedBox(height: 16),
|
|
],
|
|
},
|
|
),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|
|
|
|
enum BannerType { date, card, payment }
|