Skip to content

Instantly share code, notes, and snippets.

@ashraf267
Created June 14, 2022 06:50
Show Gist options
  • Save ashraf267/f068bf8361d9c24dd31d809f6289b0b1 to your computer and use it in GitHub Desktop.
Save ashraf267/f068bf8361d9c24dd31d809f6289b0b1 to your computer and use it in GitHub Desktop.
This is a simple UI that demystifies Stack
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