import 'package:flutter/material.dart';

class AppScaffold extends StatelessWidget {
  final String appBarTitle;
  final Widget body;
  final bool isLoading;
  final bool resizeToAvoidBottomInset;
  final bool isShowAppBar;
  final Widget? bottomSheet;
  final Color? backgroundColor;
  final PreferredSizeWidget appBar;
  final Widget drawer;
  final Widget bottomNavigationBar;
  final String subtitle;
  final bool isHomeIcon;
  final bool extendBody;

  const AppScaffold({
    super.key,
    this.appBarTitle = '',
    required this.body,
    this.isLoading = false,
    this.resizeToAvoidBottomInset = false,
    this.isShowAppBar = true,
    this.bottomSheet,
    this.backgroundColor,
    this.isHomeIcon = true,
    required this.appBar,
    this.subtitle = "",
    this.drawer = const SizedBox.shrink(),
    this.extendBody = false,
    required this.bottomNavigationBar,
  });

  @override
  Widget build(BuildContext context) {
    return GestureDetector(
      onTap: () {
        FocusScope.of(context).requestFocus(FocusNode());
      },
      child: Scaffold(
          resizeToAvoidBottomInset: resizeToAvoidBottomInset,
          backgroundColor: backgroundColor ?? Theme.of(context).scaffoldBackgroundColor,
          drawer: drawer,
          extendBody: extendBody,
          bottomNavigationBar: bottomNavigationBar,
          appBar: isShowAppBar ? appBar : null,
          bottomSheet: bottomSheet,
          body: body),
    );
  }
}
