130 lines
4.4 KiB
Dart
130 lines
4.4 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:resume/services/breakpoints.dart';
|
|
import 'package:resume/services/content_provider.dart';
|
|
import 'package:resume/widgets/content_widget.dart';
|
|
import 'package:resume/widgets/profile.dart';
|
|
import 'package:url_launcher/url_launcher.dart';
|
|
|
|
class LandingPage extends StatefulWidget {
|
|
const LandingPage({super.key});
|
|
|
|
static const String routeName = '/';
|
|
|
|
@override
|
|
State<LandingPage> createState() => _LandingPageState();
|
|
}
|
|
|
|
class _LandingPageState extends State<LandingPage> {
|
|
bool loadingDone = false;
|
|
|
|
@override
|
|
void initState() {
|
|
super.initState();
|
|
WidgetsBinding.instance.addPostFrameCallback((_) async {
|
|
await ContentProvider.init();
|
|
setState(() => loadingDone = true);
|
|
});
|
|
}
|
|
|
|
double _getPageWidth() {
|
|
final width = MediaQuery.of(context).size.width;
|
|
// if (width < Breakpoints.sm) return width;
|
|
if (width < Breakpoints.md) return width * 0.95;
|
|
if (width < Breakpoints.lg) return width * 0.8;
|
|
if (width < Breakpoints.xl) return width * 0.7;
|
|
if (width < Breakpoints.xl2) return width * 0.6;
|
|
return width * 0.5;
|
|
}
|
|
|
|
@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,
|
|
children: [
|
|
CircularProgressIndicator(),
|
|
Padding(padding: EdgeInsets.symmetric(vertical: 10)),
|
|
Text('Loading...')
|
|
],
|
|
),
|
|
)
|
|
: SingleChildScrollView(
|
|
child: Stack(
|
|
children: [
|
|
Align(
|
|
alignment: Alignment.topLeft,
|
|
child: SizedBox(
|
|
width: (MediaQuery.of(context).size.width -
|
|
_getPageWidth()) /
|
|
2,
|
|
child: const Padding(
|
|
padding: EdgeInsets.symmetric(horizontal: 50),
|
|
child: Profile(),
|
|
),
|
|
),
|
|
),
|
|
Align(
|
|
alignment: Alignment.topRight,
|
|
child: SizedBox(
|
|
width: (MediaQuery.of(context).size.width -
|
|
_getPageWidth()) /
|
|
2,
|
|
child: screenWidth >= Breakpoints.xl2
|
|
? Padding(
|
|
padding:
|
|
const EdgeInsets.symmetric(horizontal: 50),
|
|
child: ContentBox(
|
|
title: 'Fähigkeiten',
|
|
content: ContentProvider.skills,
|
|
contentType: ContentType.skills,
|
|
),
|
|
)
|
|
: null,
|
|
),
|
|
),
|
|
Center(
|
|
child: SizedBox(
|
|
width: _getPageWidth(),
|
|
child: Column(
|
|
children: [
|
|
ContentBox(
|
|
title: 'Arbeitserfahrung',
|
|
content: ContentProvider.experience,
|
|
contentType: ContentType.experience,
|
|
),
|
|
const Padding(
|
|
padding: EdgeInsets.symmetric(vertical: 15)),
|
|
ContentBox(
|
|
title: 'Bildungsweg',
|
|
content: ContentProvider.education,
|
|
contentType: ContentType.education,
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|
|
|
|
_launchURL() async {
|
|
final Uri url = Uri.parse('https://git.skup.in/marco/resume');
|
|
if (await launchUrl(url)) {
|
|
throw Exception('Could not launch $url');
|
|
}
|
|
}
|