Created
June 1, 2024 11:21
-
-
Save Nikzed/03186a89eacaa338e7fb3b0c8ece6c97 to your computer and use it in GitHub Desktop.
Dart pad example of approximate device layout
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 MyApp()); | |
} | |
class MyApp extends StatelessWidget { | |
const MyApp({super.key}); | |
@override | |
Widget build(BuildContext context) { | |
return MaterialApp( | |
theme: ThemeData( | |
scaffoldBackgroundColor: Colors.blueAccent[100], | |
), | |
home: const MyHomePage(), | |
); | |
} | |
} | |
class MyHomePage extends StatefulWidget { | |
const MyHomePage({super.key}); | |
@override | |
State<MyHomePage> createState() => _MyHomePageState(); | |
} | |
class _MyHomePageState extends State<MyHomePage> { | |
@override | |
Widget build(BuildContext context) { | |
return Scaffold( | |
body: Center( | |
child: Row( | |
mainAxisAlignment: MainAxisAlignment.center, | |
crossAxisAlignment: CrossAxisAlignment.start, | |
children: [ | |
const Spacer(), | |
Expanded( | |
child: Stack( | |
children: [ | |
Container( | |
color: Colors.orange, | |
padding: const EdgeInsets.symmetric( | |
horizontal: 10, | |
), | |
child: Stack( | |
children: [ | |
Container( | |
height: 1771, | |
width: 873, | |
color: Colors.black, | |
child: const Center( | |
child: Text( | |
'Hello world!', | |
style: TextStyle(color: Colors.white), | |
), | |
), | |
), | |
Container( | |
margin: const EdgeInsets.only( | |
top: 135, | |
right: 100, | |
), | |
width: 15, | |
height: 45, | |
color: Colors.blue, | |
), | |
], | |
), | |
), | |
Container( | |
margin: const EdgeInsets.only( | |
top: 135, | |
right: 100, | |
), | |
width: 15, | |
height: 45, | |
color: Colors.green, | |
), | |
], | |
), | |
), | |
const Spacer(), | |
], | |
), | |
), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment