Files
kulakpos_app/lib/GlobalComponents/go_to_subscription-package_page_popup_widget.dart

122 lines
4.0 KiB
Dart
Raw Normal View History

2026-02-07 15:57:09 +07:00
import 'package:flutter/material.dart';
import 'package:flutter_svg/svg.dart';
import '../Screens/subscription/package_screen.dart';
import '../constant.dart';
import '../generated/l10n.dart' as lang;
import '../model/business_info_model.dart';
2026-02-08 10:31:54 +07:00
Widget goToPackagePagePopup({
required BuildContext context,
required EnrolledPlan? enrolledPlan,
VoidCallback? onCancel,
VoidCallback? onUpgrade,
}) {
2026-02-07 15:57:09 +07:00
return AlertDialog(
backgroundColor: kWhite,
surfaceTintColor: kWhite,
elevation: 0.0,
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(30)),
contentPadding: const EdgeInsets.all(20),
titlePadding: const EdgeInsets.all(0),
content: Column(
mainAxisSize: MainAxisSize.min,
children: [
Row(
children: [
const Spacer(),
IconButton(
padding: EdgeInsets.zero,
visualDensity: const VisualDensity(horizontal: -4, vertical: -4),
onPressed: () {
2026-02-08 10:31:54 +07:00
if (onCancel != null) {
onCancel();
} else {
Navigator.pop(context);
}
2026-02-07 15:57:09 +07:00
},
icon: const Icon(
Icons.close,
color: kGreyTextColor,
)),
],
),
SvgPicture.asset(
'assets/upgradePlan.svg',
height: 198,
width: 238,
),
const SizedBox(height: 20),
FittedBox(
fit: BoxFit.scaleDown,
child: Text(
// lang.S.of(context).endYourFreePlan,
textAlign: TextAlign.center,
enrolledPlan?.plan?.subscriptionName != null ? 'End your ${enrolledPlan?.plan?.subscriptionName} plan?' : "No active plan!",
style: const TextStyle(fontSize: 24, fontWeight: FontWeight.w600, color: kTitleColor),
),
),
const SizedBox(height: 10),
Text(
enrolledPlan?.plan?.subscriptionName != null
? 'Your ${enrolledPlan?.plan?.subscriptionName} plan is almost done, buy your next plan Thanks.'
: 'You dont have an active plan! buy your next plan now, Thanks',
style: Theme.of(context).textTheme.bodyMedium?.copyWith(color: kGreyTextColor),
textAlign: TextAlign.center,
),
const SizedBox(height: 20),
2026-02-08 10:31:54 +07:00
Row(
children: [
Expanded(
child: OutlinedButton(
style: OutlinedButton.styleFrom(
padding: const EdgeInsets.symmetric(vertical: 13),
side: const BorderSide(color: Colors.red),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(30),
),
),
onPressed: () {
if (onCancel != null) {
onCancel();
} else {
Navigator.pop(context);
}
},
child: Text(
lang.S.of(context).cancel,
style: const TextStyle(color: Colors.red),
),
),
),
const SizedBox(width: 10),
Expanded(
child: ElevatedButton(
style: ElevatedButton.styleFrom(
padding: const EdgeInsets.symmetric(vertical: 13),
backgroundColor: kMainColor,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(30),
),
),
child: Text(
lang.S.of(context).upgradeNow,
style: const TextStyle(color: Colors.white),
),
onPressed: () {
if (onUpgrade != null) {
onUpgrade();
} else {
Navigator.pop(context);
}
},
),
),
],
),
2026-02-07 15:57:09 +07:00
const SizedBox(height: 5),
],
),
);
}