diff --git a/app/lib/screens/council_screen.dart b/app/lib/screens/council_screen.dart index a84fc1ab6..d960bf9c8 100644 --- a/app/lib/screens/council_screen.dart +++ b/app/lib/screens/council_screen.dart @@ -14,10 +14,49 @@ class CouncilScreen extends StatefulWidget { class _CouncilScreenState extends State { final urlController = TextEditingController(); String? errorMessage; + String? selectedNetwork = ''; + + Widget networkButton(String label, String url) { + final bool isActive = selectedNetwork == url && errorMessage == null; + final colorScheme = Theme.of(context).colorScheme; + + return SizedBox( + width: MediaQuery.of(context).size.width / 3, + child: ElevatedButton( + style: ElevatedButton.styleFrom( + backgroundColor: + isActive ? colorScheme.primaryContainer : colorScheme.surface, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(6), + side: BorderSide( + color: + isActive ? colorScheme.primaryContainer : colorScheme.outline, + ), + ), + ), + onPressed: () => _onNetworkSelected(url), + child: Text( + label, + style: TextStyle( + color: isActive + ? colorScheme.onPrimaryContainer + : colorScheme.onSurfaceVariant, + ), + ), + ), + ); + } + + void _onNetworkSelected(String url) { + setState(() { + selectedNetwork = url; + urlController.text = url; + errorMessage = null; + }); + } @override Widget build(BuildContext context) { - const size = 100.0; final content = Padding( padding: const EdgeInsets.all(16.0), child: KeyboardVisibilityBuilder(builder: (context, isKeyboardVisible) { @@ -36,6 +75,7 @@ class _CouncilScreenState extends State { controller: urlController, onChanged: (value) { final v = value.trim(); + selectedNetwork = v; if (v.isEmpty) { errorMessage = 'URL is required'; setState(() {}); @@ -60,55 +100,31 @@ class _CouncilScreenState extends State { labelText: 'TFChain URL', errorText: errorMessage, )), - const SizedBox(height: 50), - Row( - mainAxisAlignment: MainAxisAlignment.spaceEvenly, + const SizedBox(height: 30), + Column( + mainAxisAlignment: MainAxisAlignment.center, children: [ - ElevatedButton( - style: ElevatedButton.styleFrom( - fixedSize: const Size.fromWidth(size)), - onPressed: () { - urlController.text = 'wss://tfchain.dev.grid.tf'; - errorMessage = null; - setState(() {}); - }, - child: const Text('Devnet')), - ElevatedButton( - style: ElevatedButton.styleFrom( - fixedSize: const Size.fromWidth(size)), - onPressed: () { - urlController.text = 'wss://tfchain.qa.grid.tf'; - errorMessage = null; - setState(() {}); - }, - child: const Text('QAnet')), + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + networkButton('Devnet', 'wss://tfchain.dev.grid.tf'), + const SizedBox(width: 30), + networkButton('QAnet', 'wss://tfchain.qa.grid.tf'), + ], + ), + const SizedBox(height: 20), + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + networkButton( + 'Testnet', 'wss://tfchain.test.grid.tf'), + const SizedBox(width: 30), + networkButton('Mainnet', 'wss://tfchain.grid.tf'), + ], + ), ], ), const SizedBox(height: 20), - Row( - mainAxisAlignment: MainAxisAlignment.spaceEvenly, - children: [ - ElevatedButton( - style: ElevatedButton.styleFrom( - fixedSize: const Size.fromWidth(size)), - onPressed: () { - urlController.text = 'wss://tfchain.test.grid.tf'; - errorMessage = null; - setState(() {}); - }, - child: const Text('Testnet')), - ElevatedButton( - style: ElevatedButton.styleFrom( - fixedSize: const Size.fromWidth(size)), - onPressed: () { - urlController.text = 'wss://tfchain.grid.tf'; - errorMessage = null; - setState(() {}); - }, - child: const Text('Mainnet')), - ], - ), - const SizedBox(height: 50), ElevatedButton( onPressed: () { if (errorMessage == null) { diff --git a/app/lib/widgets/council/vote.dart b/app/lib/widgets/council/vote.dart index e90f5ccdc..183b217b3 100644 --- a/app/lib/widgets/council/vote.dart +++ b/app/lib/widgets/council/vote.dart @@ -93,7 +93,7 @@ class _CouncilVoteDialogState extends ConsumerState { } else { if (wallets.isEmpty) { content = Text( - 'No wallets available to vote.', + 'No wallets available to vote. Please import your council wallet.', style: Theme.of(context).textTheme.bodyLarge!.copyWith( color: Theme.of(context).colorScheme.onSurface, ),