Skip to content
Snippets Groups Projects
Commit fb11550e authored by poka's avatar poka
Browse files

Display mnemonic in array of 12 worlds

parent 2f7313ec
No related branches found
No related tags found
1 merge request!6Figma onboarding workflow
......@@ -279,6 +279,22 @@ class GenerateWalletsProvider with ChangeNotifier {
notifyListeners();
}
Future<List<String>> generateWordList() async {
final String _sentance = await generateMnemonic();
List<String> _wordsList = [];
String word;
int _nbr = 1;
for (word in _sentance.split(' ')) {
// print(word);
_wordsList.add("$_nbr:$word");
_nbr++;
}
// notifyListeners();
return _wordsList;
}
// void makeError() {
// var tata = File(appPath.path + '/ddfhjftjfg');
// tata.readAsLinesSync();
......
......@@ -15,7 +15,7 @@ class OnboardingStepNine extends StatelessWidget {
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
GenerateWalletsProvider _generateWalletProvider =
Provider.of<GenerateWalletsProvider>(context);
_generateWalletProvider.generateMnemonic();
// _generateWalletProvider.generateMnemonic();
return Scaffold(
extendBodyBehindAppBar: true,
......@@ -71,23 +71,19 @@ class OnboardingStepNine extends StatelessWidget {
),
),
SizedBox(height: 64),
// Row(children: <Widget>[
// Align(
// alignment: Alignment.centerRight,
// child:
TextField(
enabled: false,
controller: _generateWalletProvider.mnemonicController,
maxLines: 3,
textAlign: TextAlign.center,
decoration: InputDecoration(
contentPadding: EdgeInsets.all(15.0),
),
style: TextStyle(
fontSize: 22.0,
color: Colors.black,
fontWeight: FontWeight.w400)),
// ]),
// TextField(
// enabled: false,
// controller: _generateWalletProvider.mnemonicController,
// maxLines: 3,
// textAlign: TextAlign.center,
// decoration: InputDecoration(
// contentPadding: EdgeInsets.all(15.0),
// ),
// style: TextStyle(
// fontSize: 22.0,
// color: Colors.black,
// fontWeight: FontWeight.w400)),
sentanceArray(context),
Expanded(
child: Align(
alignment: Alignment.bottomCenter,
......@@ -97,18 +93,34 @@ class OnboardingStepNine extends StatelessWidget {
child: ElevatedButton(
style: ElevatedButton.styleFrom(
elevation: 5,
primary: Color(0xffD28928),
onPrimary: Colors.white, // foreground
primary: Color(0xffFFD58D),
onPrimary: Colors.black, // foreground
),
onPressed: () {
// Navigator.push(
// context,
// SmoothTransition(page: OnboardingStepNince()),
// );
_generateWalletProvider.reloadBuild();
},
child: Text("J'ai noté ma phrase",
child: Text("Choisir une autre phrase",
style: TextStyle(fontSize: 20))),
))),
SizedBox(height: 20),
SizedBox(
width: 350,
height: 55,
child: ElevatedButton(
style: ElevatedButton.styleFrom(
elevation: 5,
primary: Color(0xffD28928),
onPrimary: Colors.white, // foreground
),
onPressed: () {
// Navigator.push(
// context,
// SmoothTransition(page: OnboardingStepNince()),
// );
},
child: Text("J'ai noté ma phrase",
style: TextStyle(fontSize: 20))),
),
SizedBox(height: 80),
]),
));
......@@ -144,3 +156,64 @@ class GeckoSpeechAppBar extends StatelessWidget with PreferredSizeWidget {
));
}
}
// _generateWalletProvider
Widget sentanceArray(BuildContext context) {
GenerateWalletsProvider _generateWalletProvider =
Provider.of<GenerateWalletsProvider>(context);
return FutureBuilder(
future: _generateWalletProvider.generateWordList(),
initialData: '::::::::::::',
builder: (context, formatedArray) {
return Container(
padding: EdgeInsets.symmetric(horizontal: 12),
child: Container(
decoration: BoxDecoration(
color: Colors.grey[300],
borderRadius: BorderRadius.all(
const Radius.circular(10),
)),
// color: Colors.grey[300],
padding: EdgeInsets.all(20),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
mainAxisSize: MainAxisSize.max,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Row(children: <Widget>[
arrayCell(formatedArray.data[0]),
arrayCell(formatedArray.data[1]),
arrayCell(formatedArray.data[2]),
arrayCell(formatedArray.data[3]),
]),
SizedBox(height: 15),
Row(children: <Widget>[
arrayCell(formatedArray.data[4]),
arrayCell(formatedArray.data[5]),
arrayCell(formatedArray.data[6]),
arrayCell(formatedArray.data[7]),
]),
SizedBox(height: 15),
Row(children: <Widget>[
arrayCell(formatedArray.data[8]),
arrayCell(formatedArray.data[9]),
arrayCell(formatedArray.data[10]),
arrayCell(formatedArray.data[11]),
]),
])));
});
}
Widget arrayCell(dataWord) {
print(dataWord);
return Container(
width: 80,
child: Column(children: <Widget>[
Text(dataWord.split(':')[0], style: TextStyle(fontSize: 12)),
SizedBox(height: 2),
Text(dataWord.split(':')[1],
style: TextStyle(fontSize: 16, color: Colors.black)),
]));
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment