fix(chat): initialize startDate to current date when personal diet is not enabled and streamline widget layout for improved readability

This commit is contained in:
mso7nueh
2025-12-12 10:38:53 +03:00
parent 2408443a26
commit 391efeb8dd
8 changed files with 737 additions and 52 deletions

View File

@@ -28,6 +28,8 @@ class _ChosePlanDateWidget extends State<ChosePlanDateWidget> {
super.initState();
if (widget.hasPersonalDiet) {
startDate = [DateTime.now().add(const Duration(days: 2))];
} else {
startDate = [DateTime.now()];
}
}
@@ -49,23 +51,12 @@ class _ChosePlanDateWidget extends State<ChosePlanDateWidget> {
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Text(
planName ?? '',
style: TextStyles.headingXLSemibold.copyWith(
color: appTheme.black,
),
),
Text(planName ?? '', style: TextStyles.headingXLSemibold.copyWith(color: appTheme.black)),
if (widget.hasPersonalDiet) ...[
const SizedBox(
width: 8,
),
const SizedBox(width: 8),
PortalTarget(
closeDuration: const Duration(milliseconds: 20),
anchor: const Aligned(
shiftToWithinBound: AxisFlag(x: true, y: true),
follower: Alignment.topRight,
target: Alignment.bottomLeft,
),
anchor: const Aligned(shiftToWithinBound: AxisFlag(x: true, y: true), follower: Alignment.topRight, target: Alignment.bottomLeft),
portalFollower: Padding(
padding: const EdgeInsets.symmetric(horizontal: 20),
child: Container(
@@ -73,24 +64,12 @@ class _ChosePlanDateWidget extends State<ChosePlanDateWidget> {
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(12),
color: visible ? appTheme.whiteA700 : Colors.transparent,
boxShadow: visible
? [
BoxShadow(
color: appTheme.black900.withValues(alpha: 0.15),
blurRadius: 4,
offset: const Offset(0, 4),
),
]
: null,
boxShadow: visible ? [BoxShadow(color: appTheme.black900.withValues(alpha: 0.15), blurRadius: 4, offset: const Offset(0, 4))] : null,
),
child: AnimatedDefaultTextStyle(
style: TextStyles.textMMediumAuto.copyWith(
color: visible ? appTheme.black : Colors.transparent,
),
style: TextStyles.textMMediumAuto.copyWith(color: visible ? appTheme.black : Colors.transparent),
duration: const Duration(milliseconds: 300),
child: Text(
s.chosenPlanStartDateDescr,
),
child: Text(s.chosenPlanStartDateDescr),
),
),
),
@@ -104,14 +83,11 @@ class _ChosePlanDateWidget extends State<ChosePlanDateWidget> {
'assets/icons/question_mark.svg',
width: 22,
height: 22,
colorFilter: ColorFilter.mode(
appTheme.blueA400,
BlendMode.srcIn,
),
colorFilter: ColorFilter.mode(appTheme.blueA400, BlendMode.srcIn),
),
),
)
]
),
],
],
),
const SizedBox(height: 12),
@@ -120,19 +96,12 @@ class _ChosePlanDateWidget extends State<ChosePlanDateWidget> {
child: Text(
s.chose_plan_start_date_2,
textAlign: TextAlign.center,
style: TextStyles.textMMedium.copyWith(
color: appTheme.black,
),
style: TextStyles.textMMedium.copyWith(color: appTheme.black),
),
),
const SizedBox(height: 12),
const Padding(
padding: EdgeInsets.symmetric(horizontal: 16.0),
child: CustomDivider(),
),
CalendarWidget(
startDate: startDate,
),
const Padding(padding: EdgeInsets.symmetric(horizontal: 16.0), child: CustomDivider()),
CalendarWidget(startDate: startDate),
Padding(
padding: const EdgeInsets.only(left: 16, right: 16, top: 16, bottom: 28),
child: CustomOutlinedButton(
@@ -150,13 +119,8 @@ class _ChosePlanDateWidget extends State<ChosePlanDateWidget> {
},
height: 60,
text: s.confirm,
buttonTextStyle: TextStyles.textLSemibold.copyWith(
color: appTheme.whiteA700,
),
buttonStyle: ButtonStyle(
backgroundColor: WidgetStatePropertyAll(appTheme.blueA400),
side: const WidgetStatePropertyAll(BorderSide.none),
),
buttonTextStyle: TextStyles.textLSemibold.copyWith(color: appTheme.whiteA700),
buttonStyle: ButtonStyle(backgroundColor: WidgetStatePropertyAll(appTheme.blueA400), side: const WidgetStatePropertyAll(BorderSide.none)),
),
),
],