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

@@ -17,43 +17,63 @@ class PaymentMethodsScreen extends StatelessWidget {
body: Container(
decoration: const BoxDecoration(gradient: AppColors.phoneScreenBg),
child: SafeArea(
child: Column(
children: [
const SizedBox(height: 16),
const Padding(
padding: EdgeInsets.symmetric(horizontal: 20),
child: CustomAppBar(title: 'Способы оплаты'),
),
const SizedBox(height: 24),
Expanded(
child: BlocConsumer<PaymentMethodsBloc, PaymentMethodsState>(
listener: (context, state) {
if (state.status == PaymentMethodsStatus.failure) {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(content: Text(state.errorMessage ?? 'Ошибка')),
);
}
},
builder: (context, state) {
if (state.status == PaymentMethodsStatus.loading && state.cards.isEmpty) {
return const Center(child: CircularProgressIndicator(color: Color(0xFF00D4AA)));
}
child: BlocConsumer<PaymentMethodsBloc, PaymentMethodsState>(
listener: (context, state) {
if (state.status == PaymentMethodsStatus.failure) {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(content: Text(state.errorMessage ?? 'Ошибка')),
);
}
},
builder: (context, state) {
final isNetworkProcessing = state.status == PaymentMethodsStatus.loading ||
(state.isDeleting ?? false) ||
(state.isSettingMain ?? false);
return SingleChildScrollView(
padding: const EdgeInsets.symmetric(horizontal: 20),
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
_buildBalanceCard(context, state.balance),
const SizedBox(height: 20),
_buildCardsList(context, state),
],
return Stack(
children: [
Column(
children: [
const SizedBox(height: 16),
const Padding(
padding: EdgeInsets.symmetric(horizontal: 20),
child: CustomAppBar(title: 'Способы оплаты'),
),
);
},
),
),
],
const SizedBox(height: 24),
Expanded(
child: state.cards.isEmpty && state.status == PaymentMethodsStatus.loading
? const Center(
child: CircularProgressIndicator(color: Color(0xFF00D4AA)),
)
: SingleChildScrollView(
padding: const EdgeInsets.symmetric(horizontal: 20),
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
_buildBalanceCard(context, state.balance),
const SizedBox(height: 20),
_buildCardsList(context, state),
],
),
),
),
],
),
if (isNetworkProcessing && state.cards.isNotEmpty)
Positioned.fill(
child: Container(
color: Colors.black.withOpacity(0.4),
child: const Center(
child: CircularProgressIndicator(
color: Color(0xFF00D4AA),
),
),
),
),
],
);
},
),
),
),
@@ -163,7 +183,13 @@ class PaymentMethodsScreen extends StatelessWidget {
child: Material(
color: Colors.transparent,
child: InkWell(
onTap: () => context.go('/home/payment-methods/add-card'),
onTap: () async {
final isCardAdded = await context.push<bool>('/home/payment-methods/add-card');
if (isCardAdded == true && context.mounted) {
context.read<PaymentMethodsBloc>().add(PaymentMethodsStarted());
}
},
borderRadius: BorderRadius.circular(24),
child: const Padding(
padding: EdgeInsets.symmetric(horizontal: 16),