import 'package:flutter/material.dart';

class CustomBackground extends StatelessWidget {
  final Widget child;
  final double? opacity;
  const CustomBackground({super.key, required this.child, this.opacity});

  @override
  Widget build(BuildContext context) {
    return Container(
      width: double.infinity,
      height: double.infinity,
      decoration: BoxDecoration(
        image: DecorationImage(
          image: AssetImage('assets/images/001.png'), // اصلاح شده
          fit: BoxFit.cover, // تصویر را به صورت تمام صفحه تطبیق می‌دهد
          colorFilter: opacity != null
              ? ColorFilter.mode(
                  Colors.black.withOpacity(opacity!),
                  BlendMode.dstATop,
                )
              : null,
        ),
      ),
      child: Column(
        mainAxisAlignment: MainAxisAlignment.center,
        children: [
          Expanded(
            child: child,
          )
        ],
      ),
    );
  }
}
