Skip to content

Commit

Permalink
feat: get and show user nfts
Browse files Browse the repository at this point in the history
  • Loading branch information
dnielopez committed Oct 12, 2023
1 parent 3357f4c commit da398ee
Show file tree
Hide file tree
Showing 10 changed files with 263 additions and 141 deletions.
1 change: 1 addition & 0 deletions android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<uses-permission android:name="android.permission.INTERNET" />
<application
android:label="DinoGrow"
android:name="${applicationName}"
Expand Down
117 changes: 59 additions & 58 deletions lib/pages/generate_phrase.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:bip39/bip39.dart' as bip39;
import 'package:go_router/go_router.dart';

import 'package:dinogrow/pages/setup_password.dart';
import '../ui/widgets/widgets.dart';
Expand Down Expand Up @@ -37,66 +36,68 @@ class _GeneratePhraseScreenState extends State<GeneratePhraseScreen> {
fit: BoxFit.cover,
),
),
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
const SizedBox(height: 60),
Container(
color: Colors.orange[700],
padding: const EdgeInsets.all(8),
child: const Text(
'Important! Copy and save the recovery phrase in a secure location. This cannot be recovered later.',
style: TextStyle(fontWeight: FontWeight.bold),
textAlign: TextAlign.center,
child: Padding(
padding: const EdgeInsets.all(23),
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
const SizedBox(height: 60),
Container(
color: Colors.orange[700],
padding: const EdgeInsets.all(8),
child: const Text(
'Important! Copy and save the recovery phrase in a secure location. This cannot be recovered later.',
style: TextStyle(fontWeight: FontWeight.bold),
textAlign: TextAlign.center,
),
),
),
TextBoxWidget(text: _mnemonic),
IntroButtonWidget(
text: 'Copy phrase',
onPressed: () {
Clipboard.setData(ClipboardData(text: _mnemonic));
const snackBar = SnackBar(
content: Text('Copied!'),
);
TextBoxWidget(text: _mnemonic),
IntroButtonWidget(
text: 'Copy phrase',
onPressed: () {
Clipboard.setData(ClipboardData(text: _mnemonic));
const snackBar = SnackBar(
content: Text('Copied!'),
);

ScaffoldMessenger.of(context).showSnackBar(snackBar);
},
),
Container(
decoration: const BoxDecoration(color: Colors.black),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Checkbox(
value: _copied,
onChanged: (value) {
setState(() {
_copied = value!;
});
},
),
const Text("I have stored the recovery phrase securely"),
],
)),
IntroButtonWidget(
text: _copied ? 'Continue' : 'Go Back',
onPressed: _copied
? () {
// GoRouter.of(context).push("/passwordSetup/$_mnemonic");
showModalBottomSheet(
context: context,
isScrollControlled: true,
builder: (context) {
return SetupPasswordScreen(mnemonic: _mnemonic);
ScaffoldMessenger.of(context).showSnackBar(snackBar);
},
),
Container(
decoration: const BoxDecoration(color: Colors.black),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Checkbox(
value: _copied,
onChanged: (value) {
setState(() {
_copied = value!;
});
},
);
}
: () {
GoRouter.of(context).push("/");
},
),
const SizedBox(height: 60),
],
),
const Text("I have stored the recovery phrase securely"),
],
)),
IntroButtonWidget(
text: 'Continue',
variant: _copied ? 'primary' : 'disabled',
onPressed: _copied
? () {
// GoRouter.of(context).push("/passwordSetup/$_mnemonic");
showModalBottomSheet(
context: context,
isScrollControlled: true,
builder: (context) {
return SetupPasswordScreen(mnemonic: _mnemonic);
},
);
}
: () {},
),
const SizedBox(height: 60),
],
),
),
),
);
Expand Down
2 changes: 1 addition & 1 deletion lib/pages/home.dart
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ class _HomeScreenState extends State<HomeScreen> {
children: [
const MiniGamesScreen(),
RankingScreen(),
const MydinogrowScreen(),
MydinogrowScreen(address: _publicKey ?? ''),
WalletScreen(address: _publicKey ?? '', balance: _balance),
],
),
Expand Down
92 changes: 48 additions & 44 deletions lib/pages/input_phrase.dart
Original file line number Diff line number Diff line change
Expand Up @@ -66,53 +66,57 @@ class _InputPhraseScreenState extends State<InputPhraseScreen> {
fit: BoxFit.cover,
),
),
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
const SizedBox(height: 60),
const TextBoxWidget(text: 'Please enter your recovery phrase'),
Center(
child: Form(
key: _formKey,
child: SizedBox(
width: 300,
child: GridView.count(
padding: const EdgeInsets.all(3),
crossAxisSpacing: 10,
mainAxisSpacing: 3,
shrinkWrap: true,
crossAxisCount: 3,
children: List.generate(12, (index) {
return SizedBox(
height: 50,
child: TextFormField(
controller: controllers[index],
decoration: InputDecoration(
filled: true,
fillColor: Colors.black,
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(8),
child: Padding(
padding: const EdgeInsets.all(24),
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
const SizedBox(height: 60),
const TextBoxWidget(
text: 'Please enter your recovery phrase'),
Center(
child: Form(
key: _formKey,
child: SizedBox(
width: 300,
child: GridView.count(
padding: const EdgeInsets.all(3),
crossAxisSpacing: 10,
mainAxisSpacing: 3,
shrinkWrap: true,
crossAxisCount: 3,
children: List.generate(12, (index) {
return SizedBox(
height: 50,
child: TextFormField(
controller: controllers[index],
decoration: InputDecoration(
filled: true,
fillColor: Colors.black,
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(8),
),
hintText: '${index + 1}',
),
hintText: '${index + 1}',
textInputAction: TextInputAction.next,
),
textInputAction: TextInputAction.next,
),
);
}),
)),
);
}),
)),
),
),
),
validationFailed
? const TextBoxWidget(text: 'Invalid keyphrase')
: const SizedBox(),
IntroButtonWidget(
text: 'Continue',
onPressed: () {
_onSubmit(context);
},
),
const SizedBox(height: 32),
],
validationFailed
? const TextBoxWidget(text: 'Invalid keyphrase')
: const SizedBox(),
IntroButtonWidget(
text: 'Continue',
onPressed: () {
_onSubmit(context);
},
),
const SizedBox(height: 32),
],
),
),
),
),
Expand Down
Loading

0 comments on commit da398ee

Please sign in to comment.