changed color theme to be black and added the ability to enter the amount in the recipient’s currency
This commit is contained in:
@@ -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
|
||||||
|
|||||||
20
frontend/pshared/lib/data/dto/payment/network_fee.dart
Normal file
20
frontend/pshared/lib/data/dto/payment/network_fee.dart
Normal 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);
|
||||||
|
}
|
||||||
24
frontend/pshared/lib/data/dto/payment/quote_aggregate.dart
Normal file
24
frontend/pshared/lib/data/dto/payment/quote_aggregate.dart
Normal 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);
|
||||||
|
}
|
||||||
@@ -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,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|||||||
@@ -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,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|||||||
@@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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,
|
||||||
|
|||||||
@@ -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),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
PaymentAmountMode get mode => _mode;
|
||||||
|
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 = provider;
|
||||||
|
_provider?.addListener(_handleProviderChanged);
|
||||||
|
_syncModeWithProvider(provider);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!identical(_wallets, wallets)) {
|
||||||
|
_wallets?.removeListener(_handleWalletsChanged);
|
||||||
|
_wallets = wallets;
|
||||||
|
_wallets?.addListener(_handleWalletsChanged);
|
||||||
|
_normalizeModeForWallet();
|
||||||
|
}
|
||||||
|
|
||||||
void update(PaymentAmountProvider provider) {
|
|
||||||
if (identical(_provider, provider)) return;
|
|
||||||
_provider?.removeListener(_handleProviderChanged);
|
|
||||||
_provider = provider;
|
|
||||||
_provider?.addListener(_handleProviderChanged);
|
|
||||||
_syncTextWithAmount(provider.amount);
|
_syncTextWithAmount(provider.amount);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -31,12 +62,70 @@ 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(
|
||||||
value.replaceAll(',', '.'),
|
value.replaceAll(',', '.'),
|
||||||
@@ -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();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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",
|
||||||
|
|||||||
@@ -403,9 +403,9 @@
|
|||||||
"idempotencyKeyLabel": "Ключ идемпотентности",
|
"idempotencyKeyLabel": "Ключ идемпотентности",
|
||||||
"quoteIdLabel": "ID котировки",
|
"quoteIdLabel": "ID котировки",
|
||||||
"createdAtLabel": "Создан",
|
"createdAtLabel": "Создан",
|
||||||
"debitAmountLabel": "Списано",
|
"debitAmountLabel": "Вы платите",
|
||||||
"debitSettlementAmountLabel": "Списано к зачислению",
|
"debitSettlementAmountLabel": "Списано к зачислению",
|
||||||
"expectedSettlementAmountLabel": "Ожидаемая сумма зачисления",
|
"expectedSettlementAmountLabel": "Получателю поступит",
|
||||||
"feeTotalLabel": "Комиссия",
|
"feeTotalLabel": "Комиссия",
|
||||||
"networkFeeLabel": "Сетевая комиссия",
|
"networkFeeLabel": "Сетевая комиссия",
|
||||||
"fxRateLabel": "Курс",
|
"fxRateLabel": "Курс",
|
||||||
|
|||||||
1
frontend/pweb/lib/models/payment/amount/mode.dart
Normal file
1
frontend/pweb/lib/models/payment/amount/mode.dart
Normal file
@@ -0,0 +1 @@
|
|||||||
|
enum PaymentAmountMode {debit, settlement}
|
||||||
@@ -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,13 +24,18 @@ 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: (_) {},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -45,37 +45,37 @@ class WalletCard extends StatelessWidget {
|
|||||||
child: InkWell(
|
child: InkWell(
|
||||||
borderRadius: BorderRadius.circular(WalletCardConfig.borderRadius),
|
borderRadius: BorderRadius.circular(WalletCardConfig.borderRadius),
|
||||||
onTap: onTap,
|
onTap: onTap,
|
||||||
child: SizedBox.expand(
|
child: SizedBox.expand(
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: WalletCardConfig.contentPadding,
|
padding: WalletCardConfig.contentPadding,
|
||||||
child: Column(
|
child: Column(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
BalanceHeader(
|
BalanceHeader(
|
||||||
title: loc.paymentTypeCryptoWallet,
|
title: loc.paymentTypeCryptoWallet,
|
||||||
subtitle: networkLabel,
|
subtitle: networkLabel,
|
||||||
badge: (symbol == null || symbol.isEmpty) ? null : symbol,
|
badge: (symbol == null || symbol.isEmpty) ? null : symbol,
|
||||||
),
|
),
|
||||||
Row(
|
Row(
|
||||||
children: [
|
children: [
|
||||||
BalanceAmount(
|
BalanceAmount(
|
||||||
wallet: wallet,
|
wallet: wallet,
|
||||||
onToggleMask: () {
|
onToggleMask: () {
|
||||||
context.read<WalletsController>().toggleBalanceMask(wallet.id);
|
context.read<WalletsController>().toggleBalanceMask(wallet.id);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
WalletBalanceRefreshButton(
|
WalletBalanceRefreshButton(
|
||||||
walletRef: wallet.id,
|
walletRef: wallet.id,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
BalanceAddFunds(onTopUp: onTopUp),
|
BalanceAddFunds(onTopUp: onTopUp),
|
||||||
],
|
],
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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,
|
||||||
@@ -65,4 +66,4 @@ class TransactionRefButton extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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(
|
||||||
controller: ui.textController,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
keyboardType: const TextInputType.numberWithOptions(decimal: true),
|
children: [
|
||||||
decoration: InputDecoration(
|
if (ui.isReverseModeAvailable) ...[
|
||||||
labelText: AppLocalizations.of(context)!.amount,
|
PaymentAmountModeSelector(
|
||||||
border: const OutlineInputBorder(),
|
selectedMode: ui.mode,
|
||||||
prefixText: symbol == null ? null : '$symbol\u00A0',
|
onModeChanged: ui.handleModeChanged,
|
||||||
),
|
),
|
||||||
onChanged: ui.handleChanged,
|
const SizedBox(height: 6),
|
||||||
|
],
|
||||||
|
TextField(
|
||||||
|
controller: ui.textController,
|
||||||
|
focusNode: ui.focusNode,
|
||||||
|
keyboardType: const TextInputType.numberWithOptions(decimal: true),
|
||||||
|
decoration: InputDecoration(
|
||||||
|
labelText: loc.amount,
|
||||||
|
border: const OutlineInputBorder(),
|
||||||
|
prefixText: symbol == null ? null : '$symbol\u00A0',
|
||||||
|
helperText: switch (ui.mode) {
|
||||||
|
PaymentAmountMode.debit => loc.debitAmountLabel,
|
||||||
|
PaymentAmountMode.settlement => loc.expectedSettlementAmountLabel,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
onChanged: ui.handleChanged,
|
||||||
|
),
|
||||||
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -2,27 +2,31 @@ 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(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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,28 +121,16 @@ 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(height: _mediumSpacing),
|
||||||
|
const PaymentSummary(spacing: _extraSpacing),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(width: _columnSpacing),
|
const SizedBox(width: _columnSpacing),
|
||||||
Expanded(flex: 2, child: quoteCard),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
const SizedBox(height: _mediumSpacing),
|
|
||||||
Row(
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
|
||||||
children: [
|
|
||||||
const Expanded(
|
|
||||||
flex: 3,
|
|
||||||
child: PaymentSummary(spacing: _extraSpacing),
|
|
||||||
),
|
|
||||||
const SizedBox(width: _columnSpacing),
|
|
||||||
Expanded(
|
Expanded(
|
||||||
flex: 2,
|
flex: 2,
|
||||||
child: Column(
|
child: Column(
|
||||||
|
|||||||
@@ -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(
|
||||||
onPressed: onPressed,
|
alignment: Alignment.center,
|
||||||
style: TextButton.styleFrom(padding: EdgeInsets.zero),
|
child: SizedBox(
|
||||||
child: Text(l10n.downloadSampleCSV, style: linkStyle),
|
width: buttonWidth,
|
||||||
|
child: FilledButton(
|
||||||
|
onPressed: onPressed,
|
||||||
|
style: FilledButton.styleFrom(
|
||||||
|
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,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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,
|
||||||
|
|||||||
@@ -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: [
|
||||||
|
|||||||
@@ -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,
|
|
||||||
),
|
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -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,
|
||||||
|
|||||||
@@ -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,
|
||||||
|
|||||||
@@ -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>(
|
||||||
_controller.update(provider);
|
builder: (context, provider, _) {
|
||||||
if (provider.authState == AuthState.ready && provider.account != null) {
|
_controller.update(provider);
|
||||||
return widget.child;
|
if (provider.authState == AuthState.ready && provider.account != null) {
|
||||||
}
|
return widget.child;
|
||||||
return const Center(child: CircularProgressIndicator());
|
}
|
||||||
});
|
return const Center(child: CircularProgressIndicator());
|
||||||
|
},
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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,34 +8,45 @@ 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.error != null) {
|
if (provider.isLoading) {
|
||||||
final loc = AppLocalizations.of(context)!;
|
return const Center(child: CircularProgressIndicator());
|
||||||
return Center(
|
}
|
||||||
child: Column(
|
if (provider.error != null) {
|
||||||
mainAxisSize: MainAxisSize.min,
|
assert(() {
|
||||||
children: [
|
developer.log(
|
||||||
Text(loc.errorLogin),
|
'OrganizationLoader: provider.error != null',
|
||||||
const SizedBox(height: 12),
|
name: 'pweb.auth.redirect',
|
||||||
ElevatedButton(
|
error: provider.error,
|
||||||
onPressed: provider.load,
|
);
|
||||||
child: Text(loc.retry),
|
developer.debugger(
|
||||||
),
|
message: 'OrganizationLoader blocked app with error',
|
||||||
],
|
);
|
||||||
),
|
return true;
|
||||||
);
|
}());
|
||||||
}
|
final loc = AppLocalizations.of(context)!;
|
||||||
if ((provider.error == null) && (!provider.isOrganizationSet)) {
|
return Center(
|
||||||
return const Center(child: CircularProgressIndicator());
|
child: Column(
|
||||||
}
|
mainAxisSize: MainAxisSize.min,
|
||||||
return child;
|
children: [
|
||||||
});
|
Text(loc.errorLogin),
|
||||||
|
const SizedBox(height: 12),
|
||||||
|
ElevatedButton(onPressed: provider.load, child: Text(loc.retry)),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
if ((provider.error == null) && (!provider.isOrganizationSet)) {
|
||||||
|
return const Center(child: CircularProgressIndicator());
|
||||||
|
}
|
||||||
|
return child;
|
||||||
|
},
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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(
|
||||||
|
|||||||
@@ -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,
|
||||||
|
|||||||
@@ -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,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -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),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -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),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@@ -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(
|
||||||
|
|||||||
@@ -41,15 +41,15 @@ class PayoutSidebar extends StatelessWidget {
|
|||||||
|
|
||||||
final menuItems =
|
final menuItems =
|
||||||
items ??
|
items ??
|
||||||
<PayoutDestination>[
|
<PayoutDestination>[
|
||||||
PayoutDestination.dashboard,
|
PayoutDestination.dashboard,
|
||||||
PayoutDestination.recipients,
|
PayoutDestination.recipients,
|
||||||
PayoutDestination.invitations,
|
PayoutDestination.invitations,
|
||||||
PayoutDestination.reports,
|
PayoutDestination.reports,
|
||||||
// PayoutDestination.methods,
|
// PayoutDestination.methods,
|
||||||
// PayoutDestination.organizationSettings,
|
// PayoutDestination.organizationSettings,
|
||||||
//TODO Add when ready
|
//TODO Add when ready
|
||||||
];
|
];
|
||||||
|
|
||||||
final theme = Theme.of(context);
|
final theme = Theme.of(context);
|
||||||
|
|
||||||
|
|||||||
@@ -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(
|
||||||
|
|||||||
Reference in New Issue
Block a user