Skip to content

Instantly share code, notes, and snippets.

@Zfinix
Created November 22, 2019 20:39
Show Gist options
  • Select an option

  • Save Zfinix/5e01c465f9d666665f81f0e5b1a0d563 to your computer and use it in GitHub Desktop.

Select an option

Save Zfinix/5e01c465f9d666665f81f0e5b1a0d563 to your computer and use it in GitHub Desktop.
import 'package:flutter/material.dart';
class XMargin extends StatelessWidget {
final double x;
const XMargin(this.x);
@override
Widget build(BuildContext context) {
return SizedBox(width: x);
}
}
class YMargin extends StatelessWidget {
final double y;
const YMargin(this.y);
@override
Widget build(BuildContext context) {
return SizedBox(height: y);
}
}
class BackgroundScaffold extends StatefulWidget {
BackgroundScaffold({Key key}) : super(key: key);
@override
_BackgroundScaffoldState createState() => _BackgroundScaffoldState();
}
class _BackgroundScaffoldState extends State<BackgroundScaffold> {
@override
Widget build(BuildContext context) {
return Material(
child: Stack(
children: <Widget>[
Container(
height: double.infinity,
width: double.infinity,
decoration: BoxDecoration(
image: DecorationImage(
fit: BoxFit.cover,
image: NetworkImage(
'https://images.pexels.com/photos/2102587/pexels-photo-2102587.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=750&w=1260'))),
),
Container(
width: MediaQuery.of(context).size.width,
height: MediaQuery.of(context).size.height,
color: Colors.black.withOpacity(0.5),
),
Container(
width: MediaQuery.of(context).size.width,
height: MediaQuery.of(context).size.height,
padding: EdgeInsets.all(30),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Spacer(),
Text('Ready to\nMove ? ',
style: TextStyle(
color: Colors.white,
fontWeight: FontWeight.bold,
fontSize: 39,
)),
const YMargin(20),
Text(
'Find your dream home.\nThe most accurate home\nsearch. ',
style: TextStyle(
color: white,
fontWeight: FontWeight.w400,
fontSize: 22,
height: 1.6),
),
const YMargin(30),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Text('Start searching',
style: TextStyle(
color: Colors.white,
fontWeight: FontWeight.bold,
fontSize: 26,
)),
Container(
height: 70,
width: 70,
decoration: BoxDecoration(
color: Colors.amber,
borderRadius: BorderRadius.circular(15),
),
child: Icon(
Icons.arrow_forward,
color: Colors.white,
),
)
],
),
const YMargin(30),
],
),
),
],
),
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment