81 lines
2.1 KiB
Dart
81 lines
2.1 KiB
Dart
import 'package:flutter/material.dart';
|
|
|
|
import 'package:go_router/go_router.dart';
|
|
|
|
import 'package:provider/provider.dart';
|
|
|
|
import 'package:sxchnge_kyc/sxchnge_kyc.dart';
|
|
|
|
import 'package:sxchnge_wallet/sxchnge_wallet.dart';
|
|
|
|
import '../kyc/limits.dart';
|
|
|
|
import '../generated/i18n/app_localizations.dart';
|
|
|
|
class LimitsPage extends StatefulWidget {
|
|
const LimitsPage({super.key});
|
|
@override
|
|
State<LimitsPage> createState() => _LimitsPageState();
|
|
}
|
|
|
|
class _LimitsPageState extends State<LimitsPage> {
|
|
late final _provider = WorkspaceLimitsProvider(
|
|
context.read<LimitsService>(),
|
|
context.read<WalletProvider>(),
|
|
);
|
|
@override
|
|
void initState() {
|
|
super.initState();
|
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
|
if (mounted) _provider.refresh();
|
|
});
|
|
}
|
|
|
|
@override
|
|
void dispose() {
|
|
_provider.dispose();
|
|
super.dispose();
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final l = AppLocalizations.of(context)!;
|
|
return ChangeNotifierProvider<LimitsProvider>.value(
|
|
value: _provider,
|
|
child: SingleChildScrollView(
|
|
padding: const EdgeInsets.all(24),
|
|
child: Center(
|
|
child: ConstrainedBox(
|
|
constraints: const BoxConstraints(maxWidth: 720),
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
|
children: [
|
|
Text(
|
|
l.wLimits,
|
|
style: Theme.of(context).textTheme.displaySmall,
|
|
),
|
|
const SizedBox(height: 12),
|
|
Text(l.wLimitsScope),
|
|
const SizedBox(height: 24),
|
|
const LimitsPanel(),
|
|
const SizedBox(height: 20),
|
|
FilledButton(
|
|
onPressed: () async {
|
|
await context.push('/identity');
|
|
if (mounted) _provider.refresh();
|
|
},
|
|
child: Text(l.wIdentity),
|
|
),
|
|
TextButton(
|
|
onPressed: _provider.refresh,
|
|
child: Text(l.wRefresh),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|