improve design of name + balance on wallet_home screen
This commit is contained in:
parent
90f91be987
commit
c203364dc3
|
@ -14,6 +14,7 @@ import 'package:gecko/providers/wallets_profiles.dart';
|
||||||
import 'package:gecko/screens/wallet_view.dart';
|
import 'package:gecko/screens/wallet_view.dart';
|
||||||
import 'package:graphql_flutter/graphql_flutter.dart';
|
import 'package:graphql_flutter/graphql_flutter.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
|
import 'package:truncate/truncate.dart';
|
||||||
|
|
||||||
class DuniterIndexer with ChangeNotifier {
|
class DuniterIndexer with ChangeNotifier {
|
||||||
Map<String, String?> walletNameIndexer = {};
|
Map<String, String?> walletNameIndexer = {};
|
||||||
|
@ -224,7 +225,7 @@ class DuniterIndexer with ChangeNotifier {
|
||||||
return Text(
|
return Text(
|
||||||
_color == Colors.grey[700]!
|
_color == Colors.grey[700]!
|
||||||
? '(${walletNameIndexer[address]!})'
|
? '(${walletNameIndexer[address]!})'
|
||||||
: walletNameIndexer[address]!,
|
: truncate(walletNameIndexer[address]!, 20),
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: size,
|
fontSize: size,
|
||||||
color: _color,
|
color: _color,
|
||||||
|
|
|
@ -14,6 +14,7 @@ import 'package:gecko/screens/transaction_in_progress.dart';
|
||||||
import 'package:image_picker/image_picker.dart';
|
import 'package:image_picker/image_picker.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
import 'package:image_cropper/image_cropper.dart';
|
import 'package:image_cropper/image_cropper.dart';
|
||||||
|
import 'package:truncate/truncate.dart';
|
||||||
|
|
||||||
class WalletOptionsProvider with ChangeNotifier {
|
class WalletOptionsProvider with ChangeNotifier {
|
||||||
TextEditingController address = TextEditingController();
|
TextEditingController address = TextEditingController();
|
||||||
|
@ -504,22 +505,22 @@ class WalletOptionsProvider with ChangeNotifier {
|
||||||
|
|
||||||
Widget walletName(BuildContext context, WalletData wallet,
|
Widget walletName(BuildContext context, WalletData wallet,
|
||||||
[double size = 20, Color color = Colors.black]) {
|
[double size = 20, Color color = Colors.black]) {
|
||||||
return SizedBox(
|
double newSize = wallet.name!.length <= 15 ? size : size - 2;
|
||||||
width: 260,
|
|
||||||
child:
|
return Row(mainAxisAlignment: MainAxisAlignment.center, children: <Widget>[
|
||||||
Row(mainAxisAlignment: MainAxisAlignment.center, children: <Widget>[
|
Text(
|
||||||
Text(
|
truncate(wallet.name!, 20),
|
||||||
wallet.name!,
|
textAlign: TextAlign.center,
|
||||||
textAlign: TextAlign.center,
|
style: TextStyle(
|
||||||
style: TextStyle(
|
fontSize: isTall ? newSize : newSize * 0.9,
|
||||||
fontSize: isTall ? size : size * 0.9,
|
color: color,
|
||||||
color: color,
|
fontWeight: FontWeight.w400,
|
||||||
fontWeight: FontWeight.w400,
|
fontStyle: FontStyle.italic,
|
||||||
fontStyle: FontStyle.italic,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
]),
|
softWrap: false,
|
||||||
);
|
overflow: TextOverflow.ellipsis,
|
||||||
|
),
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -138,8 +138,6 @@ class WalletsHome extends StatelessWidget {
|
||||||
Provider.of<MyWalletsProvider>(context);
|
Provider.of<MyWalletsProvider>(context);
|
||||||
WalletOptionsProvider _walletOptions =
|
WalletOptionsProvider _walletOptions =
|
||||||
Provider.of<WalletOptionsProvider>(context, listen: false);
|
Provider.of<WalletOptionsProvider>(context, listen: false);
|
||||||
DuniterIndexer _duniterIndexer =
|
|
||||||
Provider.of<DuniterIndexer>(context, listen: false);
|
|
||||||
final bool isWalletsExists = _myWalletProvider.checkIfWalletExist();
|
final bool isWalletsExists = _myWalletProvider.checkIfWalletExist();
|
||||||
|
|
||||||
if (!isWalletsExists) {
|
if (!isWalletsExists) {
|
||||||
|
@ -183,8 +181,6 @@ class WalletsHome extends StatelessWidget {
|
||||||
padding: const EdgeInsets.all(16),
|
padding: const EdgeInsets.all(16),
|
||||||
child: GestureDetector(
|
child: GestureDetector(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
// _walletOptions.readLocalWallet(context, _repository,
|
|
||||||
// _myWalletProvider.pinCode, pinLength);
|
|
||||||
_walletOptions.getAddress(
|
_walletOptions.getAddress(
|
||||||
_currentChestNumber, _repository.derivation!);
|
_currentChestNumber, _repository.derivation!);
|
||||||
Navigator.push(
|
Navigator.push(
|
||||||
|
@ -195,11 +191,6 @@ class WalletsHome extends StatelessWidget {
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
// Navigator.push(context,
|
|
||||||
// MaterialPageRoute(builder: (context) {
|
|
||||||
// return UnlockingWallet(wallet: _repository);
|
|
||||||
// }));
|
|
||||||
},
|
},
|
||||||
child: ClipOvalShadow(
|
child: ClipOvalShadow(
|
||||||
shadow: const Shadow(
|
shadow: const Shadow(
|
||||||
|
@ -248,67 +239,12 @@ class WalletsHome extends StatelessWidget {
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
)),
|
)),
|
||||||
balanceBuilder(context, _repository.address!,
|
Stack(children: <Widget>[
|
||||||
_repository.address == defaultWallet.address),
|
balanceBuilder(context, _repository.address!,
|
||||||
ListTile(
|
_repository.address == defaultWallet.address),
|
||||||
shape: const RoundedRectangleBorder(
|
nameBuilder(context, _repository, defaultWallet,
|
||||||
borderRadius: BorderRadius.vertical(
|
_currentChestNumber),
|
||||||
bottom: Radius.circular(12))),
|
]),
|
||||||
// contentPadding: const EdgeInsets.only(left: 7.0),
|
|
||||||
tileColor:
|
|
||||||
_repository.address == defaultWallet.address
|
|
||||||
? orangeC
|
|
||||||
: const Color(0xffFFD58D),
|
|
||||||
// leading: Text('IMAGE'),
|
|
||||||
|
|
||||||
// subtitle: Text(_repository.split(':')[3],
|
|
||||||
// style: TextStyle(fontSize: 12.0, fontFamily: 'Monospace')),
|
|
||||||
title: Center(
|
|
||||||
child: Padding(
|
|
||||||
padding:
|
|
||||||
const EdgeInsets.symmetric(horizontal: 5),
|
|
||||||
child: _duniterIndexer.getNameByAddress(
|
|
||||||
context,
|
|
||||||
_repository.address!,
|
|
||||||
_repository,
|
|
||||||
17,
|
|
||||||
true,
|
|
||||||
_repository.id()[1] == defaultWallet.id()[1]
|
|
||||||
? const Color(0xffF9F9F1)
|
|
||||||
: Colors.black),
|
|
||||||
|
|
||||||
// Text(
|
|
||||||
// _repository.name!,
|
|
||||||
// textAlign: TextAlign.center,
|
|
||||||
// style: TextStyle(
|
|
||||||
// fontSize: 17.0,
|
|
||||||
// color: _repository.id()[1] ==
|
|
||||||
// defaultWallet.id()[1]
|
|
||||||
// ? const Color(0xffF9F9F1)
|
|
||||||
// : Colors.black,
|
|
||||||
// fontStyle: FontStyle.italic),
|
|
||||||
// ),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
// dense: true,
|
|
||||||
onTap: () {
|
|
||||||
// _walletOptions.readLocalWallet(
|
|
||||||
// context,
|
|
||||||
// _repository,
|
|
||||||
// _myWalletProvider.pinCode,
|
|
||||||
// pinLength);
|
|
||||||
_walletOptions.getAddress(
|
|
||||||
_currentChestNumber, _repository.derivation!);
|
|
||||||
Navigator.push(
|
|
||||||
context,
|
|
||||||
SmoothTransition(
|
|
||||||
page: WalletOptions(
|
|
||||||
wallet: _repository,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
)
|
|
||||||
]),
|
]),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@ -336,23 +272,65 @@ class WalletsHome extends StatelessWidget {
|
||||||
return Container(
|
return Container(
|
||||||
width: double.infinity,
|
width: double.infinity,
|
||||||
color: isDefault ? orangeC : yellowC,
|
color: isDefault ? orangeC : yellowC,
|
||||||
child: SizedBox(
|
child: Padding(
|
||||||
height: 25,
|
padding: const EdgeInsets.only(left: 5, right: 5, top: 38),
|
||||||
child: Column(children: [
|
child: balance(
|
||||||
const Spacer(),
|
|
||||||
// Text(
|
|
||||||
// '0.0 gd',
|
|
||||||
// textAlign: TextAlign.center,
|
|
||||||
// style: TextStyle(color: isDefault ? Colors.white : Colors.black),
|
|
||||||
// ),
|
|
||||||
balance(
|
|
||||||
context,
|
context,
|
||||||
_address,
|
_address,
|
||||||
15,
|
15,
|
||||||
isDefault ? Colors.white : Colors.black,
|
isDefault ? Colors.white : Colors.black,
|
||||||
isDefault ? yellowC : orangeC)
|
isDefault ? yellowC : orangeC)),
|
||||||
]),
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget nameBuilder(BuildContext context, WalletData _repository,
|
||||||
|
WalletData defaultWallet, int _currentChestNumber) {
|
||||||
|
WalletOptionsProvider _walletOptions =
|
||||||
|
Provider.of<WalletOptionsProvider>(context, listen: false);
|
||||||
|
DuniterIndexer _duniterIndexer =
|
||||||
|
Provider.of<DuniterIndexer>(context, listen: false);
|
||||||
|
return ListTile(
|
||||||
|
shape: const RoundedRectangleBorder(
|
||||||
|
borderRadius: BorderRadius.vertical(bottom: Radius.circular(12))),
|
||||||
|
// contentPadding: const EdgeInsets.only(left: 7.0),
|
||||||
|
tileColor: _repository.address == defaultWallet.address
|
||||||
|
? orangeC
|
||||||
|
: const Color(0xffFFD58D),
|
||||||
|
// leading: Text('IMAGE'),
|
||||||
|
|
||||||
|
// subtitle: Text(_repository.split(':')[3],
|
||||||
|
// style: TextStyle(fontSize: 12.0, fontFamily: 'Monospace')),
|
||||||
|
title: Center(
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.only(left: 5, right: 5, bottom: 35, top: 5),
|
||||||
|
child: _duniterIndexer.getNameByAddress(
|
||||||
|
context,
|
||||||
|
_repository.address!,
|
||||||
|
_repository,
|
||||||
|
20,
|
||||||
|
true,
|
||||||
|
_repository.id()[1] == defaultWallet.id()[1]
|
||||||
|
? const Color(0xffF9F9F1)
|
||||||
|
: Colors.black),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
|
// dense: true,
|
||||||
|
onTap: () {
|
||||||
|
// _walletOptions.readLocalWallet(
|
||||||
|
// context,
|
||||||
|
// _repository,
|
||||||
|
// _myWalletProvider.pinCode,
|
||||||
|
// pinLength);
|
||||||
|
_walletOptions.getAddress(_currentChestNumber, _repository.derivation!);
|
||||||
|
Navigator.push(
|
||||||
|
context,
|
||||||
|
SmoothTransition(
|
||||||
|
page: WalletOptions(
|
||||||
|
wallet: _repository,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue