-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'development' of github.com:threefoldtech/threefold_conn…
…ect into development_kyc_wallets
- Loading branch information
Showing
13 changed files
with
809 additions
and
6 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:threebotlogin/app.dart'; | ||
import 'package:threebotlogin/apps/farmers/farmers_user_data.dart'; | ||
import 'package:threebotlogin/events/events.dart'; | ||
import 'package:threebotlogin/events/go_home_event.dart'; | ||
import 'package:threebotlogin/screens/council_screen.dart'; | ||
|
||
class Council implements App { | ||
static final Council _singleton = Council._internal(); | ||
static const Widget _councilWidget = CouncilScreen(); | ||
|
||
factory Council() { | ||
return _singleton; | ||
} | ||
|
||
Council._internal(); | ||
|
||
@override | ||
Future<Widget> widget() async { | ||
return _councilWidget; | ||
} | ||
|
||
@override | ||
void clearData() { | ||
clearAllData(); | ||
} | ||
|
||
@override | ||
bool emailVerificationRequired() { | ||
return false; | ||
} | ||
|
||
@override | ||
bool pinRequired() { | ||
return true; | ||
} | ||
|
||
@override | ||
void back() { | ||
Events().emit(GoHomeEvent()); | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,134 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:threebotlogin/widgets/council/councils.dart'; | ||
import 'package:threebotlogin/widgets/layout_drawer.dart'; | ||
import 'package:validators/validators.dart'; | ||
|
||
class CouncilScreen extends StatefulWidget { | ||
const CouncilScreen({super.key}); | ||
|
||
@override | ||
State<CouncilScreen> createState() => _CouncilScreenState(); | ||
} | ||
|
||
class _CouncilScreenState extends State<CouncilScreen> { | ||
final urlController = TextEditingController(); | ||
String? errorMessage; | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
const size = 100.0; | ||
final content = Padding( | ||
padding: const EdgeInsets.all(16.0), | ||
child: Column( | ||
mainAxisAlignment: MainAxisAlignment.center, | ||
children: [ | ||
TextField( | ||
style: Theme.of(context).textTheme.bodyLarge!.copyWith( | ||
color: Theme.of(context).colorScheme.onSurface, | ||
), | ||
controller: urlController, | ||
onChanged: (value) { | ||
final v = value.trim(); | ||
if (v.isEmpty) { | ||
errorMessage = 'URL is required'; | ||
setState(() {}); | ||
return; | ||
} | ||
if (!v.startsWith('wss://') && !v.startsWith('ws://')) { | ||
errorMessage = 'Not a valid websocket URL'; | ||
setState(() {}); | ||
return; | ||
} | ||
if (!isFQDN(v.replaceFirst('wss://', '')) && | ||
!isFQDN(v.replaceFirst('ws://', ''))) { | ||
errorMessage = 'Not a valid websocket URL'; | ||
setState(() {}); | ||
return; | ||
} | ||
errorMessage = null; | ||
setState(() {}); | ||
return; | ||
}, | ||
decoration: InputDecoration( | ||
labelText: 'TFChain URL', | ||
errorText: errorMessage, | ||
)), | ||
const SizedBox(height: 50), | ||
Row( | ||
mainAxisAlignment: MainAxisAlignment.spaceEvenly, | ||
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')), | ||
], | ||
), | ||
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) { | ||
Navigator.of(context).push(MaterialPageRoute( | ||
builder: (context) => | ||
CouncilsWidget(chainUrl: urlController.text), | ||
)); | ||
} | ||
}, | ||
style: ElevatedButton.styleFrom( | ||
backgroundColor: errorMessage == null | ||
? Theme.of(context).colorScheme.primaryContainer | ||
: Theme.of(context).colorScheme.surfaceContainerHighest), | ||
child: SizedBox( | ||
width: double.infinity, | ||
child: Text( | ||
style: Theme.of(context).textTheme.titleLarge!.copyWith( | ||
color: errorMessage == null | ||
? Theme.of(context).colorScheme.primary | ||
: Colors.grey, | ||
fontWeight: FontWeight.bold), | ||
'Connect', | ||
textAlign: TextAlign.center, | ||
))) | ||
], | ||
), | ||
); | ||
return LayoutDrawer(titleText: 'Council', content: content); | ||
} | ||
} |
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
Oops, something went wrong.