Created
August 17, 2022 14:04
-
-
Save wisnuwiry/74c28dd66b20e550e229e7f4a10a9510 to your computer and use it in GitHub Desktop.
An illustration depicting independence day with Flutter
This file contains 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 const MaterialApp( | |
title: 'Independence Day', | |
debugShowCheckedModeBanner: false, | |
home: Content(), | |
); | |
} | |
} | |
class Content extends StatelessWidget { | |
const Content({Key? key}) : super(key: key); | |
@override | |
Widget build(BuildContext context) { | |
return Scaffold( | |
body: Stack(children: [ | |
Column( | |
children: const [ | |
FlagElement( | |
background: Colors.red, | |
foreground: Colors.white, | |
text: 'Recover Faster', | |
), | |
FlagElement( | |
background: Colors.white, | |
foreground: Colors.red, | |
text: 'Rise Stronger', | |
), | |
], | |
), | |
const Logo(), | |
]), | |
); | |
} | |
} | |
class Logo extends StatelessWidget { | |
const Logo({Key? key}) : super(key: key); | |
@override | |
Widget build(BuildContext context) { | |
final size = MediaQuery.of(context).size; | |
return Center( | |
child: Image.network( | |
'https://raw.githubusercontent.com/wisnuwiry/blog-v2/master/static/77-2.png', | |
width: size.width * .2, | |
height: size.height * .2, | |
), | |
); | |
} | |
} | |
class FlagElement extends StatelessWidget { | |
const FlagElement({ | |
Key? key, | |
required this.background, | |
required this.foreground, | |
required this.text, | |
}) : super(key: key); | |
final Color background; | |
final Color foreground; | |
final String text; | |
@override | |
Widget build(BuildContext context) { | |
return Expanded( | |
child: Container( | |
width: double.infinity, | |
color: background, | |
padding: const EdgeInsets.all(50), | |
child: FittedBox( | |
child: Text( | |
text.toUpperCase(), | |
style: TextStyle( | |
color: foreground, | |
fontWeight: FontWeight.bold, | |
), | |
), | |
), | |
), | |
); | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment