Last active
May 13, 2023 20:34
-
-
Save bizz84/bbd6f21fb10372f58ea520cf401fdd8f to your computer and use it in GitHub Desktop.
Simple SafeArea demo
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(const MyApp()); | |
} | |
class MyApp extends StatelessWidget { | |
const MyApp({super.key}); | |
// This widget is the root of your application. | |
@override | |
Widget build(BuildContext context) { | |
return MaterialApp( | |
title: 'Flutter Demo', | |
theme: ThemeData( | |
colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple), | |
useMaterial3: true, | |
), | |
// Guess what color will be used underneath the system UI (top and bottom)? | |
home: const Scaffold( | |
backgroundColor: Colors.red, | |
body: ColoredBox( | |
color: Colors.blue, | |
child: SafeArea( | |
child: Column( | |
crossAxisAlignment: CrossAxisAlignment.stretch, | |
children: [ | |
Expanded( | |
child: ColoredBox( | |
color: Colors.green, | |
), | |
), | |
Expanded( | |
child: ColoredBox( | |
color: Colors.yellow, | |
), | |
), | |
], | |
), | |
), | |
), | |
), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment