mirror of
https://github.com/flutter/samples.git
synced 2025-11-08 13:58:47 +00:00
[Gallery] Add version number to About dialog (#260)
* Add version number to About dialog * Update about.dart * Address feedback
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
PODS:
|
||||
- Flutter (1.0.0)
|
||||
- package_info (0.0.1):
|
||||
- Flutter
|
||||
- shared_preferences (0.0.1):
|
||||
- Flutter
|
||||
- shared_preferences_macos (0.0.1):
|
||||
@@ -15,6 +17,7 @@ PODS:
|
||||
|
||||
DEPENDENCIES:
|
||||
- Flutter (from `Flutter`)
|
||||
- package_info (from `.symlinks/plugins/package_info/ios`)
|
||||
- shared_preferences (from `.symlinks/plugins/shared_preferences/ios`)
|
||||
- shared_preferences_macos (from `.symlinks/plugins/shared_preferences_macos/ios`)
|
||||
- shared_preferences_web (from `.symlinks/plugins/shared_preferences_web/ios`)
|
||||
@@ -25,6 +28,8 @@ DEPENDENCIES:
|
||||
EXTERNAL SOURCES:
|
||||
Flutter:
|
||||
:path: Flutter
|
||||
package_info:
|
||||
:path: ".symlinks/plugins/package_info/ios"
|
||||
shared_preferences:
|
||||
:path: ".symlinks/plugins/shared_preferences/ios"
|
||||
shared_preferences_macos:
|
||||
@@ -40,6 +45,7 @@ EXTERNAL SOURCES:
|
||||
|
||||
SPEC CHECKSUMS:
|
||||
Flutter: 0e3d915762c693b495b44d77113d4970485de6ec
|
||||
package_info: 48b108e75b8802c2d5e126f208ef540561c98aef
|
||||
shared_preferences: 430726339841afefe5142b9c1f50cb6bd7793e01
|
||||
shared_preferences_macos: f3f29b71ccbb56bf40c9dd6396c9acf15e214087
|
||||
shared_preferences_web: 141cce0c3ed1a1c5bf2a0e44f52d31eeb66e5ea9
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
|
||||
import 'package:flutter/gestures.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:package_info/package_info.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
|
||||
import 'package:gallery/l10n/gallery_localizations.dart';
|
||||
@@ -20,6 +21,11 @@ void showAboutDialog({
|
||||
);
|
||||
}
|
||||
|
||||
Future<String> getVersionNumber() async {
|
||||
PackageInfo packageInfo = await PackageInfo.fromPlatform();
|
||||
return packageInfo.version;
|
||||
}
|
||||
|
||||
class _AboutDialog extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -47,9 +53,10 @@ class _AboutDialog extends StatelessWidget {
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Center(
|
||||
child: Text(
|
||||
'$name',
|
||||
FutureBuilder(
|
||||
future: getVersionNumber(),
|
||||
builder: (context, snapshot) => Text(
|
||||
snapshot.hasData ? '$name ${snapshot.data}' : '$name',
|
||||
style: textTheme.display1.apply(color: colorScheme.onPrimary),
|
||||
),
|
||||
),
|
||||
|
||||
@@ -238,6 +238,13 @@ packages:
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.1.0"
|
||||
package_info:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: package_info
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.4.0+13"
|
||||
path:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
||||
@@ -25,6 +25,7 @@ dependencies:
|
||||
shared_preferences: ^0.5.4+8
|
||||
collection: ^1.14.0
|
||||
flutter_gallery_assets: 0.1.9+2
|
||||
package_info: ^0.4.0+13
|
||||
|
||||
dev_dependencies:
|
||||
flutter_test:
|
||||
|
||||
Reference in New Issue
Block a user