Adapt to large screen

This commit is contained in:
poka 2021-12-23 21:44:24 +01:00
parent 33c1149987
commit 7bdd564a91
17 changed files with 448 additions and 413 deletions

View File

@ -51,7 +51,7 @@ Future<void> main() async {
WidgetsFlutterBinding.ensureInitialized();
if (!kIsWeb && (Platform.isWindows || Platform.isLinux || Platform.isMacOS)) {
setWindowTitle('Ğecko');
setWindowMinSize(const Size(600, 800));
setWindowMinSize(const Size(400, 700));
setWindowMaxSize(const Size(800, 1000));
}

View File

@ -9,9 +9,9 @@ class ChestProvider with ChangeNotifier {
}
Future deleteChest(context, ChestData _chest) async {
final bool _answer = await (_confirmDeletingChest(context, _chest.name) as FutureOr<bool>);
final bool? _answer = await (_confirmDeletingChest(context, _chest.name));
if (_answer) {
if (_answer!) {
await chestBox.delete(_chest.key);
if (chestBox.isEmpty) {
await configBox.put('currentChest', 0);

View File

@ -316,9 +316,9 @@ class GenerateWalletsProvider with ChangeNotifier {
return bip39Words.contains(word);
}
bool isBipWordsList(List words) {
bool isBipWordsList(List<String> words) {
bool isValid = true;
for (String word in words as Iterable<String>) {
for (String word in words) {
// Needed for bad encoding of UTF-8
word = word.replaceAll('é', '');
word = word.replaceAll('è', '');
@ -380,6 +380,7 @@ class GenerateWalletsProvider with ChangeNotifier {
if (generatedWallet == null) {
return false;
} else {
generatedMnemonic = inputMnemonic;
return true;
}
}

View File

@ -65,8 +65,8 @@ class MyWalletsProvider with ChangeNotifier {
try {
log.w('DELETE ALL WALLETS ?');
final bool _answer = await (_confirmDeletingAllWallets(context) as FutureOr<bool>);
if (_answer) {
final bool? _answer = await (_confirmDeletingAllWallets(context));
if (_answer!) {
await walletBox.clear();
await chestBox.clear();
await configBox.delete('defaultWallet');

View File

@ -108,6 +108,11 @@ class WalletOptionsProvider with ChangeNotifier {
return pinLength;
}
Future<double> getBalance(String pubkey, {bool isUd = false}) async {
final node = Gva(node: endPointGVA);
return await node.balance(pubkey, ud: isUd);
}
void _renameWallet(List<int?> _walletID, _newName,
{required bool isCesium}) async {
if (isCesium) {
@ -145,10 +150,9 @@ class WalletOptionsProvider with ChangeNotifier {
}
Future<int> deleteWallet(context, WalletData wallet) async {
final bool _answer =
await (_confirmDeletingWallet(context, wallet.name) as FutureOr<bool>);
final bool? _answer = await (_confirmDeletingWallet(context, wallet.name));
if (_answer) {
if (_answer!) {
walletBox.delete(wallet.key);
Navigator.popUntil(

View File

@ -8,39 +8,46 @@ class CommonElements {
return const Text('Coucou');
}
Widget bubbleSpeak(String text, {double? long, Key? textKey}) {
return Bubble(
padding: long == null
? const BubbleEdges.all(18)
: BubbleEdges.symmetric(horizontal: long, vertical: 30),
elevation: 5,
color: Colors.white,
margin: const BubbleEdges.fromLTRB(10, 0, 20, 10),
// nip: BubbleNip.leftTop,
child: Text(
text,
key: textKey,
style: const TextStyle(
color: Colors.black, fontSize: 18, fontWeight: FontWeight.w400),
Widget bubbleSpeak(String text,
{double? long, Key? textKey, bool isMaxWidth = true}) {
return SizedBox(
width: isMaxWidth ? double.infinity : 300,
child: Bubble(
padding: long == null
? const BubbleEdges.all(18)
: BubbleEdges.symmetric(horizontal: long, vertical: 30),
elevation: 5,
color: Colors.white,
margin: const BubbleEdges.fromLTRB(10, 0, 20, 10),
// nip: BubbleNip.leftTop,
child: Text(
text,
key: textKey,
style: const TextStyle(
color: Colors.black, fontSize: 18, fontWeight: FontWeight.w400),
),
),
);
}
Widget bubbleSpeakRich(List<TextSpan> text, {Key? textKey}) {
return Bubble(
padding: const BubbleEdges.all(18),
elevation: 5,
color: Colors.white,
margin: const BubbleEdges.fromLTRB(10, 0, 20, 10),
// nip: BubbleNip.leftTop,
child: RichText(
key: textKey,
text: TextSpan(
style: const TextStyle(
fontSize: 18.0,
color: Colors.black,
return SizedBox(
width: double.infinity,
child: Bubble(
padding: const BubbleEdges.all(18),
elevation: 5,
color: Colors.white,
margin: const BubbleEdges.fromLTRB(10, 0, 20, 10),
// nip: BubbleNip.leftTop,
child: RichText(
key: textKey,
text: TextSpan(
style: const TextStyle(
fontSize: 18.0,
color: Colors.black,
),
children: text,
),
children: text,
),
),
);

View File

@ -106,7 +106,7 @@ class CesiumWalletOptions extends StatelessWidget {
const SizedBox(width: 25),
InkWell(
onTap: () async {
File newAvatar = await (_walletOptions.changeAvatar() as FutureOr<File>);
File newAvatar = await (_walletOptions.changeAvatar());
cesiumWallet.imageFile = newAvatar;
_walletOptions.reloadBuild();
},
@ -119,7 +119,7 @@ class CesiumWalletOptions extends StatelessWidget {
),
InkWell(
onTap: () async {
File newAvatar = await (_walletOptions.changeAvatar() as FutureOr<File>);
File newAvatar = await (_walletOptions.changeAvatar());
cesiumWallet.imageFile = newAvatar;
_walletOptions.reloadBuild();
},

View File

@ -53,7 +53,7 @@ class _ChooseChestState extends State<ChooseChest> {
enableInfiniteScroll: false,
initialPage: currentChest!,
enlargeCenterPage: true,
viewportFraction: 0.6,
viewportFraction: 0.5,
),
items: chestBox.toMap().entries.map((i) {
return Builder(

View File

@ -4,23 +4,18 @@ import 'dart:ui';
import 'package:flutter/material.dart';
import 'package:gecko/globals.dart';
import 'package:gecko/providers/my_wallets.dart';
import 'package:gecko/models/queries.dart';
import 'package:gecko/models/wallet_data.dart';
import 'package:gecko/providers/wallet_options.dart';
import 'package:gecko/providers/wallets_profiles.dart';
import 'package:gecko/screens/history.dart';
import 'package:graphql_flutter/graphql_flutter.dart';
import 'package:provider/provider.dart';
import 'package:flutter/services.dart';
import 'package:qr_flutter/qr_flutter.dart';
// ignore: must_be_immutable
class WalletOptions extends StatelessWidget {
WalletOptions({Key? keyMyWallets, required this.wallet})
const WalletOptions({Key? keyMyWallets, required this.wallet})
: super(key: keyMyWallets);
WalletData wallet;
int _nbrLinesName = 1;
bool _isNewNameValid = false;
final WalletData wallet;
@override
Widget build(BuildContext context) {
@ -32,33 +27,13 @@ class WalletOptions extends StatelessWidget {
MyWalletsProvider _myWalletProvider =
Provider.of<MyWalletsProvider>(context);
_walletOptions.pubkey.text =
log.d(_walletOptions.pubkey.text);
final int? _currentChest = _myWalletProvider.getCurrentChest();
final String shortPubkey =
_walletOptions.getShortPubkey(_walletOptions.pubkey.text);
final int _currentChest = _myWalletProvider.getCurrentChest()!;
if (_isNewNameValid == false) {
_walletOptions.nameController.text = wallet.name!;
} else {
wallet.name = _walletOptions.nameController.text;
}
_walletOptions.nameController.text.length >= 15
? _nbrLinesName = 2
: _nbrLinesName = 1;
if (_walletOptions.nameController.text.length >= 26 && isTall) {
_nbrLinesName = 3;
}
WalletData defaultWallet =
_myWalletProvider.getDefaultWallet(_currentChest)!;
_walletOptions.isDefaultWallet = (defaultWallet.number == wallet.id()[1]);
int? currentChest = _myWalletProvider.getCurrentChest();
log.d("Wallet options: $currentChest:${wallet.number}");
log.d("Wallet options: $_currentChest:${wallet.number}");
return WillPopScope(
onWillPop: () {
@ -112,167 +87,21 @@ class WalletOptions extends StatelessWidget {
const Color(0xfffafafa),
],
)),
child: Row(children: <Widget>[
const SizedBox(width: 25),
InkWell(
onTap: () async {
File newAvatar = await (walletProvider.changeAvatar() as FutureOr<File>);
wallet.imageFile = newAvatar;
walletProvider.reloadBuild();
},
child: wallet.imageFile == null
? Image.asset(
'assets/avatars/${wallet.imageName}',
width: 110,
)
: Image.file(
wallet.imageFile!,
width: 110,
),
),
InkWell(
onTap: () async {
File newAvatar = await (walletProvider.changeAvatar() as FutureOr<File>);
wallet.imageFile = newAvatar;
walletProvider.reloadBuild();
},
child: Column(children: <Widget>[
Image.asset(
'assets/walletOptions/camera.png',
height: 40,
),
const SizedBox(height: 80)
])),
Column(children: <Widget>[
Row(children: <Widget>[
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: <Widget>[
const Spacer(),
avatar(walletProvider),
const Spacer(),
Column(children: <Widget>[
SizedBox(
width: 260,
child: TextField(
key: const Key('walletName'),
autofocus: false,
focusNode: walletProvider.walletNameFocus,
enabled: walletProvider.isEditing,
controller: walletProvider.nameController,
maxLines: _nbrLinesName,
textAlign: TextAlign.center,
decoration: const InputDecoration(
border: InputBorder.none,
focusedBorder: InputBorder.none,
enabledBorder: InputBorder.none,
disabledBorder: InputBorder.none,
contentPadding: EdgeInsets.all(15.0),
),
style: TextStyle(
fontSize: isTall ? 27 : 23,
color: Colors.black,
fontWeight: FontWeight.w400,
fontFamily: 'Monospace')),
),
walletName(walletProvider, _walletOptions),
SizedBox(height: isTall ? 5 : 0),
Query(
options: QueryOptions(
document: gql(getBalance),
variables: {
'pubkey': walletProvider.pubkey.text,
},
// pollInterval: Duration(seconds: 1),
),
builder: (QueryResult result,
{VoidCallback? refetch, FetchMore? fetchMore}) {
if (result.hasException) {
return Text(result.exception.toString());
}
if (result.isLoading) {
return const Text('Loading');
}
// List repositories = result.data['viewer']['repositories']['nodes'];
String wBalanceUD;
if (result.data!['balance'] == null) {
wBalanceUD = '0.0';
} else if (result.hasException) {
wBalanceUD = '?';
} else {
int wBalanceG1 =
result.data!['balance']['amount'];
int currentUD =
result.data!['currentUd']['amount'];
double wBalanceUDBrut =
wBalanceG1 / currentUD; // .toString();
wBalanceUD = double.parse(
(wBalanceUDBrut).toStringAsFixed(2))
.toString();
}
return Row(children: <Widget>[
ImageFiltered(
imageFilter: ImageFilter.blur(
sigmaX:
walletProvider.isBalanceBlur ? 6 : 0.001,
sigmaY:
walletProvider.isBalanceBlur ? 5 : 0.001),
child: Text(
wBalanceUD,
style: TextStyle(
fontSize: isTall ? 20 : 18,
color: Colors.black),
),
),
Text(' DU',
style: TextStyle(
fontSize: isTall ? 20 : 18,
color: Colors.black))
]);
// Text(
// '$wBalanceUD DU',
// style: TextStyle(
// fontSize: 20, color: Colors.black),
// );
},
),
const SizedBox(height: 5),
InkWell(
key: const Key('displayBalance'),
onTap: () {
walletProvider.bluringBalance();
},
child: Image.asset(
walletProvider.isBalanceBlur
? 'assets/walletOptions/icon_oeuil.png'
: 'assets/walletOptions/icon_oeuil_close.png',
height: 35,
),
),
balance(walletProvider),
]),
const SizedBox(width: 0),
Column(children: <Widget>[
InkWell(
key: const Key('renameWallet'),
onTap: () async {
_isNewNameValid = walletProvider.editWalletName(
wallet.id(),
isCesium: false);
await Future.delayed(
const Duration(milliseconds: 30));
walletProvider.walletNameFocus.requestFocus();
},
child: ClipRRect(
child: Image.asset(
walletProvider.isEditing
? 'assets/walletOptions/android-checkmark.png'
: 'assets/walletOptions/edit.png',
width: 20,
height: 20),
)),
const SizedBox(
height: 60,
)
])
const Spacer(),
const Spacer(),
const Spacer(),
]),
]),
]),
);
}),
SizedBox(height: 4 * ratio),
@ -285,169 +114,16 @@ class WalletOptions extends StatelessWidget {
Consumer<WalletOptionsProvider>(
builder: (context, walletProvider, _) {
return Column(children: [
GestureDetector(
key: const Key('copyPubkey'),
onTap: () {
Clipboard.setData(
ClipboardData(text: walletProvider.pubkey.text));
walletProvider.snackCopyKey(ctx);
},
child: SizedBox(
height: 50,
child: Row(children: <Widget>[
const SizedBox(width: 30),
Image.asset(
'assets/walletOptions/key.png',
height: 45,
),
const SizedBox(width: 20),
Text("${shortPubkey.split(':')[0]}:",
style: const TextStyle(
fontSize: 22,
fontWeight: FontWeight.w800,
fontFamily: 'Monospace',
color: Colors.black)),
Text(shortPubkey.split(':')[1],
style: const TextStyle(
fontSize: 22,
fontWeight: FontWeight.w800,
fontFamily: 'Monospace')),
const SizedBox(width: 15),
SizedBox(
height: 40,
child: ElevatedButton(
style: ElevatedButton.styleFrom(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8),
),
elevation: 1,
primary: orangeC, // background
onPrimary: Colors.black, // foreground
),
onPressed: () {
Clipboard.setData(ClipboardData(
text: walletProvider.pubkey.text));
walletProvider.snackCopyKey(ctx);
},
child: Row(children: <Widget>[
Image.asset(
'assets/walletOptions/copy-white.png',
height: 25,
),
const SizedBox(width: 7),
Text(
'Copier',
style: TextStyle(
fontSize: 15, color: Colors.grey[50]),
)
]),
),
),
]),
),
),
pubkeyWidget(walletProvider, ctx),
SizedBox(height: 10 * ratio),
InkWell(
key: const Key('displayHistory'),
onTap: () {
_historyProvider.nPage = 1;
Navigator.push(
context,
MaterialPageRoute(builder: (context) {
return HistoryScreen(
pubkey: walletProvider.pubkey.text,
avatar: wallet.imageFile == null
? Image.asset(
'assets/avatars/${wallet.imageName}',
width: 110,
)
: Image.file(
wallet.imageFile!,
width: 110,
));
}),
);
},
child: SizedBox(
height: 50,
child: Row(children: <Widget>[
const SizedBox(width: 30),
Image.asset(
'assets/walletOptions/clock.png',
height: 45,
),
const SizedBox(width: 22),
const Text('Historique des transactions',
style:
TextStyle(fontSize: 20, color: Colors.black)),
]),
),
),
historyWidget(context, _historyProvider, walletProvider),
SizedBox(height: 12 * ratio),
InkWell(
key: const Key('setDefaultWallet'),
onTap: !walletProvider.isDefaultWallet
? () {
defaultWallet = wallet;
chestBox.get(currentChest)!.defaultWallet =
wallet.number;
_myWalletProvider.readAllWallets(_currentChest);
_myWalletProvider.rebuildWidget();
}
: null,
child: SizedBox(
height: 50,
child: Row(children: <Widget>[
const SizedBox(width: 31),
CircleAvatar(
backgroundColor: Colors
.grey[walletProvider.isDefaultWallet ? 300 : 500],
child: Image.asset(
'assets/walletOptions/android-checkmark.png',
height: 25,
),
),
const SizedBox(width: 22),
Text(
walletProvider.isDefaultWallet
? 'Ce portefeuille est celui par defaut'
: 'Définir comme portefeuille par défaut',
style: TextStyle(
fontSize: 20,
color: walletProvider.isDefaultWallet
? Colors.grey[500]
: Colors.black)),
]),
),
),
setDefaultWallet(walletProvider, _myWalletProvider,
_walletOptions, _currentChest),
SizedBox(height: 17 * ratio),
if (!walletProvider.isDefaultWallet)
InkWell(
key: const Key('deleteWallet'),
onTap: !walletProvider.isDefaultWallet
? () async {
await walletProvider.deleteWallet(
context, wallet);
WidgetsBinding.instance!.addPostFrameCallback((_) {
_myWalletProvider.listWallets =
_myWalletProvider
.readAllWallets(_currentChest);
_myWalletProvider.rebuildWidget();
});
}
: null,
child: Row(children: <Widget>[
const SizedBox(width: 30),
Image.asset(
'assets/walletOptions/trash.png',
height: 45,
),
const SizedBox(width: 19),
const Text('Supprimer ce portefeuille',
style: TextStyle(
fontSize: 20, color: Color(0xffD80000))),
]),
),
deleteWallet(context, walletProvider, _myWalletProvider,
_currentChest)
]);
}),
]),
@ -456,4 +132,329 @@ class WalletOptions extends StatelessWidget {
),
);
}
Widget avatar(WalletOptionsProvider walletProvider) {
return Stack(
children: <Widget>[
InkWell(
onTap: () async {
File newAvatar =
await (walletProvider.changeAvatar());
wallet.imageFile = newAvatar;
walletProvider.reloadBuild();
},
child: wallet.imageFile == null
? Image.asset(
'assets/avatars/${wallet.imageName}',
width: 110,
)
: Image.file(
wallet.imageFile!,
width: 110,
),
),
Positioned(
right: 0,
child: InkWell(
onTap: () async {
File newAvatar =
await (walletProvider.changeAvatar());
wallet.imageFile = newAvatar;
walletProvider.reloadBuild();
},
child: Image.asset(
'assets/walletOptions/camera.png',
height: 40,
),
),
),
],
);
}
Widget walletName(WalletOptionsProvider walletProvider,
WalletOptionsProvider _walletOptions) {
int _nbrLinesName = 1;
_walletOptions.nameController.text.length >= 15
? _nbrLinesName = 2
: _nbrLinesName = 1;
if (_walletOptions.nameController.text.length >= 26 && isTall) {
_nbrLinesName = 3;
}
bool _isNewNameValid = false;
if (_isNewNameValid == false) {
_walletOptions.nameController.text = wallet.name!;
} else {
wallet.name = _walletOptions.nameController.text;
}
return SizedBox(
width: 260,
child: Stack(children: <Widget>[
TextField(
key: const Key('walletName'),
autofocus: false,
focusNode: walletProvider.walletNameFocus,
enabled: walletProvider.isEditing,
controller: walletProvider.nameController,
maxLines: _nbrLinesName,
textAlign: TextAlign.center,
decoration: const InputDecoration(
border: InputBorder.none,
focusedBorder: InputBorder.none,
enabledBorder: InputBorder.none,
disabledBorder: InputBorder.none,
contentPadding: EdgeInsets.all(15.0),
),
style: TextStyle(
fontSize: isTall ? 27 : 23,
color: Colors.black,
fontWeight: FontWeight.w400,
fontFamily: 'Monospace'),
),
Positioned(
right: 0,
child: InkWell(
key: const Key('renameWallet'),
onTap: () async {
_isNewNameValid =
walletProvider.editWalletName(wallet.id(), isCesium: false);
await Future.delayed(const Duration(milliseconds: 30));
walletProvider.walletNameFocus.requestFocus();
},
child: ClipRRect(
child: Image.asset(
walletProvider.isEditing
? 'assets/walletOptions/android-checkmark.png'
: 'assets/walletOptions/edit.png',
width: 20,
height: 20),
),
),
),
]),
);
}
Widget balance(WalletOptionsProvider walletProvider) {
return Column(children: <Widget>[
FutureBuilder(
future: walletProvider.getBalance(walletProvider.pubkey.text),
builder: (BuildContext context, AsyncSnapshot<num?> _balance) {
if (_balance.connectionState != ConnectionState.done ||
_balance.hasError) {
return Text('',
style: TextStyle(
fontSize: isTall ? 20 : 18,
));
}
return ImageFiltered(
imageFilter: ImageFilter.blur(
sigmaX: walletProvider.isBalanceBlur ? 6 : 0,
sigmaY: walletProvider.isBalanceBlur ? 5 : 0),
child: Text(
_balance.data.toString() + ' DU',
style: TextStyle(
fontSize: isTall ? 20 : 18,
),
),
);
}),
const SizedBox(height: 5),
InkWell(
key: const Key('displayBalance'),
onTap: () {
walletProvider.bluringBalance();
},
child: Image.asset(
walletProvider.isBalanceBlur
? 'assets/walletOptions/icon_oeuil.png'
: 'assets/walletOptions/icon_oeuil_close.png',
height: 35,
),
),
]);
}
Widget pubkeyWidget(WalletOptionsProvider walletProvider, BuildContext ctx) {
final String shortPubkey =
walletProvider.getShortPubkey(walletProvider.pubkey.text);
return GestureDetector(
key: const Key('copyPubkey'),
onTap: () {
Clipboard.setData(ClipboardData(text: walletProvider.pubkey.text));
walletProvider.snackCopyKey(ctx);
},
child: SizedBox(
height: 50,
child: Row(children: <Widget>[
const SizedBox(width: 30),
Image.asset(
'assets/walletOptions/key.png',
height: 45,
),
const SizedBox(width: 20),
Text("${shortPubkey.split(':')[0]}:",
style: const TextStyle(
fontSize: 22,
fontWeight: FontWeight.w800,
fontFamily: 'Monospace',
color: Colors.black)),
Text(shortPubkey.split(':')[1],
style: const TextStyle(
fontSize: 22,
fontWeight: FontWeight.w800,
fontFamily: 'Monospace')),
const SizedBox(width: 15),
SizedBox(
height: 40,
child: ElevatedButton(
style: ElevatedButton.styleFrom(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8),
),
elevation: 1,
primary: orangeC, // background
onPrimary: Colors.black, // foreground
),
onPressed: () {
Clipboard.setData(
ClipboardData(text: walletProvider.pubkey.text));
walletProvider.snackCopyKey(ctx);
},
child: Row(children: <Widget>[
Image.asset(
'assets/walletOptions/copy-white.png',
height: 25,
),
const SizedBox(width: 7),
Text(
'Copier',
style: TextStyle(fontSize: 15, color: Colors.grey[50]),
)
]),
),
),
]),
),
);
}
Widget historyWidget(
BuildContext context,
WalletsProfilesProvider _historyProvider,
WalletOptionsProvider walletProvider) {
return InkWell(
key: const Key('displayHistory'),
onTap: () {
_historyProvider.nPage = 1;
Navigator.push(
context,
MaterialPageRoute(builder: (context) {
return HistoryScreen(
pubkey: walletProvider.pubkey.text,
avatar: wallet.imageFile == null
? Image.asset(
'assets/avatars/${wallet.imageName}',
width: 110,
)
: Image.file(
wallet.imageFile!,
width: 110,
));
}),
);
},
child: SizedBox(
height: 50,
child: Row(children: <Widget>[
const SizedBox(width: 30),
Image.asset(
'assets/walletOptions/clock.png',
height: 45,
),
const SizedBox(width: 22),
const Text('Historique des transactions',
style: TextStyle(fontSize: 20, color: Colors.black)),
]),
),
);
}
Widget setDefaultWallet(
WalletOptionsProvider walletProvider,
MyWalletsProvider _myWalletProvider,
WalletOptionsProvider _walletOptions,
int _currentChest) {
WalletData defaultWallet =
_myWalletProvider.getDefaultWallet(_currentChest)!;
_walletOptions.isDefaultWallet = (defaultWallet.number == wallet.id()[1]);
return InkWell(
key: const Key('setDefaultWallet'),
onTap: !walletProvider.isDefaultWallet
? () {
defaultWallet = wallet;
chestBox.get(_currentChest)!.defaultWallet = wallet.number;
_myWalletProvider.readAllWallets(_currentChest);
_myWalletProvider.rebuildWidget();
}
: null,
child: SizedBox(
height: 50,
child: Row(children: <Widget>[
const SizedBox(width: 31),
CircleAvatar(
backgroundColor:
Colors.grey[walletProvider.isDefaultWallet ? 300 : 500],
child: Image.asset(
'assets/walletOptions/android-checkmark.png',
height: 25,
),
),
const SizedBox(width: 22),
Text(
walletProvider.isDefaultWallet
? 'Ce portefeuille est celui par defaut'
: 'Définir comme portefeuille par défaut',
style: TextStyle(
fontSize: 20,
color: walletProvider.isDefaultWallet
? Colors.grey[500]
: Colors.black)),
]),
),
);
}
Widget deleteWallet(
BuildContext context,
WalletOptionsProvider walletProvider,
MyWalletsProvider _myWalletProvider,
int _currentChest) {
return InkWell(
key: const Key('deleteWallet'),
onTap: !walletProvider.isDefaultWallet
? () async {
await walletProvider.deleteWallet(context, wallet);
WidgetsBinding.instance!.addPostFrameCallback((_) {
_myWalletProvider.listWallets =
_myWalletProvider.readAllWallets(_currentChest);
_myWalletProvider.rebuildWidget();
});
}
: null,
child: Row(children: <Widget>[
const SizedBox(width: 30),
Image.asset(
'assets/walletOptions/trash.png',
height: 45,
),
const SizedBox(width: 19),
const Text('Supprimer ce portefeuille',
style: TextStyle(fontSize: 20, color: Color(0xffD80000))),
]),
);
}
}

View File

@ -68,11 +68,12 @@ class WalletsHome extends StatelessWidget {
return Column(children: [
const SizedBox(height: 50),
SizedBox(
height: 120,
width: 445,
height: 90,
width: 420,
child: ElevatedButton.icon(
icon: Image.asset(
'assets/chests/config.png',
height: 60,
),
style: ElevatedButton.styleFrom(
elevation: 2,
@ -86,9 +87,9 @@ class WalletsHome extends StatelessWidget {
}),
),
label: const Text(
" Paramétrer ce coffre",
" Paramétrer ce coffre",
style: TextStyle(
fontSize: 25,
fontSize: 22,
fontWeight: FontWeight.w700,
color: Color(0xff8a3c0f),
),
@ -96,10 +97,13 @@ class WalletsHome extends StatelessWidget {
)),
const SizedBox(height: 30),
SizedBox(
height: 120,
width: 445,
height: 90,
width: 420,
child: ElevatedButton.icon(
icon: Image.asset('assets/chests/miniChests.png'),
icon: Image.asset(
'assets/chests/miniChests.png',
height: 70,
),
style: ElevatedButton.styleFrom(
elevation: 2,
primary: floattingYellow, // background
@ -112,9 +116,9 @@ class WalletsHome extends StatelessWidget {
}),
),
label: const Text(
" Changer de coffre",
" Changer de coffre",
style: TextStyle(
fontSize: 25,
fontSize: 22,
fontWeight: FontWeight.w700,
color: Color(0xff8a3c0f),
),
@ -148,12 +152,20 @@ class WalletsHome extends StatelessWidget {
List _listWallets = _myWalletProvider.listWallets;
WalletData? defaultWallet =
_myWalletProvider.getDefaultWallet(configBox.get('currentChest'));
final double screenWidth = MediaQuery.of(context).size.width;
int nTule = 2;
if (screenWidth >= 900) {
nTule = 4;
} else if (screenWidth >= 650) {
nTule = 3;
}
return CustomScrollView(slivers: <Widget>[
const SliverToBoxAdapter(child: SizedBox(height: 20)),
SliverGrid.count(
key: const Key('listWallets'),
crossAxisCount: 2,
crossAxisCount: nTule,
childAspectRatio: 1,
crossAxisSpacing: 0,
mainAxisSpacing: 0,

View File

@ -31,7 +31,7 @@ class OnboardingStepTwelve extends StatelessWidget {
const SizedBox(height: 10),
Image.asset(
'assets/onBoarding/plusieurs-codes-secrets-un-trousseau.png',
height: 410 * ratio,
height: isTall ? 410 : 380,
),
Expanded(
child: Align(
@ -57,7 +57,7 @@ class OnboardingStepTwelve extends StatelessWidget {
child: const Text("Générer le code secret",
style: TextStyle(fontSize: 20))),
))),
SizedBox(height: isTall ? 80 : 40),
const SizedBox(height: 80),
]),
));
}

View File

@ -112,7 +112,7 @@ class OnboardingStepFourteen extends StatelessWidget {
)
],
onCompleted: (_pin) async {
_myWalletProvider.pinCode = _pin;
_myWalletProvider.pinCode = _pin.toUpperCase();
_myWalletProvider.pinLenght = _pinLenght;
log.d(_pin + ' || ' + _generateWalletProvider.pin.text);
if (_pin.toUpperCase() == _generateWalletProvider.pin.text) {
@ -124,10 +124,12 @@ class OnboardingStepFourteen extends StatelessWidget {
await _generateWalletProvider.storeHDWChest(
generatedWallet, 'Mon portefeuille courant', context);
_myWalletProvider.readAllWallets(_currentChest);
scheduleMicrotask(() {
_walletOptions.reloadBuild();
_myWalletProvider.rebuildWidget();
});
// scheduleMicrotask(() {
_walletOptions.reloadBuild();
// _myWalletProvider.rebuildWidget();
// });
_generateWalletProvider.generatedMnemonic =
_generateWalletProvider.pin.text = '';
Navigator.push(
context,
FaderTransition(

View File

@ -43,8 +43,8 @@ class OnboardingStepSeven extends StatelessWidget {
Container(
padding: const EdgeInsets.only(bottom: 90),
child: common.bubbleSpeak(
"Moi, jai déjà essayé de\nmémoriser une phrase de\nrestauration, mais je nai\npas une mémoire\ndéléphant.",
),
"Moi, jai déjà essayé de\nmémoriser une phrase de\nrestauration, mais je nai\npas une mémoire\ndéléphant.",
isMaxWidth: false),
),
Image.asset(
'assets/onBoarding/chopp-gecko.png',

View File

@ -29,7 +29,7 @@ class OnboardingStepEight extends StatelessWidget {
"Jai généré votre phrase de restauration !\nTâchez de la garder bien secrète, car elle permet à quiconque la connaît daccéder à tous vos portefeuilles.",
textKey: const Key('step6'),
),
SizedBox(height: isTall ? 61 : 31),
SizedBox(height: isTall ? 70 : 40),
// SizedBox(height: 30),
sentanceArray(context),
// ),
@ -63,9 +63,10 @@ class OnboardingStepEight extends StatelessWidget {
}
Widget sentanceArray(BuildContext context) {
return Container(
return Padding(
padding: const EdgeInsets.symmetric(horizontal: 12),
child: Container(
constraints: const BoxConstraints(maxWidth: 450),
decoration: BoxDecoration(
border: Border.all(color: Colors.black),
color: Colors.grey[300],
@ -116,7 +117,7 @@ Widget arrayCell(dataWord) {
ImageFiltered(
imageFilter: ImageFilter.blur(sigmaX: 4, sigmaY: 4),
child: Text(dataWord.split(':')[1],
style: const TextStyle(fontSize: 20, color: Colors.black)),
style: const TextStyle(fontSize: 19, color: Colors.black)),
)
],
));

View File

@ -115,9 +115,10 @@ Widget sentanceArray(BuildContext context) {
List formatedArray = _generateWalletProvider.generateWordList();
return Container(
return Padding(
padding: const EdgeInsets.symmetric(horizontal: 12),
child: Container(
constraints: const BoxConstraints(maxWidth: 450),
decoration: BoxDecoration(
border: Border.all(color: Colors.black),
color: Colors.grey[300],
@ -187,6 +188,11 @@ class PrintWallet extends StatelessWidget {
return MaterialApp(
home: Scaffold(
appBar: AppBar(
leading: IconButton(
icon: const Icon(Icons.arrow_back, color: Colors.white),
onPressed: () {
Navigator.pop(context);
}),
toolbarHeight: 60 * ratio,
title: const Text('Imprimer ce trousseau')),
body: PdfPreview(

View File

@ -14,6 +14,7 @@ class SearchScreen extends StatelessWidget {
Widget build(BuildContext context) {
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
SearchProvider _searchProvider = Provider.of<SearchProvider>(context);
final double screenHeight = MediaQuery.of(context).size.height;
return WillPopScope(
onWillPop: () {
@ -101,7 +102,7 @@ class SearchScreen extends StatelessWidget {
),
),
),
const Spacer(flex: 1),
Spacer(flex: screenHeight <= 800 ? 1 : 2),
]),
),
));

View File

@ -440,9 +440,9 @@ void main() {
await goBack();
await deleteAllWallets();
await sleep(100);
final String pincode = await (createNewKeychain('Fast wallet') as FutureOr<String>);
final String? pincode = await (createNewKeychain('Fast wallet'));
await sleep(200);
await driver!.enterText(pincode);
await driver!.enterText(pincode!);
await sleep(100);
await createDerivation();
await sleep(100);