Created
June 14, 2022 06:50
-
-
Save ashraf267/f068bf8361d9c24dd31d809f6289b0b1 to your computer and use it in GitHub Desktop.
This is a simple UI that demystifies Stack
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(const MaterialApp(home: MyApp())); | |
class MyApp extends StatelessWidget { | |
const MyApp({Key? key}) : super(key: key); | |
@override | |
Widget build(BuildContext context) { | |
return Scaffold( | |
body: Center( | |
child: Stack( | |
alignment: Alignment.topCenter, | |
clipBehavior: Clip.none, | |
children: [ | |
Container( | |
padding: const EdgeInsets.fromLTRB(25, 70, 25, 30), | |
color: Colors.green.shade50, | |
child: const Text( | |
'Successful', | |
style: TextStyle( | |
fontSize: 27, | |
color: Colors.green, | |
), | |
), | |
), | |
Positioned( | |
top: -20, | |
child: Container( | |
padding: const EdgeInsets.all(16), | |
decoration: BoxDecoration( | |
color: Colors.white, | |
border: Border.all( | |
color: Colors.green.shade50, | |
width: 4, | |
), | |
shape: BoxShape.circle, | |
), | |
child: const Icon( | |
Icons.gpp_good, | |
size: 40, | |
color: Colors.green, | |
), | |
), | |
), | |
], | |
), | |
), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment