Icons#
Skribble renders Material icons with rough, hand-drawn outlines and optional hachure or cross-hatch fills. The icon system includes a pre-generated catalog of Material icons converted to SVG primitives, a runtime rough renderer, and helpers for custom icon sets.
WiredIcon#
The primary icon widget. Looks up the given IconData in the pre-generated rough icon catalog and renders it with hand-drawn strokes. Falls back to Flutter's standard
Icon for unsupported icon families.
// Basic usage
WiredIcon(icon: Icons.home)
// With customization
WiredIcon(
icon: Icons.favorite,
size: 32,
color: Colors.red,
fillStyle: WiredIconFillStyle.hachure,
strokeWidth: 2.0,
)
Constructor parameters#
| Parameter | Type | Default | Description |
|---|---|---|---|
icon |
IconData |
required | The icon to render. |
size |
double? |
null |
Icon size. Defaults to IconTheme.of(context).size or 24. |
color |
Color? |
null |
Icon color. Defaults to IconTheme.of(context).color or theme.textColor. |
semanticLabel |
String? |
null |
Accessibility label. |
fillStyle |
WiredIconFillStyle |
.solid |
Fill strategy for the icon shapes. |
strokeWidth |
double |
1.6 |
Width of the outline strokes. |
drawConfig |
DrawConfig? |
null |
Custom rough drawing configuration. |
sampleDistance |
double |
1.2 |
Sampling distance along path contours. |
hachureGap |
double |
2.25 |
Gap between hachure fill lines. |
hachureAngle |
double |
320 |
Angle of hachure fill lines in degrees. |
Fill styles#
The WiredIconFillStyle enum controls how icon shapes are filled:
| Style | Description |
|---|---|
none | Outline only, no fill. |
solid | Solid color fill (default). Clean and readable. |
hachure | Diagonal hatching lines at the configured angle and gap. |
crossHatch | Two layers of hachure lines at 90 degrees to each other. |
Notes#
-
Only
MaterialIconsfont family icons have rough equivalents in the catalog. Other icon families (e.g., custom fonts) fall back toIcon. -
RTL text direction is handled automatically: icons with
matchTextDirectionare flipped horizontally. -
The
drawConfigparameter allows full control over randomness, roughness, bowing, and curve fitting. -
The rough rendering uses path sampling along contours, with
sampleDistancecontrolling fidelity.
WiredSvgIcon#
Renders a pre-parsed WiredSvgIconData with rough hand-drawn strokes. This is the lower-level rendering widget used by
WiredIcon internally.
WiredSvgIcon(
data: myCustomSvgIconData,
size: 48,
color: Colors.blue,
fillStyle: WiredIconFillStyle.crossHatch,
strokeWidth: 2.0,
)
Constructor parameters#
| Parameter | Type | Default | Description |
|---|---|---|---|
data |
WiredSvgIconData |
required | Pre-parsed SVG icon data. |
size | double? | null | Icon size. |
color |
Color? |
null |
Icon color. |
semanticLabel |
String? |
null |
Accessibility label. |
fillStyle |
WiredIconFillStyle |
.solid |
Fill strategy. |
strokeWidth |
double |
1.6 |
Outline stroke width. |
drawConfig |
DrawConfig? |
null |
Custom rough drawing configuration. |
flipHorizontally |
bool |
false |
Mirror the icon horizontally. |
sampleDistance |
double |
1.2 |
Path sampling distance. |
hachureGap |
double |
2.25 |
Hachure line gap. |
hachureAngle |
double |
320 |
Hachure angle in degrees. |
Notes#
- SVG data is scaled to fit the target size while maintaining aspect ratio.
- Path primitives are memoized with
useMemoizedfor performance. - Supports
flipHorizontallyfor RTL icon rendering.
WiredSvgIconData#
The data type that represents a pre-parsed SVG icon. Contains the viewport dimensions and a list of drawable primitives.
const myIcon = WiredSvgIconData(
width: 24,
height: 24,
primitives: [
WiredSvgPrimitive.path('M12 2L2 22h20L12 2z'),
WiredSvgPrimitive.circle(cx: 12, cy: 16, radius: 2),
],
);
Structure#
final class WiredSvgIconData {
final double width;
final double height;
final List<WiredSvgPrimitive> primitives;
}
Primitive types#
| Type | Factory | Description |
|---|---|---|
WiredSvgPathPrimitive |
.path(data) |
An SVG path string (e.g., 'M0 0L10 10'). |
WiredSvgCirclePrimitive |
.circle(cx, cy, radius) |
A circle primitive. |
WiredSvgEllipsePrimitive |
.ellipse(cx, cy, radiusX, radiusY) |
An ellipse primitive. |
Each primitive supports an optional fillRule parameter (WiredSvgFillRule.nonZero
or .evenOdd).
WiredAnimatedIcon#
A hand-drawn wrapper around Flutter's AnimatedIcon. Applies Skribble theme colors while preserving the standard animation behavior.
final controller = useAnimationController(
duration: Duration(milliseconds: 300),
);
WiredAnimatedIcon(
icon: AnimatedIcons.menu_arrow,
progress: controller,
size: 24,
)
Constructor parameters#
| Parameter | Type | Default | Description |
|---|---|---|---|
icon |
AnimatedIconData |
required | The animated icon data. |
progress |
Animation<double> |
required | Animation progress (0.0 to 1.0). |
color |
Color? |
null |
Icon color. Defaults to theme.textColor. |
size | double? | null | Icon size. |
semanticLabel |
String? |
null |
Accessibility label. |
textDirection |
TextDirection? |
null |
Text direction for the icon. |
Notes#
-
Wraps the standard
AnimatedIconinbuildWiredElementfor repaint isolation. - Color defaults to
theme.textColorwhen not specified.
Rough icon generation pipeline#
Skribble includes a build-time pipeline that converts Material icons from their standard font/SVG format into the
WiredSvgIconData catalog used at runtime.
Overview#
The pipeline consists of two tooling packages:
-
flutter-material kit -- Extracts SVG path data from the Material Icons font and converts each glyph into
WiredSvgPrimitiveentries. -
svg-manifest kit -- Processes SVG files into the manifest format, generating Dart source files with
WiredSvgIconDataconstants.
Generated files#
The build pipeline produces two files in packages/skribble/lib/src/generated/:
-
material_rough_icons.g.dart-- AMap<int, WiredSvgIconData>keyed by icon code point, containing the SVG primitive data for every supported Material icon. -
material_rough_icon_font.g.dart-- Code point lookup tables and a custom font family constant for the rough icon font.
Using generated icon maps#
import 'package:skribble/skribble.dart';
// Look up by IconData
final data = lookupMaterialRoughIcon(Icons.home);
if (data != null) {
// Use with WiredSvgIcon
}
// Look up by string identifier
final data2 = lookupMaterialRoughIconByIdentifier('home');
// Get the rough font family name
final fontFamily = materialRoughFontFamily;
// Get all available icon identifiers
final identifiers = materialRoughIconIdentifiers;
// Get all available code points
final codePoints = materialRoughIconCodePoints;
Icon lookup helpers#
| Function | Description |
|---|---|
lookupMaterialRoughIcon(IconData) |
Returns WiredSvgIconData? for a Material icon. |
lookupMaterialRoughIconByIdentifier(String) |
Returns WiredSvgIconData? by icon name string. |
lookupMaterialRoughFontIcon(String) |
Returns IconData? for the rough icon font. |
materialRoughFontFamily |
The font family string for the rough icon font. |
materialRoughFontCodePoints |
Map<String, int> of icon name to code point. |
materialRoughIconIdentifiers |
List<String> of all available icon names. |
materialRoughIconCodePoints |
List<int> of all available code points. |
skribble_icons package#
The skribble_icons package provides a curated set of 30 hand-drawn custom icons with a unified lookup API. It re-exports all Material rough icons from the main
skribble package, giving you a single import for both custom and Material icons.
Installation#
dart pub add skribble_icons
Import#
import 'package:skribble_icons/skribble_icons.dart';
Curated custom icons#
The package includes 30 custom icons covering common UI actions:
home, search, settings, star, heart,
user, menu, close, check, plus, minus,
arrow_left, arrow_right, arrow_up, arrow_down, edit,
delete, share, copy, mail, phone, camera,
image, calendar, clock, lock, unlock,
eye, eye_off, notification.
Unified lookup API#
Look up any custom icon by its string identifier:
import 'package:skribble_icons/skribble_icons.dart';
// Look up a custom icon by name
final data = lookupSkribbleIconByIdentifier('star');
if (data != null) {
WiredSvgIcon(data: data, size: 32);
}
Available exports#
| Export | Type | Description |
|---|---|---|
kSkribbleIcons |
Map<int, WiredSvgIconData> |
All custom icons keyed by codepoint. |
kSkribbleIconsCodePoints |
Map<String, int> |
Maps icon identifier strings to codepoints. |
lookupSkribbleIconByIdentifier |
WiredSvgIconData? Function |
Returns icon data for a given identifier, or null. |
WiredSvgIconData |
class | The SVG icon data type (re-exported from skribble). |
WiredSvgPrimitive |
class | SVG primitive types (re-exported from skribble). |
Material icons#
All Material rough icons remain available through the main skribble package. The skribble_icons
package focuses on the curated custom icon set. Use WiredIcon(icon: Icons.home) for Material icons and
WiredSvgIcon(data: ...) for custom icons from skribble_icons.
Custom icon sets#
The skribble_icons_custom package provides tooling for generating rough icon catalogs from your own SVG icon sets.
Workflow#
- Place SVG files in a source directory.
- Configure the icon set in the package's build configuration.
- Run the generation pipeline to produce a Dart file with
WiredSvgIconDataconstants. - Use the generated constants with
WiredSvgIcon.
// After generating from your SVG set:
import 'package:my_app/generated/custom_icons.g.dart';
WiredSvgIcon(
data: kCustomIcons['logo']!,
size: 48,
fillStyle: WiredIconFillStyle.hachure,
)
Notes#
- Custom icons go through the same SVG-to-primitive conversion as Material icons.
- The generator handles path, circle, and ellipse SVG elements.
- Fill rules (nonZero / evenOdd) are preserved from the source SVG.
- Complex SVG features (gradients, filters, masks) are not supported -- icons should be simple path-based designs.