import 'package:flutter/material.dart'; class Background extends StatelessWidget { final Widget child; final String backgroundImage; const Background({ Key? key, required this.child, required this.backgroundImage, }) : super(key: key); @override Widget build(BuildContext context) { return Scaffold( resizeToAvoidBottomInset: false, body: Container( width: double.infinity, height: double.infinity, decoration: BoxDecoration( image: DecorationImage( image: AssetImage( backgroundImage), // Penggunaan backgroundImage di sini fit: BoxFit.cover, ), ), child: child, ), ); } } void main() { runApp( MaterialApp( home: Background( // Contoh penggunaan Background dengan memberikan URL gambar backgroundImage: 'assets/images/newbackground.png', // URL gambar disini child: Container( // Contoh child widget alignment: Alignment.center, ), ), ), ); }