Skip to content
Get started
Menu
Get started

Settings view

Group payment preferences with PaymentFormFieldGroup sections such as Notifications, Payments and Language. Do not use one flat list. Save is the primary action and locks repeat taps while its Future runs. Your app supplies values, persistence and statusMessage; status is announced in the header. Avoid another primary action in child.

Payment settings grouped into labelled sections.Payment settings grouped into labelled sections.
Settings view
Payment settings grouped into labelled sections at 200 percent text.
200% text

This complete example keeps Save visible until there are changes to persist. Your app supplies the disabled reason and saves the values.

import 'package:flutter/material.dart';
import 'package:rakit_ui/rakit_ui.dart';
void main() => runApp(const SettingsApp());
class SettingsApp extends StatelessWidget {
const SettingsApp({super.key});
@override
Widget build(BuildContext context) => const MaterialApp(
localizationsDelegates: [PaymentLocalizations.delegate],
supportedLocales: [Locale('en'), Locale('id')],
home: Scaffold(
body: PaymentSettingsView(
title: 'Settings',
saveDisabledReason: 'Make a change before saving.',
child: PaymentFormFieldGroup(
legend: 'Notifications',
children: [Text('Refund notifications are enabled.')],
),
),
),
);
}
example/lib/screens/gallery_views.dart
PaymentSettingsView(
title: 'Payment settings',
statusMessage: 'Saved',
statusTone: StatusTone.success,
onSave: () async {
await Future<void>.delayed(const Duration(milliseconds: 600));
},
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
spacing: PaymentTheme.of(context).space(PaymentSpace.block),
children: [
PaymentFormFieldGroup(
legend: 'Notifications',
children: [
PaymentSwitch(
label: 'Refund notifications',
value: refunds,
onChanged: (v) => setState(() => refunds = v),
),
PaymentSwitch(
label: 'Promotions',
value: promos,
onChanged: (v) => setState(() => promos = v),
),
],
),
PaymentFormFieldGroup(
legend: 'Default method',
children: [
for (final value in ['bank', 'wallet'])
PaymentRadio<String>(
value: value,
groupValue: method,
onChanged: (v) => setState(() => method = v),
label: value == 'bank' ? 'BCA virtual account' : 'Wallet',
),
],
),
PaymentFormFieldGroup(
legend: 'Language',
children: [
PaymentSelect<String>(
label: 'Statement language',
options: const [
PaymentSelectOption(value: 'en', label: 'English'),
PaymentSelectOption(value: 'id', label: 'Bahasa Indonesia'),
],
value: language,
onChanged: (v) => setState(() => language = v),
),
],
),
],
),
);

Variants: idle, saving, saved, error.

The host supplies draft values, the save operation and a status message. Use field groups to separate related preferences.

Situation Variant / composition Payment example
Account preferences idle Group Notifications, Payments and Language; Save is the only primary action.

Use Full page view for read-only account facts.

Return the save Future so repeat taps stay blocked. Show saved status only after the host confirms persistence; preserve edits after a failure.

With onSave: null, pass saveDisabledReason to show a disabled Save and a readable explanation beside it on wide layouts or above it on phones and at large text. Screen readers hear the explanation as Save’s hint, so a person who moves straight to Save hears why it is unavailable; the visible caption is not read a second time. When both are null, Save is hidden as before. A non-null onSave enables Save and ignores saveDisabledReason.

saveDisabledReason (D114) was added in rakit_ui 0.2.0.

Do: Group Notifications, Payments and Language; Save is the only primary action.

Don’t: Keep old Saved feedback after the customer edits a setting.

Group related preferences under a legend. Distinguish unsaved edits, saving, confirmed save and failed save in the status message.

Use field-group legends for related settings. The header announces status, and Save remains reachable at large text.

Save fills the phone footer and hugs the end on wide layouts. The host supplies the save result.

Example account settings screen with synthetic dataExample account settings screen with synthetic data
Example: account settings

PaymentSettingsView

class PaymentSettingsView extends StatelessWidget · lib/src/views/settings_view.dart

Grouped host settings with a future-locked Save action.

ParameterTypeDefaultDescription
title:requiredString—Heading displayed above the content.
child:requiredWidget—Body content owned by the host.
onSave:Future<void> Function()?—Saves settings; repeated activation waits for completion.
saveLabel:String?—Save button label; defaults to the localized Save.
saveDisabledReason:String?—Keeps Save visible and disabled with this explanation when onSave is null. Ignored when onSave is provided. With both null, Save is hidden.
statusMessage:String?—Result of the most recent save.
statusTone:StatusToneStatusTone.neutralSemantic tone of the save result.