AppBackground.image constructor
const
AppBackground.image({
- Key? key,
- required ImageProvider<
Object> image, - required Widget child,
- String title = '',
- Widget? titleWidget,
- bool showBackButton = false,
- VoidCallback? onBackPressed,
- Widget? leading,
- bool showNotification = false,
- VoidCallback? onNotificationPressed,
- int? notificationBadgeCount,
- bool showSearch = false,
- VoidCallback? onSearchPressed,
- bool showCall = false,
- VoidCallback? onCallPressed,
- bool showOptions = false,
- List<
PopupMenuEntry> ? optionMenuItems, - void onOptionSelected(
- dynamic value
- List<
Widget> ? actions, - Widget? floatingActionButton,
- Color? appBarColor,
- double? appBarHeight,
- bool isRefresh = false,
- Future<
void> onRefresh()?, - bool isLoading = false,
- Widget? loadingWidget,
- bool isError = false,
- String? errorMessage,
- VoidCallback? onRetry,
- bool useSafeArea = true,
- bool isChildScrollable = true,
- Color? statusBarColor,
- Brightness? statusBarBrightness,
Creates an AppBackground with an image displayed behind all content.
Accepts any ImageProvider — asset, network, memory, or file:
// Asset image
AppBackground.image(
image: AssetImage('assets/background.png'),
child: MyPage(),
)
// Network image
AppBackground.image(
image: NetworkImage('https://example.com/bg.jpg'),
child: MyPage(),
)
Implementation
const AppBackground.image({
super.key,
required ImageProvider image,
required this.child,
this.title = '',
this.titleWidget,
this.showBackButton = false,
this.onBackPressed,
this.leading,
this.showNotification = false,
this.onNotificationPressed,
this.notificationBadgeCount,
this.showSearch = false,
this.onSearchPressed,
this.showCall = false,
this.onCallPressed,
this.showOptions = false,
this.optionMenuItems,
this.onOptionSelected,
this.actions,
this.bottomNavigationBar,
this.floatingActionButton,
this.appBarColor,
this.appBarHeight,
this.isRefresh = false,
this.onRefresh,
this.isLoading = false,
this.loadingWidget,
this.isError = false,
this.errorMessage,
this.onRetry,
this.useSafeArea = true,
this.isChildScrollable = true,
this.statusBarColor,
this.statusBarBrightness,
}) : _backgroundType = _BackgroundType.image,
backgroundImage = image,
backgroundColor = null;