fusion tx ui fixes for mobile

This commit is contained in:
julian 2023-10-23 15:05:50 -06:00
parent a299ca1315
commit 968f028199
2 changed files with 120 additions and 147 deletions

View file

@ -12,14 +12,12 @@ import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:stackwallet/models/isar/models/blockchain_data/v2/transaction_v2.dart'; import 'package:stackwallet/models/isar/models/blockchain_data/v2/transaction_v2.dart';
import 'package:stackwallet/pages/wallet_view/transaction_views/tx_v2/transaction_v2_list_item.dart'; import 'package:stackwallet/pages/wallet_view/transaction_views/tx_v2/transaction_v2_list_item.dart';
import 'package:stackwallet/pages/wallet_view/wallet_view.dart';
import 'package:stackwallet/themes/stack_colors.dart'; import 'package:stackwallet/themes/stack_colors.dart';
import 'package:stackwallet/utilities/constants.dart'; import 'package:stackwallet/utilities/constants.dart';
import 'package:stackwallet/utilities/enums/coin_enum.dart'; import 'package:stackwallet/utilities/enums/coin_enum.dart';
import 'package:stackwallet/utilities/text_styles.dart'; import 'package:stackwallet/utilities/text_styles.dart';
import 'package:stackwallet/utilities/util.dart'; import 'package:stackwallet/utilities/util.dart';
import 'package:stackwallet/widgets/background.dart'; import 'package:stackwallet/widgets/background.dart';
import 'package:stackwallet/widgets/conditional_parent.dart';
import 'package:stackwallet/widgets/custom_buttons/app_bar_icon_button.dart'; import 'package:stackwallet/widgets/custom_buttons/app_bar_icon_button.dart';
import 'package:stackwallet/widgets/desktop/desktop_dialog_close_button.dart'; import 'package:stackwallet/widgets/desktop/desktop_dialog_close_button.dart';
import 'package:stackwallet/widgets/rounded_white_container.dart'; import 'package:stackwallet/widgets/rounded_white_container.dart';
@ -80,147 +78,66 @@ class _FusionGroupDetailsViewState
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return ConditionalParent( if (isDesktop) {
condition: !isDesktop, return Material(
builder: (child) => Background( color: Colors.transparent,
child: child, child: Padding(
), padding: const EdgeInsets.only(left: 32),
child: Scaffold(
backgroundColor: isDesktop
? Colors.transparent
: Theme.of(context).extension<StackColors>()!.background,
appBar: isDesktop
? null
: AppBar(
backgroundColor:
Theme.of(context).extension<StackColors>()!.background,
leading: AppBarBackButton(
onPressed: () async {
Navigator.of(context).pop();
},
),
title: Text(
"Fusion transactions",
style: STextStyles.navBarTitle(context),
),
),
body: Padding(
padding: isDesktop
? const EdgeInsets.only(left: 32)
: const EdgeInsets.all(12),
child: Column( child: Column(
children: [ children: [
if (isDesktop) Row(
Row( mainAxisAlignment: MainAxisAlignment.spaceBetween,
mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [
children: [ Text(
Text( "Fusion transactions",
"Fusion transactions", style: STextStyles.desktopH3(context),
style: STextStyles.desktopH3(context), ),
), const DesktopDialogCloseButton(),
const DesktopDialogCloseButton(), ],
], ),
),
Flexible( Flexible(
child: Padding( child: Padding(
padding: isDesktop padding: const EdgeInsets.only(
? const EdgeInsets.only( right: 32,
right: 32, bottom: 32,
bottom: 32, ),
) child: RoundedWhiteContainer(
: const EdgeInsets.all(0), borderColor: isDesktop
child: ConditionalParent( ? Theme.of(context)
condition: isDesktop, .extension<StackColors>()!
builder: (child) { .backgroundAppBar
return RoundedWhiteContainer( : null,
borderColor: isDesktop padding: const EdgeInsets.all(0),
? Theme.of(context) child: ListView.separated(
.extension<StackColors>()! shrinkWrap: true,
.backgroundAppBar itemBuilder: (context, index) {
: null, BorderRadius? radius;
padding: const EdgeInsets.all(0), if (widget.transactions.length == 1) {
child: child, radius = BorderRadius.circular(
); Constants.size.circularBorderRadius,
}, );
child: SingleChildScrollView( } else if (index == widget.transactions.length - 1) {
primary: isDesktop ? false : null, radius = _borderRadiusLast;
child: Padding( } else if (index == 0) {
padding: isDesktop radius = _borderRadiusFirst;
? const EdgeInsets.all(0) }
: const EdgeInsets.all(4), final tx = widget.transactions[index];
child: Util.isDesktop return TxListItem(
? ListView.separated( tx: tx,
shrinkWrap: true, coin: widget.coin,
itemBuilder: (context, index) { radius: radius,
BorderRadius? radius; );
if (widget.transactions.length == 1) { },
radius = BorderRadius.circular( separatorBuilder: (context, index) {
Constants.size.circularBorderRadius, return Container(
); width: double.infinity,
} else if (index == height: 1.2,
widget.transactions.length - 1) { color: Theme.of(context)
radius = _borderRadiusLast; .extension<StackColors>()!
} else if (index == 0) { .background,
radius = _borderRadiusFirst; );
} },
final tx = widget.transactions[index]; itemCount: widget.transactions.length,
return TxListItem(
tx: tx,
coin: widget.coin,
radius: radius,
);
},
separatorBuilder: (context, index) {
return Container(
width: double.infinity,
height: 1.2,
color: Theme.of(context)
.extension<StackColors>()!
.background,
);
},
itemCount: widget.transactions.length,
)
: ListView.builder(
itemCount: widget.transactions.length,
itemBuilder: (context, index) {
BorderRadius? radius;
bool shouldWrap = false;
if (widget.transactions.length == 1) {
radius = BorderRadius.circular(
Constants.size.circularBorderRadius,
);
} else if (index ==
widget.transactions.length - 1) {
radius = _borderRadiusLast;
shouldWrap = true;
} else if (index == 0) {
radius = _borderRadiusFirst;
}
final tx = widget.transactions[index];
if (shouldWrap) {
return Column(
children: [
TxListItem(
tx: tx,
coin: widget.coin,
radius: radius,
),
const SizedBox(
height: WalletView.navBarHeight + 14,
),
],
);
} else {
return TxListItem(
tx: tx,
coin: widget.coin,
radius: radius,
);
}
},
),
),
), ),
), ),
), ),
@ -228,7 +145,52 @@ class _FusionGroupDetailsViewState
], ],
), ),
), ),
), );
); } else {
return Background(
child: Scaffold(
backgroundColor:
Theme.of(context).extension<StackColors>()!.background,
appBar: AppBar(
backgroundColor:
Theme.of(context).extension<StackColors>()!.background,
leading: AppBarBackButton(
onPressed: () async {
Navigator.of(context).pop();
},
),
title: Text(
"Fusion transactions",
style: STextStyles.navBarTitle(context),
),
),
body: Padding(
padding: const EdgeInsets.all(16),
child: ListView.builder(
itemCount: widget.transactions.length,
itemBuilder: (context, index) {
BorderRadius? radius;
if (widget.transactions.length == 1) {
radius = BorderRadius.circular(
Constants.size.circularBorderRadius,
);
} else if (index == widget.transactions.length - 1) {
radius = _borderRadiusLast;
} else if (index == 0) {
radius = _borderRadiusFirst;
}
final tx = widget.transactions[index];
return TxListItem(
tx: tx,
coin: widget.coin,
radius: radius,
);
},
),
),
),
);
}
} }
} }

