AppBackground.image constructor

const AppBackground.image({
  1. Key? key,
  2. required ImageProvider<Object> image,
  3. required Widget child,
  4. String title = '',
  5. Widget? titleWidget,
  6. bool showBackButton = false,
  7. VoidCallback? onBackPressed,
  8. Widget? leading,
  9. bool showNotification = false,
  10. VoidCallback? onNotificationPressed,
  11. int? notificationBadgeCount,
  12. bool showSearch = false,
  13. VoidCallback? onSearchPressed,
  14. bool showCall = false,
  15. VoidCallback? onCallPressed,
  16. bool showOptions = false,
  17. List<PopupMenuEntry>? optionMenuItems,
  18. void onOptionSelected(
    1. dynamic value
    )?,
  19. List<Widget>? actions,
  20. Widget? bottomNavigationBar,
  21. Widget? floatingActionButton,
  22. Color? appBarColor,
  23. double? appBarHeight,
  24. bool isRefresh = false,
  25. Future<void> onRefresh()?,
  26. bool isLoading = false,
  27. Widget? loadingWidget,
  28. bool isError = false,
  29. String? errorMessage,
  30. VoidCallback? onRetry,
  31. bool useSafeArea = true,
  32. bool isChildScrollable = true,
  33. Color? statusBarColor,
  34. 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;