fix functional bugs

This commit is contained in:
2026-05-29 11:40:55 +03:00
parent 591265a7fc
commit 134ffdde60
50 changed files with 1086 additions and 771 deletions

View File

@@ -27,15 +27,26 @@ class SubscriptionDetailsScreen extends StatelessWidget {
const SizedBox(height: 16),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 20),
child: BlocBuilder<SubscriptionDetailsBloc, SubscriptionDetailsState>(
builder: (context, state) {
String title = "Загрузка...";
if (state is DetailsContentState) {
title = state.subscription.title;
}
return CustomAppBar(title: title);
},
),
child:
BlocConsumer<
SubscriptionDetailsBloc,
SubscriptionDetailsState
>(
listenWhen: (previous, current) =>
current is DetailsContentState && current.isSuccess,
listener: (context, state) {
if (state is DetailsContentState && state.isSuccess) {
context.pop(true);
}
},
builder: (context, state) {
String title = "Загрузка...";
if (state is DetailsContentState) {
title = state.subscription.title;
}
return CustomAppBar(title: title);
},
),
),
const SizedBox(height: 20),
@@ -53,11 +64,16 @@ class SubscriptionDetailsScreen extends StatelessWidget {
child: Image.asset('assets/wave.png'),
),
),
BlocBuilder<SubscriptionDetailsBloc, SubscriptionDetailsState>(
BlocBuilder<
SubscriptionDetailsBloc,
SubscriptionDetailsState
>(
builder: (context, state) {
if (state is DetailsLoading) {
return const Center(
child: CircularProgressIndicator(color: Color(0xFF80FFD1)),
child: CircularProgressIndicator(
color: Color(0xFF80FFD1),
),
);
}
if (state is DetailsError) {
@@ -85,6 +101,7 @@ class SubscriptionDetailsScreen extends StatelessWidget {
}
Widget _buildContent(BuildContext context, DetailsContentState state) {
final bool isAvailableForPurchase = state.subscription.isActive;
return SingleChildScrollView(
padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 20),
child: Column(
@@ -98,22 +115,28 @@ class SubscriptionDetailsScreen extends StatelessWidget {
height: 1.5,
),
),
const SizedBox(height: 30),
_ActionCard(state: state),
if (isAvailableForPurchase) ...[
const SizedBox(height: 30),
const SizedBox(height: 30),
_ActionCard(state: state),
GradientButton(
text: 'Активировать',
onTap: () => context.read<SubscriptionDetailsBloc>().add(
ActivateSubscriptionPressed(),
const SizedBox(height: 30),
GradientButton(
text: state.isAlreadyPurchased ? 'Продлить' : 'Активировать',
onTap: () {
context.read<SubscriptionDetailsBloc>().add(
ActivateSubscriptionPressed(),
);
},
enabled: state.isAgreed,
width: double.infinity,
height: 56,
fontSize: 16,
showArrows: true,
),
width: double.infinity,
height: 56,
fontSize: 16,
showArrows: true,
),
],
const SizedBox(height: 20),
],
),
@@ -232,4 +255,4 @@ class _PriceRow extends StatelessWidget {
),
);
}
}
}