View file

@ -37,6 +37,8 @@ import 'package:stackwallet/pages/token_view/my_tokens_view.dart';
import 'package:stackwallet/pages/wallet_view/sub_widgets/transactions_list.dart'; import 'package:stackwallet/pages/wallet_view/sub_widgets/transactions_list.dart';
import 'package:stackwallet/pages/wallet_view/sub_widgets/wallet_summary.dart'; import 'package:stackwallet/pages/wallet_view/sub_widgets/wallet_summary.dart';
import 'package:stackwallet/pages/wallet_view/transaction_views/all_transactions_view.dart'; import 'package:stackwallet/pages/wallet_view/transaction_views/all_transactions_view.dart';
import 'package:stackwallet/pages/wallet_view/transaction_views/tx_v2/all_transactions_v2_view.dart';
import 'package:stackwallet/pages/wallet_view/transaction_views/tx_v2/transaction_v2_list.dart';
import 'package:stackwallet/providers/global/auto_swb_service_provider.dart'; import 'package:stackwallet/providers/global/auto_swb_service_provider.dart';
import 'package:stackwallet/providers/global/paynym_api_provider.dart'; import 'package:stackwallet/providers/global/paynym_api_provider.dart';
import 'package:stackwallet/providers/providers.dart'; import 'package:stackwallet/providers/providers.dart';
@ -842,7 +844,10 @@ class _WalletViewState extends ConsumerState<WalletView> {
text: "See all", text: "See all",
onTap: () { onTap: () {
Navigator.of(context).pushNamed( Navigator.of(context).pushNamed(
AllTransactionsView.routeName, coin == Coin.bitcoincash ||
coin == Coin.bitcoincashTestnet
? AllTransactionsV2View.routeName
: AllTransactionsView.routeName,
arguments: walletId, arguments: walletId,
); );
}, },
@ -881,7 +886,7 @@ class _WalletViewState extends ConsumerState<WalletView> {
0.0, 0.0,
0.8, 0.8,
1.0, 1.0,
], // 10% purple, 80% transparent, 10% purple ],
).createShader(bounds); ).createShader(bounds);
}, },
child: Container( child: Container(
@ -896,10 +901,16 @@ class _WalletViewState extends ConsumerState<WalletView> {
CrossAxisAlignment.stretch, CrossAxisAlignment.stretch,
children: [ children: [
Expanded( Expanded(
child: TransactionsList( child: coin == Coin.bitcoincash ||
managerProvider: managerProvider, coin == Coin.bitcoincashTestnet
walletId: walletId, ? TransactionsV2List(
), walletId: widget.walletId,
)
: TransactionsList(
managerProvider:
managerProvider,
walletId: walletId,
),
), ),
], ],
), ),