Skip to content

Instantly share code, notes, and snippets.

@bizz84
Last active May 13, 2023 20:34
Show Gist options
  • Save bizz84/bbd6f21fb10372f58ea520cf401fdd8f to your computer and use it in GitHub Desktop.
Save bizz84/bbd6f21fb10372f58ea520cf401fdd8f to your computer and use it in GitHub Desktop.
Simple SafeArea demo
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