main
md 52 lines 1.8 KB
Rendered Raw
1 ---
2 name: hugeicons-usage
3 description: Guidelines for using the Hugeicons Flutter package, covering widget usage, customization, and theme integration.
4 ---
5
6 # Hugeicons Usage Guide
7
8 ## Core Guidelines
9
10 - **Use the `HugeIcon` widget**: Always use the provided `HugeIcon` widget for rendering icons.
11 - **Icon Data Type**: `HugeIcon.icon` expects `List<List<dynamic>>`. `HugeIcons.*` constants are SVG JSON/path data, not Flutter `IconData`.
12 - **Do Not Use `Icon`**: Do not render `HugeIcons.*` constants with Flutter's `Icon` widget. Pass them to `HugeIcon`.
13 - **Icon Constants**: Icons are accessed through the `HugeIcons` class (e.g., `HugeIcons.strokeRoundedUser`).
14 - **Theme Color Inheritance**: By default, `HugeIcon` inherits the color from the current `IconTheme`. You can override this using the `color` property.
15 - **Size**: The default size is 24.0. Use the `size` property to scale the icon.
16 - **Stroke Width**: For stroke-based icons (most icons in this package), you can customize the thickness using the `strokeWidth` property.
17
18 ## Examples
19
20 ### Simple Usage
21 ```dart
22 HugeIcon(
23 icon: HugeIcons.strokeRoundedHome01,
24 color: Colors.black,
25 size: 24.0,
26 )
27 ```
28
29 ### With Color Inheritance
30 ```dart
31 IconTheme(
32 data: IconThemeData(color: Colors.blue, size: 32.0),
33 child: HugeIcon(
34 icon: HugeIcons.strokeRoundedSettings01,
35 ),
36 )
37 ```
38
39 ### Custom Stroke Width
40 ```dart
41 HugeIcon(
42 icon: HugeIcons.strokeRoundedFavorite,
43 color: Colors.red,
44 strokeWidth: 2.5,
45 )
46 ```
47
48 ## Troubleshooting
49
50 - **Icon not showing**: Ensure the `icon` property is not null and is a valid constant from `HugeIcons`.
51 - **Type errors**: If code expects `IconData`, it is using the wrong type. Hugeicons icon constants are `List<List<dynamic>>`.
52 - **Unexpected Color**: Check if a parent `IconTheme` or `DefaultTextStyle` is providing a color you don't expect.