KYC review and correction
Read why a document needs correction, replace it, review the updated information and submit it for review. A completed upload is never a verification verdict. One pinned action guides each step; content scrolls at large text.





Run and try
Section titled “Run and try”From example/:
flutter run -d <device-id> -t lib/kyc_review_demo.dartTap Perbarui data, then Coba lagi to replace the synthetic rejected file. The scenario provides metadata only, with no camera, picker or upload effect. Continue to review: the identity reference is masked. Submit the correction; it becomes in review. Only Cek status returns an explicit synthetic host-verified snapshot. No elapsed delay or uploaded badge establishes that result.
The developer menu’s Gagal kirim pertama scenario explicitly rejects the first submit before acceptance. Review data remains and the customer can retry. This is not a lost-response simulation: a real transport timeout may have been accepted, so the host must reconcile the same request instead of blindly resubmitting. Changing a developer scenario starts a fresh synthetic session and invalidates old asynchronous callbacks. It is not a production identity-reset action.
Composition and boundaries
Section titled “Composition and boundaries”KycReviewBlock takes separate document state, host verification snapshot, typed
step, host field specs/values and callbacks. The host owns step transitions and
must preserve consent/policy eligibility before entering this correction journey.
The block doesn’t collect new consent or implement initial onboarding.
| UI | Existing library surface |
|---|---|
| Correction reason and host verdict | VerificationStatusView, VerificationSnapshot |
| File metadata, limits and rejection | DocumentUploadTile, DocumentSlotState |
| Masked identity and document review | VerificationReview, IdentityFieldSpec |
| Reachable primary action | PaymentFullPageView, PaymentButton |
Copy the composition and wire your authenticated adapters. Keep document bytes,
permissions, upload request identity, privacy/retention and provider validation
in the host. Use safe reasons suitable for display. The example uses fictional
metadata and no real identity/document content. See the
verification pattern and capture pattern.
For an uncertain submit, use the pattern’s VerificationStatusView.outcomeUnknown
presentation and host reconciliation; this scenario covers known rejection/retry.
Source
Section titled “Source”Source: compositions/kyc_review_block.dart
Open this file on GitHub. Copy and adapt it in your host app.
import 'dart:async';import 'package:flutter/material.dart';import 'package:rakit_ui/rakit_ui.dart';
enum KycReviewStep { status, document, review }
/// Copyable host presentation. Document upload state and verification verdict/// are separate inputs: replacing/uploading a document never verifies identity.class KycReviewBlock extends StatelessWidget { const KycReviewBlock({ super.key, required this.step, required this.snapshot, required this.requirement, required this.document, required this.fields, required this.values, required this.onAction, required this.onPick, required this.onReview, required this.onSubmit, this.busy = false, this.error, }); final KycReviewStep step; final VerificationSnapshot snapshot; final DocumentRequirement requirement; final DocumentSlotState document; final List<IdentityFieldSpec> fields; final Map<String, String> values; final FutureOr<void> Function(VerificationAction) onAction; final VoidCallback onPick; final VoidCallback onReview; final Future<void> Function() onSubmit; final bool busy; final String? error;
@override Widget build(BuildContext context) { final theme = PaymentTheme.of(context); final type = PaymentType.of(context); final documents = [(requirement, document)]; if (step == KycReviewStep.status) { return VerificationStatusView( snapshot: snapshot, onAction: onAction, busyAction: busy ? VerificationAction.checkStatus : null, ); } final correcting = step == KycReviewStep.document; return PaymentFullPageView( title: correcting ? 'Perbaiki dokumen' : 'Tinjau perbaikan', primaryAction: correcting ? PaymentButton( label: 'Lanjutkan tinjauan', onPressed: document.phase == DocumentSlotPhase.uploaded && !busy ? onReview : null, ) : VerificationReview.submitButton( context, documents: documents, onSubmit: onSubmit, busy: busy, ), child: Column( crossAxisAlignment: CrossAxisAlignment.stretch, spacing: theme.space(PaymentSpace.group), children: [ if (error != null) PaymentBanner( tone: StatusTone.danger, title: 'Perbaikan belum terkirim', message: error, icon: Icons.cloud_off_outlined, ), if (correcting) ...[ Text( snapshot.safeReason ?? 'Perbarui dokumen yang diminta.', style: type.bodyFor(context), ), DocumentUploadTile( requirement: requirement, state: document, needsUpdate: document.phase != DocumentSlotPhase.uploaded, onPick: busy ? null : onPick, ), ] else VerificationReview( fields: fields, values: values, documents: documents, inlineSubmit: false, busy: busy, onSubmit: onSubmit, onEditDocuments: busy ? null : () => onAction(VerificationAction.fixDetails), ), Text( 'Dokumen terunggah belum berarti identitas terverifikasi.', style: type.caption, ), ], ), ); }}Source: kyc_review_demo.dart
Open this file on GitHub. Copy and adapt it in your host app.
import 'package:flutter/material.dart';import 'package:flutter_localizations/flutter_localizations.dart';import 'package:rakit_ui/rakit_ui.dart';
import 'compositions/kyc_review_block.dart';import 'themes.dart';
void main() => runApp(const KycReviewDemo());
const kycDemoRequirement = DocumentRequirement( key: 'identity', label: 'Foto identitas · Demo', acceptedTypes: {'image/jpeg'}, acceptedTypesLabel: 'JPG', maxBytes: 5000000,);const kycDemoFile = DocumentFile( name: 'identitas_demo_baru.jpg', mimeType: 'image/jpeg', sizeBytes: 240000,);
/// Synthetic host only: metadata, masked fictional identity and explicit/// verification snapshots. No document bytes, camera, permission or network.class KycReviewDemo extends StatefulWidget { const KycReviewDemo({ super.key, this.initialDark = false, this.failFirstSubmit = false, this.delay = const Duration(milliseconds: 500), }); final bool initialDark; final bool failFirstSubmit; final Duration delay; @override State<KycReviewDemo> createState() => _KycReviewDemoState();}
class _KycReviewDemoState extends State<KycReviewDemo> { late bool dark = widget.initialDark; late bool failFirst = widget.failFirstSubmit; KycReviewStep step = KycReviewStep.status; VerificationSnapshot snapshot = const VerificationSnapshot( status: VerificationStatus.actionRequired, requestId: 'KYC-DEMO-1', safeReason: 'Foto identitas kurang jelas. Ganti dengan foto baru yang terang dan tidak terpotong.', fieldsToFix: {'identity'}, allowedActions: {VerificationAction.fixDetails}, ); DocumentSlotState document = const DocumentSlotState.failed( DocumentIssue( DocumentIssueKind.rejectedByHost, safeMessage: 'Foto buram. Unggah foto baru.', ), file: kycDemoFile, ); String? error; bool busy = false; int generation = 0; int submits = 0;
void reset(bool failure) => setState(() { generation++; busy = false; error = null; submits = 0; failFirst = failure; step = KycReviewStep.status; snapshot = const VerificationSnapshot( status: VerificationStatus.actionRequired, requestId: 'KYC-DEMO-1', safeReason: 'Foto identitas kurang jelas. Ganti dengan foto baru yang terang dan tidak terpotong.', fieldsToFix: {'identity'}, allowedActions: {VerificationAction.fixDetails}, ); document = const DocumentSlotState.failed( DocumentIssue( DocumentIssueKind.rejectedByHost, safeMessage: 'Foto buram. Unggah foto baru.', ), file: kycDemoFile, ); });
Future<void> submit() async { if (busy || step != KycReviewStep.review || document.phase != DocumentSlotPhase.uploaded) { return; } final current = generation; final reject = failFirst && submits++ == 0; setState(() { busy = true; error = null; }); await Future<void>.delayed(widget.delay); if (!mounted || current != generation) return; setState(() { busy = false; if (reject) { error = 'Belum ada data yang dikirim pada simulasi ini. Coba kirim perbaikan lagi.'; } else { // Explicit synthetic host response, never inferred from upload/time. snapshot = const VerificationSnapshot( status: VerificationStatus.inReview, requestId: 'KYC-DEMO-1', allowedActions: {VerificationAction.checkStatus}, ); step = KycReviewStep.status; } }); }
Future<void> action(VerificationAction value) async { if (busy) return; if (value == VerificationAction.fixDetails) { setState(() { step = KycReviewStep.document; error = null; }); } else if (value == VerificationAction.checkStatus && snapshot.allowedActions.contains(value)) { final current = generation; setState(() => busy = true); await Future<void>.delayed(widget.delay); if (!mounted || current != generation) return; setState(() { busy = false; snapshot = const VerificationSnapshot( status: VerificationStatus.verified, requestId: 'KYC-DEMO-1', ); }); } }
@override Widget build(BuildContext context) => MaterialApp( debugShowCheckedModeBanner: false, theme: buildTheme(DemoBrand.ruangBayar, Brightness.light), darkTheme: buildTheme(DemoBrand.ruangBayar, Brightness.dark), themeMode: dark ? ThemeMode.dark : ThemeMode.light, locale: const Locale('id'), supportedLocales: const [Locale('id'), Locale('en')], localizationsDelegates: const [ PaymentLocalizations.delegate, GlobalMaterialLocalizations.delegate, GlobalWidgetsLocalizations.delegate, GlobalCupertinoLocalizations.delegate, ], home: Scaffold( appBar: AppBar( title: const Text('Identitas · Demo'), actions: [ PaymentIconButton( icon: Icons.brightness_6_outlined, tooltip: 'Ganti tema', onPressed: () => setState(() => dark = !dark), ), PopupMenuButton<bool>( tooltip: 'Skenario demo', onSelected: reset, itemBuilder: (_) => const [ PopupMenuItem(value: false, child: Text('Perbaikan dokumen')), PopupMenuItem(value: true, child: Text('Gagal kirim pertama')), ], ), ], ), body: SafeArea( top: false, child: KycReviewBlock( step: step, snapshot: snapshot, requirement: kycDemoRequirement, document: document, fields: const [ IdentityFieldSpec(key: 'name', label: 'Nama'), IdentityFieldSpec( key: 'reference', label: 'Referensi identitas', maskInReview: true, ), ], values: const { 'name': 'Rina Contoh · Demo', 'reference': 'DEMO-00002190', }, busy: busy, error: error, onAction: action, onPick: () => setState(() { document = const DocumentSlotState.uploaded( kycDemoFile, requestId: 'UPLOAD-DEMO-2', ); }), onReview: () => setState(() => step = KycReviewStep.review), onSubmit: submit, ), ), ), );}Source: themes.dart
Open this file on GitHub. Copy and adapt it in your host app.
import 'package:flutter/foundation.dart';import 'package:flutter/material.dart';import 'package:rakit_ui/rakit_ui.dart';
/// Three independent brands applied from outside the package, without forking.enum DemoBrand { ruangBayar, lumen, soft }
ThemeData buildTheme(DemoBrand brand, Brightness brightness) { final dark = brightness == Brightness.dark; switch (brand) { case DemoBrand.ruangBayar: // "Hairline": white page, navy-black ink, rules instead of cards. // Colors are contrast-checked in docs/design-research.md, section 0. final ink = dark ? const Color(0xFFECEDF0) : const Color(0xFF1A1F36); final surface = dark ? const Color(0xFF131417) : Colors.white; final scheme = ColorScheme.fromSeed( seedColor: const Color(0xFF1A1F36), brightness: brightness, dynamicSchemeVariant: DynamicSchemeVariant.monochrome, primary: ink, onPrimary: surface, surface: surface, onSurface: ink, ); final payment = PaymentTheme.fromColorScheme(scheme).copyWith( accent: ink, onAccent: surface, surface: surface, surfaceMuted: dark ? const Color(0xFF1C1E23) : const Color(0xFFF5F6F8), outline: dark ? const Color(0xFF2C2E35) : const Color(0xFFE3E6EC), textPrimary: ink, textSecondary: dark ? const Color(0xFFA2A8B5) : const Color(0xFF5E6678), // Control edge 3.37:1 light, 4.85:1 dark; disabled labels stay above // 2:1 on the muted fill. border: dark ? const Color(0xFF7E838E) : const Color(0xFF868C9A), disabled: dark ? const Color(0xFF62656E) : const Color(0xFFA6ABB5), ); return _base(scheme, payment, background: surface); case DemoBrand.lumen: // "Contrast": pure black and white and heavier amounts, with the same // corners as Hairline (radius 8). final ink = dark ? Colors.white : Colors.black; final surface = dark ? const Color(0xFF0F0F0F) : Colors.white; final scheme = ColorScheme.fromSeed( seedColor: Colors.black, brightness: brightness, dynamicSchemeVariant: DynamicSchemeVariant.monochrome, primary: ink, onPrimary: surface, surface: surface, onSurface: ink, ); final payment = PaymentTheme.fromColorScheme(scheme).copyWith( accent: ink, onAccent: surface, surface: surface, surfaceMuted: dark ? const Color(0xFF1F1F1F) : const Color(0xFFF3F3F3), outline: dark ? const Color(0xFF333333) : const Color(0xFFE8E8E8), textPrimary: ink, textSecondary: dark ? const Color(0xFFB3B3B3) : const Color(0xFF545454), radius: 8, amountWeight: FontWeight.w700, ); return _base(scheme, payment, background: surface); case DemoBrand.soft: // "Soft": a tinted page with white inset panels, an indigo accent, // rounder corners and a lighter amount. Tokens only; the panels are // host styling (SoftInsetPanel). Contrast on the tinted page: body // text 14.3:1, secondary 5.6:1, accent 6.3:1, control edge 3.5:1, // status tones at least 5.6:1 (docs/design-research.md, section 9). final page = dark ? const Color(0xFF0E0F13) : const Color(0xFFF1F2F6); final surface = dark ? const Color(0xFF18191E) : Colors.white; final ink = dark ? const Color(0xFFECEDF1) : const Color(0xFF1C2133); final accent = dark ? const Color(0xFFAEB7FF) : const Color(0xFF3D4AC4); final onAccent = dark ? page : Colors.white; final scheme = ColorScheme.fromSeed( seedColor: const Color(0xFF3D4AC4), brightness: brightness, primary: accent, onPrimary: onAccent, surface: surface, onSurface: ink, ); final payment = PaymentTheme.fromColorScheme(scheme).copyWith( accent: accent, onAccent: onAccent, surface: surface, surfaceMuted: dark ? const Color(0xFF212329) : const Color(0xFFF4F5F9), outline: dark ? const Color(0xFF2E3038) : const Color(0xFFE2E4EB), textPrimary: ink, textSecondary: dark ? const Color(0xFFA4AAB7) : const Color(0xFF586074), border: dark ? const Color(0xFF7F8592) : const Color(0xFF7A8090), disabled: dark ? const Color(0xFF62656E) : const Color(0xFFA3A8B4), // D101 radius roles: 8 tags, 12 controls, 16 boxes, 20 sheets. radius: 16, controlRadius: 12, sheetRadius: 20, amountWeight: FontWeight.w500, ); // D102: fields stay white on the tinted page. return _base( scheme, payment, background: page, field: PaymentFieldTheme(fillColor: surface), ); }}
ThemeData _base( ColorScheme scheme, PaymentTheme payment, { required Color background, PaymentFieldTheme? field,}) { final controlRadius = payment.controlBorderRadius; return ThemeData( colorScheme: scheme, useMaterial3: true, splashFactory: switch (defaultTargetPlatform) { TargetPlatform.iOS => NoSplash.splashFactory, TargetPlatform.android when !kIsWeb => InkSparkle.splashFactory, _ => null, }, scaffoldBackgroundColor: background, extensions: [payment, ?field], dividerTheme: DividerThemeData(color: payment.outline, space: 1), appBarTheme: AppBarTheme( backgroundColor: background, foregroundColor: payment.textPrimary, surfaceTintColor: Colors.transparent, scrolledUnderElevation: 0, centerTitle: false, titleTextStyle: TextStyle( fontSize: 17, height: 24 / 17, letterSpacing: 0, fontWeight: FontWeight.w600, color: payment.textPrimary, ), shape: Border(bottom: BorderSide(color: payment.outline)), ), // Demo/Scenarios/Gallery switcher: a plain bar with a hairline, the // selected destination in ink, no tonal pill. navigationBarTheme: NavigationBarThemeData( backgroundColor: background, surfaceTintColor: Colors.transparent, indicatorColor: Colors.transparent, height: 64, iconTheme: WidgetStateProperty.resolveWith( (states) => IconThemeData( size: 24, color: states.contains(WidgetState.selected) ? payment.textPrimary : payment.textSecondary, ), ), labelTextStyle: WidgetStateProperty.resolveWith( (states) => TextStyle( fontSize: 12, fontWeight: FontWeight.w500, color: states.contains(WidgetState.selected) ? payment.textPrimary : payment.textSecondary, ), ), ), snackBarTheme: SnackBarThemeData( behavior: SnackBarBehavior.floating, shape: RoundedRectangleBorder(borderRadius: controlRadius), ), dialogTheme: DialogThemeData( backgroundColor: payment.surface, surfaceTintColor: Colors.transparent, shape: RoundedRectangleBorder(borderRadius: payment.sheetBorderRadius), ), bottomSheetTheme: BottomSheetThemeData( backgroundColor: payment.surface, surfaceTintColor: Colors.transparent, ), popupMenuTheme: PopupMenuThemeData( color: payment.surface, surfaceTintColor: Colors.transparent, shape: RoundedRectangleBorder( borderRadius: controlRadius, side: BorderSide(color: payment.outline), ), ), // Plain Material buttons in example screens match PaymentButton: 6 px // corners, ink outline, no pill. filledButtonTheme: FilledButtonThemeData( style: FilledButton.styleFrom( shape: RoundedRectangleBorder(borderRadius: controlRadius), ), ), outlinedButtonTheme: OutlinedButtonThemeData( style: OutlinedButton.styleFrom( foregroundColor: payment.textPrimary, side: BorderSide(color: payment.border), shape: RoundedRectangleBorder(borderRadius: controlRadius), ), ), textButtonTheme: TextButtonThemeData( style: TextButton.styleFrom( foregroundColor: payment.textPrimary, shape: RoundedRectangleBorder(borderRadius: controlRadius), ), ), // Chips in example screens (sheet filters, the scenario picker): small // corners, no check mark, selection shown by an ink outline. chipTheme: ChipThemeData( showCheckmark: false, backgroundColor: payment.surface, selectedColor: payment.surfaceMuted, side: WidgetStateBorderSide.resolveWith( (states) => BorderSide( color: states.contains(WidgetState.selected) ? payment.accent : payment.outline, ), ), shape: RoundedRectangleBorder(borderRadius: controlRadius), labelStyle: TextStyle(fontSize: 14, color: payment.textPrimary), ), checkboxTheme: CheckboxThemeData( shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(4)), ), inputDecorationTheme: InputDecorationTheme( filled: true, fillColor: payment.surface, border: OutlineInputBorder( borderRadius: controlRadius, borderSide: BorderSide(color: payment.textSecondary), ), enabledBorder: OutlineInputBorder( borderRadius: controlRadius, borderSide: BorderSide(color: payment.border), ), focusedBorder: OutlineInputBorder( borderRadius: controlRadius, borderSide: BorderSide(color: payment.accent, width: 2), ), ), );}Proof and limits
Section titled “Proof and limits”Widget tests cover correction and masked review, failed-submit retry and a reachable submit action at 320 dp with 200% text. The demo uses fictional metadata and no real documents. Connect your own upload and verification services. See Compatibility for device coverage.