Created
March 30, 2020 20:41
-
-
Save diegoveloper/c39830a2cb4999554ecfb8ca489fb9c3 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import 'package:flutter/material.dart'; | |
| void main() { | |
| runApp(MyApp()); | |
| } | |
| class MyApp extends StatelessWidget { | |
| @override | |
| Widget build(BuildContext context) { | |
| return MaterialApp( | |
| theme: ThemeData.dark(), | |
| debugShowCheckedModeBanner: false, | |
| home: Scaffold( | |
| body: Center( | |
| child: MyHome(), | |
| ), | |
| ), | |
| ); | |
| } | |
| } | |
| class MyHome extends StatelessWidget { | |
| @override | |
| Widget build(BuildContext context) { | |
| final stackHeight = MediaQuery.of(context).size.height * 0.5; | |
| final barHeight = 10.0; | |
| return Scaffold( | |
| body: Center( | |
| child: SizedBox( | |
| height: stackHeight, | |
| child: Stack( | |
| children: [ | |
| Positioned.fill( | |
| child: Image.network( | |
| 'https://www.thedesignwork.com/wp-content/uploads/2014/01/animation-gif-2.gif', | |
| fit: BoxFit.cover, | |
| ), | |
| ), | |
| Positioned( | |
| left: 0, | |
| right: 0, | |
| height: barHeight, | |
| bottom: 0, | |
| child: Container( | |
| color: Colors.red, | |
| ), | |
| ), | |
| ], | |
| ), | |
| ), | |
| ), | |
| ); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment