Refactoring
This commit is contained in:
@@ -39,32 +39,33 @@ class _LandingPageState extends State<LandingPage> {
|
||||
double _getSidebarWidth() =>
|
||||
(MediaQuery.of(context).size.width - _getMainContentWidth()) / 2;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final screenWidth = MediaQuery.of(context).size.width;
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: const Text('Landing'),
|
||||
actions: const [
|
||||
TextButton(onPressed: _launchURL, child: Text('Source Code')),
|
||||
],
|
||||
),
|
||||
body: !loadingDone
|
||||
// While the content is being loaded from JSON, show a LoadingIndicator
|
||||
? const Center(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
Widget _getSideBar() {
|
||||
return ContentBox(
|
||||
title: 'Fähigkeiten',
|
||||
content: ContentProvider.skills,
|
||||
contentType: ContentType.skills,
|
||||
);
|
||||
}
|
||||
|
||||
Widget _getMainContent() {
|
||||
return Column(
|
||||
children: [
|
||||
CircularProgressIndicator(),
|
||||
Padding(padding: EdgeInsets.symmetric(vertical: 10)),
|
||||
Text('Loading...')
|
||||
],
|
||||
ContentBox(
|
||||
title: 'Arbeitserfahrung',
|
||||
content: ContentProvider.experience,
|
||||
contentType: ContentType.experience,
|
||||
),
|
||||
)
|
||||
: SingleChildScrollView(
|
||||
child: LayoutBuilder(
|
||||
builder: (context, constraints) {
|
||||
const Padding(padding: EdgeInsets.only(bottom: 25)),
|
||||
ContentBox(
|
||||
title: 'Bildungsweg',
|
||||
content: ContentProvider.education,
|
||||
contentType: ContentType.education,
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildLayout(BuildContext context, BoxConstraints constraints) {
|
||||
if (constraints.maxWidth > Breakpoints.xl2) {
|
||||
return Stack(
|
||||
children: [
|
||||
@@ -83,8 +84,7 @@ class _LandingPageState extends State<LandingPage> {
|
||||
child: SizedBox(
|
||||
width: _getSidebarWidth(),
|
||||
child: Padding(
|
||||
padding:
|
||||
const EdgeInsets.symmetric(horizontal: 50),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 50),
|
||||
child: _getSideBar(),
|
||||
),
|
||||
),
|
||||
@@ -111,8 +111,7 @@ class _LandingPageState extends State<LandingPage> {
|
||||
child: Profile(),
|
||||
),
|
||||
Padding(
|
||||
padding:
|
||||
const EdgeInsets.symmetric(horizontal: 50),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 50),
|
||||
child: _getSideBar(),
|
||||
),
|
||||
],
|
||||
@@ -163,35 +162,34 @@ class _LandingPageState extends State<LandingPage> {
|
||||
),
|
||||
);
|
||||
}
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _getSideBar() {
|
||||
return ContentBox(
|
||||
title: 'Fähigkeiten',
|
||||
content: ContentProvider.skills,
|
||||
contentType: ContentType.skills,
|
||||
);
|
||||
}
|
||||
|
||||
Widget _getMainContent() {
|
||||
return Column(
|
||||
children: [
|
||||
ContentBox(
|
||||
title: 'Arbeitserfahrung',
|
||||
content: ContentProvider.experience,
|
||||
contentType: ContentType.experience,
|
||||
),
|
||||
const Padding(padding: EdgeInsets.only(bottom: 25)),
|
||||
ContentBox(
|
||||
title: 'Bildungsweg',
|
||||
content: ContentProvider.education,
|
||||
contentType: ContentType.education,
|
||||
),
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: const Text('Landing'),
|
||||
actions: const [
|
||||
TextButton(onPressed: _launchURL, child: Text('Source Code')),
|
||||
],
|
||||
),
|
||||
body: !loadingDone
|
||||
? const Center(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
CircularProgressIndicator(),
|
||||
Padding(padding: EdgeInsets.symmetric(vertical: 10)),
|
||||
Text('Loading...')
|
||||
],
|
||||
),
|
||||
)
|
||||
: SingleChildScrollView(
|
||||
child: LayoutBuilder(
|
||||
builder: _buildLayout,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,10 +21,13 @@ class SkillListTile extends StatelessWidget {
|
||||
if (percentage != null)
|
||||
Expanded(
|
||||
flex: 5,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(left: 8.0),
|
||||
child: LinearProgressIndicator(
|
||||
value: double.parse(percentage!) / 100,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user