diff options
Diffstat (limited to 'lib/about.dart')
| -rw-r--r-- | lib/about.dart | 74 |
1 files changed, 74 insertions, 0 deletions
diff --git a/lib/about.dart b/lib/about.dart new file mode 100644 index 0000000..6e829dc --- /dev/null +++ b/lib/about.dart @@ -0,0 +1,74 @@ +import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; +import 'package:package_info_plus/package_info_plus.dart'; +import 'package:url_launcher/url_launcher_string.dart'; + +class AboutPage extends StatefulWidget { + const AboutPage({super.key}); + + @override + State<AboutPage> createState() => _AboutPageState(); +} + +class _AboutPageState extends State<AboutPage> { + Future<(PackageInfo, String)>? _loadedData; + + @override + void initState() { + super.initState(); + _loadedData = Future(() async { + var packageInfo = await PackageInfo.fromPlatform(); + var license = await rootBundle.loadString('LICENSE'); + return (packageInfo, license); + }); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar(title: Text('About')), + body: Center( + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Icon( + Icons.speed, + size: Theme.of(context).textTheme.displayLarge?.fontSize ?? 72, + ), + Text( + 'Simple Speedometer', + style: Theme.of(context).textTheme.titleLarge, + ), + Text('© 2025 Mica White'), + Text(''), + TextButton.icon( + icon: Icon(Icons.code), + label: Text('View source code'), + onPressed: () => + launchUrlString("https://www.botahamec.dev/cgit/speedometer"), + ), + FutureBuilder( + future: _loadedData, + builder: (context, snapshot) => TextButton.icon( + icon: Icon(Icons.copyright), + label: Text('View licenses'), + onPressed: () => Navigator.push( + context, + MaterialPageRoute( + builder: (context) => LicensePage( + applicationIcon: Icon(Icons.speed), + applicationName: snapshot.data?.$1.appName, + applicationVersion: snapshot.data?.$1.version, + applicationLegalese: snapshot.data?.$2, + ), + ), + ), + ), + ), + ], + ), + ), + ); + } +} |
