Skip to content

Commit

Permalink
fixed wallets list padding
Browse files Browse the repository at this point in the history
  • Loading branch information
br0ck-w00d committed Oct 2, 2024
1 parent cd3aaec commit 613162d
Showing 1 changed file with 103 additions and 132 deletions.
235 changes: 103 additions & 132 deletions magic/lib/presentation/ui/welcome/wallets.dart
Original file line number Diff line number Diff line change
Expand Up @@ -77,141 +77,112 @@ class WalletsPageState extends State<WalletsPage> {
color: Colors.white),
onPressed: () => toStage(WalletsLifecycle.exiting))),
),
// child: IconButton(
// icon: const Icon(Icons.close_rounded,
// color: Colors.white54),
// onPressed: () => toStage(WalletsLifecycle.exiting))),
Column(children: [
ConstrainedBox(
constraints: BoxConstraints(
maxHeight: screen.height - 60 - 60 - 32 - 100,
constraints: BoxConstraints(
maxHeight: screen.height - 60 - 60 - 32 - 100,
),
child: ListView.builder(
shrinkWrap: true,
itemCount: cubits.keys.master.derivationWallets.length +
cubits.keys.master.keypairWallets.length,
itemBuilder: (context, int index) => Padding(
padding: const EdgeInsets.symmetric(
vertical: 8.0), // Add padding here
child: index <
cubits.keys.master.derivationWallets.length
? ListTile(
dense: true,
visualDensity: VisualDensity.compact,
iconColor: Colors.white70,
textColor: Colors.white70,
leading: const CircleAvatar(
backgroundColor: AppColors.foreground,
child: Icon(Icons.wallet_rounded,
color: Colors.white38),
),
title: Text(
'Wallet $index (HD wallet)',
),
trailing: IconButton(
icon: const Icon(Icons.delete_rounded,
color: AppColors.white24),
onPressed: () async {
await cubits.keys.removeMnemonic(cubits
.keys
.master
.derivationWallets[index]
.mnemonic!);
await cubits.keys.saveSecrets();

///// do we need to resetup our subscriptions? yes.
///// all of them or just this wallet? just do all of them.
//await subscription.setupSubscriptions(
// cubits.keys.master);

/// do we need to get all our assets again? yes.
/// all of them or just this wallet? just do all of them.
//cubits.wallet.clearAssets();
await cubits.wallet.populateAssets();

/// do we need to derive all our addresses? yes.
/// all of them or just this wallet? we can specify just this wallet.
deriveInBackground();
// why not use this like we do on startup...?
//cubits.receive.deriveAll([
// Blockchain.ravencoinMain,
// Blockchain.evrmoreMain,
//]);

setState(() {});
},
),
)
: ListTile(
dense: true,
visualDensity: VisualDensity.compact,
leading: const CircleAvatar(
backgroundColor: AppColors.foreground,
child: Icon(Icons.abc, color: Colors.white),
),
title: Text('Wallet $index (Keypair wallet)'),
trailing: IconButton(
icon: const Icon(Icons.delete_rounded,
color: AppColors.white24),
onPressed: () async {
final kpIndex = index -
cubits.keys.master.derivationWallets
.length;
await cubits.keys.removeWif(cubits.keys
.master.keypairWallets[kpIndex].wif);
await cubits.keys.saveSecrets();

/// do we need to resetup our subscriptions? yes.
/// all of them or just this wallet? just do all of them.
await subscription
.setupSubscriptions(cubits.keys.master);

/// do we need to get all our assets again? yes.
/// all of them or just this wallet? just do all of them.
//cubits.wallet.clearAssets();
await cubits.wallet.populateAssets();

/// do we need to derive all our addresses? yes.
/// all of them or just this wallet? we can specify just this wallet.
deriveInBackground();
// why not use this like we do on startup...?
//cubits.receive.deriveAll([
// Blockchain.ravencoinMain,
// Blockchain.evrmoreMain,
//]);

setState(() {});
},
),
),
),
child: ListView.builder(
shrinkWrap: true,
itemCount:
cubits.keys.master.derivationWallets.length +
cubits.keys.master.keypairWallets.length,
itemBuilder: (context, int index) =>
//Container(
// padding:
// const EdgeInsets.only(top: 16, bottom: 16),
// decoration: index <
// cubits.keys.master.derivationWallets
// .length +
// cubits.keys.master.keypairWallets
// .length -
// 1
// ? const BoxDecoration(
// border: Border(
// bottom: BorderSide(
// color: Colors
// .black38, // Set the color of the border
// width:
// 1.0, // Set the width of the border
// ),
// ),
// )
// : null,
// child:
index <
cubits
.keys.master.derivationWallets.length
? ListTile(
dense: true,
visualDensity: VisualDensity.compact,
iconColor: Colors.white70,
textColor: Colors.white70,
leading: const CircleAvatar(
backgroundColor: AppColors.foreground,
child: Icon(Icons.wallet_rounded,
color: Colors.white38),
),
title: Text(
'Wallet $index (HD wallet)',
),
trailing: IconButton(
icon: const Icon(Icons.delete_rounded,
color: AppColors.white24),
onPressed: () async {
await cubits.keys.removeMnemonic(
cubits
.keys
.master
.derivationWallets[index]
.mnemonic!);
await cubits.keys.saveSecrets();

///// do we need to resetup our subscriptions? yes.
///// all of them or just this wallet? just do all of them.
//await subscription.setupSubscriptions(
// cubits.keys.master);

/// do we need to get all our assets again? yes.
/// all of them or just this wallet? just do all of them.
//cubits.wallet.clearAssets();
await cubits.wallet.populateAssets();

/// do we need to derive all our addresses? yes.
/// all of them or just this wallet? we can specify just this wallet.
deriveInBackground();
// why not use this like we do on startup...?
//cubits.receive.deriveAll([
// Blockchain.ravencoinMain,
// Blockchain.evrmoreMain,
//]);

setState(() {});
},
),
)
: ListTile(
dense: true,
visualDensity: VisualDensity.compact,
leading: const CircleAvatar(
backgroundColor: AppColors.foreground,
child: Icon(Icons.abc,
color: Colors.white),
),
title: Text(
'Wallet $index (Keypair wallet)'),
trailing: IconButton(
icon: const Icon(Icons.delete_rounded,
color: AppColors.white24),
onPressed: () async {
final kpIndex = index -
cubits.keys.master
.derivationWallets.length;
await cubits.keys.removeWif(cubits
.keys
.master
.keypairWallets[kpIndex]
.wif);
await cubits.keys.saveSecrets();

/// do we need to resetup our subscriptions? yes.
/// all of them or just this wallet? just do all of them.
await subscription.setupSubscriptions(
cubits.keys.master);

/// do we need to get all our assets again? yes.
/// all of them or just this wallet? just do all of them.
//cubits.wallet.clearAssets();
await cubits.wallet.populateAssets();

/// do we need to derive all our addresses? yes.
/// all of them or just this wallet? we can specify just this wallet.
deriveInBackground();
// why not use this like we do on startup...?
//cubits.receive.deriveAll([
// Blockchain.ravencoinMain,
// Blockchain.evrmoreMain,
//]);

setState(() {});
},
),
)))
//)
),
)
]),
const Padding(
padding: EdgeInsets.only(bottom: 32.0, right: 16.0),
Expand Down

0 comments on commit 613162d

Please sign in to comment.