loadImage static method
Loads image bytes from assets and returns a ready-to-use withImage action.
Call this once in initState or before building and store the result in state.
iosImage is loaded for iOS native rendering; falls back to materialImage.
Implementation
static Future<BaseNavigationBarAction> loadImage({
required String materialImage,
String? iosImage,
double imageSize = 24.0,
double imageWidth = 24.0,
double imageHeight = 24.0,
String? label,
VoidCallback? onPressed,
Color? tint,
double? padding,
double? labelSize,
String? badgeValue,
Color? badgeColor,
}) async {
final String assetPath = iosImage ?? materialImage;
final Uint8List bytes = (await rootBundle.load(assetPath)).buffer.asUint8List();
return BaseNavigationBarAction.withImage(
materialImage: materialImage,
imageBytes: bytes,
imageSize: imageSize,
imageWidth: imageWidth,
imageHeight: imageHeight,
label: label,
onPressed: onPressed,
tint: tint,
padding: padding,
labelSize: labelSize,
badgeValue: badgeValue,
badgeColor: badgeColor,
);
}