feat(issue-1154, issue-851): diary UX changed, price added to a active plan card

This commit is contained in:
misha
2026-11-24 12:17:32 +03:00
parent 1e8c1ab2eb
commit ad122ed2f7
6 changed files with 436 additions and 133 deletions

View File

@@ -24,8 +24,14 @@ import 'package:share_plus/share_plus.dart';
class PlanWidget extends StatefulWidget {
final PlanModel plan;
final int index;
final bool showPriceOnCover;
const PlanWidget({super.key, required this.plan, required this.index});
const PlanWidget({
super.key,
required this.plan,
required this.index,
this.showPriceOnCover = false,
});
@override
State<PlanWidget> createState() => _PlanWidgetState();
@@ -37,6 +43,10 @@ class _PlanWidgetState extends State<PlanWidget> {
@override
Widget build(BuildContext context) {
final s = S.of(context);
final minPrice = widget.plan.minPriceOfOptions.toStringAsFixed(0);
final price = widget.plan.packetsCount == 1
? '${widget.plan.packet1Options?.price ?? minPrice}₽'
: '${s.from} $minPrice₽';
return InkWell(
onTap: () => GoRouter.of(context).pushNamed(
'aboutPlanScreen',
@@ -117,14 +127,40 @@ class _PlanWidgetState extends State<PlanWidget> {
),
Positioned(
bottom: 16,
child: SizedBox(
width: MediaQuery.sizeOf(context).width,
child: InfoRow(
plan: widget.plan,
itemsBackgroundColor: appTheme.whiteA700,
disableDescriptionOfTypes: true,
type: ProductType.plan,
),
left: 0,
right: 0,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
if (widget.showPriceOnCover)
Padding(
padding: const EdgeInsets.only(bottom: 8),
child: Container(
padding: const EdgeInsets.symmetric(
horizontal: 14,
vertical: 4,
),
decoration: BoxDecoration(
color: appTheme.greenA700,
borderRadius: const BorderRadius.horizontal(
right: Radius.circular(8),
),
),
child: Text(
price,
style: TextStyles.textSSemibold.copyWith(
color: appTheme.whiteA700,
),
),
),
),
InfoRow(
plan: widget.plan,
itemsBackgroundColor: appTheme.whiteA700,
disableDescriptionOfTypes: true,
type: ProductType.plan,
),
],
),
),
],
@@ -216,14 +252,16 @@ class _PlanWidgetState extends State<PlanWidget> {
),
],
),
const Spacer(),
Text(
'${widget.plan.packetsCount == 1 ? widget.plan.packet1Options?.price : '${s.from} ${widget.plan.minPriceOfOptions.toStringAsFixed(0)}'}₽',
style: TextStyles.headingXLSemibold.copyWith(
color: appTheme.greenA700,
if (!widget.showPriceOnCover) ...[
const Spacer(),
Text(
price,
style: TextStyles.headingXLSemibold.copyWith(
color: appTheme.greenA700,
),
),
),
const SizedBox(width: 16),
const SizedBox(width: 16),
],
],
),
title: Padding(