@@ -4,7 +4,6 @@ import 'package:flutter/material.dart';
44import 'package:walletconnect_flutter_dapp/models/chain_metadata.dart' ;
55import 'package:walletconnect_flutter_dapp/utils/constants.dart' ;
66import 'package:walletconnect_flutter_dapp/utils/crypto/chain_data.dart' ;
7- import 'package:walletconnect_flutter_dapp/utils/string_constants.dart' ;
87import 'package:walletconnect_flutter_dapp/widgets/chain_button.dart' ;
98import 'package:walletconnect_flutter_dapp/widgets/session_widget.dart' ;
109import 'package:walletconnect_flutter_v2/walletconnect_flutter_v2.dart' ;
@@ -99,13 +98,32 @@ class _WCMPageState extends State<WCMPage> with SingleTickerProviderStateMixin {
9998
10099 Widget _buildWalletConnect () {
101100 // Build the list of chain button
102- final List <ChainMetadata > chains = ChainData .chains;
101+ final List <Widget > evmChainButtons = [];
102+ final List <Widget > nonEvmChainButtons = [];
103103
104- List <Widget > chainButtons = [];
104+ final evmChains = ChainData .chains.where ((e) => e.type == ChainType .eip155);
105+ final nonEvmChains =
106+ ChainData .chains.where ((e) => e.type != ChainType .eip155);
105107
106- for (final ChainMetadata chain in chains ) {
108+ for (final ChainMetadata chain in evmChains ) {
107109 // Build the button
108- chainButtons.add (
110+ evmChainButtons.add (
111+ ChainButton (
112+ chain: chain,
113+ onPressed: () {
114+ _selectChain (
115+ chain,
116+ // deselectOthers: true,
117+ );
118+ },
119+ selected: _selectedChains.contains (chain),
120+ ),
121+ );
122+ }
123+
124+ for (final ChainMetadata chain in nonEvmChains) {
125+ // Build the button
126+ nonEvmChainButtons.add (
109127 ChainButton (
110128 chain: chain,
111129 onPressed: () {
@@ -123,37 +141,26 @@ class _WCMPageState extends State<WCMPage> with SingleTickerProviderStateMixin {
123141 appBar: AppBar (
124142 title: const Text ('WalletConnectModal' ),
125143 ),
126- body: Column (
127- mainAxisAlignment: MainAxisAlignment .center,
128- mainAxisSize: MainAxisSize .min,
129- crossAxisAlignment: CrossAxisAlignment .center,
144+ body: ListView (
130145 children: [
146+ const Text ('EVM Chains:' , style: StyleConstants .buttonText),
147+ const SizedBox (height: StyleConstants .linear8),
148+ Wrap (
149+ spacing: 10.0 ,
150+ children: evmChainButtons,
151+ ),
152+ const Divider (),
153+ const Text ('Non EVM Chains:' , style: StyleConstants .buttonText),
154+ Wrap (
155+ spacing: 10.0 ,
156+ children: nonEvmChainButtons,
157+ ),
158+ const Divider (),
159+ const SizedBox (height: StyleConstants .linear8),
131160 WalletConnectModalConnect (
132161 service: _walletConnectModalService! ,
133- ),
134- // WalletConnectModalConnect(
135- // service: _walletConnectModalService!,
136- // width: double.infinity,
137- // height: 100,
138- // ),
139- Expanded (
140- child: Container (
141- padding: const EdgeInsets .all (8.0 ),
142- child: ListView (
143- children: [
144- const Text (
145- StringConstants .selectChains,
146- style: StyleConstants .subtitleText,
147- textAlign: TextAlign .center,
148- ),
149- const SizedBox (
150- height: StyleConstants .linear24,
151- ),
152- // _buildTestnetSwitch(),
153- ...chainButtons,
154- ],
155- ),
156- ),
162+ width: double .infinity,
163+ height: 50.0 ,
157164 ),
158165 ],
159166 ),
0 commit comments