SafeArea Widget Example in Flutter
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(
title: "SafeArea Widget",
debugShowCheckedModeBanner: false,
theme: ThemeData(
appBarTheme: const AppBarTheme(
backgroundColor: Colors.grey,
centerTitle: true,
),
),
home: const SafeAreaExample(),
);
}
}
class SafeAreaExample extends StatelessWidget {
const SafeAreaExample({super.key});
@override
Widget build(BuildContext context) {
return SafeArea(
child: Container(
color: Colors.white,
child: const Text(
"Hello World",
style: TextStyle(fontWeight: FontWeight.bold),
),
),
);
}
}
Comments
Post a Comment