import 'package:flutter/material.dart'; class PageBackgroundWidget extends StatelessWidget { final Widget child; final String? page; const PageBackgroundWidget({super.key, required this.child, this.page}); @override Widget build(BuildContext context) { return SingleChildScrollView( scrollDirection: Axis.vertical, child: Container( alignment: Alignment.center, height: MediaQuery.of(context).size.height + 200, decoration: BoxDecoration( image: DecorationImage( // Image.asset('assets/ph_logo2.webp', // width: 192, cacheWidth: (192 * MediaQuery.of(context).devicePixelRatio).round()), image: AssetImage( page == 'login' ? 'assets/login_background.webp' : page == 'register' ? 'assets/register_background.webp' : 'assets/background.webp', ), // image: Image.asset('assets/login_background.webp', width: 192, cacheWidth: (192 * MediaQuery.of(context).devicePixelRatio).round()), fit: BoxFit.fitWidth, alignment: Alignment.topCenter, opacity: 0.3, ), gradient: const RadialGradient( tileMode: TileMode.clamp, colors: [ Color.fromRGBO(45, 15, 43, 1), Color.fromRGBO(77, 29, 73, 1), ], ), ), child: Center( child: child, )), ); } }