Divider
A divider marks a boundary inside a short run of content. Keep the words on both sides meaningful even when the rule is invisible.
Read a receipt
#Read the subtotal above the divider and the total below. Add or remove the delivery fee to change the total.
components/divider/appliance/split_receipt.dart
import 'package:flutter/widgets.dart';
import 'package:appliance_ui/appliance_ui.dart';
class SplitReceipt extends StatefulWidget {
const SplitReceipt({super.key});
@override
State<SplitReceipt> createState() => _SplitReceiptState();
}
class _SplitReceiptState extends State<SplitReceipt> {
bool delivery = false;
@override
Widget build(BuildContext context) => ConstrainedBox(
constraints: const BoxConstraints(maxWidth: 440),
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const Text('Subtotal £12'),
const SizedBox(height: 12),
const ApplianceDivider(),
const SizedBox(height: 12),
Text(delivery ? 'Total £15' : 'Total £12'),
const SizedBox(height: 12),
ApplianceButton(
delivery ? 'Remove delivery' : 'Add delivery',
onPressed: () => setState(() => delivery = !delivery),
),
],
),
);
}
Parameters
ApplianceDivider API ↗indent- The room before it.
endIndent- The room after it.
vertical- Whether it runs down instead of across.
style- Overrides the component’s themed appearance for this instance.
Shared behaviour
- Keyboard and focus. Tab reaches the delivery action. The rule itself needs no keyboard stop.
- Screen readers. Read Subtotal and Total in order. Their labels explain the relationship without relying on the divider.
- Direction and type. The horizontal rule separates the same two lines in either direction. The amount and its label grow with the text setting.