Merchant overview
Read available balance, inspect revenue and method mix, then open unconfirmed payments without requesting another payment. The balance is the single display amount; section totals and metadata recede. Content scrolls rather than shrinking to fit a phone. The host shell owns bottom navigation and safe areas.




Run the demo
Section titled “Run the demo”From the repository’s example/ directory:
flutter run -d <device-id> -t lib/merchant_demo.dartPeriksa transaksi opens three synthetic unknown records. Lihat semua opens all records. Tap a record to inspect its details. Settings switches the theme. No payment, clipboard write, network call or status verdict is performed.
The same block also runs in the Soft host preset, framed in a host inset panel on a tinted page. See Theming:
flutter run -d <device-id> -t lib/soft_merchant_demo.dartHow it is assembled
Section titled “How it is assembled”| Section | Library components |
|---|---|
| Balance | AmountText with the display variant |
| Notice and inspection action | PaymentBanner, PaymentLink |
| Revenue and method mix | ChartModule, PaymentBarChart, PaymentMeterChart |
| Recent records | TransactionListItem, TransactionRecord |
| Transaction detail | PaymentSheet, PaymentSheetHeader, StatusHeader, PaymentButton |
| Hierarchy and rhythm | PaymentType, PaymentTheme, PaymentSpace, PaymentSection |
The host supplies authoritative totals, method percentages and unconfirmed count, which may include records outside the preview. Null balance means unavailable, never zero. The detail scenario covers confirmed and unknown only; map other provider states explicitly in your host. A dismissed sheet never changes status. Read the history pattern and status/recovery pattern before integrating.
Copy the source
Section titled “Copy the source”Copy the two compositions into your host and adapt MerchantOverviewData and its
callbacks. Keep the scrolling body inside your Scaffold’s safe area. Configure
the shared theme in the host; the supplied themes demonstrate both looks.
Source: compositions/merchant_overview.dart
Open this file on GitHub. Copy and adapt it in your host app.
import 'package:flutter/material.dart';import 'package:rakit_ui/rakit_ui.dart';
/// Copyable host data, not a new kit model or a ledger./// The host supplies authoritative totals and the unresolved count separately/// from the short recent-transactions preview.class MerchantOverviewData { const MerchantOverviewData({ required this.merchant, required this.balance, required this.revenue, required this.period, required this.points, required this.methods, required this.recent, required this.unconfirmedCount, });
final String merchant; final Money? balance; final Money revenue; final String period; final List<ChartPoint> points; final List<MeterSegment> methods; final List<TransactionRecord> recent; final int unconfirmedCount;}
/// Scaffold-free block: the host owns navigation, fetching and status checks./// Uses only public library APIs; safe to copy into a different host app.class MerchantOverview extends StatelessWidget { const MerchantOverview({ super.key, required this.data, required this.onInspectUnconfirmed, required this.onViewTransactions, required this.onOpenTransaction, required this.onOpenAccount, });
final MerchantOverviewData data; final VoidCallback onInspectUnconfirmed; final VoidCallback onViewTransactions; final ValueChanged<TransactionRecord> onOpenTransaction; final VoidCallback onOpenAccount;
@override Widget build(BuildContext context) { final theme = PaymentTheme.of(context); final type = PaymentType.of(context); final gap = theme.space(PaymentSpace.group); return ListView( key: const PageStorageKey('merchant-overview'), padding: EdgeInsets.all(gap), children: [ Row( children: [ Expanded( child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text(data.merchant, style: type.title), Text('Ruang Bayar · Demo', style: type.caption), ], ), ), PaymentIconButton( icon: Icons.person_outline, tooltip: 'Akun toko', onPressed: onOpenAccount, ), ], ), const PaymentDivider(), SizedBox(height: gap), Text('Saldo tersedia', style: type.caption), SizedBox(height: theme.space(PaymentSpace.related)), if (data.balance case final balance?) Align( alignment: AlignmentDirectional.centerStart, child: AmountText(balance, variant: AmountTextVariant.display), ) else Text('Saldo belum tersedia', style: type.body), SizedBox(height: gap), if (data.unconfirmedCount > 0) ...[ PaymentBanner( tone: StatusTone.warning, icon: Icons.help_outline, title: '${data.unconfirmedCount} pembayaran perlu dicek', message: 'Belum terkonfirmasi. Jangan minta bayar ulang.', actions: [ PaymentLink( label: 'Periksa transaksi', onPressed: onInspectUnconfirmed, ), ], ), SizedBox(height: gap), ], ChartModule( title: 'Pemasukan', state: data.points.isEmpty ? ChartState.empty : ChartState.ready, headline: data.revenue, emptyTitle: 'Belum ada pemasukan', emptyMessage: 'Pembayaran terkonfirmasi akan muncul di sini.', chart: PaymentBarChart(points: data.points, showLegend: false), ), Text(data.period, style: type.caption), const PaymentDivider(), PaymentSection( title: 'Metode pembayaran', child: data.methods.isEmpty ? Text('Belum ada metode tercatat.', style: type.caption) : PaymentMeterChart( segments: data.methods, unit: PaymentChartUnit.percent, ), ), const PaymentDivider(), PaymentSection( title: 'Transaksi terbaru', trailing: PaymentLink( label: 'Lihat semua', onPressed: onViewTransactions, variant: PaymentLinkVariant.secondary, ), child: data.recent.isEmpty ? Text( 'Belum ada transaksi. Pembayaran pertama akan tampil di sini.', style: type.body, ) : Column( children: [ for (final record in data.recent) ...[ TransactionListItem( record: record, onTap: () => onOpenTransaction(record), ), const PaymentDivider(), ], ], ), ), ], ); }}Source: compositions/merchant_transaction_detail.dart
Open this file on GitHub. Copy and adapt it in your host app.
import 'package:flutter/material.dart';import 'package:rakit_ui/rakit_ui.dart';
/// Host presentation for the two states in the synthetic merchant demo./// This does not fetch status, retry payment, or create a receipt.class MerchantTransactionDetail extends StatelessWidget { const MerchantTransactionDetail({ super.key, required this.record, required this.onClose, });
final TransactionRecord record; final VoidCallback onClose;
@override Widget build(BuildContext context) { final theme = PaymentTheme.of(context); final type = PaymentType.of(context); final confirmed = record.status == PaymentStatus.succeeded; final group = theme.space(PaymentSpace.group); return PaymentSheet( header: PaymentSheetHeader( title: 'Detail transaksi', subtitle: record.reference ?? record.id, ), body: Column( crossAxisAlignment: CrossAxisAlignment.start, mainAxisSize: MainAxisSize.min, children: [ AmountText(record.amount, variant: AmountTextVariant.display), SizedBox(height: theme.space(PaymentSpace.inline)), Text( record.methodLabel ?? 'Metode tidak tersedia', style: type.caption, ), SizedBox(height: theme.space(PaymentSpace.major)), StatusHeader( tone: confirmed ? StatusTone.success : StatusTone.warning, icon: confirmed ? Icons.check_circle_outline : Icons.help_outline, title: confirmed ? 'Pembayaran berhasil' : 'Belum terkonfirmasi', hatched: !confirmed, ), SizedBox(height: theme.space(PaymentSpace.related)), Text( confirmed ? 'Pembayaran ini telah dikonfirmasi.' : 'Status pembayaran ini belum dapat dipastikan. Periksa statusnya sebelum meminta pelanggan membayar ulang.', style: type.bodyFor(context), ), SizedBox(height: group), Text( 'Demo · Data sintetis. Tidak ada pembayaran dikirim.', style: type.caption, ), ], ), footer: PaymentButton( label: 'Kembali ke transaksi', variant: PaymentButtonVariant.secondary, onPressed: onClose, ), ); }}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), ), ), );}Source: merchant_demo.dart
Open this file on GitHub. Copy and adapt it in your host app.
import 'package:flutter/material.dart';import 'package:flutter/services.dart';import 'package:flutter_localizations/flutter_localizations.dart';import 'package:rakit_ui/rakit_ui.dart';
import 'compositions/merchant_overview.dart';import 'compositions/merchant_transaction_detail.dart';import 'compositions/soft_inset_panel.dart';import 'themes.dart';
void main() { WidgetsFlutterBinding.ensureInitialized(); SystemChrome.setEnabledSystemUIMode(SystemUiMode.edgeToEdge); runApp(const MerchantDemo());}
/// Deterministic, synthetic host fixture. No provider or network is involved.final merchantFixture = MerchantOverviewData( merchant: 'Toko Senja', balance: const Money.idr(8240000), revenue: const Money.idr(12450000), period: '29 Okt – 4 Nov 2026', points: [ for (final (label, value) in const [ ('29 Okt', 1200000), ('30 Okt', 1800000), ('31 Okt', 1600000), ('1 Nov', 2100000), ('2 Nov', 1400000), ('3 Nov', 2050000), ('4 Nov', 2300000), ]) ChartPoint(label: label, value: Money.idr(value)), ], methods: [ MeterSegment(label: 'QRIS', measure: 65), MeterSegment(label: 'Transfer', measure: 25), MeterSegment(label: 'Saldo', measure: 10), ], recent: merchantTransactions.take(2).toList(), unconfirmedCount: 3,);
final merchantTransactions = [ for (final (id, amount, method, status, minute) in [ ('INV-2048', 150000, 'QRIS', PaymentStatus.succeeded, 42), ('INV-2047', 320000, 'Transfer', null, 38), ('INV-2046', 210000, 'QRIS', null, 30), ('INV-2045', 95000, 'Saldo', null, 20), ]) TransactionRecord( id: id, title: id, reference: id, amount: Money.idr(amount), createdAt: DateTime(2026, 11, 4, 10, minute), status: status, merchant: method, methodLabel: method, ),];
class MerchantDemo extends StatefulWidget { const MerchantDemo({super.key, this.brand = DemoBrand.ruangBayar});
/// Hairline by default. [DemoBrand.soft] also frames each tab in a /// [SoftInsetPanel] on the tinted page. final DemoBrand brand;
@override State<MerchantDemo> createState() => _MerchantDemoState();}
class _MerchantDemoState extends State<MerchantDemo> { bool dark = false;
@override Widget build(BuildContext context) => MaterialApp( debugShowCheckedModeBanner: false, theme: buildTheme(widget.brand, Brightness.light), darkTheme: buildTheme(widget.brand, 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: _MerchantShell( inset: widget.brand == DemoBrand.soft, dark: dark, onDarkChanged: (v) => setState(() => dark = v), ), );}
class _MerchantShell extends StatefulWidget { const _MerchantShell({ required this.dark, required this.onDarkChanged, this.inset = false, }); final bool dark; final ValueChanged<bool> onDarkChanged; final bool inset;
@override State<_MerchantShell> createState() => _MerchantShellState();}
class _MerchantShellState extends State<_MerchantShell> { int tab = 0; bool unconfirmedOnly = false;
void transactions({bool unconfirmed = false}) => setState(() { tab = 1; unconfirmedOnly = unconfirmed; });
void openRecord(TransactionRecord record) => showPaymentSheet<void>( context: context, builder: (context) => MerchantTransactionDetail( record: record, onClose: () => Navigator.pop(context), ), ); @override Widget build(BuildContext context) { final theme = PaymentTheme.of(context); final type = PaymentType.of(context); // Soft frames the tab in a host inset panel; Hairline uses the page. Widget frame(Widget body) => widget.inset ? SoftInsetPanel(child: body) : body; return AnnotatedRegion<SystemUiOverlayStyle>( value: (widget.dark ? SystemUiOverlayStyle.light : SystemUiOverlayStyle.dark) .copyWith( systemNavigationBarColor: Colors.transparent, systemNavigationBarDividerColor: Colors.transparent, systemNavigationBarContrastEnforced: false, ), child: Scaffold( body: SafeArea( child: frame(switch (tab) { 0 => MerchantOverview( data: merchantFixture, onInspectUnconfirmed: () => transactions(unconfirmed: true), onViewTransactions: transactions, onOpenTransaction: openRecord, onOpenAccount: () => setState(() => tab = 2), ), 1 => ListView( padding: EdgeInsets.all(theme.space(PaymentSpace.group)), children: [ Text( unconfirmedOnly ? 'Pembayaran belum diketahui' : 'Semua transaksi', style: type.title, ), if (unconfirmedOnly) PaymentLink( label: 'Tampilkan semua transaksi', onPressed: () => transactions(), ), for (final record in merchantTransactions.where( (r) => !unconfirmedOnly || r.status == null, )) TransactionListItem( record: record, onTap: () => openRecord(record), ), ], ), _ => ListView( padding: EdgeInsets.all(theme.space(PaymentSpace.group)), children: [ Text('Pengaturan toko', style: type.title), Text('Toko Senja · Demo sintetis', style: type.caption), SwitchListTile( title: const Text('Mode gelap'), value: widget.dark, onChanged: widget.onDarkChanged, ), ], ), }), ), // The native host shell owns navigation and safe-area handling. bottomNavigationBar: BottomNavigationBar( currentIndex: tab, selectedItemColor: theme.textPrimary, unselectedItemColor: theme.textSecondary, selectedLabelStyle: type.caption, unselectedLabelStyle: type.caption, backgroundColor: theme.surface, elevation: 0, onTap: (value) => setState(() { tab = value; unconfirmedOnly = false; }), items: const [ BottomNavigationBarItem( icon: Icon(Icons.home_outlined), label: 'Ringkasan', ), BottomNavigationBarItem( icon: Icon(Icons.receipt_long_outlined), label: 'Transaksi', ), BottomNavigationBarItem( icon: Icon(Icons.settings_outlined), label: 'Pengaturan', ), ], ), ), ); }}Verification and limits
Section titled “Verification and limits”Widget tests cover transaction inspection, unavailable and empty data, and a reachable 48 dp detail action at 320 dp with 200% text. The demo starts with a fixed data snapshot; add host loading, retrieval and reconciliation. See Compatibility for device coverage.