generated from GDG-on-Campus-SKHU/23-24-Assignment-template
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathdefault_layout.dart
45 lines (41 loc) · 971 Bytes
/
default_layout.dart
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import 'package:flutter/material.dart';
class DefaultLayout extends StatelessWidget {
final Color? backgroundColor;
final Widget child;
final String? title;
final Widget? bottomNavigationBar;
const DefaultLayout({
super.key,
required this.child,
this.backgroundColor,
this.title,
this.bottomNavigationBar,
});
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: backgroundColor ?? Colors.white,
appBar: renderAppBar(),
body: child,
bottomNavigationBar: bottomNavigationBar,
);
}
AppBar? renderAppBar() {
if (title == null) {
return null;
} else {
return AppBar(
backgroundColor: Colors.white,
elevation: 0,
title: Text(
title!,
style: const TextStyle(
fontSize: 16,
fontWeight: FontWeight.w500,
),
),
foregroundColor: Colors.black,
);
}
}
}