1import 'package:flutter/material.dart'; 2 3import '../constants/app_colors.dart'; 4 5/// A solid color overlay for the status bar area 6/// 7/// Prevents content from showing through the transparent status bar when 8/// scrolling. Use with a Stack widget, positioned at the top. 9/// 10/// Example: 11/// ```dart 12/// Stack( 13/// children: [ 14/// // Your scrollable content 15/// CustomScrollView(...), 16/// // Status bar overlay 17/// const StatusBarOverlay(), 18/// ], 19/// ) 20/// ``` 21class StatusBarOverlay extends StatelessWidget { 22 const StatusBarOverlay({ 23 this.color = AppColors.background, 24 super.key, 25 }); 26 27 /// The color to fill the status bar area with 28 final Color color; 29 30 @override 31 Widget build(BuildContext context) { 32 final statusBarHeight = MediaQuery.of(context).padding.top; 33 34 return Positioned( 35 top: 0, 36 left: 0, 37 right: 0, 38 height: statusBarHeight, 39 child: Container(color: color), 40 ); 41 } 42}