Color picker
A colour picker combines related controls for choosing a colour. Show its numeric value so readers can identify or reproduce the chosen shade.
Choose an ink colour
#Change the hue and then adjust the colour. The hexadecimal readout shows the red, green and blue channels of the new ink.
components/color-picker/appliance/choose_ink.dart
import 'package:flutter/widgets.dart';
import 'package:appliance_ui/appliance_ui.dart';
class ChooseInk extends StatefulWidget {
const ChooseInk({super.key});
@override
State<ChooseInk> createState() => _ChooseInkState();
}
class _ChooseInkState extends State<ChooseInk> {
final ink = DesignColorController(const Color(0xff32628c));
@override
void dispose() {
ink.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) => ConstrainedBox(
constraints: const BoxConstraints(maxWidth: 320),
child: SingleChildScrollView(
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
ApplianceColorPicker(controller: ink),
const SizedBox(height: 12),
ListenableBuilder(
listenable: ink,
builder: (context, _) => Text(
"Ink: #${(ink.color.toARGB32() & 0xffffff).toRadixString(16).padLeft(6, '0').toUpperCase()}",
),
),
],
),
),
);
}
Parameters
ApplianceColorPicker API ↗controller- Owns the selected colour and notifies listeners when it changes.
showAlpha- Includes a control for opacity.
Shared behaviour
- Keyboard and focus. Tab between the picker’s adjustable controls. Use the arrows on the focused control and inspect the hexadecimal result.
- Screen readers. Read the names and values of the colour controls and the ink code beneath the picker.
- Direction and type. Try the picker in RTL and at 200% text. The hexadecimal value keeps its written order.