diff options
| author | Mica White <botahamec@outlook.com> | 2025-12-29 00:13:51 -0500 |
|---|---|---|
| committer | Mica White <botahamec@outlook.com> | 2025-12-29 00:13:51 -0500 |
| commit | eda099834e8c1cf028cc21d20266fde589fb2ef7 (patch) | |
| tree | 08c4df4708fe834e9baa3bf98b1e3a50f1329f3f /lib | |
| parent | 74f9c14eb1918624725267947e3366b6f465ea0e (diff) | |
Add build date to about
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/about.dart | 41 |
1 files changed, 26 insertions, 15 deletions
diff --git a/lib/about.dart b/lib/about.dart index 6e829dc..7dbaaf4 100644 --- a/lib/about.dart +++ b/lib/about.dart @@ -1,3 +1,4 @@ +import 'package:build_info/build_info.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:package_info_plus/package_info_plus.dart'; @@ -11,7 +12,7 @@ class AboutPage extends StatefulWidget { } class _AboutPageState extends State<AboutPage> { - Future<(PackageInfo, String)>? _loadedData; + Future<(PackageInfo, String, BuildInfoData?)>? _loadedData; @override void initState() { @@ -19,7 +20,8 @@ class _AboutPageState extends State<AboutPage> { _loadedData = Future(() async { var packageInfo = await PackageInfo.fromPlatform(); var license = await rootBundle.loadString('LICENSE'); - return (packageInfo, license); + var buildInfo = await BuildInfo.fromPlatform(); + return (packageInfo, license, buildInfo); }); } @@ -50,21 +52,30 @@ class _AboutPageState extends State<AboutPage> { ), 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, + builder: (context, snapshot) { + final appName = snapshot.data?.$1.appName; + final version = snapshot.data?.$1.version; + final legalese = snapshot.data?.$2; + final buildDate = snapshot.data?.$3?.buildDate; + + return TextButton.icon( + icon: Icon(Icons.copyright), + label: Text('View licenses'), + onPressed: () => Navigator.push( + context, + MaterialPageRoute( + builder: (context) => LicensePage( + applicationIcon: Icon(Icons.speed), + applicationName: appName, + applicationVersion: snapshot.hasData + ? '$version (${buildDate?.year}-${buildDate?.month}-${buildDate?.day})' + : null, + applicationLegalese: legalese, + ), ), ), - ), - ), + ); + }, ), ], ), |
