fix styles on the add card page, move the parser to a separate file, change the styles of the page of one news item, add a parser for the subscription page, add the input field for the qr code

This commit is contained in:
2026-06-01 17:15:08 +03:00
parent 0b6757e26f
commit b9da1d3064
9 changed files with 300 additions and 307 deletions

View File

@@ -4,9 +4,10 @@ import 'package:go_router/go_router.dart';
import '../../core/app_colors.dart';
import '../components/app_checkbox.dart';
import '../components/custom_app_bar.dart'; // ✅ Добавь импорт
import '../components/custom_app_bar.dart';
import '../components/gradient_button.dart';
import '../components/period_selector.dart';
import '../components/content_parser.dart'; // ✅ Парсер контента
import '../event/subscription_details_event.dart';
import '../state/susbcription_details_state.dart';
import '../viewmodel/susbcription_details_bloc.dart';
@@ -27,26 +28,25 @@ class SubscriptionDetailsScreen extends StatelessWidget {
const SizedBox(height: 16),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 20),
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);
},
),
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),
@@ -65,8 +65,8 @@ class SubscriptionDetailsScreen extends StatelessWidget {
),
),
BlocBuilder<
SubscriptionDetailsBloc,
SubscriptionDetailsState
SubscriptionDetailsBloc,
SubscriptionDetailsState
>(
builder: (context, state) {
if (state is DetailsLoading) {
@@ -102,27 +102,26 @@ 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(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
state.subscription.fullDescription,
style: const TextStyle(
color: Colors.white,
fontSize: 15,
height: 1.5,
// 🔹 Обёртка для растягивания контента на всю ширину
Column(
crossAxisAlignment: CrossAxisAlignment.stretch, // ✅ Растягивает детей на всю ширину
mainAxisSize: MainAxisSize.min, // ✅ Не занимает лишнее место по вертикали
children: ContentParser.parseContent(
textJson: state.subscription.fullDescriptionJson,
text: state.subscription.fullDescription,
),
),
if (isAvailableForPurchase) ...[
const SizedBox(height: 30),
_ActionCard(state: state),
const SizedBox(height: 30),
GradientButton(
text: state.isAlreadyPurchased ? 'Продлить' : 'Активировать',
onTap: () {
@@ -255,4 +254,4 @@ class _PriceRow extends StatelessWidget {
),
);
}
}
}