Skip to content

Commit

Permalink
feat: add padding to all elements if there is safe space causes by no…
Browse files Browse the repository at this point in the history
…tch etc. (#414)

Co-authored-by: Rafal Rejek <[email protected]>
  • Loading branch information
2 people authored and simon-the-shark committed Nov 21, 2024
1 parent 22c191a commit 526c1a1
Showing 1 changed file with 28 additions and 8 deletions.
36 changes: 28 additions & 8 deletions lib/features/home_view/home_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ class HomeView extends StatelessWidget {

@override
Widget build(BuildContext context) {
final safeAreaInsets = MediaQuery.of(context).padding;
final horizontalPadding = safeAreaInsets.left;

final sections = [
const AcademicCalendarConsumer(),
const ParkingsSection(),
Expand All @@ -27,17 +30,34 @@ class HomeView extends StatelessWidget {
const NewsSection(),
const DepartmentsSection(),
].lock;

return Scaffold(
backgroundColor: context.colorTheme.whiteSoap,
appBar: LogoAppBar(context),
body: KeepAliveHomeViewProviders(
child: ListView.separated(
padding: const EdgeInsets.only(bottom: HomeViewConfig.bottomPadding),
itemBuilder: (context, index) => sections[index],
separatorBuilder: (context, index) => SizedBox(
height: index == 1 ? 0 : HomeViewConfig.paddingMedium,
appBar: PreferredSize(
preferredSize: const Size.fromHeight(kToolbarHeight),
child: SafeArea(
child: Padding(
padding: EdgeInsets.only(left: horizontalPadding),
child: LogoAppBar(context),
),
),
),
body: SafeArea(
child: Padding(
padding: EdgeInsets.only(
left: horizontalPadding, // Align with the top bar
right: safeAreaInsets.right,
bottom: HomeViewConfig.bottomPadding,
),
child: KeepAliveHomeViewProviders(
child: ListView.separated(
itemBuilder: (context, index) => sections[index],
separatorBuilder: (context, index) => SizedBox(
height: index == 1 ? 0 : HomeViewConfig.paddingMedium,
),
itemCount: sections.length,
),
),
itemCount: sections.length,
),
),
);
Expand Down

0 comments on commit 526c1a1

Please sign in to comment.