-
Notifications
You must be signed in to change notification settings - Fork 6
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 #12 from felipecastrosales/develop
Develop
- Loading branch information
Showing
7 changed files
with
116 additions
and
4 deletions.
There are no files selected for viewing
59 changes: 59 additions & 0 deletions
59
lib/app/core/platform_info/widgets/platform_info_widget.dart
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,59 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:package_info_plus/package_info_plus.dart'; | ||
import 'package:site/app/core/tokens/app_text_styles.dart'; | ||
|
||
class PlatformInfoWidget extends StatefulWidget { | ||
const PlatformInfoWidget({ | ||
super.key, | ||
required this.padding, | ||
}); | ||
|
||
final EdgeInsets padding; | ||
|
||
@override | ||
State<PlatformInfoWidget> createState() => _PlatformInfoWidgetState(); | ||
} | ||
|
||
class _PlatformInfoWidgetState extends State<PlatformInfoWidget> { | ||
late Future<PackageInfo> packageInfo; | ||
|
||
EdgeInsets get padding => widget.padding; | ||
|
||
@override | ||
void initState() { | ||
super.initState(); | ||
packageInfo = PackageInfo.fromPlatform(); | ||
} | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return FutureBuilder<PackageInfo>( | ||
future: packageInfo, | ||
builder: (context, snapshot) { | ||
if ([ | ||
ConnectionState.none, | ||
ConnectionState.active, | ||
ConnectionState.waiting, | ||
].contains(snapshot.connectionState)) { | ||
return const CircularProgressIndicator(); | ||
} | ||
|
||
if (snapshot.hasData && snapshot.data != null) { | ||
final data = snapshot.data!; | ||
final text = | ||
'v${data.version}${data.buildNumber.isEmpty ? '' : '+${data.buildNumber}'}'; | ||
|
||
return Padding( | ||
padding: padding, | ||
child: SelectableText( | ||
text, | ||
style: AppTextStyles.f24WhiteFW500, | ||
), | ||
); | ||
} | ||
|
||
return const SizedBox.shrink(); | ||
}, | ||
); | ||
} | ||
} |
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
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
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