Small changes on InformationView
This commit is contained in:
@@ -2,16 +2,11 @@ import 'package:cabo_counter/utility/local_storage_service.dart';
|
|||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||||
import 'package:package_info_plus/package_info_plus.dart';
|
|
||||||
import 'package:url_launcher/url_launcher.dart';
|
import 'package:url_launcher/url_launcher.dart';
|
||||||
|
|
||||||
class InformationView extends StatelessWidget {
|
class InformationView extends StatelessWidget {
|
||||||
const InformationView({super.key});
|
const InformationView({super.key});
|
||||||
|
|
||||||
Future<PackageInfo> _getPackageInfo() async {
|
|
||||||
return await PackageInfo.fromPlatform();
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return CupertinoPageScaffold(
|
return CupertinoPageScaffold(
|
||||||
@@ -20,9 +15,7 @@ class InformationView extends StatelessWidget {
|
|||||||
middle: Text('Über'),
|
middle: Text('Über'),
|
||||||
),
|
),
|
||||||
child: SafeArea(
|
child: SafeArea(
|
||||||
child: Stack(
|
child: Column(
|
||||||
children: [
|
|
||||||
Column(
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
const Padding(
|
const Padding(
|
||||||
@@ -36,12 +29,11 @@ class InformationView extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.symmetric(
|
padding:
|
||||||
horizontal: 20, vertical: 10),
|
const EdgeInsets.symmetric(horizontal: 20, vertical: 10),
|
||||||
child: SizedBox(
|
child: SizedBox(
|
||||||
height: 200,
|
height: 200,
|
||||||
child:
|
child: Image.asset('assets/cabo-counter-logo_rounded.png'),
|
||||||
Image.asset('assets/cabo-counter-logo_rounded.png'),
|
|
||||||
)),
|
)),
|
||||||
const Padding(
|
const Padding(
|
||||||
padding: EdgeInsets.symmetric(horizontal: 30),
|
padding: EdgeInsets.symmetric(horizontal: 30),
|
||||||
@@ -59,7 +51,7 @@ class InformationView extends StatelessWidget {
|
|||||||
softWrap: true,
|
softWrap: true,
|
||||||
)),
|
)),
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
height: 30,
|
height: 15,
|
||||||
),
|
),
|
||||||
const Text(
|
const Text(
|
||||||
'\u00A9 Felix Kirchner',
|
'\u00A9 Felix Kirchner',
|
||||||
@@ -69,19 +61,22 @@ class InformationView extends StatelessWidget {
|
|||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
IconButton(
|
IconButton(
|
||||||
onPressed: () => launchUrl(
|
onPressed: () =>
|
||||||
Uri.parse('https://www.instagram.com/fx.kr')),
|
launchUrl(Uri.parse('https://www.instagram.com/fx.kr')),
|
||||||
icon: const Icon(FontAwesomeIcons.instagram)),
|
icon: const Icon(FontAwesomeIcons.instagram)),
|
||||||
IconButton(
|
IconButton(
|
||||||
onPressed: () => launchUrl(
|
onPressed: () => launchUrl(
|
||||||
Uri.parse('mailto:felix.kirchner.fk@gmail.com')),
|
Uri.parse('mailto:felix.kirchner.fk@gmail.com')),
|
||||||
icon: const Icon(CupertinoIcons.envelope)),
|
icon: const Icon(CupertinoIcons.envelope)),
|
||||||
IconButton(
|
IconButton(
|
||||||
onPressed: () => launchUrl(
|
onPressed: () =>
|
||||||
Uri.parse('https://www.github.com/flixcoo')),
|
launchUrl(Uri.parse('https://www.github.com/flixcoo')),
|
||||||
icon: const Icon(FontAwesomeIcons.github)),
|
icon: const Icon(FontAwesomeIcons.github)),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
const SizedBox(
|
||||||
|
height: 10,
|
||||||
|
),
|
||||||
CupertinoButton(
|
CupertinoButton(
|
||||||
sizeStyle: CupertinoButtonSize.medium,
|
sizeStyle: CupertinoButtonSize.medium,
|
||||||
child: const Text('Spieldaten exportieren'),
|
child: const Text('Spieldaten exportieren'),
|
||||||
@@ -92,8 +87,8 @@ class InformationView extends StatelessWidget {
|
|||||||
context: context,
|
context: context,
|
||||||
builder: (context) => CupertinoAlertDialog(
|
builder: (context) => CupertinoAlertDialog(
|
||||||
title: const Text('Fehler'),
|
title: const Text('Fehler'),
|
||||||
content: const Text(
|
content:
|
||||||
'Datei konnte nicht exportiert werden.'),
|
const Text('Datei konnte nicht exportiert werden.'),
|
||||||
actions: [
|
actions: [
|
||||||
CupertinoDialogAction(
|
CupertinoDialogAction(
|
||||||
child: const Text('OK'),
|
child: const Text('OK'),
|
||||||
@@ -109,8 +104,7 @@ class InformationView extends StatelessWidget {
|
|||||||
sizeStyle: CupertinoButtonSize.medium,
|
sizeStyle: CupertinoButtonSize.medium,
|
||||||
child: const Text('Spieldaten importieren'),
|
child: const Text('Spieldaten importieren'),
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
final success =
|
final success = await LocalStorageService.importJsonFile();
|
||||||
await LocalStorageService.importJsonFile();
|
|
||||||
if (!success && context.mounted) {
|
if (!success && context.mounted) {
|
||||||
showCupertinoDialog(
|
showCupertinoDialog(
|
||||||
context: context,
|
context: context,
|
||||||
@@ -128,34 +122,6 @@ class InformationView extends StatelessWidget {
|
|||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
),
|
|
||||||
Positioned(
|
|
||||||
bottom: 30,
|
|
||||||
left: 0,
|
|
||||||
right: 0,
|
|
||||||
child: FutureBuilder<PackageInfo>(
|
|
||||||
future: _getPackageInfo(),
|
|
||||||
builder: (context, snapshot) {
|
|
||||||
if (snapshot.hasData) {
|
|
||||||
return Text(
|
|
||||||
'Alpha ${snapshot.data!.version} '
|
|
||||||
'(Build ${snapshot.data!.buildNumber})',
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
);
|
|
||||||
} else if (snapshot.hasError) {
|
|
||||||
return const Text(
|
|
||||||
'App-Version -.-.- (Build -)',
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
return const Text(
|
|
||||||
'Lade Version...',
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
)));
|
)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user