changed color theme to be black and added the ability to enter the amount in the recipient’s currency

This commit is contained in:
Arseni
2026-03-02 17:41:41 +03:00
parent 17e08ff26f
commit 6bb3ab5063
41 changed files with 618 additions and 239 deletions

View File

@@ -15,7 +15,7 @@ class CommonConstants {
static String clientId = ''; static String clientId = '';
static String wsProto = 'ws'; static String wsProto = 'ws';
static String wsEndpoint = '/ws'; static String wsEndpoint = '/ws';
static Color themeColor = Color.fromARGB(255, 80, 63, 224); static Color themeColor = Color.fromARGB(255, 0, 0, 0);
static String nilObjectRef = '000000000000000000000000'; static String nilObjectRef = '000000000000000000000000';
// Public getters for shared properties // Public getters for shared properties

View File

@@ -0,0 +1,20 @@
import 'package:json_annotation/json_annotation.dart';
import 'package:pshared/data/dto/money.dart';
part 'network_fee.g.dart';
@JsonSerializable()
class NetworkFeeDTO {
final MoneyDTO? networkFee;
final String? estimationContext;
const NetworkFeeDTO({
this.networkFee,
this.estimationContext,
});
factory NetworkFeeDTO.fromJson(Map<String, dynamic> json) => _$NetworkFeeDTOFromJson(json);
Map<String, dynamic> toJson() => _$NetworkFeeDTOToJson(this);
}

View File

@@ -0,0 +1,24 @@
import 'package:json_annotation/json_annotation.dart';
import 'package:pshared/data/dto/money.dart';
part 'quote_aggregate.g.dart';
@JsonSerializable()
class PaymentQuoteAggregateDTO {
final List<MoneyDTO>? debitAmounts;
final List<MoneyDTO>? expectedSettlementAmounts;
final List<MoneyDTO>? expectedFeeTotals;
final List<MoneyDTO>? networkFeeTotals;
const PaymentQuoteAggregateDTO({
this.debitAmounts,
this.expectedSettlementAmounts,
this.expectedFeeTotals,
this.networkFeeTotals,
});
factory PaymentQuoteAggregateDTO.fromJson(Map<String, dynamic> json) => _$PaymentQuoteAggregateDTOFromJson(json);
Map<String, dynamic> toJson() => _$PaymentQuoteAggregateDTOToJson(this);
}

View File

@@ -73,7 +73,7 @@ enum ResourceType {
@JsonValue('ledger_parties') @JsonValue('ledger_parties')
ledgerParties, ledgerParties,
@JsonValue('ledger_posing_lines') @JsonValue('ledger_posting_lines')
ledgerPostingLines, ledgerPostingLines,
@JsonValue('payments') @JsonValue('payments')
@@ -113,4 +113,8 @@ enum ResourceType {
/// Represents steps in workflows or processes /// Represents steps in workflows or processes
@JsonValue('steps') @JsonValue('steps')
steps, steps,
/// Fallback for unknown values returned by backend.
@JsonValue('unknown')
unknown,
} }

View File

@@ -1,12 +1,15 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:pshared/models/payment/settlement_mode.dart';
class PaymentAmountProvider with ChangeNotifier { class PaymentAmountProvider with ChangeNotifier {
double _amount = 10.0; double _amount = 10.0;
bool _payerCoversFee = true; bool _payerCoversFee = true;
SettlementMode _settlementMode = SettlementMode.fixSource;
double get amount => _amount; double get amount => _amount;
bool get payerCoversFee => _payerCoversFee; bool get payerCoversFee => _payerCoversFee;
SettlementMode get settlementMode => _settlementMode;
void setAmount(double value) { void setAmount(double value) {
_amount = value; _amount = value;
@@ -17,4 +20,10 @@ class PaymentAmountProvider with ChangeNotifier {
_payerCoversFee = value; _payerCoversFee = value;
notifyListeners(); notifyListeners();
} }
void setSettlementMode(SettlementMode value) {
if (_settlementMode == value) return;
_settlementMode = value;
notifyListeners();
}
} }

View File

@@ -7,6 +7,7 @@ import 'package:pshared/provider/resource.dart';
import 'package:pshared/service/payment/multiple.dart'; import 'package:pshared/service/payment/multiple.dart';
import 'package:pshared/utils/exception.dart'; import 'package:pshared/utils/exception.dart';
class MultiPaymentProvider extends ChangeNotifier { class MultiPaymentProvider extends ChangeNotifier {
late OrganizationsProvider _organization; late OrganizationsProvider _organization;
late MultiQuotationProvider _quotation; late MultiQuotationProvider _quotation;

View File

@@ -22,6 +22,8 @@ import 'package:pshared/utils/currency.dart';
import 'package:pshared/utils/payment/fx_helpers.dart'; import 'package:pshared/utils/payment/fx_helpers.dart';
class QuotationIntentBuilder { class QuotationIntentBuilder {
static const String _settlementCurrency = 'RUB';
PaymentIntent? build({ PaymentIntent? build({
required PaymentAmountProvider payment, required PaymentAmountProvider payment,
required WalletsController wallets, required WalletsController wallets,
@@ -39,10 +41,12 @@ class QuotationIntentBuilder {
data: paymentData, data: paymentData,
); );
final sourceCurrency = currencyCodeToString(selectedWallet.currency); final sourceCurrency = currencyCodeToString(selectedWallet.currency);
final amountCurrency = payment.settlementMode == SettlementMode.fixReceived
? _settlementCurrency
: sourceCurrency;
final amount = Money( final amount = Money(
amount: payment.amount.toString(), amount: payment.amount.toString(),
// TODO: adapt to possible other sources currency: amountCurrency,
currency: sourceCurrency,
); );
final isCryptoToCrypto = final isCryptoToCrypto =
paymentData is CryptoAddressPaymentMethod && paymentData is CryptoAddressPaymentMethod &&
@@ -50,7 +54,7 @@ class QuotationIntentBuilder {
amount.currency; amount.currency;
final fxIntent = FxIntentHelper.buildSellBaseBuyQuote( final fxIntent = FxIntentHelper.buildSellBaseBuyQuote(
baseCurrency: sourceCurrency, baseCurrency: sourceCurrency,
quoteCurrency: 'RUB', // TODO: exentd target currencies quoteCurrency: _settlementCurrency, // TODO: exentd target currencies
enabled: !isCryptoToCrypto, enabled: !isCryptoToCrypto,
); );
return PaymentIntent( return PaymentIntent(
@@ -68,7 +72,7 @@ class QuotationIntentBuilder {
feeTreatment: payment.payerCoversFee feeTreatment: payment.payerCoversFee
? FeeTreatment.addToSource ? FeeTreatment.addToSource
: FeeTreatment.deductFromDestination, : FeeTreatment.deductFromDestination,
settlementMode: SettlementMode.fixSource, settlementMode: payment.settlementMode,
customer: customer, customer: customer,
); );
} }

View File

@@ -13,6 +13,7 @@ import 'package:pshared/models/payment/quote/quotes.dart';
import 'package:pshared/service/authorization/service.dart'; import 'package:pshared/service/authorization/service.dart';
import 'package:pshared/service/services.dart'; import 'package:pshared/service/services.dart';
class MultiplePaymentsService { class MultiplePaymentsService {
static final _logger = Logger('service.payment.multiple'); static final _logger = Logger('service.payment.multiple');
static const String _objectType = Services.payments; static const String _objectType = Services.payments;

View File

@@ -17,6 +17,7 @@ import 'package:pshared/service/authorization/storage.dart';
import 'package:pshared/service/services.dart'; import 'package:pshared/service/services.dart';
import 'package:pshared/utils/http/requests.dart'; import 'package:pshared/utils/http/requests.dart';
class VerificationService { class VerificationService {
static final _logger = Logger('service.verification'); static final _logger = Logger('service.verification');
static const String _objectType = Services.verification; static const String _objectType = Services.verification;

View File

@@ -0,0 +1,57 @@
import 'package:pshared/models/payment/methods/card.dart';
import 'package:pshared/models/payment/methods/crypto_address.dart';
import 'package:pshared/models/payment/methods/data.dart';
import 'package:pshared/models/payment/methods/iban.dart';
import 'package:pshared/models/payment/methods/russian_bank.dart';
import 'package:pshared/models/payment/quote/quote.dart';
class PaymentQuotationCurrencyResolver {
static String? resolveQuoteCurrency({
PaymentQuote? quote,
PaymentMethodData? paymentData,
}) {
final quoteCurrency = _normalizeCurrency(
quote?.amounts?.destinationSettlement?.currency,
);
if (quoteCurrency != null) return quoteCurrency;
if (paymentData == null) return null;
final metadataCurrency = _normalizeCurrency(
paymentData.metadata?['currency'],
);
if (metadataCurrency != null) return metadataCurrency;
if (paymentData is CryptoAddressPaymentMethod) {
return _normalizeCurrency(paymentData.asset?.tokenSymbol);
}
if (paymentData is RussianBankAccountPaymentMethod ||
paymentData is CardPaymentMethod) {
return 'RUB';
}
if (paymentData is IbanPaymentMethod) {
return 'EUR';
}
return null;
}
static bool isFxEnabled({
required String? sourceCurrency,
required String? quoteCurrency,
}) {
final normalizedSource = _normalizeCurrency(sourceCurrency);
final normalizedQuote = _normalizeCurrency(quoteCurrency);
if (normalizedSource == null || normalizedQuote == null) return false;
return normalizedSource != normalizedQuote;
}
static String? _normalizeCurrency(String? value) {
final normalized = value?.trim().toUpperCase();
if (normalized == null || normalized.isEmpty) return null;
return normalized;
}
}

View File

@@ -20,7 +20,10 @@ class PayApp extends StatelessWidget {
Widget build(BuildContext context) => MaterialApp.router( Widget build(BuildContext context) => MaterialApp.router(
title: 'Sendico', title: 'Sendico',
theme: ThemeData( theme: ThemeData(
colorScheme: ColorScheme.fromSeed(seedColor: Constants.themeColor), colorScheme: ColorScheme.fromSeed(
seedColor: Constants.themeColor,
dynamicSchemeVariant: DynamicSchemeVariant.monochrome,
),
useMaterial3: true, useMaterial3: true,
), ),
routerConfig: _router, routerConfig: _router,

View File

@@ -1,25 +1,56 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:pshared/controllers/balance_mask/wallets.dart';
import 'package:pshared/models/payment/settlement_mode.dart';
import 'package:pshared/provider/payment/amount.dart'; import 'package:pshared/provider/payment/amount.dart';
import 'package:pshared/utils/currency.dart'; import 'package:pshared/utils/currency.dart';
import 'package:pshared/utils/money.dart'; import 'package:pshared/utils/money.dart';
import 'package:pweb/models/payment/amount/mode.dart';
class PaymentAmountFieldController extends ChangeNotifier { class PaymentAmountFieldController extends ChangeNotifier {
static const String _settlementCurrencyCode = 'RUB';
final TextEditingController textController; final TextEditingController textController;
final FocusNode focusNode = FocusNode();
PaymentAmountProvider? _provider; PaymentAmountProvider? _provider;
WalletsController? _wallets;
bool _isSyncingText = false; bool _isSyncingText = false;
PaymentAmountMode _mode = PaymentAmountMode.debit;
PaymentAmountFieldController({required double initialAmount}) PaymentAmountFieldController({required double initialAmount})
: textController = TextEditingController( : textController = TextEditingController(
text: amountToString(initialAmount), text: amountToString(initialAmount),
); );
void update(PaymentAmountProvider provider) { PaymentAmountMode get mode => _mode;
if (identical(_provider, provider)) return; bool get isReverseModeAvailable {
final sourceCurrencyCode = _sourceCurrencyCode;
return sourceCurrencyCode != null &&
sourceCurrencyCode != _settlementCurrencyCode;
}
String? get activeCurrencyCode => switch (_mode) {
PaymentAmountMode.debit => _sourceCurrencyCode,
PaymentAmountMode.settlement => _settlementCurrencyCode,
};
void update(PaymentAmountProvider provider, WalletsController wallets) {
if (!identical(_provider, provider)) {
_provider?.removeListener(_handleProviderChanged); _provider?.removeListener(_handleProviderChanged);
_provider = provider; _provider = provider;
_provider?.addListener(_handleProviderChanged); _provider?.addListener(_handleProviderChanged);
_syncModeWithProvider(provider);
}
if (!identical(_wallets, wallets)) {
_wallets?.removeListener(_handleWalletsChanged);
_wallets = wallets;
_wallets?.addListener(_handleWalletsChanged);
_normalizeModeForWallet();
}
_syncTextWithAmount(provider.amount); _syncTextWithAmount(provider.amount);
} }
@@ -31,11 +62,69 @@ class PaymentAmountFieldController extends ChangeNotifier {
} }
} }
void handleModeChanged(PaymentAmountMode value) {
if (value == _mode) return;
if (!isReverseModeAvailable && value == PaymentAmountMode.settlement) {
return;
}
_mode = value;
_provider?.setSettlementMode(_settlementModeFromMode(value));
notifyListeners();
}
void _handleProviderChanged() { void _handleProviderChanged() {
final provider = _provider; final provider = _provider;
if (provider == null) return; if (provider == null) return;
_syncTextWithAmount(provider.amount); _syncTextWithAmount(provider.amount);
final changed = _syncModeWithProvider(provider);
if (changed) {
_normalizeModeForWallet();
notifyListeners();
} }
}
void _handleWalletsChanged() {
final changed = _normalizeModeForWallet();
if (changed) {
notifyListeners();
}
}
bool _syncModeWithProvider(PaymentAmountProvider provider) {
final nextMode = _modeFromSettlementMode(provider.settlementMode);
if (nextMode == _mode) return false;
_mode = nextMode;
return true;
}
bool _normalizeModeForWallet() {
if (isReverseModeAvailable || _mode != PaymentAmountMode.settlement) {
return false;
}
_mode = PaymentAmountMode.debit;
_provider?.setSettlementMode(SettlementMode.fixSource);
return true;
}
String? get _sourceCurrencyCode {
final selectedWallet = _wallets?.selectedWallet;
if (selectedWallet == null) return null;
return currencyCodeToString(selectedWallet.currency);
}
PaymentAmountMode _modeFromSettlementMode(SettlementMode mode) =>
switch (mode) {
SettlementMode.fixReceived => PaymentAmountMode.settlement,
SettlementMode.fixSource ||
SettlementMode.unspecified => PaymentAmountMode.debit,
};
SettlementMode _settlementModeFromMode(PaymentAmountMode mode) =>
switch (mode) {
PaymentAmountMode.debit => SettlementMode.fixSource,
PaymentAmountMode.settlement => SettlementMode.fixReceived,
};
double? _parseAmount(String value) { double? _parseAmount(String value) {
final parsed = parseMoneyAmount( final parsed = parseMoneyAmount(
@@ -61,6 +150,8 @@ class PaymentAmountFieldController extends ChangeNotifier {
@override @override
void dispose() { void dispose() {
_provider?.removeListener(_handleProviderChanged); _provider?.removeListener(_handleProviderChanged);
_wallets?.removeListener(_handleWalletsChanged);
focusNode.dispose();
textController.dispose(); textController.dispose();
super.dispose(); super.dispose();
} }

View File

@@ -403,9 +403,9 @@
"idempotencyKeyLabel": "Idempotency key", "idempotencyKeyLabel": "Idempotency key",
"quoteIdLabel": "Quote ID", "quoteIdLabel": "Quote ID",
"createdAtLabel": "Created at", "createdAtLabel": "Created at",
"debitAmountLabel": "Debit amount", "debitAmountLabel": "You pay",
"debitSettlementAmountLabel": "Debit settlement amount", "debitSettlementAmountLabel": "Debit settlement amount",
"expectedSettlementAmountLabel": "Expected settlement amount", "expectedSettlementAmountLabel": "Recipient gets",
"feeTotalLabel": "Total fee", "feeTotalLabel": "Total fee",
"networkFeeLabel": "Network fee", "networkFeeLabel": "Network fee",
"fxRateLabel": "Rate", "fxRateLabel": "Rate",

View File

@@ -403,9 +403,9 @@
"idempotencyKeyLabel": "Ключ идемпотентности", "idempotencyKeyLabel": "Ключ идемпотентности",
"quoteIdLabel": "ID котировки", "quoteIdLabel": "ID котировки",
"createdAtLabel": "Создан", "createdAtLabel": "Создан",
"debitAmountLabel": "Списано", "debitAmountLabel": "Вы платите",
"debitSettlementAmountLabel": "Списано к зачислению", "debitSettlementAmountLabel": "Списано к зачислению",
"expectedSettlementAmountLabel": "Ожидаемая сумма зачисления", "expectedSettlementAmountLabel": "Получателю поступит",
"feeTotalLabel": "Комиссия", "feeTotalLabel": "Комиссия",
"networkFeeLabel": "Сетевая комиссия", "networkFeeLabel": "Сетевая комиссия",
"fxRateLabel": "Курс", "fxRateLabel": "Курс",

View File

@@ -0,0 +1 @@
enum PaymentAmountMode {debit, settlement}

View File

@@ -9,7 +9,10 @@ class TwoFactorCodeInput extends StatelessWidget {
const TwoFactorCodeInput({super.key, required this.onCompleted}); const TwoFactorCodeInput({super.key, required this.onCompleted});
@override @override
Widget build(BuildContext context) => Center( Widget build(BuildContext context){
final theme = Theme.of(context).colorScheme;
return Center(
child: ConstrainedBox( child: ConstrainedBox(
constraints: const BoxConstraints(maxWidth: 300), constraints: const BoxConstraints(maxWidth: 300),
child: MaterialPinField( child: MaterialPinField(
@@ -21,9 +24,13 @@ class TwoFactorCodeInput extends StatelessWidget {
shape: MaterialPinShape.outlined, shape: MaterialPinShape.outlined,
borderRadius: BorderRadius.circular(4), borderRadius: BorderRadius.circular(4),
cellSize: Size(40, 48), cellSize: Size(40, 48),
borderColor: Theme.of(context).colorScheme.primaryContainer, borderColor: theme.primaryContainer.withValues(alpha: 0.2),
focusedBorderColor: Theme.of(context).colorScheme.primary, focusedBorderColor: theme.primary,
cursorColor: Theme.of(context).colorScheme.primary, filledBorderColor: theme.primary,
cursorColor: theme.primary,
focusedFillColor: theme.onSecondary,
filledFillColor: theme.onSecondary,
fillColor: theme.onSecondary,
), ),
onCompleted: onCompleted, onCompleted: onCompleted,
onChanged: (_) {}, onChanged: (_) {},
@@ -31,3 +38,4 @@ class TwoFactorCodeInput extends StatelessWidget {
), ),
); );
} }
}

View File

@@ -24,11 +24,12 @@ class TransactionRefButton extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final theme = Theme.of(context).colorScheme; final theme = Theme.of(context);
final colorScheme = theme.colorScheme;
final backgroundColor = isActive ? theme.primary : theme.onSecondary; final selectedBackground = colorScheme.onSecondary;
final foregroundColor = isActive ? theme.onPrimary : theme.onPrimaryContainer; final backgroundColor = isActive ? colorScheme.primary : selectedBackground;
final hoverColor = isActive ? theme.primary : theme.secondaryContainer; final hoverColor = isActive ? colorScheme.primary : colorScheme.surfaceContainerHighest;
final foregroundColor = isActive ? colorScheme.onPrimary : colorScheme.primary;
return Material( return Material(
color: backgroundColor, color: backgroundColor,

View File

@@ -2,36 +2,49 @@ import 'package:flutter/material.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'package:pshared/controllers/balance_mask/wallets.dart';
import 'package:pshared/models/currency.dart';
import 'package:pshared/utils/currency.dart'; import 'package:pshared/utils/currency.dart';
import 'package:pweb/controllers/payments/amount_field.dart'; import 'package:pweb/controllers/payments/amount_field.dart';
import 'package:pweb/models/payment/amount/mode.dart';
import 'package:pweb/pages/dashboard/payouts/amount/mode/selector.dart';
import 'package:pweb/generated/i18n/app_localizations.dart'; import 'package:pweb/generated/i18n/app_localizations.dart';
class PaymentAmountField extends StatelessWidget { class PaymentAmountField extends StatelessWidget {
const PaymentAmountField(); const PaymentAmountField();
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final currency = context.select<WalletsController, Currency?>(
(c) => c.selectedWallet?.currency,
);
final symbol = currency == null ? null : currencyCodeToSymbol(currency);
final ui = context.watch<PaymentAmountFieldController>(); final ui = context.watch<PaymentAmountFieldController>();
final loc = AppLocalizations.of(context)!;
final symbol = currencySymbolFromCode(ui.activeCurrencyCode);
return TextField( return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
if (ui.isReverseModeAvailable) ...[
PaymentAmountModeSelector(
selectedMode: ui.mode,
onModeChanged: ui.handleModeChanged,
),
const SizedBox(height: 6),
],
TextField(
controller: ui.textController, controller: ui.textController,
focusNode: ui.focusNode,
keyboardType: const TextInputType.numberWithOptions(decimal: true), keyboardType: const TextInputType.numberWithOptions(decimal: true),
decoration: InputDecoration( decoration: InputDecoration(
labelText: AppLocalizations.of(context)!.amount, labelText: loc.amount,
border: const OutlineInputBorder(), border: const OutlineInputBorder(),
prefixText: symbol == null ? null : '$symbol\u00A0', prefixText: symbol == null ? null : '$symbol\u00A0',
helperText: switch (ui.mode) {
PaymentAmountMode.debit => loc.debitAmountLabel,
PaymentAmountMode.settlement => loc.expectedSettlementAmountLabel,
},
), ),
onChanged: ui.handleChanged, onChanged: ui.handleChanged,
),
],
); );
} }
} }

View File

@@ -0,0 +1,43 @@
import 'package:flutter/material.dart';
class ModeButton extends StatelessWidget {
final String label;
final bool isSelected;
final VoidCallback onTap;
const ModeButton({
required this.label,
required this.isSelected,
required this.onTap,
});
@override
Widget build(BuildContext context) {
final theme = Theme.of(context);
return Material(
color: isSelected
? theme.colorScheme.primary
: theme.colorScheme.onSecondary,
borderRadius: BorderRadius.circular(8),
child: InkWell(
borderRadius: BorderRadius.circular(8),
onTap: onTap,
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 5),
child: Text(
label,
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: theme.textTheme.labelSmall?.copyWith(
fontWeight: FontWeight.w500,
color: isSelected
? theme.colorScheme.onSecondary
: theme.colorScheme.primary,
),
),
),
),
);
}
}

View File

@@ -0,0 +1,53 @@
import 'package:flutter/material.dart';
import 'package:pweb/models/payment/amount/mode.dart';
import 'package:pweb/pages/dashboard/payouts/amount/mode/button.dart';
import 'package:pweb/generated/i18n/app_localizations.dart';
class PaymentAmountModeSelector extends StatelessWidget {
final PaymentAmountMode selectedMode;
final ValueChanged<PaymentAmountMode> onModeChanged;
const PaymentAmountModeSelector({
super.key,
required this.selectedMode,
required this.onModeChanged,
});
@override
Widget build(BuildContext context) {
final theme = Theme.of(context);
final loc = AppLocalizations.of(context)!;
return Container(
padding: const EdgeInsets.all(2),
decoration: BoxDecoration(
color: theme.colorScheme.onSecondary,
borderRadius: BorderRadius.circular(10),
border: Border.all(
color: theme.colorScheme.outline,
),
),
child: Row(
children: [
Expanded(
child: ModeButton(
label: loc.debitAmountLabel,
isSelected: selectedMode == PaymentAmountMode.debit,
onTap: () => onModeChanged(PaymentAmountMode.debit),
),
),
const SizedBox(width: 2),
Expanded(
child: ModeButton(
label: loc.expectedSettlementAmountLabel,
isSelected: selectedMode == PaymentAmountMode.settlement,
onTap: () => onModeChanged(PaymentAmountMode.settlement),
),
),
],
),
);
}
}

View File

@@ -2,24 +2,28 @@ import 'package:flutter/material.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'package:pshared/controllers/balance_mask/wallets.dart';
import 'package:pshared/provider/payment/amount.dart'; import 'package:pshared/provider/payment/amount.dart';
import 'package:pweb/controllers/payments/amount_field.dart'; import 'package:pweb/controllers/payments/amount_field.dart';
import 'package:pweb/pages/dashboard/payouts/amount/feild.dart'; import 'package:pweb/pages/dashboard/payouts/amount/feild.dart';
class PaymentAmountWidget extends StatelessWidget { class PaymentAmountWidget extends StatelessWidget {
const PaymentAmountWidget({super.key}); const PaymentAmountWidget({super.key});
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return ChangeNotifierProxyProvider<PaymentAmountProvider, PaymentAmountFieldController>( return ChangeNotifierProxyProvider2<
PaymentAmountProvider,
WalletsController,
PaymentAmountFieldController
>(
create: (ctx) { create: (ctx) {
final initialAmount = ctx.read<PaymentAmountProvider>().amount; final initialAmount = ctx.read<PaymentAmountProvider>().amount;
return PaymentAmountFieldController(initialAmount: initialAmount); return PaymentAmountFieldController(initialAmount: initialAmount);
}, },
update: (ctx, amountProvider, controller) { update: (ctx, amountProvider, wallets, controller) {
controller!.update(amountProvider); controller!.update(amountProvider, wallets);
return controller; return controller;
}, },
child: const PaymentAmountField(), child: const PaymentAmountField(),

View File

@@ -101,6 +101,18 @@ class PaymentFormWidget extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
detailsHeader, detailsHeader,
Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Expanded(
flex: 3,
child: const PaymentAmountWidget(),
),
const SizedBox(width: _columnSpacing),
Expanded(flex: 2, child: quoteCard),
],
),
const SizedBox(height: _smallSpacing),
Row( Row(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
@@ -109,26 +121,14 @@ class PaymentFormWidget extends StatelessWidget {
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
const PaymentAmountWidget(),
const SizedBox(height: _smallSpacing),
FeePayerSwitch( FeePayerSwitch(
spacing: _smallSpacing, spacing: _smallSpacing,
style: theme.textTheme.bodySmall, style: theme.textTheme.bodySmall,
), ),
],
),
),
const SizedBox(width: _columnSpacing),
Expanded(flex: 2, child: quoteCard),
],
),
const SizedBox(height: _mediumSpacing), const SizedBox(height: _mediumSpacing),
Row( const PaymentSummary(spacing: _extraSpacing),
crossAxisAlignment: CrossAxisAlignment.start, ],
children: [ ),
const Expanded(
flex: 3,
child: PaymentSummary(spacing: _extraSpacing),
), ),
const SizedBox(width: _columnSpacing), const SizedBox(width: _columnSpacing),
Expanded( Expanded(

View File

@@ -6,25 +6,42 @@ import 'package:pweb/generated/i18n/app_localizations.dart';
class FileFormatSampleDownloadButton extends StatelessWidget { class FileFormatSampleDownloadButton extends StatelessWidget {
const FileFormatSampleDownloadButton({ const FileFormatSampleDownloadButton({
super.key, super.key,
required this.theme,
required this.l10n,
required this.onPressed, required this.onPressed,
}); });
final ThemeData theme;
final AppLocalizations l10n;
final VoidCallback onPressed; final VoidCallback onPressed;
final double buttonWidth = 220;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final linkStyle = theme.textTheme.bodyMedium?.copyWith( final theme = Theme.of(context);
color: theme.colorScheme.primary, final l10n = AppLocalizations.of(context)!;
final textStyle = theme.textTheme.bodyMedium?.copyWith(
color: theme.colorScheme.onPrimary,
fontWeight: FontWeight.w500,
); );
return TextButton( return Align(
alignment: Alignment.center,
child: SizedBox(
width: buttonWidth,
child: FilledButton(
onPressed: onPressed, onPressed: onPressed,
style: TextButton.styleFrom(padding: EdgeInsets.zero), style: FilledButton.styleFrom(
child: Text(l10n.downloadSampleCSV, style: linkStyle), backgroundColor: theme.colorScheme.primary,
foregroundColor: theme.colorScheme.onPrimary,
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 12),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10),
),
),
child: Text(
l10n.downloadSampleCSV,
textAlign: TextAlign.center,
style: textStyle,
),
),
),
); );
} }
} }

View File

@@ -6,15 +6,12 @@ import 'package:pweb/generated/i18n/app_localizations.dart';
class FileFormatSampleHeader extends StatelessWidget { class FileFormatSampleHeader extends StatelessWidget {
const FileFormatSampleHeader({ const FileFormatSampleHeader({
super.key, super.key,
required this.theme,
required this.l10n,
}); });
final ThemeData theme;
final AppLocalizations l10n;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final theme = Theme.of(context);
final l10n = AppLocalizations.of(context)!;
final titleStyle = theme.textTheme.bodyLarge?.copyWith( final titleStyle = theme.textTheme.bodyLarge?.copyWith(
fontSize: 18, fontSize: 18,
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,

View File

@@ -8,15 +8,14 @@ import 'package:pweb/generated/i18n/app_localizations.dart';
class FileFormatSampleTable extends StatelessWidget { class FileFormatSampleTable extends StatelessWidget {
const FileFormatSampleTable({ const FileFormatSampleTable({
super.key, super.key,
required this.l10n,
required this.rows, required this.rows,
}); });
final AppLocalizations l10n;
final List<CsvPayoutRow> rows; final List<CsvPayoutRow> rows;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final l10n = AppLocalizations.of(context)!;
return DataTable( return DataTable(
columnSpacing: 20, columnSpacing: 20,
columns: [ columns: [

View File

@@ -9,29 +9,20 @@ import 'package:pweb/pages/dashboard/payouts/multiple/sections/sample/header.dar
import 'package:pweb/pages/dashboard/payouts/multiple/sections/sample/table.dart'; import 'package:pweb/pages/dashboard/payouts/multiple/sections/sample/table.dart';
import 'package:pweb/utils/download.dart'; import 'package:pweb/utils/download.dart';
import 'package:pweb/generated/i18n/app_localizations.dart';
class FileFormatSampleSection extends StatelessWidget { class FileFormatSampleSection extends StatelessWidget {
const FileFormatSampleSection({super.key}); const FileFormatSampleSection({super.key});
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final theme = Theme.of(context);
final l10n = AppLocalizations.of(context)!;
return Column( return Column(
crossAxisAlignment: CrossAxisAlignment.stretch, crossAxisAlignment: CrossAxisAlignment.stretch,
children: [ children: [
FileFormatSampleHeader(theme: theme, l10n: l10n), FileFormatSampleHeader(),
const SizedBox(height: 12), const SizedBox(height: 12),
FileFormatSampleTable(l10n: l10n, rows: sampleRows), FileFormatSampleTable(rows: sampleRows),
const SizedBox(height: 10), const SizedBox(height: 10),
FileFormatSampleDownloadButton( FileFormatSampleDownloadButton(onPressed: _downloadSampleCsv),
theme: theme,
l10n: l10n,
onPressed: _downloadSampleCsv,
),
], ],
); );
} }

View File

@@ -33,7 +33,8 @@ class QuoteStatusCard extends StatelessWidget {
Widget build(BuildContext context) { Widget build(BuildContext context) {
final theme = Theme.of(context); final theme = Theme.of(context);
final foregroundColor = _resolveForegroundColor(theme, statusType); final foregroundColor = _resolveForegroundColor(theme, statusType);
final statusStyle = theme.textTheme.bodyMedium?.copyWith(color: foregroundColor); final elementColor = _resolveElementColor(theme, statusType);
final statusStyle = theme.textTheme.bodyMedium?.copyWith(color: elementColor);
final helperStyle = theme.textTheme.bodySmall?.copyWith( final helperStyle = theme.textTheme.bodySmall?.copyWith(
color: foregroundColor.withValues(alpha: 0.8), color: foregroundColor.withValues(alpha: 0.8),
); );
@@ -43,6 +44,9 @@ class QuoteStatusCard extends StatelessWidget {
decoration: BoxDecoration( decoration: BoxDecoration(
color: _resolveCardColor(theme, statusType), color: _resolveCardColor(theme, statusType),
borderRadius: BorderRadius.circular(_cardRadius), borderRadius: BorderRadius.circular(_cardRadius),
border: Border.all(
color: elementColor.withValues(alpha: 0.5),
),
), ),
child: Row( child: Row(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
@@ -61,7 +65,7 @@ class QuoteStatusCard extends StatelessWidget {
: Icon( : Icon(
_resolveIcon(statusType), _resolveIcon(statusType),
size: _iconSize, size: _iconSize,
color: foregroundColor, color: elementColor,
), ),
), ),
const SizedBox(width: _cardSpacing), const SizedBox(width: _cardSpacing),
@@ -98,28 +102,36 @@ class QuoteStatusCard extends StatelessWidget {
Color _resolveCardColor(ThemeData theme, QuoteStatusType status) { Color _resolveCardColor(ThemeData theme, QuoteStatusType status) {
switch (status) { switch (status) {
case QuoteStatusType.loading: case QuoteStatusType.loading:
return theme.colorScheme.secondaryContainer; case QuoteStatusType.active:
case QuoteStatusType.missing:
return theme.colorScheme.onSecondary;
case QuoteStatusType.error: case QuoteStatusType.error:
case QuoteStatusType.expired: case QuoteStatusType.expired:
return theme.colorScheme.errorContainer; return theme.colorScheme.errorContainer;
case QuoteStatusType.active:
return theme.colorScheme.primaryContainer;
case QuoteStatusType.missing:
return theme.colorScheme.surfaceContainerHighest;
} }
} }
Color _resolveForegroundColor(ThemeData theme, QuoteStatusType status) { Color _resolveForegroundColor(ThemeData theme, QuoteStatusType status) {
switch (status) { switch (status) {
case QuoteStatusType.active:
case QuoteStatusType.missing:
case QuoteStatusType.loading: case QuoteStatusType.loading:
return theme.colorScheme.onSecondaryContainer; return theme.colorScheme.onSecondary;
case QuoteStatusType.error: case QuoteStatusType.error:
case QuoteStatusType.expired: case QuoteStatusType.expired:
return theme.colorScheme.onErrorContainer; return theme.colorScheme.onErrorContainer;
}
}
Color _resolveElementColor(ThemeData theme, QuoteStatusType status) {
switch (status) {
case QuoteStatusType.active: case QuoteStatusType.active:
return theme.colorScheme.onPrimaryContainer;
case QuoteStatusType.missing: case QuoteStatusType.missing:
return theme.colorScheme.onSurfaceVariant; case QuoteStatusType.loading:
return theme.colorScheme.primary;
case QuoteStatusType.error:
case QuoteStatusType.expired:
return theme.colorScheme.onErrorContainer;
} }
} }

View File

@@ -1,11 +1,15 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'package:pshared/models/recipient/recipient.dart'; import 'package:pshared/models/recipient/recipient.dart';
import 'package:pshared/provider/recipient/provider.dart'; import 'package:pshared/provider/recipient/provider.dart';
import 'package:pweb/app/router/payout_routes.dart';
import 'package:pweb/pages/address_book/page/search.dart'; import 'package:pweb/pages/address_book/page/search.dart';
import 'package:pweb/pages/payout_page/send/widgets/add_recipient_tile.dart';
import 'package:pweb/pages/dashboard/payouts/single/address_book/long_list/widget.dart'; import 'package:pweb/pages/dashboard/payouts/single/address_book/long_list/widget.dart';
import 'package:pweb/pages/dashboard/payouts/single/address_book/placeholder.dart'; import 'package:pweb/pages/dashboard/payouts/single/address_book/placeholder.dart';
import 'package:pweb/pages/dashboard/payouts/single/address_book/short_list.dart'; import 'package:pweb/pages/dashboard/payouts/single/address_book/short_list.dart';
@@ -63,6 +67,10 @@ class _AddressBookPayoutState extends State<AddressBookPayout> {
final loc = AppLocalizations.of(context)!; final loc = AppLocalizations.of(context)!;
final provider = context.watch<RecipientsProvider>(); final provider = context.watch<RecipientsProvider>();
final recipients = provider.recipients; final recipients = provider.recipients;
void onAddRecipient() {
provider.setCurrentObject(null);
context.pushNamed(PayoutRoutes.addRecipient);
}
final filteredRecipients = filterRecipients( final filteredRecipients = filterRecipients(
recipients: recipients, recipients: recipients,
query: _query, query: _query,
@@ -97,7 +105,12 @@ class _AddressBookPayoutState extends State<AddressBookPayout> {
const SizedBox(height: _spacingBetween), const SizedBox(height: _spacingBetween),
Expanded( Expanded(
child: recipients.isEmpty child: recipients.isEmpty
? AddressBookPlaceholder(text: loc.noRecipientsYet) ? Center(
child: AddRecipientTile(
label: loc.addRecipient,
onTap: onAddRecipient,
),
)
: _isExpanded && filteredRecipients.isEmpty : _isExpanded && filteredRecipients.isEmpty
? AddressBookPlaceholder(text: loc.noRecipientsFound) ? AddressBookPlaceholder(text: loc.noRecipientsFound)
: _isExpanded : _isExpanded
@@ -108,6 +121,10 @@ class _AddressBookPayoutState extends State<AddressBookPayout> {
: ShortListAddressBookPayout( : ShortListAddressBookPayout(
recipients: recipients, recipients: recipients,
onSelected: widget.onSelected, onSelected: widget.onSelected,
trailing: AddRecipientTile(
label: loc.addRecipient,
onTap: onAddRecipient,
),
), ),
), ),
], ],

View File

@@ -40,7 +40,6 @@ class InvitationsForm extends StatelessWidget {
firstNameController: firstNameController, firstNameController: firstNameController,
lastNameController: lastNameController, lastNameController: lastNameController,
messageController: messageController, messageController: messageController,
canCreateRoles: canCreateRoles,
expiryDays: expiryDays, expiryDays: expiryDays,
onExpiryChanged: onExpiryChanged, onExpiryChanged: onExpiryChanged,
selectedRoleRef: selectedRoleRef, selectedRoleRef: selectedRoleRef,

View File

@@ -16,7 +16,6 @@ class InvitationFormView extends StatelessWidget {
final TextEditingController firstNameController; final TextEditingController firstNameController;
final TextEditingController lastNameController; final TextEditingController lastNameController;
final TextEditingController messageController; final TextEditingController messageController;
final bool canCreateRoles;
final int expiryDays; final int expiryDays;
final ValueChanged<int> onExpiryChanged; final ValueChanged<int> onExpiryChanged;
final String? selectedRoleRef; final String? selectedRoleRef;
@@ -31,7 +30,6 @@ class InvitationFormView extends StatelessWidget {
required this.firstNameController, required this.firstNameController,
required this.lastNameController, required this.lastNameController,
required this.messageController, required this.messageController,
required this.canCreateRoles,
required this.expiryDays, required this.expiryDays,
required this.onExpiryChanged, required this.onExpiryChanged,
required this.selectedRoleRef, required this.selectedRoleRef,

View File

@@ -1,3 +1,5 @@
import 'dart:developer' as developer;
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
@@ -12,7 +14,6 @@ import 'package:pweb/models/account/account_loader.dart';
import 'package:pweb/generated/i18n/app_localizations.dart'; import 'package:pweb/generated/i18n/app_localizations.dart';
class AccountLoader extends StatefulWidget { class AccountLoader extends StatefulWidget {
final Widget child; final Widget child;
const AccountLoader({super.key, required this.child}); const AccountLoader({super.key, required this.child});
@@ -27,7 +28,8 @@ class _AccountLoaderState extends State<AccountLoader> {
@override @override
void initState() { void initState() {
super.initState(); super.initState();
_controller = AccountLoaderController()..addListener(_handleControllerAction); _controller = AccountLoaderController()
..addListener(_handleControllerAction);
WidgetsBinding.instance.addPostFrameCallback((_) { WidgetsBinding.instance.addPostFrameCallback((_) {
if (!mounted) return; if (!mounted) return;
Provider.of<AccountProvider>(context, listen: false).restoreIfPossible(); Provider.of<AccountProvider>(context, listen: false).restoreIfPossible();
@@ -45,6 +47,17 @@ class _AccountLoaderState extends State<AccountLoader> {
switch (action) { switch (action) {
case AccountLoaderAction.showErrorAndGoToLogin: case AccountLoaderAction.showErrorAndGoToLogin:
final error = _controller.error ?? Exception('Authorization failed'); final error = _controller.error ?? Exception('Authorization failed');
assert(() {
developer.log(
'AccountLoader action=showErrorAndGoToLogin',
name: 'pweb.auth.redirect',
error: error,
);
developer.debugger(
message: 'AccountLoader: redirecting to login due to auth error',
);
return true;
}());
WidgetsBinding.instance.addPostFrameCallback((_) { WidgetsBinding.instance.addPostFrameCallback((_) {
if (!mounted) return; if (!mounted) return;
postNotifyUserOfErrorX( postNotifyUserOfErrorX(
@@ -56,6 +69,17 @@ class _AccountLoaderState extends State<AccountLoader> {
}); });
break; break;
case AccountLoaderAction.goToLogin: case AccountLoaderAction.goToLogin:
assert(() {
developer.log(
'AccountLoader action=goToLogin',
name: 'pweb.auth.redirect',
);
developer.debugger(
message:
'AccountLoader: redirecting to login due to empty auth state',
);
return true;
}());
WidgetsBinding.instance.addPostFrameCallback((_) => goToLogin()); WidgetsBinding.instance.addPostFrameCallback((_) => goToLogin());
break; break;
} }
@@ -70,12 +94,14 @@ class _AccountLoaderState extends State<AccountLoader> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Consumer<AccountProvider>(builder: (context, provider, _) { return Consumer<AccountProvider>(
builder: (context, provider, _) {
_controller.update(provider); _controller.update(provider);
if (provider.authState == AuthState.ready && provider.account != null) { if (provider.authState == AuthState.ready && provider.account != null) {
return widget.child; return widget.child;
} }
return const Center(child: CircularProgressIndicator()); return const Center(child: CircularProgressIndicator());
}); },
);
} }
} }

View File

@@ -1,3 +1,5 @@
import 'dart:developer' as developer;
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
@@ -6,16 +8,29 @@ import 'package:pshared/provider/organizations.dart';
import 'package:pweb/generated/i18n/app_localizations.dart'; import 'package:pweb/generated/i18n/app_localizations.dart';
class OrganizationLoader extends StatelessWidget { class OrganizationLoader extends StatelessWidget {
final Widget child; final Widget child;
const OrganizationLoader({super.key, required this.child}); const OrganizationLoader({super.key, required this.child});
@override @override
Widget build(BuildContext context) => Consumer<OrganizationsProvider>(builder: (context, provider, _) { Widget build(BuildContext context) => Consumer<OrganizationsProvider>(
if (provider.isLoading) return const Center(child: CircularProgressIndicator()); builder: (context, provider, _) {
if (provider.isLoading) {
return const Center(child: CircularProgressIndicator());
}
if (provider.error != null) { if (provider.error != null) {
assert(() {
developer.log(
'OrganizationLoader: provider.error != null',
name: 'pweb.auth.redirect',
error: provider.error,
);
developer.debugger(
message: 'OrganizationLoader blocked app with error',
);
return true;
}());
final loc = AppLocalizations.of(context)!; final loc = AppLocalizations.of(context)!;
return Center( return Center(
child: Column( child: Column(
@@ -23,10 +38,7 @@ class OrganizationLoader extends StatelessWidget {
children: [ children: [
Text(loc.errorLogin), Text(loc.errorLogin),
const SizedBox(height: 12), const SizedBox(height: 12),
ElevatedButton( ElevatedButton(onPressed: provider.load, child: Text(loc.retry)),
onPressed: provider.load,
child: Text(loc.retry),
),
], ],
), ),
); );
@@ -35,5 +47,6 @@ class OrganizationLoader extends StatelessWidget {
return const Center(child: CircularProgressIndicator()); return const Center(child: CircularProgressIndicator());
} }
return child; return child;
}); },
);
} }

View File

@@ -1,3 +1,5 @@
import 'dart:developer' as developer;
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
@@ -7,7 +9,6 @@ import 'package:pshared/provider/permissions.dart';
import 'package:pweb/generated/i18n/app_localizations.dart'; import 'package:pweb/generated/i18n/app_localizations.dart';
class PermissionsLoader extends StatelessWidget { class PermissionsLoader extends StatelessWidget {
final Widget child; final Widget child;
const PermissionsLoader({super.key, required this.child}); const PermissionsLoader({super.key, required this.child});
@@ -17,6 +18,17 @@ class PermissionsLoader extends StatelessWidget {
return Consumer2<PermissionsProvider, AccountProvider>( return Consumer2<PermissionsProvider, AccountProvider>(
builder: (context, provider, _, _) { builder: (context, provider, _, _) {
if (provider.error != null) { if (provider.error != null) {
assert(() {
developer.log(
'PermissionsLoader: provider.error != null',
name: 'pweb.auth.redirect',
error: provider.error,
);
developer.debugger(
message: 'PermissionsLoader blocked app with error',
);
return true;
}());
final loc = AppLocalizations.of(context)!; final loc = AppLocalizations.of(context)!;
return Center( return Center(
child: Column( child: Column(

View File

@@ -19,7 +19,6 @@ import 'package:pweb/controllers/payments/page_ui.dart';
import 'package:pweb/controllers/payouts/payout_verification.dart'; import 'package:pweb/controllers/payouts/payout_verification.dart';
import 'package:pweb/utils/payment/payout_verification_flow.dart'; import 'package:pweb/utils/payment/payout_verification_flow.dart';
void initializePaymentPage( void initializePaymentPage(
BuildContext context, BuildContext context,
PaymentType? initialPaymentType, PaymentType? initialPaymentType,

View File

@@ -18,23 +18,34 @@ class AddRecipientTile extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final theme = Theme.of(context); final theme = Theme.of(context);
final buttonBorderColor = theme.colorScheme.primary;
final buttonBackgroundColor = theme.colorScheme.onSecondary;
final buttonIconColor = theme.colorScheme.primary;
return InkWell( return InkWell(
onTap: onTap, onTap: onTap,
borderRadius: BorderRadius.circular(8), borderRadius: BorderRadius.circular(8),
hoverColor: theme.colorScheme.primaryContainer, hoverColor: theme.colorScheme.surfaceContainerHighest,
child: SizedBox( child: SizedBox(
width: _tileSize, width: _tileSize,
height: _tileSize, height: _tileSize,
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [
CircleAvatar( Container(
radius: _avatarRadius, width: _avatarRadius * 2,
backgroundColor: theme.colorScheme.primaryContainer, height: _avatarRadius * 2,
alignment: Alignment.center,
decoration: BoxDecoration(
color: buttonBackgroundColor,
shape: BoxShape.circle,
border: Border.fromBorderSide(
BorderSide(color: buttonBorderColor, width: 1.5),
),
),
child: Icon( child: Icon(
Icons.add, Icons.add,
color: theme.colorScheme.primary, color: buttonIconColor,
size: 20, size: 20,
), ),
), ),

View File

@@ -1,36 +0,0 @@
import 'package:flutter/material.dart';
class PasswordToggleButton extends StatelessWidget {
const PasswordToggleButton({
super.key,
required this.title,
required this.isExpanded,
required this.isBusy,
required this.onToggle,
});
final String title;
final bool isExpanded;
final bool isBusy;
final VoidCallback onToggle;
@override
Widget build(BuildContext context) {
final theme = Theme.of(context);
final iconColor = theme.colorScheme.primary;
return TextButton.icon(
onPressed: isBusy
? null
: () {
onToggle();
},
icon: Icon(
isExpanded ? Icons.lock_open : Icons.lock_outline,
color: iconColor,
),
label: Text(title, style: theme.textTheme.bodyMedium),
);
}
}

View File

@@ -1,16 +0,0 @@
import 'package:flutter/material.dart';
class SignUpBackButton extends StatelessWidget {
const SignUpBackButton({super.key});
@override
Widget build(BuildContext context) => Row(
children: [
IconButton(
onPressed: Navigator.of(context).pop,
icon: const Icon(Icons.arrow_back),
),
],
);
}

View File

@@ -37,8 +37,9 @@ class SideMenuColumn extends StatelessWidget {
padding: const EdgeInsets.symmetric(vertical: 8), padding: const EdgeInsets.symmetric(vertical: 8),
children: items.map((item) { children: items.map((item) {
final isSelected = item == selected; final isSelected = item == selected;
final selectedBackground = theme.colorScheme.surfaceContainerHighest;
final backgroundColor = isSelected final backgroundColor = isSelected
? theme.colorScheme.primaryContainer ? selectedBackground
: Colors.transparent; : Colors.transparent;
return Padding( return Padding(
@@ -54,7 +55,7 @@ class SideMenuColumn extends StatelessWidget {
unawaited(PosthogService.pageOpened(item, uiSource: 'sidebar')); unawaited(PosthogService.pageOpened(item, uiSource: 'sidebar'));
}, },
borderRadius: BorderRadius.circular(12), borderRadius: BorderRadius.circular(12),
hoverColor: theme.colorScheme.primaryContainer, hoverColor: selectedBackground,
child: Padding( child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 30, vertical: 12), padding: const EdgeInsets.symmetric(horizontal: 30, vertical: 12),
child: Row( child: Row(

View File

@@ -25,8 +25,9 @@ class UserProfileCard extends StatelessWidget {
Widget build(BuildContext context) { Widget build(BuildContext context) {
final loc = AppLocalizations.of(context)!; final loc = AppLocalizations.of(context)!;
bool isSelected = selected == PayoutDestination.settings; bool isSelected = selected == PayoutDestination.settings;
final selectedBackground = theme.colorScheme.surfaceContainerHighest;
final backgroundColor = isSelected final backgroundColor = isSelected
? theme.colorScheme.primaryContainer ? selectedBackground
: Colors.transparent; : Colors.transparent;
return Material( return Material(