import 'package:flutter/material.dart';
import 'package:sfm_app/product/constant/image/image_constants.dart';

class SharedBackground extends StatelessWidget {
  final Widget child;
  const SharedBackground({super.key, required this.child});

  @override
  Widget build(BuildContext context) {
    Size size = MediaQuery.of(context).size;
    return Directionality(
      textDirection: TextDirection.ltr,
      child: Scaffold(
        resizeToAvoidBottomInset: false,
        body: SizedBox(
          height: size.height,
          width: double.infinity,
          child: Stack(
            alignment: Alignment.center,
            children: <Widget>[
              Positioned(
                top: 0,
                left: 0,
                child: Image.asset(
                  ImageConstants.instance.getImage("background_top"),
                  width: size.width * 0.3,
                ),
              ),
              Positioned(
                bottom: 0,
                right: 0,
                child: Image.asset(
                  ImageConstants.instance.getImage("background_bottom"),
                  width: size.width * 0.4,
                ),
              ),
              SafeArea(child: child)
            ],
          ),
        ),
      ),
    );
  }
}
