-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1391 from ardriveapp/PE-4533
PE-4533: Add Version Number to Login Screen
- Loading branch information
Showing
3 changed files
with
83 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import 'package:ardrive/utils/app_localizations_wrapper.dart'; | ||
import 'package:ardrive_ui/ardrive_ui.dart'; | ||
import 'package:flutter/foundation.dart'; | ||
import 'package:flutter/material.dart'; | ||
import 'package:package_info_plus/package_info_plus.dart'; | ||
|
||
class AppVersionWidget extends StatelessWidget { | ||
final Color color; | ||
|
||
const AppVersionWidget({ | ||
Key? key, | ||
this.color = Colors.grey, | ||
}) : super(key: key); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return FutureBuilder( | ||
future: PackageInfo.fromPlatform(), | ||
builder: (BuildContext context, AsyncSnapshot<PackageInfo> snapshot) { | ||
final info = snapshot.data; | ||
if (info == null) { | ||
return const SizedBox( | ||
height: 32, | ||
width: 32, | ||
); | ||
} | ||
final literalVersion = | ||
kIsWeb ? info.version : '${info.version}+${info.buildNumber}'; | ||
return Text( | ||
appLocalizationsOf(context).appVersion(literalVersion), | ||
style: ArDriveTypography.body.buttonNormalRegular( | ||
color: color, | ||
), | ||
textAlign: TextAlign.center, | ||
); | ||
}, | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters