Add optional KYC flow and service-backed account limits
This commit is contained in:
1 parent
61ccfc1844
commit
3397f04ab7
38 files changed
+3443
-36
No files matched your search
@@ -0,0 +1,78 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:sxchnge_kyc/sxchnge_kyc.dart';
|
||||
|
||||
import 'preview.dart';
|
||||
|
||||
import '../generated/i18n/app_localizations.dart';
|
||||
|
||||
class PhotoPanel extends StatelessWidget {
|
||||
const PhotoPanel({
|
||||
super.key,
|
||||
required this.kind,
|
||||
required this.photo,
|
||||
this.onPick,
|
||||
this.onRemove,
|
||||
this.review = false,
|
||||
});
|
||||
final PhotoKind kind;
|
||||
final Photo? photo;
|
||||
final VoidCallback? onPick;
|
||||
final VoidCallback? onRemove;
|
||||
final bool review;
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final l = AppLocalizations.of(context)!;
|
||||
final t = Theme.of(context);
|
||||
final passport = kind == PhotoKind.passport;
|
||||
final title = passport ? l.kycPassport : l.kycSelfie;
|
||||
return Card(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(20),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
Text(title, style: t.textTheme.titleLarge),
|
||||
const SizedBox(height: 16),
|
||||
if (photo != null)
|
||||
ClipRRect(
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
child: PhotoPreview(photo: photo!, label: title),
|
||||
)
|
||||
else
|
||||
Container(
|
||||
height: 140,
|
||||
decoration: BoxDecoration(
|
||||
color: t.colorScheme.surfaceContainerHighest,
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
),
|
||||
child: Icon(
|
||||
passport ? Icons.badge_outlined : Icons.portrait_outlined,
|
||||
size: 64,
|
||||
color: t.colorScheme.primary,
|
||||
),
|
||||
),
|
||||
if (!review) ...[
|
||||
const SizedBox(height: 16),
|
||||
Text(passport ? l.kycPassportHelp : l.kycSelfieHelp),
|
||||
const SizedBox(height: 12),
|
||||
Text(l.kycFileRules, style: t.textTheme.bodySmall),
|
||||
const SizedBox(height: 16),
|
||||
OutlinedButton.icon(
|
||||
key: ValueKey('pick-${kind.name}'),
|
||||
onPressed: onPick,
|
||||
icon: const Icon(Icons.add_photo_alternate_outlined),
|
||||
label: Text(
|
||||
photo == null ? l.kycChoose : l.kycReplace,
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
),
|
||||
if (photo != null)
|
||||
TextButton(onPressed: onRemove, child: Text(l.kycRemove)),
|
||||
],
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user