improve dargndrop UX
This commit is contained in:
parent
8b32bb8e26
commit
d76ad9b7e3
|
@ -158,6 +158,7 @@
|
||||||
"months": "{} months",
|
"months": "{} months",
|
||||||
"certify": "Certify",
|
"certify": "Certify",
|
||||||
"from": "From:",
|
"from": "From:",
|
||||||
|
"to": "To:",
|
||||||
"amount": "Amount:",
|
"amount": "Amount:",
|
||||||
"choiceOfSourceWallet": "Choose a source wallet",
|
"choiceOfSourceWallet": "Choose a source wallet",
|
||||||
"extrinsicInProgress": "{} in progress",
|
"extrinsicInProgress": "{} in progress",
|
||||||
|
@ -193,5 +194,6 @@
|
||||||
"revokeMyIdentity": "Revoke my identity",
|
"revokeMyIdentity": "Revoke my identity",
|
||||||
"youCannotRevokeThisIdentity": "You cannot revoke this identity while\nit is member of the blacksmiths web",
|
"youCannotRevokeThisIdentity": "You cannot revoke this identity while\nit is member of the blacksmiths web",
|
||||||
"showUdAmounts": "Show amounts in UD",
|
"showUdAmounts": "Show amounts in UD",
|
||||||
"ud": "{}UD"
|
"ud": "{}UD",
|
||||||
|
"chooseATargetWallet": "Choose a target wallet"
|
||||||
}
|
}
|
|
@ -158,6 +158,7 @@
|
||||||
"months": "{} months",
|
"months": "{} months",
|
||||||
"certify": "Certify",
|
"certify": "Certify",
|
||||||
"from": "From:",
|
"from": "From:",
|
||||||
|
"to": "To:",
|
||||||
"amount": "Amount:",
|
"amount": "Amount:",
|
||||||
"choiceOfSourceWallet": "Choose a source wallet",
|
"choiceOfSourceWallet": "Choose a source wallet",
|
||||||
"extrinsicInProgress": "{} in progress",
|
"extrinsicInProgress": "{} in progress",
|
||||||
|
@ -193,5 +194,6 @@
|
||||||
"revokeMyIdentity": "Revoke my identity",
|
"revokeMyIdentity": "Revoke my identity",
|
||||||
"youCannotRevokeThisIdentity": "You cannot revoke this identity while\nit is member of the blacksmiths web",
|
"youCannotRevokeThisIdentity": "You cannot revoke this identity while\nit is member of the blacksmiths web",
|
||||||
"showUdAmounts": "Show amounts in UD",
|
"showUdAmounts": "Show amounts in UD",
|
||||||
"ud": "{}UD"
|
"ud": "{}UD",
|
||||||
|
"chooseATargetWallet": "Choose a target wallet"
|
||||||
}
|
}
|
|
@ -159,6 +159,7 @@
|
||||||
"months": "{} mois",
|
"months": "{} mois",
|
||||||
"certify": "Certifier",
|
"certify": "Certifier",
|
||||||
"from": "Depuis:",
|
"from": "Depuis:",
|
||||||
|
"to": "Vers:",
|
||||||
"amount": "Montant:",
|
"amount": "Montant:",
|
||||||
"choiceOfSourceWallet": "Choix du portefeuille source",
|
"choiceOfSourceWallet": "Choix du portefeuille source",
|
||||||
"extrinsicInProgress": "{} en cours",
|
"extrinsicInProgress": "{} en cours",
|
||||||
|
@ -194,5 +195,6 @@
|
||||||
"revokeMyIdentity": "Révoquer mon identité",
|
"revokeMyIdentity": "Révoquer mon identité",
|
||||||
"youCannotRevokeThisIdentity": "Vous ne pouvez pas révoquer cette identité tant\nqu'elle fait partie de la toile forgerons",
|
"youCannotRevokeThisIdentity": "Vous ne pouvez pas révoquer cette identité tant\nqu'elle fait partie de la toile forgerons",
|
||||||
"showUdAmounts": "Afficher les montants en DU",
|
"showUdAmounts": "Afficher les montants en DU",
|
||||||
"ud": "{}DU"
|
"ud": "{}DU",
|
||||||
|
"chooseATargetWallet": "Choisissez un portefeuille cible"
|
||||||
}
|
}
|
|
@ -13,6 +13,8 @@ class MyWalletsProvider with ChangeNotifier {
|
||||||
late String mnemonic;
|
late String mnemonic;
|
||||||
int? pinLenght;
|
int? pinLenght;
|
||||||
bool isNewDerivationLoading = false;
|
bool isNewDerivationLoading = false;
|
||||||
|
String lastFlyBy = '';
|
||||||
|
String dragAddress = '';
|
||||||
|
|
||||||
int getCurrentChest() {
|
int getCurrentChest() {
|
||||||
if (configBox.get('currentChest') == null) {
|
if (configBox.get('currentChest') == null) {
|
||||||
|
|
|
@ -1,7 +1,10 @@
|
||||||
|
// ignore_for_file: use_build_context_synchronously
|
||||||
|
|
||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
|
|
||||||
import 'package:easy_localization/easy_localization.dart';
|
import 'package:easy_localization/easy_localization.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
|
import 'package:flutter_markdown/flutter_markdown.dart';
|
||||||
import 'package:gecko/globals.dart';
|
import 'package:gecko/globals.dart';
|
||||||
import 'package:gecko/models/chest_data.dart';
|
import 'package:gecko/models/chest_data.dart';
|
||||||
import 'package:gecko/models/widgets_keys.dart';
|
import 'package:gecko/models/widgets_keys.dart';
|
||||||
|
@ -64,7 +67,9 @@ class WalletsHome extends StatelessWidget {
|
||||||
style: TextStyle(color: Colors.grey[850])),
|
style: TextStyle(color: Colors.grey[850])),
|
||||||
backgroundColor: const Color(0xffFFD58D),
|
backgroundColor: const Color(0xffFFD58D),
|
||||||
),
|
),
|
||||||
bottomNavigationBar: homeProvider.bottomAppBar(context),
|
bottomNavigationBar: myWalletProvider.lastFlyBy == ''
|
||||||
|
? homeProvider.bottomAppBar(context)
|
||||||
|
: dragInfo(context),
|
||||||
body: SafeArea(
|
body: SafeArea(
|
||||||
child: Stack(children: [
|
child: Stack(children: [
|
||||||
myWalletsTiles(context, currentChestNumber),
|
myWalletsTiles(context, currentChestNumber),
|
||||||
|
@ -75,6 +80,37 @@ class WalletsHome extends StatelessWidget {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Widget dragInfo(BuildContext context) {
|
||||||
|
final myWalletProvider =
|
||||||
|
Provider.of<MyWalletsProvider>(context, listen: false);
|
||||||
|
|
||||||
|
final walletDataFrom =
|
||||||
|
myWalletProvider.getWalletDataByAddress(myWalletProvider.dragAddress);
|
||||||
|
final walletDataTo =
|
||||||
|
myWalletProvider.getWalletDataByAddress(myWalletProvider.lastFlyBy);
|
||||||
|
|
||||||
|
final bool isSameAddress =
|
||||||
|
myWalletProvider.dragAddress == myWalletProvider.lastFlyBy;
|
||||||
|
|
||||||
|
final double screenWidth = MediaQuery.of(homeContext).size.width;
|
||||||
|
return Container(
|
||||||
|
color: yellowC,
|
||||||
|
width: screenWidth,
|
||||||
|
height: 80,
|
||||||
|
child: Center(
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
const SizedBox(height: 5),
|
||||||
|
Text('${'executeATransfer'.tr()}:'),
|
||||||
|
MarkdownBody(data: '${'from'.tr()} **${walletDataFrom!.name}**'),
|
||||||
|
if (isSameAddress) Text('chooseATargetWallet'.tr()),
|
||||||
|
if (!isSameAddress)
|
||||||
|
MarkdownBody(data: 'Vers: **${walletDataTo!.name}**'),
|
||||||
|
],
|
||||||
|
)),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
Widget chestOptions(
|
Widget chestOptions(
|
||||||
BuildContext context, MyWalletsProvider myWalletProvider) {
|
BuildContext context, MyWalletsProvider myWalletProvider) {
|
||||||
return Column(children: [
|
return Column(children: [
|
||||||
|
@ -187,6 +223,7 @@ class WalletsHome extends StatelessWidget {
|
||||||
} else if (screenWidth >= 650) {
|
} else if (screenWidth >= 650) {
|
||||||
nTule = 3;
|
nTule = 3;
|
||||||
}
|
}
|
||||||
|
// final dragAnchorStrategy = pointerDragAnchorStrategy;
|
||||||
|
|
||||||
return CustomScrollView(slivers: <Widget>[
|
return CustomScrollView(slivers: <Widget>[
|
||||||
const SliverToBoxAdapter(child: SizedBox(height: 20)),
|
const SliverToBoxAdapter(child: SizedBox(height: 20)),
|
||||||
|
@ -199,10 +236,19 @@ class WalletsHome extends StatelessWidget {
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
for (WalletData repository in listWallets as Iterable<WalletData>)
|
for (WalletData repository in listWallets as Iterable<WalletData>)
|
||||||
LongPressDraggable<String>(
|
LongPressDraggable<String>(
|
||||||
|
delay: const Duration(milliseconds: 200),
|
||||||
data: repository.address!,
|
data: repository.address!,
|
||||||
dragAnchorStrategy:
|
// dragAnchorStrategy:
|
||||||
(Draggable<Object> _, BuildContext __, Offset ___) =>
|
// (Draggable<Object> _, BuildContext __, Offset ___) =>
|
||||||
const Offset(0, 0),
|
// const Offset(40, 40),
|
||||||
|
dragAnchorStrategy: pointerDragAnchorStrategy,
|
||||||
|
onDragStarted: () =>
|
||||||
|
myWalletProvider.dragAddress = repository.address!,
|
||||||
|
onDragEnd: (_) {
|
||||||
|
myWalletProvider.lastFlyBy = '';
|
||||||
|
myWalletProvider.dragAddress = '';
|
||||||
|
myWalletProvider.reload();
|
||||||
|
},
|
||||||
feedback: ElevatedButton(
|
feedback: ElevatedButton(
|
||||||
onPressed: () {},
|
onPressed: () {},
|
||||||
style: ElevatedButton.styleFrom(
|
style: ElevatedButton.styleFrom(
|
||||||
|
@ -215,96 +261,109 @@ class WalletsHome extends StatelessWidget {
|
||||||
child: Image(image: AssetImage('assets/vector_white.png')),
|
child: Image(image: AssetImage('assets/vector_white.png')),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
child: DragTarget<String>(onAccept: (senderAddress) async {
|
child: DragTarget<String>(
|
||||||
log.d(
|
onAccept: (senderAddress) async {
|
||||||
'INTERPAY: sender: $senderAddress --- receiver: ${repository.address!}');
|
log.d(
|
||||||
final walletData =
|
'INTERPAY: sender: $senderAddress --- receiver: ${repository.address!}');
|
||||||
myWalletProvider.getWalletDataByAddress(senderAddress);
|
final walletData = myWalletProvider
|
||||||
await sub.setCurrentWallet(walletData!);
|
.getWalletDataByAddress(senderAddress);
|
||||||
sub.reload();
|
await sub.setCurrentWallet(walletData!);
|
||||||
paymentPopup(context, repository.address!);
|
sub.reload();
|
||||||
}, builder: (
|
paymentPopup(context, repository.address!);
|
||||||
BuildContext context,
|
},
|
||||||
List<dynamic> accepted,
|
// onMove: ((details) => log.d('oooookkkkkkkk')),
|
||||||
List<dynamic> rejected,
|
onMove: (details) {
|
||||||
) {
|
if (repository.address! != myWalletProvider.lastFlyBy) {
|
||||||
return Padding(
|
log.d('oooookkkkkkkk: ${repository.address!}');
|
||||||
padding: const EdgeInsets.all(16),
|
myWalletProvider.lastFlyBy = repository.address!;
|
||||||
child: GestureDetector(
|
myWalletProvider.reload();
|
||||||
key: keyOpenWallet(repository.address!),
|
}
|
||||||
onTap: () {
|
},
|
||||||
walletOptions.getAddress(
|
onWillAccept: (senderAddress) =>
|
||||||
currentChestNumber, repository.derivation!);
|
senderAddress != repository.address!,
|
||||||
Navigator.push(
|
builder: (
|
||||||
context,
|
BuildContext context,
|
||||||
SmoothTransition(
|
List<dynamic> accepted,
|
||||||
page: WalletOptions(
|
List<dynamic> rejected,
|
||||||
wallet: repository,
|
) {
|
||||||
|
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,
|
||||||
),
|
),
|
||||||
);
|
clipper: CustomClipperOval(),
|
||||||
},
|
child: ClipRRect(
|
||||||
child: ClipOvalShadow(
|
borderRadius:
|
||||||
shadow: const Shadow(
|
const BorderRadius.all(Radius.circular(12)),
|
||||||
color: Colors.transparent,
|
child: Column(children: <Widget>[
|
||||||
offset: Offset(0, 0),
|
Expanded(
|
||||||
blurRadius: 5,
|
child: Container(
|
||||||
),
|
width: double.infinity,
|
||||||
clipper: CustomClipperOval(),
|
height: double.infinity,
|
||||||
child: ClipRRect(
|
decoration: BoxDecoration(
|
||||||
borderRadius:
|
gradient: RadialGradient(
|
||||||
const BorderRadius.all(Radius.circular(12)),
|
radius: 0.6,
|
||||||
child: Column(children: <Widget>[
|
colors: [
|
||||||
Expanded(
|
Colors.green[400]!,
|
||||||
child: Container(
|
const Color(0xFFE7E7A6),
|
||||||
width: double.infinity,
|
],
|
||||||
height: double.infinity,
|
)),
|
||||||
decoration: BoxDecoration(
|
child:
|
||||||
gradient: RadialGradient(
|
// SvgPicture.asset('assets/chopp-gecko2.png',
|
||||||
radius: 0.6,
|
// semanticsLabel: 'Gecko', height: 48),
|
||||||
colors: [
|
repository.imageCustomPath == null ||
|
||||||
Colors.green[400]!,
|
repository.imageCustomPath == ''
|
||||||
const Color(0xFFE7E7A6),
|
? Image.asset(
|
||||||
],
|
'assets/avatars/${repository.imageDefaultPath}',
|
||||||
)),
|
alignment: Alignment.bottomCenter,
|
||||||
child:
|
scale: 0.5,
|
||||||
// SvgPicture.asset('assets/chopp-gecko2.png',
|
)
|
||||||
// semanticsLabel: 'Gecko', height: 48),
|
: Container(
|
||||||
repository.imageCustomPath == null ||
|
decoration: BoxDecoration(
|
||||||
repository.imageCustomPath == ''
|
shape: BoxShape.circle,
|
||||||
? Image.asset(
|
color: Colors.transparent,
|
||||||
'assets/avatars/${repository.imageDefaultPath}',
|
image: DecorationImage(
|
||||||
alignment: Alignment.bottomCenter,
|
fit: BoxFit.fitHeight,
|
||||||
scale: 0.5,
|
image: FileImage(
|
||||||
)
|
File(repository
|
||||||
: Container(
|
.imageCustomPath!),
|
||||||
decoration: BoxDecoration(
|
),
|
||||||
shape: BoxShape.circle,
|
|
||||||
color: Colors.transparent,
|
|
||||||
image: DecorationImage(
|
|
||||||
fit: BoxFit.fitHeight,
|
|
||||||
image: FileImage(
|
|
||||||
File(repository
|
|
||||||
.imageCustomPath!),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
)),
|
||||||
)),
|
Stack(children: <Widget>[
|
||||||
Stack(children: <Widget>[
|
balanceBuilder(
|
||||||
balanceBuilder(
|
context,
|
||||||
context,
|
repository.address!,
|
||||||
repository.address!,
|
repository.address ==
|
||||||
repository.address ==
|
defaultWallet.address),
|
||||||
defaultWallet.address),
|
nameBuilder(context, repository,
|
||||||
nameBuilder(context, repository, defaultWallet,
|
defaultWallet, currentChestNumber),
|
||||||
currentChestNumber),
|
]),
|
||||||
]),
|
]),
|
||||||
]),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
));
|
);
|
||||||
}),
|
}),
|
||||||
),
|
),
|
||||||
Consumer<SubstrateSdk>(builder: (context, sub, _) {
|
Consumer<SubstrateSdk>(builder: (context, sub, _) {
|
||||||
return sub.nodeConnected
|
return sub.nodeConnected
|
||||||
|
|
|
@ -5,7 +5,7 @@ description: Pay with G1.
|
||||||
# pub.dev using `pub publish`. This is preferred for private packages.
|
# pub.dev using `pub publish`. This is preferred for private packages.
|
||||||
publish_to: 'none' # Remove this line if you wish to publish to pub.dev
|
publish_to: 'none' # Remove this line if you wish to publish to pub.dev
|
||||||
|
|
||||||
version: 0.0.11+28
|
version: 0.0.11+29
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: '>=2.12.0 <3.0.0'
|
sdk: '>=2.12.0 <3.0.0'
|
||||||
|
|
Loading…
Reference in New Issue