Skip to content

Commit

Permalink
added version
Browse files Browse the repository at this point in the history
  • Loading branch information
quetool committed Jul 22, 2024
1 parent c98e33b commit b06a704
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 32 deletions.
27 changes: 22 additions & 5 deletions example/dapp/lib/pages/connect_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import 'package:fl_toast/fl_toast.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:package_info_plus/package_info_plus.dart';
import 'package:qr_flutter/qr_flutter.dart';
import 'package:url_launcher/url_launcher_string.dart';
import 'package:walletconnect_flutter_v2/walletconnect_flutter_v2.dart';
Expand Down Expand Up @@ -220,10 +221,26 @@ class ConnectPageState extends State<ConnectPage> {
),
child: ListView(
children: <Widget>[
const Text(
StringConstants.appTitle,
style: StyleConstants.subtitleText,
textAlign: TextAlign.center,
Column(
children: [
const Text(
'Flutter Dapp',
style: StyleConstants.subtitleText,
textAlign: TextAlign.center,
),
FutureBuilder<PackageInfo>(
future: PackageInfo.fromPlatform(),
builder: (context, snapshot) {
if (!snapshot.hasData) {
return const SizedBox.shrink();
}
final v = snapshot.data!.version;
final b = snapshot.data!.buildNumber;
const f = String.fromEnvironment('FLUTTER_APP_FLAVOR');
return Text('$v-$f ($b) - SDK v$packageVersion');
},
),
],
),
const SizedBox(
height: StyleConstants.linear16,
Expand All @@ -234,7 +251,7 @@ class ConnectPageState extends State<ConnectPage> {
textAlign: TextAlign.center,
),
const SizedBox(
height: StyleConstants.linear16,
height: StyleConstants.linear8,
),
SizedBox(
height: StyleConstants.linear48,
Expand Down
1 change: 1 addition & 0 deletions example/dapp/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ dependencies:
fl_toast: ^3.1.0
url_launcher: ^6.2.2
intl: ^0.19.0
package_info_plus: ^7.0.0
walletconnect_flutter_v2:
path: ../..

Expand Down
43 changes: 17 additions & 26 deletions example/wallet/lib/pages/settings_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import 'package:fl_toast/fl_toast.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:get_it/get_it.dart';
import 'package:package_info_plus/package_info_plus.dart';
import 'package:walletconnect_flutter_v2/walletconnect_flutter_v2.dart';
import 'package:walletconnect_flutter_v2_wallet/dependencies/bottom_sheet/i_bottom_sheet_service.dart';
import 'package:walletconnect_flutter_v2_wallet/dependencies/i_web3wallet_service.dart';
Expand All @@ -22,21 +23,6 @@ class SettingsPage extends StatefulWidget {
}

class _SettingsPageState extends State<SettingsPage> {
String? version;
@override
void initState() {
super.initState();
// TODO
// PackageInfo.fromPlatform().then((info) {
// setState(() {
// version =
// '${info.version} (${info.buildNumber}) - SDK v$packageVersion';
// });
// });

version = const String.fromEnvironment('FLUTTER_APP_FLAVOR');
}

@override
Widget build(BuildContext context) {
final keysService = GetIt.I<IKeyService>();
Expand Down Expand Up @@ -111,6 +97,22 @@ class _SettingsPageState extends State<SettingsPage> {
);
},
),
const SizedBox(height: 12.0),
FutureBuilder<PackageInfo>(
future: PackageInfo.fromPlatform(),
builder: (context, snapshot) {
if (!snapshot.hasData) {
return const SizedBox.shrink();
}
final v = snapshot.data!.version;
final b = snapshot.data!.buildNumber;
const f = String.fromEnvironment('FLUTTER_APP_FLAVOR');
return _DataContainer(
title: 'App version',
data: '$v-$f ($b) - SDK v$packageVersion',
);
},
),
const SizedBox(height: 20.0),
const Divider(height: 1.0),
const SizedBox(height: 20.0),
Expand Down Expand Up @@ -161,17 +163,6 @@ class _SettingsPageState extends State<SettingsPage> {
],
),
const SizedBox(height: 12.0),
Row(
children: [
Expanded(
child: Text(
version ?? '',
textAlign: TextAlign.center,
style: const TextStyle(fontSize: 11.0),
),
)
],
),
],
),
),
Expand Down
2 changes: 1 addition & 1 deletion example/wallet/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ dependencies:
get_it: ^7.2.0
eth_sig_util: ^0.0.9
get_it_mixin: ^4.0.0
# package_info_plus: ^7.0.0
package_info_plus: ^7.0.0
convert: ^3.0.1
url_launcher: ^6.2.2
kadena_dart_sdk: ^2.3.2
Expand Down

0 comments on commit b06a704

Please sign in to comment.