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
Denys Konovalov 2dc41b7e24 - added license info
- fixed issues
2022-01-16 15:28:42 +01:00

167 lines
7.2 KiB
Dart

// GCG.MeinCantor - Die Schulplattform für Cantorianer.
// Copyright (C) 2021-2022 Georg-Cantor-Gymnasium Halle (Saale)
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published
// by the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
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,
)),
);
},
),
),
],
)),
);
}));
}
}