desktop trade history scroll fix

This commit is contained in:
julian 2022-11-22 16:18:38 -06:00
parent 157829a933
commit 467d43d9f3
2 changed files with 217 additions and 167 deletions

View file

@ -63,19 +63,9 @@ class _DesktopExchangeViewState extends State<DesktopExchangeView> {
width: 16, width: 16,
), ),
Expanded( Expanded(
child: Column( child: Row(
mainAxisSize: MainAxisSize.min, children: const [
crossAxisAlignment: CrossAxisAlignment.start, Expanded(
children: [
Text(
"Exchange details",
style: STextStyles.desktopTextExtraExtraSmall(context),
),
const SizedBox(
height: 16,
),
const RoundedWhiteContainer(
padding: EdgeInsets.all(0),
child: DesktopTradeHistory(), child: DesktopTradeHistory(),
), ),
], ],

View file

@ -6,6 +6,7 @@ import 'package:stackwallet/pages/exchange_view/trade_details_view.dart';
import 'package:stackwallet/providers/exchange/trade_sent_from_stack_lookup_provider.dart'; import 'package:stackwallet/providers/exchange/trade_sent_from_stack_lookup_provider.dart';
import 'package:stackwallet/providers/global/trades_service_provider.dart'; import 'package:stackwallet/providers/global/trades_service_provider.dart';
import 'package:stackwallet/providers/global/wallets_provider.dart'; import 'package:stackwallet/providers/global/wallets_provider.dart';
import 'package:stackwallet/utilities/constants.dart';
import 'package:stackwallet/utilities/text_styles.dart'; import 'package:stackwallet/utilities/text_styles.dart';
import 'package:stackwallet/utilities/theme/stack_colors.dart'; import 'package:stackwallet/utilities/theme/stack_colors.dart';
import 'package:stackwallet/widgets/rounded_white_container.dart'; import 'package:stackwallet/widgets/rounded_white_container.dart';
@ -24,6 +25,28 @@ class DesktopTradeHistory extends ConsumerStatefulWidget {
} }
class _DesktopTradeHistoryState extends ConsumerState<DesktopTradeHistory> { class _DesktopTradeHistoryState extends ConsumerState<DesktopTradeHistory> {
BorderRadius get _borderRadiusFirst {
return BorderRadius.only(
topLeft: Radius.circular(
Constants.size.circularBorderRadius,
),
topRight: Radius.circular(
Constants.size.circularBorderRadius,
),
);
}
BorderRadius get _borderRadiusLast {
return BorderRadius.only(
bottomLeft: Radius.circular(
Constants.size.circularBorderRadius,
),
bottomRight: Radius.circular(
Constants.size.circularBorderRadius,
),
);
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final trades = final trades =
@ -33,17 +56,42 @@ class _DesktopTradeHistoryState extends ConsumerState<DesktopTradeHistory> {
final hasHistory = tradeCount > 0; final hasHistory = tradeCount > 0;
if (hasHistory) { if (hasHistory) {
return ListView.separated( return Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
"Exchange details",
style: STextStyles.desktopTextExtraExtraSmall(context),
),
const SizedBox(
height: 16,
),
Expanded(
child: ListView.separated(
shrinkWrap: true, shrinkWrap: true,
primary: false, primary: false,
itemBuilder: (context, index) { itemBuilder: (context, index) {
return TradeCard( BorderRadius? radius;
if (index == tradeCount - 1) {
radius = _borderRadiusLast;
} else if (index == 0) {
radius = _borderRadiusFirst;
}
return Container(
decoration: BoxDecoration(
color: Theme.of(context).extension<StackColors>()!.popupBG,
borderRadius: radius,
),
child: TradeCard(
key: Key("tradeCard_${trades[index].uuid}"), key: Key("tradeCard_${trades[index].uuid}"),
trade: trades[index], trade: trades[index],
onTap: () async { onTap: () async {
final String tradeId = trades[index].tradeId; final String tradeId = trades[index].tradeId;
final lookup = ref.read(tradeSentFromStackLookupProvider).all; final lookup =
ref.read(tradeSentFromStackLookupProvider).all;
debugPrint("ALL: $lookup"); debugPrint("ALL: $lookup");
@ -54,7 +102,9 @@ class _DesktopTradeHistoryState extends ConsumerState<DesktopTradeHistory> {
.read(tradeSentFromStackLookupProvider) .read(tradeSentFromStackLookupProvider)
.getWalletIdsForTradeId(tradeId); .getWalletIdsForTradeId(tradeId);
if (txid != null && walletIds != null && walletIds.isNotEmpty) { if (txid != null &&
walletIds != null &&
walletIds.isNotEmpty) {
final manager = ref final manager = ref
.read(walletsChangeNotifierProvider) .read(walletsChangeNotifierProvider)
.getManager(walletIds.first); .getManager(walletIds.first);
@ -90,14 +140,17 @@ class _DesktopTradeHistoryState extends ConsumerState<DesktopTradeHistory> {
), ),
child: Row( child: Row(
mainAxisAlignment: mainAxisAlignment:
MainAxisAlignment.spaceBetween, MainAxisAlignment
.spaceBetween,
children: [ children: [
Text( Text(
"Trade details", "Trade details",
style: STextStyles.desktopH3(context), style: STextStyles.desktopH3(
context),
), ),
DesktopDialogCloseButton( DesktopDialogCloseButton(
onPressedOverride: Navigator.of( onPressedOverride:
Navigator.of(
context, context,
rootNavigator: true, rootNavigator: true,
).pop, ).pop,
@ -150,14 +203,17 @@ class _DesktopTradeHistoryState extends ConsumerState<DesktopTradeHistory> {
), ),
child: Row( child: Row(
mainAxisAlignment: mainAxisAlignment:
MainAxisAlignment.spaceBetween, MainAxisAlignment
.spaceBetween,
children: [ children: [
Text( Text(
"Trade details", "Trade details",
style: STextStyles.desktopH3(context), style: STextStyles.desktopH3(
context),
), ),
DesktopDialogCloseButton( DesktopDialogCloseButton(
onPressedOverride: Navigator.of( onPressedOverride:
Navigator.of(
context, context,
rootNavigator: true, rootNavigator: true,
).pop, ).pop,
@ -187,6 +243,7 @@ class _DesktopTradeHistoryState extends ConsumerState<DesktopTradeHistory> {
); );
} }
}, },
),
); );
}, },
separatorBuilder: (context, index) { separatorBuilder: (context, index) {
@ -196,6 +253,9 @@ class _DesktopTradeHistoryState extends ConsumerState<DesktopTradeHistory> {
); );
}, },
itemCount: tradeCount, itemCount: tradeCount,
),
),
],
); );
} else { } else {
return RoundedWhiteContainer( return RoundedWhiteContainer(