forked from axiom-team/gecko
payment inter wallets is working; bug with feedback position
This commit is contained in:
parent
edbe1d8b5c
commit
8b32bb8e26
|
@ -339,7 +339,7 @@ class DuniterIndexer with ChangeNotifier {
|
|||
MaterialPageRoute(builder: (context) {
|
||||
walletsProfiles.address = profile['id'];
|
||||
return WalletViewScreen(
|
||||
pubkey: profile['id'],
|
||||
address: profile['id'],
|
||||
username: g1WalletsBox
|
||||
.get(profile['id'])
|
||||
?.id
|
||||
|
|
|
@ -44,7 +44,7 @@ class WalletsProfilesProvider with ChangeNotifier {
|
|||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(builder: (context) {
|
||||
return WalletViewScreen(pubkey: barcode!.rawContent);
|
||||
return WalletViewScreen(address: barcode!.rawContent);
|
||||
}),
|
||||
);
|
||||
} else {
|
||||
|
|
|
@ -354,7 +354,7 @@ class ActivityScreen extends StatelessWidget with ChangeNotifier {
|
|||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(builder: (context) {
|
||||
return WalletViewScreen(pubkey: repository[1]);
|
||||
return WalletViewScreen(address: repository[1]);
|
||||
}),
|
||||
);
|
||||
// Navigator.pop(context);
|
||||
|
|
|
@ -53,8 +53,6 @@ class ChooseWalletScreen extends StatelessWidget {
|
|||
),
|
||||
onPressed: () async {
|
||||
await sub.setCurrentWallet(selectedWallet!);
|
||||
|
||||
// _walletViewProvider.reload();
|
||||
sub.reload();
|
||||
|
||||
// Navigator.pop(context);
|
||||
|
|
|
@ -18,6 +18,7 @@ import 'package:gecko/screens/myWallets/choose_chest.dart';
|
|||
import 'package:gecko/screens/myWallets/import_g1_v1.dart';
|
||||
import 'package:gecko/screens/myWallets/unlocking_wallet.dart';
|
||||
import 'package:gecko/screens/myWallets/wallet_options.dart';
|
||||
import 'package:gecko/screens/wallet_view.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
class WalletsHome extends StatelessWidget {
|
||||
|
@ -159,6 +160,7 @@ class WalletsHome extends StatelessWidget {
|
|||
WalletOptionsProvider walletOptions =
|
||||
Provider.of<WalletOptionsProvider>(context, listen: false);
|
||||
final bool isWalletsExists = myWalletProvider.checkIfWalletExist();
|
||||
SubstrateSdk sub = Provider.of<SubstrateSdk>(context, listen: false);
|
||||
|
||||
if (!isWalletsExists) {
|
||||
return const Text('');
|
||||
|
@ -196,78 +198,114 @@ class WalletsHome extends StatelessWidget {
|
|||
mainAxisSpacing: 0,
|
||||
children: <Widget>[
|
||||
for (WalletData repository in listWallets as Iterable<WalletData>)
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(16),
|
||||
child: GestureDetector(
|
||||
key: keyOpenWallet(repository.address!),
|
||||
onTap: () {
|
||||
walletOptions.getAddress(
|
||||
currentChestNumber, repository.derivation!);
|
||||
Navigator.push(
|
||||
context,
|
||||
SmoothTransition(
|
||||
page: WalletOptions(
|
||||
wallet: repository,
|
||||
LongPressDraggable<String>(
|
||||
data: repository.address!,
|
||||
dragAnchorStrategy:
|
||||
(Draggable<Object> _, BuildContext __, Offset ___) =>
|
||||
const Offset(0, 0),
|
||||
feedback: ElevatedButton(
|
||||
onPressed: () {},
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: orangeC,
|
||||
shape: const CircleBorder(),
|
||||
padding: const EdgeInsets.all(15),
|
||||
),
|
||||
child: const SizedBox(
|
||||
height: 35,
|
||||
child: Image(image: AssetImage('assets/vector_white.png')),
|
||||
),
|
||||
),
|
||||
child: DragTarget<String>(onAccept: (senderAddress) async {
|
||||
log.d(
|
||||
'INTERPAY: sender: $senderAddress --- receiver: ${repository.address!}');
|
||||
final walletData =
|
||||
myWalletProvider.getWalletDataByAddress(senderAddress);
|
||||
await sub.setCurrentWallet(walletData!);
|
||||
sub.reload();
|
||||
paymentPopup(context, repository.address!);
|
||||
}, builder: (
|
||||
BuildContext context,
|
||||
List<dynamic> accepted,
|
||||
List<dynamic> rejected,
|
||||
) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.all(16),
|
||||
child: GestureDetector(
|
||||
key: keyOpenWallet(repository.address!),
|
||||
onTap: () {
|
||||
walletOptions.getAddress(
|
||||
currentChestNumber, repository.derivation!);
|
||||
Navigator.push(
|
||||
context,
|
||||
SmoothTransition(
|
||||
page: WalletOptions(
|
||||
wallet: repository,
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
child: ClipOvalShadow(
|
||||
shadow: const Shadow(
|
||||
color: Colors.transparent,
|
||||
offset: Offset(0, 0),
|
||||
blurRadius: 5,
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
child: ClipOvalShadow(
|
||||
shadow: const Shadow(
|
||||
color: Colors.transparent,
|
||||
offset: Offset(0, 0),
|
||||
blurRadius: 5,
|
||||
),
|
||||
clipper: CustomClipperOval(),
|
||||
child: ClipRRect(
|
||||
borderRadius:
|
||||
const BorderRadius.all(Radius.circular(12)),
|
||||
child: Column(children: <Widget>[
|
||||
Expanded(
|
||||
child: Container(
|
||||
width: double.infinity,
|
||||
height: double.infinity,
|
||||
decoration: BoxDecoration(
|
||||
gradient: RadialGradient(
|
||||
radius: 0.6,
|
||||
colors: [
|
||||
Colors.green[400]!,
|
||||
const Color(0xFFE7E7A6),
|
||||
],
|
||||
)),
|
||||
child:
|
||||
// SvgPicture.asset('assets/chopp-gecko2.png',
|
||||
// semanticsLabel: 'Gecko', height: 48),
|
||||
repository.imageCustomPath == null ||
|
||||
repository.imageCustomPath == ''
|
||||
? Image.asset(
|
||||
'assets/avatars/${repository.imageDefaultPath}',
|
||||
alignment: Alignment.bottomCenter,
|
||||
scale: 0.5,
|
||||
)
|
||||
: Container(
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
color: Colors.transparent,
|
||||
image: DecorationImage(
|
||||
fit: BoxFit.fitHeight,
|
||||
image: FileImage(
|
||||
File(repository.imageCustomPath!),
|
||||
clipper: CustomClipperOval(),
|
||||
child: ClipRRect(
|
||||
borderRadius:
|
||||
const BorderRadius.all(Radius.circular(12)),
|
||||
child: Column(children: <Widget>[
|
||||
Expanded(
|
||||
child: Container(
|
||||
width: double.infinity,
|
||||
height: double.infinity,
|
||||
decoration: BoxDecoration(
|
||||
gradient: RadialGradient(
|
||||
radius: 0.6,
|
||||
colors: [
|
||||
Colors.green[400]!,
|
||||
const Color(0xFFE7E7A6),
|
||||
],
|
||||
)),
|
||||
child:
|
||||
// SvgPicture.asset('assets/chopp-gecko2.png',
|
||||
// semanticsLabel: 'Gecko', height: 48),
|
||||
repository.imageCustomPath == null ||
|
||||
repository.imageCustomPath == ''
|
||||
? Image.asset(
|
||||
'assets/avatars/${repository.imageDefaultPath}',
|
||||
alignment: Alignment.bottomCenter,
|
||||
scale: 0.5,
|
||||
)
|
||||
: Container(
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
color: Colors.transparent,
|
||||
image: DecorationImage(
|
||||
fit: BoxFit.fitHeight,
|
||||
image: FileImage(
|
||||
File(repository
|
||||
.imageCustomPath!),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
)),
|
||||
Stack(children: <Widget>[
|
||||
balanceBuilder(context, repository.address!,
|
||||
repository.address == defaultWallet.address),
|
||||
nameBuilder(context, repository, defaultWallet,
|
||||
currentChestNumber),
|
||||
]),
|
||||
]),
|
||||
),
|
||||
),
|
||||
)),
|
||||
)),
|
||||
Stack(children: <Widget>[
|
||||
balanceBuilder(
|
||||
context,
|
||||
repository.address!,
|
||||
repository.address ==
|
||||
defaultWallet.address),
|
||||
nameBuilder(context, repository, defaultWallet,
|
||||
currentChestNumber),
|
||||
]),
|
||||
]),
|
||||
),
|
||||
),
|
||||
));
|
||||
}),
|
||||
),
|
||||
Consumer<SubstrateSdk>(builder: (context, sub, _) {
|
||||
return sub.nodeConnected
|
||||
? addNewDerivation(context)
|
||||
|
|
|
@ -116,7 +116,7 @@ class ContactsScreen extends StatelessWidget {
|
|||
walletsProfilesClass.address =
|
||||
g1Wallet.pubkey;
|
||||
return WalletViewScreen(
|
||||
pubkey: g1Wallet.pubkey,
|
||||
address: g1Wallet.pubkey,
|
||||
username: g1WalletsBox
|
||||
.get(g1Wallet.pubkey)
|
||||
?.id
|
||||
|
|
|
@ -143,7 +143,7 @@ class SearchResultScreen extends StatelessWidget {
|
|||
walletsProfilesClass.address =
|
||||
g1Wallet.pubkey;
|
||||
return WalletViewScreen(
|
||||
pubkey: g1Wallet.pubkey,
|
||||
address: g1Wallet.pubkey,
|
||||
username: g1WalletsBox
|
||||
.get(g1Wallet.pubkey)
|
||||
?.id
|
||||
|
|
|
@ -24,9 +24,9 @@ import 'package:qr_flutter/qr_flutter.dart';
|
|||
|
||||
class WalletViewScreen extends StatelessWidget {
|
||||
const WalletViewScreen(
|
||||
{required this.pubkey, this.username, this.avatar, Key? key})
|
||||
{required this.address, this.username, this.avatar, Key? key})
|
||||
: super(key: key);
|
||||
final String? pubkey;
|
||||
final String? address;
|
||||
final String? username;
|
||||
final Image? avatar;
|
||||
final double buttonSize = 100;
|
||||
|
@ -39,7 +39,7 @@ class WalletViewScreen extends StatelessWidget {
|
|||
Provider.of<WalletsProfilesProvider>(context, listen: false);
|
||||
CesiumPlusProvider cesiumPlusProvider =
|
||||
Provider.of<CesiumPlusProvider>(context, listen: false);
|
||||
walletProfile.address = pubkey!;
|
||||
walletProfile.address = address!;
|
||||
SubstrateSdk sub = Provider.of<SubstrateSdk>(context, listen: false);
|
||||
HomeProvider homeProvider =
|
||||
Provider.of<HomeProvider>(context, listen: false);
|
||||
|
@ -67,14 +67,14 @@ class WalletViewScreen extends StatelessWidget {
|
|||
onPressed: () async {
|
||||
G1WalletsList? newContact;
|
||||
g1WalletsBox.toMap().forEach((key, value) {
|
||||
if (key == pubkey) newContact = value;
|
||||
if (key == address) newContact = value;
|
||||
});
|
||||
// G1WalletsList(pubkey: pubkey!, username: username);
|
||||
await walletProfile.addContact(
|
||||
newContact ?? G1WalletsList(pubkey: pubkey!));
|
||||
newContact ?? G1WalletsList(pubkey: address!));
|
||||
},
|
||||
icon: Icon(
|
||||
walletProfile.isContact(pubkey!)
|
||||
walletProfile.isContact(address!)
|
||||
? Icons.add_reaction_rounded
|
||||
: Icons.add_reaction_outlined,
|
||||
size: 35,
|
||||
|
@ -110,7 +110,7 @@ class WalletViewScreen extends StatelessWidget {
|
|||
bottomNavigationBar: homeProvider.bottomAppBar(context),
|
||||
body: SafeArea(
|
||||
child: Column(children: <Widget>[
|
||||
walletProfile.headerProfileView(context, pubkey!, username),
|
||||
walletProfile.headerProfileView(context, address!, username),
|
||||
SizedBox(height: isTall ? 10 : 0),
|
||||
Row(mainAxisAlignment: MainAxisAlignment.spaceAround, children: [
|
||||
Column(children: <Widget>[
|
||||
|
@ -134,7 +134,7 @@ class WalletViewScreen extends StatelessWidget {
|
|||
context,
|
||||
MaterialPageRoute(builder: (context) {
|
||||
return ActivityScreen(
|
||||
address: pubkey,
|
||||
address: address,
|
||||
avatar:
|
||||
cesiumPlusProvider.defaultAvatar(50));
|
||||
}),
|
||||
|
@ -155,7 +155,7 @@ class WalletViewScreen extends StatelessWidget {
|
|||
WalletData? defaultWallet = myWalletProvider.getDefaultWallet();
|
||||
return FutureBuilder(
|
||||
future: sub.certState(defaultWallet.address!,
|
||||
pubkey!), // .canCertify(_defaultWallet.address!, pubkey!),
|
||||
address!), // .canCertify(_defaultWallet.address!, pubkey!),
|
||||
builder: (context, AsyncSnapshot<Map<String, int>> snapshot) {
|
||||
if (snapshot.data == null) return const SizedBox();
|
||||
String duration = '';
|
||||
|
@ -223,7 +223,7 @@ class WalletViewScreen extends StatelessWidget {
|
|||
context,
|
||||
"areYouSureYouWantToCertify".tr(
|
||||
args: [
|
||||
getShortPubkey(pubkey!)
|
||||
getShortPubkey(address!)
|
||||
]));
|
||||
|
||||
if (result ?? false) {
|
||||
|
@ -303,7 +303,7 @@ class WalletViewScreen extends StatelessWidget {
|
|||
image: AssetImage('assets/copy_key.png'),
|
||||
height: 90)),
|
||||
onTap: () {
|
||||
Clipboard.setData(ClipboardData(text: pubkey));
|
||||
Clipboard.setData(ClipboardData(text: address));
|
||||
snackCopyKey(context);
|
||||
}),
|
||||
),
|
||||
|
@ -340,14 +340,14 @@ class WalletViewScreen extends StatelessWidget {
|
|||
splashColor: yellowC,
|
||||
onTap: sub.nodeConnected
|
||||
? () {
|
||||
paymentPopup(context, walletProfile);
|
||||
paymentPopup(context, address!);
|
||||
}
|
||||
: null, // inkwell color
|
||||
child: const Padding(
|
||||
padding: EdgeInsets.all(14),
|
||||
child: Image(
|
||||
image: AssetImage('assets/vector_white.png'),
|
||||
))),
|
||||
padding: EdgeInsets.all(14),
|
||||
child: Image(
|
||||
image: AssetImage('assets/vector_white.png')),
|
||||
)),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
@ -397,270 +397,267 @@ class WalletViewScreen extends StatelessWidget {
|
|||
),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
void paymentPopup(
|
||||
BuildContext context, WalletsProfilesProvider walletViewProvider) {
|
||||
// WalletsProfilesProvider _walletViewProvider =
|
||||
// Provider.of<WalletsProfilesProvider>(context, listen: false);
|
||||
void paymentPopup(BuildContext context, String toAddress) {
|
||||
// WalletsProfilesProvider _walletViewProvider =
|
||||
// Provider.of<WalletsProfilesProvider>(context, listen: false);
|
||||
final walletViewProvider =
|
||||
Provider.of<WalletsProfilesProvider>(context, listen: false);
|
||||
|
||||
final myWalletProvider =
|
||||
Provider.of<MyWalletsProvider>(context, listen: false);
|
||||
final sub = Provider.of<SubstrateSdk>(context, listen: false);
|
||||
final myWalletProvider =
|
||||
Provider.of<MyWalletsProvider>(context, listen: false);
|
||||
final sub = Provider.of<SubstrateSdk>(context, listen: false);
|
||||
|
||||
const double shapeSize = 20;
|
||||
WalletData? defaultWallet = myWalletProvider.getDefaultWallet();
|
||||
log.d(defaultWallet.address);
|
||||
const double shapeSize = 20;
|
||||
WalletData? defaultWallet = myWalletProvider.getDefaultWallet();
|
||||
log.d(defaultWallet.address);
|
||||
|
||||
bool canValidate = false;
|
||||
bool canValidate = false;
|
||||
|
||||
final bool isUdUnit = configBox.get('isUdUnit') ?? false;
|
||||
final udValue = sub.udValue;
|
||||
final double balanceRatio = isUdUnit ? round(udValue / 100, 6) : 1;
|
||||
final bool isUdUnit = configBox.get('isUdUnit') ?? false;
|
||||
final udValue = sub.udValue;
|
||||
final double balanceRatio = isUdUnit ? round(udValue / 100, 6) : 1;
|
||||
|
||||
showModalBottomSheet<void>(
|
||||
shape: const RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.only(
|
||||
topRight: Radius.circular(shapeSize),
|
||||
topLeft: Radius.circular(shapeSize),
|
||||
),
|
||||
showModalBottomSheet<void>(
|
||||
shape: const RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.only(
|
||||
topRight: Radius.circular(shapeSize),
|
||||
topLeft: Radius.circular(shapeSize),
|
||||
),
|
||||
isScrollControlled: true,
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return StatefulBuilder(
|
||||
builder: (BuildContext context, StateSetter setState) {
|
||||
if (walletViewProvider.payAmount.text != '' &&
|
||||
(double.parse(walletViewProvider.payAmount.text) +
|
||||
2 / balanceRatio) <=
|
||||
(balanceCache[defaultWallet.address] ?? 0) &&
|
||||
walletViewProvider.address != defaultWallet.address) {
|
||||
if ((balanceCache[pubkey] == 0 || balanceCache[pubkey] == null) &&
|
||||
double.parse(walletViewProvider.payAmount.text) <
|
||||
5 / balanceRatio) {
|
||||
canValidate = false;
|
||||
} else {
|
||||
canValidate = true;
|
||||
}
|
||||
} else {
|
||||
),
|
||||
isScrollControlled: true,
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return StatefulBuilder(
|
||||
builder: (BuildContext context, StateSetter setState) {
|
||||
if (walletViewProvider.payAmount.text != '' &&
|
||||
(double.parse(walletViewProvider.payAmount.text) +
|
||||
2 / balanceRatio) <=
|
||||
(balanceCache[defaultWallet.address] ?? 0) &&
|
||||
toAddress != defaultWallet.address) {
|
||||
if ((balanceCache[toAddress] == 0 ||
|
||||
balanceCache[toAddress] == null) &&
|
||||
double.parse(walletViewProvider.payAmount.text) <
|
||||
5 / balanceRatio) {
|
||||
canValidate = false;
|
||||
} else {
|
||||
canValidate = true;
|
||||
}
|
||||
final bool isUdUnit = configBox.get('isUdUnit') ?? false;
|
||||
return Padding(
|
||||
padding: EdgeInsets.only(
|
||||
bottom: MediaQuery.of(context).viewInsets.bottom),
|
||||
child: Container(
|
||||
height: 400,
|
||||
decoration: const ShapeDecoration(
|
||||
color: Color(0xffffeed1),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.only(
|
||||
topRight: Radius.circular(shapeSize),
|
||||
topLeft: Radius.circular(shapeSize),
|
||||
),
|
||||
} else {
|
||||
canValidate = false;
|
||||
}
|
||||
final bool isUdUnit = configBox.get('isUdUnit') ?? false;
|
||||
return Padding(
|
||||
padding: EdgeInsets.only(
|
||||
bottom: MediaQuery.of(context).viewInsets.bottom),
|
||||
child: Container(
|
||||
height: 400,
|
||||
decoration: const ShapeDecoration(
|
||||
color: Color(0xffffeed1),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.only(
|
||||
topRight: Radius.circular(shapeSize),
|
||||
topLeft: Radius.circular(shapeSize),
|
||||
),
|
||||
),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
top: 24, bottom: 0, left: 24, right: 24),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
'executeATransfer'.tr(),
|
||||
style: const TextStyle(
|
||||
fontSize: 26, fontWeight: FontWeight.w700),
|
||||
),
|
||||
IconButton(
|
||||
iconSize: 40,
|
||||
icon: const Icon(Icons.cancel_outlined),
|
||||
onPressed: () {
|
||||
Navigator.pop(context);
|
||||
},
|
||||
),
|
||||
]),
|
||||
const SizedBox(height: 20),
|
||||
Text(
|
||||
'from'.tr(),
|
||||
style: TextStyle(
|
||||
fontSize: 19,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: Colors.grey[600]),
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
Consumer<SubstrateSdk>(builder: (context, sub, _) {
|
||||
return InkWell(
|
||||
key: keyChangeChest,
|
||||
onTap: () async {
|
||||
String? pin;
|
||||
if (myWalletProvider.pinCode == '') {
|
||||
pin = await Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (homeContext) {
|
||||
return UnlockingWallet(
|
||||
wallet: defaultWallet);
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
if (pin != null ||
|
||||
myWalletProvider.pinCode != '') {
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(builder: (context) {
|
||||
return ChooseWalletScreen(
|
||||
pin: pin ?? myWalletProvider.pinCode);
|
||||
}),
|
||||
);
|
||||
}
|
||||
},
|
||||
child: Container(
|
||||
width: double.infinity,
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(
|
||||
color: Colors.blueAccent.shade200,
|
||||
width: 2),
|
||||
borderRadius: const BorderRadius.all(
|
||||
Radius.circular(10.0)),
|
||||
),
|
||||
padding: const EdgeInsets.all(10),
|
||||
child: Row(children: [
|
||||
Text(defaultWallet.name!),
|
||||
const Spacer(),
|
||||
balance(context, defaultWallet.address!, 20)
|
||||
]),
|
||||
),
|
||||
);
|
||||
}),
|
||||
const Spacer(),
|
||||
|
||||
// const SizedBox(height: 10),
|
||||
Text(
|
||||
'amount'.tr(),
|
||||
style: TextStyle(
|
||||
fontSize: 19,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: Colors.grey[600]),
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
TextField(
|
||||
key: keyAmountField,
|
||||
controller: walletViewProvider.payAmount,
|
||||
autofocus: true,
|
||||
maxLines: 1,
|
||||
textAlign: TextAlign.center,
|
||||
keyboardType: TextInputType.number,
|
||||
onChanged: (_) => setState(() {
|
||||
// _walletViewProvider.reload();
|
||||
}),
|
||||
inputFormatters: <TextInputFormatter>[
|
||||
// FilteringTextInputFormatter.digitsOnly,
|
||||
FilteringTextInputFormatter.deny(',',
|
||||
replacementString: '.'),
|
||||
FilteringTextInputFormatter.allow(
|
||||
RegExp(r'(^\d+\.?\d{0,2})')),
|
||||
],
|
||||
// onChanged: (v) => _searchProvider.reload(),
|
||||
decoration: InputDecoration(
|
||||
hintText: '0.00',
|
||||
suffix: Text(isUdUnit
|
||||
? 'ud'.tr(args: [''])
|
||||
: currencyName), // udUnitDisplay(40),
|
||||
filled: true,
|
||||
fillColor: Colors.transparent,
|
||||
// border: OutlineInputBorder(
|
||||
// borderSide:
|
||||
// BorderSide(color: Colors.grey[500], width: 2),
|
||||
// borderRadius: BorderRadius.circular(8)),
|
||||
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(
|
||||
color: Colors.grey[500]!, width: 2),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
contentPadding: const EdgeInsets.all(20),
|
||||
),
|
||||
style: const TextStyle(
|
||||
fontSize: 40,
|
||||
color: Colors.black,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
// const SizedBox(height: 40),
|
||||
const Spacer(),
|
||||
SizedBox(
|
||||
width: double.infinity,
|
||||
height: 60,
|
||||
child: ElevatedButton(
|
||||
key: keyConfirmPayment,
|
||||
style: ElevatedButton.styleFrom(
|
||||
foregroundColor: Colors.white, elevation: 4,
|
||||
backgroundColor: orangeC, // foreground
|
||||
),
|
||||
onPressed: canValidate
|
||||
? () async {
|
||||
String? pin;
|
||||
if (myWalletProvider.pinCode == '') {
|
||||
pin = await Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (homeContext) {
|
||||
return UnlockingWallet(
|
||||
wallet: defaultWallet);
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
log.d(pin);
|
||||
if (pin != null ||
|
||||
myWalletProvider.pinCode != '') {
|
||||
// Payment workflow !
|
||||
WalletsProfilesProvider
|
||||
walletViewProvider =
|
||||
Provider.of<WalletsProfilesProvider>(
|
||||
context,
|
||||
listen: false);
|
||||
SubstrateSdk sub =
|
||||
Provider.of<SubstrateSdk>(context,
|
||||
listen: false);
|
||||
final acc = sub.getCurrentWallet();
|
||||
log.d(
|
||||
"fromAddress: ${acc.address!},destAddress: ${walletViewProvider.address!}, amount: ${double.parse(walletViewProvider.payAmount.text)}, password: $pin");
|
||||
sub.pay(
|
||||
fromAddress: acc.address!,
|
||||
destAddress:
|
||||
walletViewProvider.address!,
|
||||
amount: double.parse(
|
||||
walletViewProvider
|
||||
.payAmount.text),
|
||||
password:
|
||||
pin ?? myWalletProvider.pinCode);
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(builder: (context) {
|
||||
return const TransactionInProgress();
|
||||
}),
|
||||
);
|
||||
}
|
||||
}
|
||||
: null,
|
||||
child: Text(
|
||||
'executeTheTransfer'.tr(),
|
||||
style: const TextStyle(
|
||||
fontSize: 20, fontWeight: FontWeight.w600),
|
||||
),
|
||||
),
|
||||
),
|
||||
const Spacer(),
|
||||
]),
|
||||
),
|
||||
),
|
||||
);
|
||||
});
|
||||
}).then((value) => walletViewProvider.payAmount.text = '');
|
||||
}
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
top: 24, bottom: 0, left: 24, right: 24),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
'executeATransfer'.tr(),
|
||||
style: const TextStyle(
|
||||
fontSize: 26, fontWeight: FontWeight.w700),
|
||||
),
|
||||
IconButton(
|
||||
iconSize: 40,
|
||||
icon: const Icon(Icons.cancel_outlined),
|
||||
onPressed: () {
|
||||
Navigator.pop(context);
|
||||
},
|
||||
),
|
||||
]),
|
||||
const SizedBox(height: 20),
|
||||
Text(
|
||||
'from'.tr(),
|
||||
style: TextStyle(
|
||||
fontSize: 19,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: Colors.grey[600]),
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
Consumer<SubstrateSdk>(builder: (context, sub, _) {
|
||||
return InkWell(
|
||||
key: keyChangeChest,
|
||||
onTap: () async {
|
||||
String? pin;
|
||||
if (myWalletProvider.pinCode == '') {
|
||||
pin = await Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (homeContext) {
|
||||
return UnlockingWallet(
|
||||
wallet: defaultWallet);
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
if (pin != null || myWalletProvider.pinCode != '') {
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(builder: (context) {
|
||||
return ChooseWalletScreen(
|
||||
pin: pin ?? myWalletProvider.pinCode);
|
||||
}),
|
||||
);
|
||||
}
|
||||
},
|
||||
child: Container(
|
||||
width: double.infinity,
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(
|
||||
color: Colors.blueAccent.shade200, width: 2),
|
||||
borderRadius:
|
||||
const BorderRadius.all(Radius.circular(10.0)),
|
||||
),
|
||||
padding: const EdgeInsets.all(10),
|
||||
child: Row(children: [
|
||||
Text(defaultWallet.name!),
|
||||
const Spacer(),
|
||||
balance(context, defaultWallet.address!, 20)
|
||||
]),
|
||||
),
|
||||
);
|
||||
}),
|
||||
const Spacer(),
|
||||
|
||||
// const SizedBox(height: 10),
|
||||
Text(
|
||||
'amount'.tr(),
|
||||
style: TextStyle(
|
||||
fontSize: 19,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: Colors.grey[600]),
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
TextField(
|
||||
key: keyAmountField,
|
||||
controller: walletViewProvider.payAmount,
|
||||
autofocus: true,
|
||||
maxLines: 1,
|
||||
textAlign: TextAlign.center,
|
||||
keyboardType: TextInputType.number,
|
||||
onChanged: (_) => setState(() {
|
||||
// _walletViewProvider.reload();
|
||||
}),
|
||||
inputFormatters: <TextInputFormatter>[
|
||||
// FilteringTextInputFormatter.digitsOnly,
|
||||
FilteringTextInputFormatter.deny(',',
|
||||
replacementString: '.'),
|
||||
FilteringTextInputFormatter.allow(
|
||||
RegExp(r'(^\d+\.?\d{0,2})')),
|
||||
],
|
||||
// onChanged: (v) => _searchProvider.reload(),
|
||||
decoration: InputDecoration(
|
||||
hintText: '0.00',
|
||||
suffix: Text(isUdUnit
|
||||
? 'ud'.tr(args: [''])
|
||||
: currencyName), // udUnitDisplay(40),
|
||||
filled: true,
|
||||
fillColor: Colors.transparent,
|
||||
// border: OutlineInputBorder(
|
||||
// borderSide:
|
||||
// BorderSide(color: Colors.grey[500], width: 2),
|
||||
// borderRadius: BorderRadius.circular(8)),
|
||||
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderSide:
|
||||
BorderSide(color: Colors.grey[500]!, width: 2),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
contentPadding: const EdgeInsets.all(20),
|
||||
),
|
||||
style: const TextStyle(
|
||||
fontSize: 40,
|
||||
color: Colors.black,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
// const SizedBox(height: 40),
|
||||
const Spacer(),
|
||||
SizedBox(
|
||||
width: double.infinity,
|
||||
height: 60,
|
||||
child: ElevatedButton(
|
||||
key: keyConfirmPayment,
|
||||
style: ElevatedButton.styleFrom(
|
||||
foregroundColor: Colors.white, elevation: 4,
|
||||
backgroundColor: orangeC, // foreground
|
||||
),
|
||||
onPressed: canValidate
|
||||
? () async {
|
||||
String? pin;
|
||||
if (myWalletProvider.pinCode == '') {
|
||||
pin = await Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (homeContext) {
|
||||
return UnlockingWallet(
|
||||
wallet: defaultWallet);
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
log.d(pin);
|
||||
if (pin != null ||
|
||||
myWalletProvider.pinCode != '') {
|
||||
// Payment workflow !
|
||||
WalletsProfilesProvider walletViewProvider =
|
||||
Provider.of<WalletsProfilesProvider>(
|
||||
context,
|
||||
listen: false);
|
||||
SubstrateSdk sub =
|
||||
Provider.of<SubstrateSdk>(context,
|
||||
listen: false);
|
||||
final acc = sub.getCurrentWallet();
|
||||
log.d(
|
||||
"fromAddress: ${acc.address!},destAddress: $toAddress, amount: ${double.parse(walletViewProvider.payAmount.text)}, password: $pin");
|
||||
sub.pay(
|
||||
fromAddress: acc.address!,
|
||||
destAddress: toAddress,
|
||||
amount: double.parse(
|
||||
walletViewProvider.payAmount.text),
|
||||
password:
|
||||
pin ?? myWalletProvider.pinCode);
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(builder: (context) {
|
||||
return const TransactionInProgress();
|
||||
}),
|
||||
);
|
||||
}
|
||||
}
|
||||
: null,
|
||||
child: Text(
|
||||
'executeTheTransfer'.tr(),
|
||||
style: const TextStyle(
|
||||
fontSize: 20, fontWeight: FontWeight.w600),
|
||||
),
|
||||
),
|
||||
),
|
||||
const Spacer(),
|
||||
]),
|
||||
),
|
||||
),
|
||||
);
|
||||
});
|
||||
}).then((value) => walletViewProvider.payAmount.text = '');
|
||||
}
|
||||
|
|
12
pubspec.lock
12
pubspec.lock
|
@ -611,7 +611,7 @@ packages:
|
|||
name: image_picker_android
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.8.5+2"
|
||||
version: "0.8.5+3"
|
||||
image_picker_for_web:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
@ -826,7 +826,7 @@ packages:
|
|||
name: package_info_plus_windows
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.0.0"
|
||||
version: "2.1.0"
|
||||
path:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
@ -980,7 +980,7 @@ packages:
|
|||
name: pointycastle
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "3.6.1"
|
||||
version: "3.6.2"
|
||||
polkawallet_sdk:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
|
@ -1003,7 +1003,7 @@ packages:
|
|||
name: printing
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "5.9.2"
|
||||
version: "5.9.3"
|
||||
process:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
@ -1096,7 +1096,7 @@ packages:
|
|||
name: shared_preferences_android
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.0.12"
|
||||
version: "2.0.13"
|
||||
shared_preferences_ios:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
@ -1325,7 +1325,7 @@ packages:
|
|||
name: win32
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.7.0"
|
||||
version: "3.0.0"
|
||||
xdg_directories:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
|
Loading…
Reference in New Issue