color_picker library
OverlookV2 color picker.
Public API surface:
- Dialogs and triggers: ColorPickerDialog, ColorPickerTrigger,
ColorPickerRow,
CompactColorPicker - Primitives: hex input, swatches, layer panel, preset library
- Utilities: colorToHex, hexToColor, parseHex
Classes
- AlphaPainter
- Custom painter for rendering a checkerboard pattern to indicate transparency.
- AlphaSlider
- Opacity slider widget with checkerboard pattern background.
- AngleInputDialer
- Circular dialer widget for visually setting gradient rotation angle.
- BlendModeDropdown
- Custom dropdown widget using MenuAnchor for blend mode selection.
- ColorHexInput
- Hex color input field widget with format validation and auto-formatting.
- ColorPicker
- Main color picker widget with all components.
- ColorPickerDialog
- Complete dialog wrapper for color picker.
- ColorPickerLayersControlPanel
- Layers control panel for color picker.
- ColorPickerPanel
- Simplified color picker panel with a clean layout:
- ColorPickerPopupHeight
- Calculates the default popup height from the widget layouts that compose a ColorPickerPanel.
- ColorPickerRow
- A horizontal color picker row with swatch and inline text inputs.
- ColorPickerStorage
- Storage service for color picker data (recent colors, preferences).
- ColorPickerTrigger
- A clickable widget that opens a color picker popup.
- ColorPreset
- Represents a color preset with optional label. Uses PaintSwatch to support solid colors and all gradient types.
- ColorPresetsView
- Display grid of preset colors.
- ColorStop
- A position-color pair representing a gradient stop.
- ColorTile
- Individual color tile widget for displaying colors in grids.
- DefaultPresetLibrary
- Default preset library for the Codelessly Color Picker.
- GradientAlphaInput
- Alpha/opacity input widget with drag support.
- GradientEditor
- Widget for editing gradient stops with visual controls.
- GradientRotationInput
- Widget for inputting gradient rotation angle with a visual dialer.
- GradientStopsList
- Editable list of gradient stops.
- HexColorInputFormatter
- Custom formatter for hex color input that handles pasted values with #.
- ImagePickerWidget
- Simple image picker widget that displays a button to pick images.
- LayerData
- Data model representing a paint layer with color, blend mode, and paint type.
- LayerInfoPanel
- Widget that displays information about a selected layer.
- LayersList
- Widget that displays a list of selectable and rearrangeable layers.
- LayersPreview
- Widget that renders a preview of multiple layers composited together.
- PaintData
- Unified paint model representing all paint types (solid, gradients).
- PaintState
- Encapsulates all paint-related state for a color picker.
- PaintSwatch
- A paint swatch for display in recent colors, presets, and libraries.
- PaintTypeDropdown
- Custom dropdown widget using MenuAnchor to fix z-index issues in popups.
- Palette
- 2D color palette widget for saturation and brightness selection.
- PresetLibraryEntry
- Represents a preset library entry (collection of colors or gradients). Each entry is a named collection/palette containing multiple paint swatches.
- PresetLibraryView
- Preset library view for displaying style sheet colors.
- RainbowSlider
- Hue slider widget displaying the full color spectrum.
- RecentColorsManager
- Helper class to manage recent colors with automatic persistence.
- RecentColorsView
- Display grid of recent colors and gradients.
- RotationAnglePainter
- UpperCaseTextFormatter
- Text input formatter that converts text to uppercase.
Enums
- BlendModeType
- Blend mode enum for color panel layer controls.
- PaintType
- Paint type enum for color picker mode selection.
Constants
- alphaSquareColorFallback → const Color
- Color for alpha checkerboard squares (fallback when theme not available).
Functions
-
colorToHex(
Color color, {bool withAlpha = false, bool withHashtag = false}) → String - Converts a Color to a hex string representation.
-
hexToColor(
String hex, {Color? fallback}) → Color? - Parses a hex string to a Color object.
-
isValidHex(
String hex, {bool withAlpha = false}) → bool - Validates whether a string is a valid hex color format.
-
normalizeHex(
String hex, {bool withAlpha = false}) → String - Normalizes a hex string to a standard format.
-
parseHex(
String hex, {bool withAlpha = false}) → String - Parses and normalizes a hex color string.
-
showColorPickerDialog(
{required BuildContext context, required Color initialColor, String title = 'Select Color', bool allowOpacity = true, bool showRecentColors = true, bool showPresets = true, bool showPresetLibrary = true, List< ColorPreset> ? presets, List<PresetLibraryEntry> ? presetLibrary, List<PaintSwatch> ? recentSwatches, ValueChanged<PaintSwatch> ? onRecentSwatchAdd, VoidCallback? onCreatePreset, ValueChanged<Color> ? onPresetLibrarySelected}) → Future<Color?> - Convenience function to show color picker in a dialog.
Typedefs
-
ColorPositionChanged<
TPosition> = void Function(TPosition position, Color color) - Callback for position changes with color.
-
GradientStopChangedCallback
= void Function(List<
ColorStop> stops) - Callback for gradient stop changes.
- ImageSelectedCallback = void Function(Uint8List bytes, String name)
- Callback for when an image is selected.
-
LayersChangedCallback
= void Function(List<
LayerData> updatedLayers) - Consolidated callback that returns the entire updated layers list. This simplifies state management by having a single callback for all modifications.