CNIcon class
Describes an image or icon asset for native rendering.
Use the named constructors to create assets from different sources:
- CNIcon.symbol — SF Symbol (system icon)
- CNIcon.xcasset — Image from the app's asset catalog
- CNIcon.asset — Flutter asset path (svg/png/jpg auto-detected)
- CNIcon.svg — SVG bytes
- CNIcon.png — PNG bytes
- CNIcon.jpg — JPG bytes
- CNIcon.data — Generic bytes with explicit format
Constructors
- CNIcon.asset(String path, {Size size = const Size(24, 24), Color? color, String? format, BoxFit fit = BoxFit.contain})
-
Flutter asset path — format is auto-detected from the file extension.
const
- CNIcon.data(Uint8List bytes, String format, {Size size = const Size(24, 24), Color? color, BoxFit fit = BoxFit.contain})
-
Generic bytes with an explicit format string (e.g.
'png','svg').const - CNIcon.jpg(Uint8List data, {Size size = const Size(24, 24), Color? color, BoxFit fit = BoxFit.contain})
-
JPG bytes.
const
- CNIcon.png(Uint8List data, {Size size = const Size(24, 24), Color? color, BoxFit fit = BoxFit.contain})
-
PNG bytes.
const
- CNIcon.svg(Uint8List data, {Size size = const Size(24, 24), Color? color, BoxFit fit = BoxFit.contain})
-
SVG bytes.
const
- CNIcon.symbol(String name, {Size size = const Size(24, 24), Color? color, CNSymbolRenderingMode? mode, BoxFit fit = BoxFit.contain})
-
SF Symbol — renders via
Image(systemName:)in SwiftUI.const - CNIcon.xcasset(String name, {Size size = const Size(24, 24), Color? color, BoxFit fit = BoxFit.contain})
-
xcasset image from the app bundle — loaded via
UIImage(named:).const
Properties
- assetPath → String
-
Flutter asset path for CNIcon.asset sources. Empty string otherwise.
no setter
- color → Color?
-
Per-asset tint/icon color. Overridden by
CNButtonThemecolors when set.final - fit → BoxFit
-
How the image should be scaled within size. Defaults to BoxFit.contain.
final
- gradient → bool?
-
Gradient rendering flag. Always null — gradient was removed in 0.0.7.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- imageData → Uint8List?
-
Raw bytes for bytes-based sources. Null otherwise.
no setter
- imageFormat → String?
-
Format string for bytes/asset sources ('svg', 'png', 'jpg'). Null otherwise.
no setter
- mode → CNSymbolRenderingMode?
-
Optional rendering mode (applies to SF Symbols).
final
-
props
→ List<
Object?> -
The list of properties that will be used to determine whether
two instances are equal.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- size → Size
-
Desired render size. Defaults to 24×24 points.
final
- stringify → bool?
-
If set to
true, thetoStringmethod will be overridden to output this instance'sprops.no setterinherited - xcassetName → String?
-
xcasset catalog name for CNIcon.xcasset sources. Null otherwise.
no setter
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toMap(
) → Map< String, dynamic> -
Returns the serialization dict entries for this asset (without color).
Callers should merge in
iconColorseparately using a resolved ARGB int. -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited