Adopt in an existing app
Install the published package in your existing Flutter project:
flutter pub add rakit_uiImport package:rakit_ui/rakit_ui.dart where you use a component. Keep your current app shell, router, state manager and localization delegates. You do not need to clone the repository or adopt a checkout flow.
Start with no kit setup
Section titled “Start with no kit setup”Under your existing MaterialApp, components work without registering a PaymentTheme extension or PaymentLocalizations.delegate:
PaymentTheme.of(context)derives tokens from the ambientThemeData.colorSchemewhen there is no extension. Light and dark schemes resolve independently.PaymentLocalizations.of(context)first looks for a registered kit delegate. Without one, the ambient locale’s language code selects Indonesian forid, and English for everything else, including an absent locale. Your own app delegate does not translate kit-owned labels such as Close or Cancel.- Labels you pass yourself stay yours to translate. For supported kit languages and explicit delegate setup, see Localization.
You can start with one button or text field, then add a brand bridge when the defaults differ from your app.
What follows your host theme
Section titled “What follows your host theme”| Host setting | What Rakit uses |
|---|---|
colorScheme |
Derives semantic colors when no PaymentTheme is installed. An installed extension supplies its own tokens. |
textTheme.bodyMedium.fontFamily and fontFamilyFallback |
Inherited by the kit’s type roles, except explicit amount/reference font overrides. |
textTheme.bodyMedium.fontSize |
Does not resize the kit roles: body is 15, input 16, title 17. See type defaults. |
filledButtonTheme |
Partially inherited by primary/destructive PaymentButtons. The kit sets background/foreground colors (including disabled colors), shape and text style, and owns every size property (D118): minimum, fixed and maximum size, padding, tap-target size and visual density. A host fixedSize, maximumSize or padding does not change a kit button. Other unset properties, such as overlay or elevation, still inherit. Use PaymentButtonTheme for supported, stable customization. |
inputDecorationTheme |
Partially inherited. The kit sets resting, focus, error and disabled borders, label/hint styles and helper/error line limits; field callers supply content padding. Without PaymentFieldTheme.fillColor, filled and fillColor remain unset, so a host filled: true, fillColor: Colors.red can fill PaymentTextField red. Use PaymentFieldTheme for supported, stable customization. |
bottomSheetTheme |
Does not define the kit surface’s corners and layout. Use PaymentTheme.sheetRadius. |
visualDensity |
Does not shrink the kit’s 48 dp target floor. |
| Host control shape radii | Not copied automatically. Map them to the kit’s corner roles or family themes. |
Material component themes still supply properties the kit leaves unset; they are not isolated from kit controls. Host settings such as button overlay color and field fill can leak into their appearance; button size properties cannot (D118). Use the public PaymentButtonTheme and PaymentFieldTheme extensions as the supported, stable brand bridge, and check inherited Material settings when a control looks unexpected. These extensions do not clear unrelated host Material properties.
Bridge your brand once
Section titled “Bridge your brand once”This complete lib/main.dart uses the published import. In your app, call withRakit(yourExistingTheme) for each light/dark theme instead of replacing the app or its router. It preserves unrelated extensions and replaces only the three kit extensions it configures.
import 'package:flutter/material.dart';import 'package:rakit_ui/rakit_ui.dart';
ThemeData withRakit(ThemeData host) { const radius = 4.0; final payment = PaymentTheme.fromColorScheme(host.colorScheme).copyWith( radius: radius, controlRadius: radius, sheetRadius: radius, tagRadius: radius, ); return host.copyWith(extensions: [ ...host.extensions.values.where((extension) => extension is! PaymentTheme && extension is! PaymentButtonTheme && extension is! PaymentFieldTheme), payment, PaymentButtonTheme( style: PaymentButtonStyle( borderRadius: BorderRadius.circular(radius), textStyle: const TextStyle(fontWeight: FontWeight.w500), ), ), PaymentFieldTheme( fillColor: host.colorScheme.surface, borderRadius: BorderRadius.circular(radius), textStyle: const TextStyle(fontSize: 15), ), ]);}
void main() => runApp(MaterialApp( theme: withRakit(ThemeData( colorScheme: ColorScheme.fromSeed(seedColor: const Color(0xFF7C3AED)), )), home: Scaffold( appBar: AppBar(title: const Text('Notes')), body: ListView( padding: const EdgeInsets.all(16), children: [ const PaymentTextField(label: 'Notebook name'), PaymentButton(label: 'Done', onPressed: () {}), ], ), ),));Setting only radius: 4 derives control 3, sheet 6 and tag 2. Set each role explicitly, as above, when your brand uses the same corner everywhere. The field text override changes entered text and placeholders; labels and helper/error text keep their roles. Button typography changes through its family style. Check custom colors in light/dark and long labels at 200% text, including disabled, focus and error states.
Compact controls
Section titled “Compact controls”PaymentButton(size: PaymentSize.small, ...) has a default visual height of 36 dp inside a target of at least 48 × 48 dp. Medium has a default visual height of 48 dp. Larger text or wrapping labels can increase the visual height; host button-theme sizes such as fixedSize cannot (D118). Host VisualDensity.compact does not remove the target floor. The B5 touch floor is deliberate for iOS and Android; do not constrain a small button into a 36 dp parent to imitate a dense host toolbar.
Adopt only what you need
Section titled “Adopt only what you need”A notes app can use PaymentSearchField<String> with its own tags and query callback, showPaymentSheet for note actions, and PaymentSettingsView around its own settings controls. None requires PaymentQuote, Money, a payment attempt or a payment provider. The component pages describe their specific data contracts.
Why the Payment prefix
Section titled “Why the Payment prefix”Payment is the package namespace retained from the kit’s payment origins (D34). It does not make every component payment-only. Existing public names stay stable; D112 does not rename them. Typedef aliases are deferred until a demonstrated need, rather than adding a second name for every widget.
| General UI, usable without payment models | Payment-specific composition and data |
|---|---|
PaymentButton, PaymentTextField, PaymentSearchField, PaymentSwitch |
PaymentSummary, PaymentMethodPicker, PaymentConfirmation |
PaymentSheet, PaymentSettingsView, StateMessage |
PaymentStatusView, PaymentInstructions, PaymentReceipt |
| Layout, navigation, tables and charts in the component catalog | PaymentQuote, PaymentAttempt, PaymentStatusSnapshot, Money |
This is a selection, not an exhaustive export list. KYC patterns have their own identity contracts; general controls do not require them either.
Keep the host in charge
Section titled “Keep the host in charge”The kit reports intent through callbacks. Your app owns navigation (including destinations chosen from sheets), async loading/error/retry state, settings persistence, validation rules, authentication, networking and business decisions. Close dismisses UI; it does not cancel a backend operation. Keep credentials and raw provider errors in your host boundary, and pass only safe display messages. See Host-owned decisions.
Adoption checklist
Section titled “Adoption checklist”- Install the hosted package and copy a component’s Minimal example to confirm the integration.
- Keep your router, state and localization setup; decide whether the English/Indonesian fallback is enough for kit-owned strings.
- Build the brand bridge for light and dark, preserving unrelated theme extensions.
- Check 48 dp targets, 200% text at 320 dp, keyboard focus and custom color contrast.
- Connect host-owned loading, errors, validation, persistence and navigation before replacing demo callbacks.
- Add payment or KYC models only when adopting those domain patterns. The quick start is optional for a general UI integration.