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,37 +78,13 @@ 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: [
@ -123,33 +97,18 @@ class _FusionGroupDetailsViewState
), ),
Flexible( Flexible(
child: Padding( child: Padding(
padding: isDesktop padding: const EdgeInsets.only(
? const EdgeInsets.only(
right: 32, right: 32,
bottom: 32, bottom: 32,
) ),
: const EdgeInsets.all(0), child: RoundedWhiteContainer(
child: ConditionalParent(
condition: isDesktop,
builder: (child) {
return RoundedWhiteContainer(
borderColor: isDesktop borderColor: isDesktop
? Theme.of(context) ? Theme.of(context)
.extension<StackColors>()! .extension<StackColors>()!
.backgroundAppBar .backgroundAppBar
: null, : null,
padding: const EdgeInsets.all(0), padding: const EdgeInsets.all(0),
child: child, child: ListView.separated(
);
},
child: SingleChildScrollView(
primary: isDesktop ? false : null,
child: Padding(
padding: isDesktop
? const EdgeInsets.all(0)
: const EdgeInsets.all(4),
child: Util.isDesktop
? ListView.separated(
shrinkWrap: true, shrinkWrap: true,
itemBuilder: (context, index) { itemBuilder: (context, index) {
BorderRadius? radius; BorderRadius? radius;
@ -157,8 +116,7 @@ class _FusionGroupDetailsViewState
radius = BorderRadius.circular( radius = BorderRadius.circular(
Constants.size.circularBorderRadius, Constants.size.circularBorderRadius,
); );
} else if (index == } else if (index == widget.transactions.length - 1) {
widget.transactions.length - 1) {
radius = _borderRadiusLast; radius = _borderRadiusLast;
} else if (index == 0) { } else if (index == 0) {
radius = _borderRadiusFirst; radius = _borderRadiusFirst;
@ -180,55 +138,59 @@ class _FusionGroupDetailsViewState
); );
}, },
itemCount: widget.transactions.length, itemCount: widget.transactions.length,
) ),
: ListView.builder( ),
),
),
],
),
),
);
} 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, itemCount: widget.transactions.length,
itemBuilder: (context, index) { itemBuilder: (context, index) {
BorderRadius? radius; BorderRadius? radius;
bool shouldWrap = false;
if (widget.transactions.length == 1) { if (widget.transactions.length == 1) {
radius = BorderRadius.circular( radius = BorderRadius.circular(
Constants.size.circularBorderRadius, Constants.size.circularBorderRadius,
); );
} else if (index == } else if (index == widget.transactions.length - 1) {
widget.transactions.length - 1) {
radius = _borderRadiusLast; radius = _borderRadiusLast;
shouldWrap = true;
} else if (index == 0) { } else if (index == 0) {
radius = _borderRadiusFirst; radius = _borderRadiusFirst;
} }
final tx = widget.transactions[index]; 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( return TxListItem(
tx: tx, tx: tx,
coin: widget.coin, coin: widget.coin,
radius: radius, 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,8 +901,14 @@ class _WalletViewState extends ConsumerState<WalletView> {
CrossAxisAlignment.stretch, CrossAxisAlignment.stretch,
children: [ children: [
Expanded( Expanded(
child: TransactionsList( child: coin == Coin.bitcoincash ||
managerProvider: managerProvider, coin == Coin.bitcoincashTestnet
? TransactionsV2List(
walletId: widget.walletId,
)
: TransactionsList(
managerProvider:
managerProvider,
walletId: walletId, walletId: walletId,
), ),
), ),