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