import 'package:flutter/material.dart';
import 'package:syncrow_web/utils/constants/assets.dart';
import 'package:syncrow_web/utils/helpers/responsice_layout_helper/responsive_layout_helper.dart';
import 'package:syncrow_web/web_layout/web_app_bar.dart';

import 'menu_sidebar.dart';

class WebScaffold extends StatelessWidget with HelperResponsiveLayout {
  final bool enableMenuSidebar;
  final Widget? appBarTitle;
  final Widget? centerBody;
  final Widget? rightBody;
  final Widget? scaffoldBody;
  const WebScaffold({
    super.key,
    this.appBarTitle,
    this.centerBody,
    this.rightBody,
    this.scaffoldBody,
    this.enableMenuSidebar = false,
  });
  @override
  Widget build(BuildContext context) {
    final isSmall = isSmallScreenSize(context);
    return Scaffold(
        body: Stack(
      children: [
        SizedBox(
          width: MediaQuery.sizeOf(context).width,
          height: MediaQuery.sizeOf(context).height,
          child: Image.asset(
            Assets.webBackgroundPng,
            fit: BoxFit.cover,
          ),
        ),
        Column(
          crossAxisAlignment: CrossAxisAlignment.stretch,
          children: [
            Opacity(
                opacity: 0.7,
                child: WebAppBar(
                  title: appBarTitle,
                  centerBody: centerBody,
                  rightBody: rightBody,
                )),
            Expanded(
              child: Row(
                children: [
                  if (enableMenuSidebar && !isSmall) const MenuSidebar(),
                  Expanded(flex: 5, child: scaffoldBody!)
                ],
              ),
            )
          ],
        ),
      ],
    ));
  }
}
