import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:syncrow_app/features/shared_widgets/text_widgets/body_large.dart';
import 'package:syncrow_app/generated/assets.dart';
import 'package:syncrow_app/utils/resource_manager/color_manager.dart';
import 'package:syncrow_app/utils/resource_manager/constants.dart';
import 'package:syncrow_app/utils/resource_manager/font_manager.dart';

class DefaultScaffold extends StatelessWidget {
  const DefaultScaffold({
    super.key,
    required this.child,
    this.title,
    this.actions,
    this.appBar,
    this.bottomNavBar,
    this.padding,
    this.leading,
    this.leadingWidth,
    this.height,
  });

  final Widget child;
  final String? title;
  final List<Widget>? actions;
  final PreferredSizeWidget? appBar;
  final Widget? bottomNavBar;
  final EdgeInsetsGeometry? padding;
  final Widget? leading;
  final double? leadingWidth;
  final double? height;
  @override
  Widget build(BuildContext context) {
    return AnnotatedRegion(
      value: SystemUiOverlayStyle(
        statusBarColor: ColorsManager.primaryColor.withOpacity(0.5),
        statusBarIconBrightness: Brightness.dark, // For Android (dark icons)
        statusBarBrightness: Brightness.dark, // For iOS (dark icons)
      ),
      child: Scaffold(
        backgroundColor: ColorsManager.backgroundColor,
        extendBodyBehindAppBar: true,
        extendBody: true,
        appBar: appBar ??
            AppBar(
              backgroundColor: Colors.transparent,
              centerTitle: true,
              title: BodyLarge(
                text: title ?? "",
                fontColor: ColorsManager.secondaryColor,
                fontWeight: FontsManager.bold,
              ),
              actions: actions,
              leading: leading,
              leadingWidth: leadingWidth,
            ),
        body: Container(
          width: MediaQuery.sizeOf(context).width,
          height: height ?? MediaQuery.sizeOf(context).height,
          padding: padding ??
              const EdgeInsets.symmetric(horizontal: Constants.defaultPadding),
          decoration: BoxDecoration(
            image: const DecorationImage(
              colorFilter: ColorFilter.mode(
                ColorsManager.backgroundGrey,
                BlendMode.srcIn,
              ),
              image: AssetImage(
                Assets.assetsImagesBackground,
              ),
              fit: BoxFit.cover,
            ),
          ),
          child: SafeArea(child: child),
        ),
        bottomNavigationBar: bottomNavBar,
      ),
    );
  }
}
