abstracted into safezone

This commit is contained in:
2024-09-06 20:43:01 -04:00
parent 06ae8ba52a
commit 12938e6b93
2 changed files with 30 additions and 11 deletions

View File

@@ -1,21 +1,16 @@
import 'package:flutter/material.dart';
import 'package:ything_radio/SafeZone.dart';
class About extends StatelessWidget {
const About({super.key});
@override
Widget build(BuildContext context) {
final safeLeftPadding = MediaQuery.of(context).padding.left + 16;
final safeRightPadding = MediaQuery.of(context).padding.right + 16;
final safeBottomPadding = MediaQuery.of(context).padding.bottom;
final safeTopPadding = MediaQuery.of(context).padding.top;
return DefaultTextStyle(
style: Theme.of(context).textTheme.bodyLarge!,
child: SingleChildScrollView(
child: Padding(
padding: EdgeInsets.only(left: safeLeftPadding, right: safeRightPadding, bottom: safeBottomPadding, top: safeTopPadding),
child: const Text(
return SafeZone(
child: DefaultTextStyle(
style: Theme.of(context).textTheme.bodyLarge!,
child: const SingleChildScrollView(
child: Text(
'Ything Radio is an app that is intended to provide a demonstration of the '
'open source ything_radio app. This app is used to provide the ability for the '
'"look and feel" of the app to be tested on real devices for those wishing to '

24
lib/SafeZone.dart Normal file
View File

@@ -0,0 +1,24 @@
import 'package:flutter/material.dart';
class SafeZone extends StatelessWidget {
const SafeZone({super.key, required this.child});
final Widget child;
@override
Widget build(BuildContext context) {
final safeLeftPadding = MediaQuery.of(context).padding.left + 16;
final safeRightPadding = MediaQuery.of(context).padding.right + 16;
final safeBottomPadding = MediaQuery.of(context).padding.bottom + 16;
final safeTopPadding = MediaQuery.of(context).padding.top + 16;
return Padding(
padding: EdgeInsets.only(
left: safeLeftPadding,
right: safeRightPadding,
bottom: safeBottomPadding,
top: safeTopPadding),
child: child,
);
}
}