79 lines
2.0 KiB
Dart
79 lines
2.0 KiB
Dart
// import 'package:flutter/material.dart';
|
|
|
|
// class Background extends StatelessWidget {
|
|
// final Widget child;
|
|
// const Background({
|
|
// Key? key,
|
|
// required this.child,
|
|
// this.topImage = "assets/images/newbackground.png",
|
|
// this.bottomImage = "assets/images/login_bottom.png",
|
|
// }) : super(key: key);
|
|
|
|
// final String topImage, bottomImage;
|
|
|
|
// @override
|
|
// Widget build(BuildContext context) {
|
|
// return Scaffold(
|
|
// resizeToAvoidBottomInset: false,
|
|
// body: Container(
|
|
// width: double.infinity,
|
|
// height: MediaQuery.of(context).size.height,
|
|
// child: Stack(
|
|
// alignment: Alignment.center,
|
|
// children: <Widget>[
|
|
// Positioned(
|
|
// top: 0,
|
|
// left: 0,
|
|
// child: Image.asset(
|
|
// topImage,
|
|
// width: 120,
|
|
// ),
|
|
// ),
|
|
// // Positioned(
|
|
// // bottom: 0,
|
|
// // right: 0,
|
|
// // child: Image.asset(bottomImage, width: 120),
|
|
// // ),
|
|
// SafeArea(child: child),
|
|
// ],
|
|
// ),
|
|
// ),
|
|
// );
|
|
// }
|
|
// }
|
|
import 'package:flutter/material.dart';
|
|
|
|
class Background extends StatelessWidget {
|
|
final Widget child;
|
|
const Background({
|
|
Key? key,
|
|
required this.child,
|
|
this.backgroundImage = "assets/images/Desain tanpa.png",
|
|
}) : super(key: key);
|
|
|
|
final String backgroundImage;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Scaffold(
|
|
resizeToAvoidBottomInset: false,
|
|
body: Container(
|
|
width: double.infinity,
|
|
height: MediaQuery.of(context).size.height,
|
|
decoration: BoxDecoration(
|
|
image: DecorationImage(
|
|
image: AssetImage(backgroundImage),
|
|
fit: BoxFit.cover,
|
|
),
|
|
),
|
|
child: Stack(
|
|
alignment: Alignment.center,
|
|
children: <Widget>[
|
|
SafeArea(child: child),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|