Skip to content

Commit

Permalink
bitcoin unit on txitem,few ui updates
Browse files Browse the repository at this point in the history
  • Loading branch information
yshwanth committed May 27, 2022
1 parent 73a4a1c commit 1197fd7
Show file tree
Hide file tree
Showing 6 changed files with 145 additions and 169 deletions.
8 changes: 4 additions & 4 deletions lib/cubit/wallet/send.dart
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ class SendCubit extends Cubit<SendState> {
),
);

_logger.logException(e, 'SendCubit.confirmclicked', s);
_logger.logException(e.toString(), 'SendCubit.confirmclicked', s);
}
}

Expand Down Expand Up @@ -423,7 +423,7 @@ class SendCubit extends Cubit<SendState> {
),
);

_logger.logException(e, 'SendCubit.confirmclicked', s);
_logger.logException(e.toString(), 'SendCubit.confirmclicked', s);
}
}

Expand Down Expand Up @@ -452,9 +452,9 @@ class SendCubit extends Cubit<SendState> {
void sendClicked() async {
try {
if (state.sendingTx == true) {
emit(state.copyWith(sendingTx: true, errLoading: emptyString));
return;
}
emit(state.copyWith(sendingTx: true, errLoading: emptyString));
final nodeAddress = _nodeAddressCubit.state.getAddress();
final socks5 = _torCubit.state.getSocks5();

Expand Down Expand Up @@ -506,7 +506,7 @@ class SendCubit extends Cubit<SendState> {
errLoading: e.toString(),
),
);
_logger.logException(e, 'SendCubit.sendclicked', s);
_logger.logException(e.toString(), 'SendCubit.sendclicked', s);
}
}

