Added Localizations and ran small fixes
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:pshared/models/payment/status.dart';
|
||||
@@ -7,6 +6,8 @@ import 'package:pshared/utils/localization.dart';
|
||||
import 'package:pweb/models/wallet_transaction.dart';
|
||||
import 'package:pweb/providers/wallet_transactions.dart';
|
||||
|
||||
import 'package:pweb/generated/i18n/app_localizations.dart';
|
||||
|
||||
|
||||
class WalletHistoryFilters extends StatelessWidget {
|
||||
final WalletTransactionsProvider provider;
|
||||
@@ -21,6 +22,7 @@ class WalletHistoryFilters extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final theme = Theme.of(context);
|
||||
final loc = AppLocalizations.of(context)!;
|
||||
|
||||
return Card(
|
||||
elevation: 2,
|
||||
@@ -35,13 +37,13 @@ class WalletHistoryFilters extends StatelessWidget {
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
'Wallet activity',
|
||||
loc.walletActivity,
|
||||
style: theme.textTheme.titleMedium,
|
||||
),
|
||||
if (provider.hasFilters)
|
||||
TextButton(
|
||||
onPressed: provider.resetFilters,
|
||||
child: const Text('Reset'),
|
||||
child: Text(loc.reset),
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -81,7 +83,7 @@ class WalletHistoryFilters extends StatelessWidget {
|
||||
icon: const Icon(Icons.date_range_outlined),
|
||||
label: Text(
|
||||
provider.dateRange == null
|
||||
? 'Select period'
|
||||
? loc.selectPeriod
|
||||
: '${dateToLocalFormat(context, provider.dateRange!.start)} – ${dateToLocalFormat(context, provider.dateRange!.end)}',
|
||||
),
|
||||
),
|
||||
@@ -91,4 +93,4 @@ class WalletHistoryFilters extends StatelessWidget {
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,6 +7,8 @@ import 'package:pweb/pages/payout_page/wallet/history/filters.dart';
|
||||
import 'package:pweb/pages/payout_page/wallet/history/table.dart';
|
||||
import 'package:pweb/providers/wallet_transactions.dart';
|
||||
|
||||
import 'package:pweb/generated/i18n/app_localizations.dart';
|
||||
|
||||
|
||||
class WalletHistory extends StatefulWidget {
|
||||
final Wallet wallet;
|
||||
@@ -64,6 +66,7 @@ class _WalletHistoryState extends State<WalletHistory> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final theme = Theme.of(context);
|
||||
final loc = AppLocalizations.of(context)!;
|
||||
|
||||
return Consumer<WalletTransactionsProvider>(
|
||||
builder: (context, provider, child) {
|
||||
@@ -81,16 +84,16 @@ class _WalletHistoryState extends State<WalletHistory> {
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
'Failed to load history',
|
||||
loc.failedToLoadHistory,
|
||||
style: theme.textTheme.titleMedium!
|
||||
.copyWith(color: theme.colorScheme.error),
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
Text(provider.error!),
|
||||
Text(loc.notificationError(provider.error ?? loc.noErrorInformation)),
|
||||
const SizedBox(height: 8),
|
||||
OutlinedButton(
|
||||
onPressed: _load,
|
||||
child: const Text('Retry'),
|
||||
child: Text(loc.retry),
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -113,4 +116,4 @@ class _WalletHistoryState extends State<WalletHistory> {
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:pweb/models/wallet_transaction.dart';
|
||||
@@ -6,6 +5,8 @@ import 'package:pweb/pages/payout_page/wallet/history/chip.dart';
|
||||
import 'package:pweb/pages/report/table/badge.dart';
|
||||
import 'package:pweb/utils/currency.dart';
|
||||
|
||||
import 'package:pweb/generated/i18n/app_localizations.dart';
|
||||
|
||||
|
||||
class WalletTransactionsTable extends StatelessWidget {
|
||||
final List<WalletTransaction> transactions;
|
||||
@@ -15,14 +16,15 @@ class WalletTransactionsTable extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final theme = Theme.of(context);
|
||||
final loc = AppLocalizations.of(context)!;
|
||||
|
||||
if (transactions.isEmpty) {
|
||||
return Card(
|
||||
color: theme.colorScheme.onSecondary,
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)),
|
||||
child: const Padding(
|
||||
padding: EdgeInsets.all(16),
|
||||
child: Text('No history yet'),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(16),
|
||||
child: Text(loc.walletHistoryEmpty),
|
||||
),
|
||||
);
|
||||
}
|
||||
@@ -38,14 +40,14 @@ class WalletTransactionsTable extends StatelessWidget {
|
||||
child: DataTable(
|
||||
columnSpacing: 18,
|
||||
headingTextStyle: const TextStyle(fontWeight: FontWeight.w600),
|
||||
columns: const [
|
||||
DataColumn(label: Text('Status')),
|
||||
DataColumn(label: Text('Type')),
|
||||
DataColumn(label: Text('Amount')),
|
||||
DataColumn(label: Text('Balance')),
|
||||
DataColumn(label: Text('Counterparty')),
|
||||
DataColumn(label: Text('Date')),
|
||||
DataColumn(label: Text('Comment')),
|
||||
columns: [
|
||||
DataColumn(label: Text(loc.colStatus)),
|
||||
DataColumn(label: Text(loc.colType)),
|
||||
DataColumn(label: Text(loc.colAmount)),
|
||||
DataColumn(label: Text(loc.colBalance)),
|
||||
DataColumn(label: Text(loc.colCounterparty)),
|
||||
DataColumn(label: Text(loc.colDate)),
|
||||
DataColumn(label: Text(loc.colComment)),
|
||||
],
|
||||
rows: List.generate(
|
||||
transactions.length,
|
||||
@@ -85,4 +87,4 @@ class WalletTransactionsTable extends StatelessWidget {
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user