This repository has been archived on 2023-06-24. You can view files and clone it, but cannot push or open issues or pull requests.
meincantor-app/lib/Settings/Pages/info_settings.dart

150 lines
6.4 KiB
Dart
Raw Normal View History

import 'package:flutter/material.dart';
import 'package:flutter_linkify/flutter_linkify.dart';
import 'package:meincantor/const.dart';
import 'package:meincantor/main.dart';
import 'package:url_launcher/url_launcher.dart';
class InfoSettings extends StatelessWidget {
const InfoSettings({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text("Informationen"),
centerTitle: true,
),
body: LayoutBuilder(builder: (context, constraints) {
double widgetWidth = constraints.maxWidth;
int factor;
if (widgetWidth <= 600) {
factor = 1;
} else if (widgetWidth <= 1400) {
factor = 2;
} else if (widgetWidth <= 2000) {
factor = 3;
} else {
factor = 1;
}
return Center(
heightFactor: 1,
child: Container(
constraints: BoxConstraints(
maxWidth: MediaQuery.of(context).size.width / factor,
),
child: ListView(
padding: const EdgeInsets.fromLTRB(5, 5, 5, 5),
children: [
const Padding(
padding: EdgeInsets.all(5),
child: ListTile(
leading: Icon(Icons.info_outlined),
title: Text("Version"),
subtitle: Text(version)),
),
Padding(
padding: const EdgeInsets.all(5),
child: ListTile(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(15.0)),
leading: const Icon(Icons.person_outlined),
title: const Text("Autor"),
subtitle: const Text(author),
onTap: () =>
launch("https://git.cantorgymnasium.de/denyskon"),
),
),
Padding(
padding: const EdgeInsets.all(5),
child: ListTile(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(15.0)),
leading: const Icon(Icons.source_outlined),
title: const Text("Quellcode"),
subtitle: Linkify(
onOpen: (link) async {
if (await canLaunch(link.url)) {
await launch(link.url);
} else {
throw 'Could not launch $link';
}
},
text:
"https://git.cantorgymnasium.de/cantortechnik/meincantor-app",
linkStyle: const TextStyle(color: Palette.accent),
),
onTap: () => launch(
"https://git.cantorgymnasium.de/cantortechnik/meincantor-app")),
),
Padding(
padding: const EdgeInsets.all(5),
child: ListTile(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(15.0)),
leading:
const Icon(Icons.settings_backup_restore_outlined),
title: const Text("Änderungsverlauf"),
subtitle: const Text("Was ist neu?"),
onTap: () {
showModalBottomSheet<void>(
isScrollControlled: true,
context: context,
builder: (BuildContext context) {
return SizedBox(
height: 400,
child: Column(
children: <Widget>[
AppBar(
title: const Text("Änderungsverlauf"),
),
const Padding(
padding: EdgeInsets.all(10),
child: Text(
"1.0.0 --\nErste Release-Version!"),
),
],
),
);
},
);
},
),
),
Padding(
padding: const EdgeInsets.all(5),
child: ListTile(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(15.0)),
leading: const Icon(Icons.copyright_outlined),
title: const Text("Lizenzen"),
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => LicensePage(
applicationIcon: Padding(
padding: const EdgeInsets.all(5),
child: MediaQuery.of(context).platformBrightness == Brightness.light
? Image.asset(
"assets/images/meincantor-big.png",
width: 196)
: Image.asset(
"assets/images/meincantor-big-dark.png",
width: 196)
),
applicationVersion: version,
)),
);
},
),
),
],
)),
);
}));
}
}