Expand Down
10 changes: 7 additions & 3 deletions lib/ui/component/NewWallet/SeedImport/Label.dart
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,18 @@ class _SeedImportLabelState extends State<SeedImportLabel> {
if (state.savingWallet)
const Padding(
padding: EdgeInsets.all(16.0),
child: Text('Recoving wallet...'),
child: Text('Recovering wallet...'),
)
else
Padding(
padding: EdgeInsets.zero,
child: TextButton(
child: ElevatedButton(
style: ElevatedButton.styleFrom(
primary: c.colours.primary,
onPrimary: c.colours.background,
),
onPressed: () async {
c.read<SeedImportWalletCubit>().nextClicked();
context.read<SeedImportWalletCubit>().nextClicked();
},
child: const Text('Confirm'),
),
Expand Down
23 changes: 10 additions & 13 deletions lib/ui/component/NewWallet/SeedImport/Warning.dart
Original file line number Diff line number Diff line change
Expand Up @@ -26,19 +26,16 @@ Use whatever you have and we will attempt to recover any associated spendable fu
color: c.colours.onPrimary,
),
),
const SizedBox(height: 24),
GestureDetector(
onTap: () => c.read<SeedImportWalletCubit>().nextClicked(),
child: SizedBox(
height: 20,
width: 20,
child: Text(
'I Understand'.toUpperCase(),
textAlign: TextAlign.center,
style: c.fonts.bodyMedium!.copyWith(
color: c.colours.primary,
),
),
const SizedBox(height: 32),
ElevatedButton(
style: ElevatedButton.styleFrom(
primary: c.colours.primary,
onPrimary: c.colours.background,
),
onPressed: () => c.read<SeedImportWalletCubit>().nextClicked(),
child: Text(
'I Understand'.toUpperCase(),
textAlign: TextAlign.center,
),
),
],
Expand Down
4 changes: 4 additions & 0 deletions lib/ui/component/NewWallet/XpubImport/Label.dart
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ class XpubLabel extends StatelessWidget {
Padding(
padding: EdgeInsets.zero,
child: TextField(
style: TextStyle(
color: c.colours.onBackground,
fontSize: 18,
),
onChanged: (text) {
c.read<XpubImportWalletCubit>().labelChanged(text);
},
Expand Down
219 changes: 113 additions & 106 deletions lib/ui/component/Send/Confirm.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,124 +15,131 @@ class ConfirmTransaction extends StatelessWidget {
final preferences = context.select((PreferencesCubit p) => p.state);

if (state.finalAmount == null) return Container();
return Padding(
padding: const EdgeInsets.only(top: 8),
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
const SizedBox(height: 12),
Text(
'Transaction\nDetails',
style: context.fonts.headline5!.copyWith(
color: context.colours.onBackground,
),
),
const SizedBox(height: 40),
Text(
'Address'.toUpperCase(),
style: context.fonts.overline!.copyWith(
color: context.colours.onBackground,
),
),
const SizedBox(height: 16),
Text(
state.address,
style: context.fonts.caption!.copyWith(
color: context.colours.onBackground,
),
),
const SizedBox(height: 60),
Row(
return IgnorePointer(
ignoring: state.sendingTx,
child: AnimatedOpacity(
duration: const Duration(milliseconds: 300),
opacity: state.sendingTx ? 0.5 : 1,
child: Padding(
padding: const EdgeInsets.only(top: 8),
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
Padding(
padding: const EdgeInsets.only(bottom: 17.0),
child: Text(
'Amount'.toUpperCase(),
style: context.fonts.overline!.copyWith(
color: context.colours.onBackground,
),
const SizedBox(height: 12),
Text(
'Transaction\nDetails',
style: context.fonts.headline5!.copyWith(
color: context.colours.onBackground,
),
),
const Spacer(),
BitcoinDisplayMedium(
satsAmount: state.finalAmount.toString(),
bitcoinUnit: preferences.preferredBitcoinUnit,
const SizedBox(height: 40),
Text(
'Address'.toUpperCase(),
style: context.fonts.overline!.copyWith(
color: context.colours.onBackground,
),
),
],
),
const SizedBox(height: 20),
Row(
children: [
Padding(
padding: const EdgeInsets.only(bottom: 17.0),
child: Text(
'Network Fee'.toUpperCase(),
style: context.fonts.overline!.copyWith(
color: context.colours.onBackground,
),
const SizedBox(height: 16),
Text(
state.address,
style: context.fonts.caption!.copyWith(
color: context.colours.onBackground,
),
),
const Spacer(),
BitcoinDisplayMedium(
satsAmount: state.finalFee.toString(),
bitcoinUnit: preferences.preferredBitcoinUnit,
const SizedBox(height: 60),
Row(
children: [
Padding(
padding: const EdgeInsets.only(bottom: 17.0),
child: Text(
'Amount'.toUpperCase(),
style: context.fonts.overline!.copyWith(
color: context.colours.onBackground,
),
),
),
const Spacer(),
BitcoinDisplayMedium(
satsAmount: state.finalAmount.toString(),
bitcoinUnit: preferences.preferredBitcoinUnit,
),
],
),
],
),
const SizedBox(height: 20),
Row(
children: [
Padding(
padding: const EdgeInsets.only(bottom: 17.0),
child: Text(
'Total'.toUpperCase(),
style: context.fonts.overline!.copyWith(
color: context.colours.onBackground,
const SizedBox(height: 20),
Row(
children: [
Padding(
padding: const EdgeInsets.only(bottom: 17.0),
child: Text(
'Network Fee'.toUpperCase(),
style: context.fonts.overline!.copyWith(
color: context.colours.onBackground,
),
),
),
),
const Spacer(),
BitcoinDisplayMedium(
satsAmount: state.finalFee.toString(),
bitcoinUnit: preferences.preferredBitcoinUnit,
),
],
),
const Spacer(),
BitcoinDisplayMedium(
satsAmount: state.total().toString(),
bitcoinUnit: preferences.preferredBitcoinUnit,
const SizedBox(height: 20),
Row(
children: [
Padding(
padding: const EdgeInsets.only(bottom: 17.0),
child: Text(
'Total'.toUpperCase(),
style: context.fonts.overline!.copyWith(
color: context.colours.onBackground,
),
),
),
const Spacer(),
BitcoinDisplayMedium(
satsAmount: state.total().toString(),
bitcoinUnit: preferences.preferredBitcoinUnit,
),
],
),
const SizedBox(height: 30),
if (wallet.isNotWatchOnly())
TextButton(
onPressed: () {
context.read<SendCubit>().sendClicked();
},
child: const Text('SEND'),
)
else ...[
TextButton(
onPressed: () {
context.read<SendCubit>().copyPSBT();
// Future.delayed(Duration(seconds: 2));
},
child: const Text('COPY PSBT'),
),
const SizedBox(height: 12),
TextButton(
onPressed: () {
// context.read<SendCubit>().savePSBTToFile(context);
// Future.delayed(Duration(seconds: 2));
},
child: const Text('SAVE PSBT'),
)
],
const SizedBox(height: 6),
if (state.errSending != '')
Text(
state.errSending,
style: context.fonts.caption!.copyWith(
color: context.colours.error.withOpacity(0.7),
),
textAlign: TextAlign.center,
),
],
),
const SizedBox(height: 30),
if (wallet.isNotWatchOnly())
TextButton(
onPressed: () {
context.read<SendCubit>().sendClicked();
},
child: const Text('SEND'),
)
else ...[
TextButton(
onPressed: () {
context.read<SendCubit>().copyPSBT();
// Future.delayed(Duration(seconds: 2));
},
child: const Text('COPY PSBT'),
),
const SizedBox(height: 12),
TextButton(
onPressed: () {
// context.read<SendCubit>().savePSBTToFile(context);
// Future.delayed(Duration(seconds: 2));
},
child: const Text('SAVE PSBT'),
)
],
const SizedBox(height: 6),
if (state.errSending != '')
Text(
state.errSending,
style: context.fonts.caption!.copyWith(
color: context.colours.error.withOpacity(0.7),
),
textAlign: TextAlign.center,
),
],
),
),
);
}
Expand Down
Loading

0 comments on commit 1197fd7

Please sign in to comment.