import 'package:flutter/material.dart'; /// Description: background for login and register page /// Time : 08/24/2023 Thursday /// Author : liuyuqi.gov@msn.cn class Background extends StatelessWidget { final Widget child; final String topImg, bottomImg; const Background( {super.key, required this.child, this.topImg = "assets/images/main_top.png", this.bottomImg = "assets/images/main_bottom.png"}); @override Widget build(BuildContext context) { return Scaffold( resizeToAvoidBottomInset: false, body: SizedBox( // color: Colors.green, width: double.infinity, height: MediaQuery.of(context).size.height, child: Stack( alignment: Alignment.center, // alignment: Alignment.topCenter, children: [ Positioned( top: 0, left: 0, child: Image.asset( topImg, width: 120, )), // Positioned( // bottom: 0, // right: 0, // child: Image.asset( // bottomImg, // width: 120, // )), SafeArea( child: Container( margin: const EdgeInsets.only(left: 20, right: 20), child: child, )) ], ), ), ); } }