From 4e0243ed8299d7e5094eb523e64e21e3f8e1c16b Mon Sep 17 00:00:00 2001 From: Alfreedom <00tango.bromine@icloud.com> Date: Tue, 9 Jan 2024 12:17:26 +0100 Subject: [PATCH] minor changes --- example/dapp/lib/main.dart | 17 ++++++++++++--- example/dapp/lib/pages/sessions_page.dart | 11 +++++----- .../lib/dependencies/web3wallet_service.dart | 2 +- example/wallet/lib/main.dart | 5 ++++- example/wallet/lib/pages/app_detail_page.dart | 17 ++++++++------- example/wallet/lib/widgets/pairing_item.dart | 21 +++++++++++++++---- 6 files changed, 51 insertions(+), 22 deletions(-) diff --git a/example/dapp/lib/main.dart b/example/dapp/lib/main.dart index 30310e25..918eecc9 100644 --- a/example/dapp/lib/main.dart +++ b/example/dapp/lib/main.dart @@ -67,10 +67,12 @@ class _MyHomePageState extends State { projectId: DartDefines.projectId, logLevel: LogLevel.info, metadata: const PairingMetadata( - name: 'Flutter WalletConnect', - description: 'Flutter WalletConnect Dapp Example', + name: 'Example dApp', + description: 'Example dApp', url: 'https://walletconnect.com/', - icons: ['https://walletconnect.com/walletconnect-logo.png'], + icons: [ + 'https://images.prismic.io/wallet-connect/65785a56531ac2845a260732_WalletConnect-App-Logo-1024X1024.png' + ], redirect: Redirect( native: 'myflutterdapp://', universal: 'https://walletconnect.com', @@ -82,6 +84,7 @@ class _MyHomePageState extends State { for (final ChainMetadata chain in ChainData.allChains) { // Loop through the events for that chain for (final event in getChainEvents(chain.type)) { + debugPrint('registerEventHandler $event for chain ${chain.chainId}'); _web3App!.registerEventHandler(chainId: chain.chainId, event: event); } } @@ -89,6 +92,7 @@ class _MyHomePageState extends State { // Register event handlers _web3App!.onSessionPing.subscribe(_onSessionPing); _web3App!.onSessionEvent.subscribe(_onSessionEvent); + _web3App!.onSessionUpdate.subscribe(_onSessionUpdate); _web3App!.core.relayClient.onRelayClientConnect.subscribe(_setState); _web3App!.core.relayClient.onRelayClientDisconnect.subscribe(_setState); _web3App!.onSessionConnect.subscribe(_onSessionConnect); @@ -133,6 +137,7 @@ class _MyHomePageState extends State { _web3App!.core.relayClient.onRelayClientDisconnect.unsubscribe(_setState); _web3App!.onSessionPing.unsubscribe(_onSessionPing); _web3App!.onSessionEvent.unsubscribe(_onSessionEvent); + _web3App!.onSessionUpdate.unsubscribe(_onSessionUpdate); super.dispose(); } @@ -241,6 +246,7 @@ class _MyHomePageState extends State { } void _onSessionPing(SessionPing? args) { + debugPrint('[$runtimeType] _onSessionPing $args'); showDialog( context: context, builder: (BuildContext context) { @@ -253,6 +259,7 @@ class _MyHomePageState extends State { } void _onSessionEvent(SessionEvent? args) { + debugPrint('[$runtimeType] _onSessionEvent $args'); showDialog( context: context, builder: (BuildContext context) { @@ -268,4 +275,8 @@ class _MyHomePageState extends State { void _onSessionConnect(SessionConnect? event) { debugPrint(jsonEncode(event?.session.toJson())); } + + void _onSessionUpdate(SessionUpdate? args) { + debugPrint('[$runtimeType] _onSessionUpdate $args'); + } } diff --git a/example/dapp/lib/pages/sessions_page.dart b/example/dapp/lib/pages/sessions_page.dart index ebee8e60..76582286 100644 --- a/example/dapp/lib/pages/sessions_page.dart +++ b/example/dapp/lib/pages/sessions_page.dart @@ -45,8 +45,7 @@ class SessionsPageState extends State { children: [ Container( constraints: const BoxConstraints( - maxWidth: 200, - minWidth: 150, + maxWidth: 150, ), decoration: const BoxDecoration( border: Border( @@ -79,9 +78,11 @@ class SessionsPageState extends State { ), Expanded( child: Container( - // color: StyleConstants.primaryColor, - padding: const EdgeInsets.all( - StyleConstants.linear8, + padding: const EdgeInsets.only( + left: StyleConstants.linear8, + top: StyleConstants.linear8, + right: StyleConstants.linear8, + bottom: StyleConstants.linear72, ), child: _buildSessionView(), ), diff --git a/example/wallet/lib/dependencies/web3wallet_service.dart b/example/wallet/lib/dependencies/web3wallet_service.dart index 3cca879c..583aa30a 100644 --- a/example/wallet/lib/dependencies/web3wallet_service.dart +++ b/example/wallet/lib/dependencies/web3wallet_service.dart @@ -47,7 +47,7 @@ class Web3WalletService extends IWeb3WalletService { description: 'Example Wallet', url: 'https://walletconnect.com/', icons: [ - 'https://github.com/WalletConnect/Web3ModalFlutter/blob/master/assets/png/logo_wc.png' + 'https://images.prismic.io/wallet-connect/65785a56531ac2845a260732_WalletConnect-App-Logo-1024X1024.png' ], redirect: Redirect( native: 'myflutterwallet://', diff --git a/example/wallet/lib/main.dart b/example/wallet/lib/main.dart index 27f79c2d..91a71ebf 100644 --- a/example/wallet/lib/main.dart +++ b/example/wallet/lib/main.dart @@ -205,7 +205,10 @@ class _MyHomePageState extends State with GetItStateMixin { return Scaffold( appBar: AppBar( - title: Text(_pageDatas[_selectedIndex].title), + title: Text( + _pageDatas[_selectedIndex].title, + style: const TextStyle(color: Colors.white), + ), ), bottomNavigationBar: MediaQuery.of(context).size.width < Constants.smallScreen diff --git a/example/wallet/lib/pages/app_detail_page.dart b/example/wallet/lib/pages/app_detail_page.dart index 084e94f0..71f9e473 100644 --- a/example/wallet/lib/pages/app_detail_page.dart +++ b/example/wallet/lib/pages/app_detail_page.dart @@ -57,12 +57,18 @@ class AppDetailPageState extends State { return Scaffold( appBar: AppBar( - title: Text(widget.pairing.peerMetadata?.name ?? 'Unknown'), + title: Text( + widget.pairing.peerMetadata?.name ?? 'Unknown', + style: const TextStyle(color: Colors.white), + ), ), body: SingleChildScrollView( child: Container( - padding: const EdgeInsets.all( - StyleConstants.linear8, + padding: const EdgeInsets.only( + left: StyleConstants.linear8, + top: StyleConstants.linear8, + right: StyleConstants.linear8, + bottom: StyleConstants.linear32, ), child: Column( mainAxisSize: MainAxisSize.min, @@ -77,11 +83,6 @@ class AppDetailPageState extends State { ), ), const SizedBox(height: 20.0), - Text( - widget.pairing.peerMetadata!.name, - style: StyleConstants.subtitleText, - ), - const SizedBox(height: 20.0), Text(widget.pairing.peerMetadata!.url), Text('Expires on: $expiryDate'), const SizedBox(height: 20.0), diff --git a/example/wallet/lib/widgets/pairing_item.dart b/example/wallet/lib/widgets/pairing_item.dart index b652a726..ae2b1ae9 100644 --- a/example/wallet/lib/widgets/pairing_item.dart +++ b/example/wallet/lib/widgets/pairing_item.dart @@ -37,15 +37,28 @@ class PairingItem extends StatelessWidget { : const AssetImage('assets/images/default_icon.png')) as ImageProvider, ), - title: Text(metadata.name), + title: Text( + metadata.name, + style: const TextStyle(color: Colors.white), + ), subtitle: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Text(metadata.url), - Text('Expires on: $expiryDate'), + Text( + metadata.url, + style: const TextStyle(color: Colors.white60), + ), + Text( + 'Expires on: $expiryDate', + style: const TextStyle(color: Colors.white60), + ), ], ), - trailing: const Icon(Icons.arrow_forward_ios, size: 20.0), + trailing: const Icon( + Icons.arrow_forward_ios, + size: 20.0, + color: Colors.white60, + ), onTap: onTap, ); }