redesigned payment page + a lot of fixes

This commit is contained in:
Arseni
2026-02-21 21:55:20 +03:00
parent a68aa2abff
commit 0c6fa03aba
208 changed files with 4062 additions and 2217 deletions

View File

@@ -1,70 +0,0 @@
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'package:pshared/models/payment/quote/status_type.dart';
import 'package:pweb/pages/dashboard/payouts/quote_status/widgets/body.dart';
import 'package:pweb/providers/quotation/quotation.dart';
import 'package:pweb/utils/quote_duration_format.dart';
import 'package:pweb/generated/i18n/app_localizations.dart';
class QuoteStatus extends StatelessWidget {
final double spacing;
const QuoteStatus({super.key, required this.spacing});
@override
Widget build(BuildContext context) {
final loc = AppLocalizations.of(context)!;
final controller = context.watch<QuotationController>();
final timeLeft = controller.timeLeft;
final isLoading = controller.isLoading;
final statusType = controller.quoteStatus;
final autoRefreshMode = controller.autoRefreshMode;
String statusText;
String? helperText;
switch (statusType) {
case QuoteStatusType.loading:
statusText = loc.quoteUpdating;
break;
case QuoteStatusType.error:
statusText = loc.quoteErrorGeneric;
break;
case QuoteStatusType.missing:
statusText = loc.quoteUnavailable;
break;
case QuoteStatusType.expired:
statusText = loc.quoteExpired;
helperText = loc.quoteRefreshRequired;
break;
case QuoteStatusType.active:
statusText = timeLeft == null
? loc.quoteActive
: loc.quoteExpiresIn(formatQuoteDuration(timeLeft));
break;
}
final canRefresh = controller.canRefresh && !isLoading;
final showPrimaryRefresh = canRefresh &&
(statusType == QuoteStatusType.expired ||
statusType == QuoteStatusType.error ||
statusType == QuoteStatusType.missing);
return QuoteStatusBody(
spacing: spacing,
statusType: statusType,
statusText: statusText,
helperText: helperText,
isLoading: isLoading,
canRefresh: canRefresh,
showPrimaryRefresh: showPrimaryRefresh,
autoRefreshMode: autoRefreshMode,
onAutoRefreshModeChanged: controller.setAutoRefreshMode,
onRefresh: controller.refreshQuotation,
);
}
}

View File

@@ -48,34 +48,14 @@ class QuoteAutoRefreshSection extends StatelessWidget {
),
),
const SizedBox(width: _autoRefreshSpacing),
ToggleButtons(
isSelected: [
autoRefreshMode == AutoRefreshMode.off,
autoRefreshMode == AutoRefreshMode.on,
],
onPressed: canRefresh
? (index) {
final nextMode =
index == 1 ? AutoRefreshMode.on : AutoRefreshMode.off;
if (nextMode == autoRefreshMode) return;
onModeChanged(nextMode);
}
Switch.adaptive(
activeTrackColor: theme.colorScheme.primary,
value: autoRefreshMode == AutoRefreshMode.on,
onChanged: canRefresh
? (value) => onModeChanged(
value ? AutoRefreshMode.on : AutoRefreshMode.off,
)
: null,
borderRadius: BorderRadius.circular(999),
constraints: const BoxConstraints(minHeight: 32, minWidth: 56),
selectedColor: theme.colorScheme.onPrimary,
fillColor: theme.colorScheme.primary,
color: theme.colorScheme.onSurface,
children: [
Padding(
padding: const EdgeInsets.symmetric(horizontal: 12),
child: Text(loc.toggleOff),
),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 12),
child: Text(loc.toggleOn),
),
],
),
],
);