mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2024-12-24 04:19:23 +00:00
desktop trade history scroll fix
This commit is contained in:
parent
157829a933
commit
467d43d9f3
2 changed files with 217 additions and 167 deletions
|
@ -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(),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
|
|
@ -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,169 +56,206 @@ class _DesktopTradeHistoryState extends ConsumerState<DesktopTradeHistory> {
|
||||||
final hasHistory = tradeCount > 0;
|
final hasHistory = tradeCount > 0;
|
||||||
|
|
||||||
if (hasHistory) {
|
if (hasHistory) {
|
||||||
return ListView.separated(
|
return Column(
|
||||||
shrinkWrap: true,
|
mainAxisSize: MainAxisSize.min,
|
||||||
primary: false,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
itemBuilder: (context, index) {
|
children: [
|
||||||
return TradeCard(
|
Text(
|
||||||
key: Key("tradeCard_${trades[index].uuid}"),
|
"Exchange details",
|
||||||
trade: trades[index],
|
style: STextStyles.desktopTextExtraExtraSmall(context),
|
||||||
onTap: () async {
|
),
|
||||||
final String tradeId = trades[index].tradeId;
|
const SizedBox(
|
||||||
|
height: 16,
|
||||||
final lookup = ref.read(tradeSentFromStackLookupProvider).all;
|
),
|
||||||
|
Expanded(
|
||||||
debugPrint("ALL: $lookup");
|
child: ListView.separated(
|
||||||
|
shrinkWrap: true,
|
||||||
final String? txid = ref
|
primary: false,
|
||||||
.read(tradeSentFromStackLookupProvider)
|
itemBuilder: (context, index) {
|
||||||
.getTxidForTradeId(tradeId);
|
BorderRadius? radius;
|
||||||
final List<String>? walletIds = ref
|
if (index == tradeCount - 1) {
|
||||||
.read(tradeSentFromStackLookupProvider)
|
radius = _borderRadiusLast;
|
||||||
.getWalletIdsForTradeId(tradeId);
|
} else if (index == 0) {
|
||||||
|
radius = _borderRadiusFirst;
|
||||||
if (txid != null && walletIds != null && walletIds.isNotEmpty) {
|
|
||||||
final manager = ref
|
|
||||||
.read(walletsChangeNotifierProvider)
|
|
||||||
.getManager(walletIds.first);
|
|
||||||
|
|
||||||
debugPrint("name: ${manager.walletName}");
|
|
||||||
|
|
||||||
// TODO store tx data completely locally in isar so we don't lock up ui here when querying txData
|
|
||||||
final txData = await manager.transactionData;
|
|
||||||
|
|
||||||
final tx = txData.getAllTransactions()[txid];
|
|
||||||
|
|
||||||
if (mounted) {
|
|
||||||
await showDialog<void>(
|
|
||||||
context: context,
|
|
||||||
builder: (context) => Navigator(
|
|
||||||
initialRoute: TradeDetailsView.routeName,
|
|
||||||
onGenerateRoute: RouteGenerator.generateRoute,
|
|
||||||
onGenerateInitialRoutes: (_, __) {
|
|
||||||
return [
|
|
||||||
FadePageRoute(
|
|
||||||
DesktopDialog(
|
|
||||||
// maxHeight:
|
|
||||||
// MediaQuery.of(context).size.height - 64,
|
|
||||||
maxHeight: double.infinity,
|
|
||||||
maxWidth: 580,
|
|
||||||
child: Column(
|
|
||||||
mainAxisSize: MainAxisSize.min,
|
|
||||||
children: [
|
|
||||||
Padding(
|
|
||||||
padding: const EdgeInsets.only(
|
|
||||||
left: 32,
|
|
||||||
bottom: 16,
|
|
||||||
),
|
|
||||||
child: Row(
|
|
||||||
mainAxisAlignment:
|
|
||||||
MainAxisAlignment.spaceBetween,
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
"Trade details",
|
|
||||||
style: STextStyles.desktopH3(context),
|
|
||||||
),
|
|
||||||
DesktopDialogCloseButton(
|
|
||||||
onPressedOverride: Navigator.of(
|
|
||||||
context,
|
|
||||||
rootNavigator: true,
|
|
||||||
).pop,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Flexible(
|
|
||||||
child: TradeDetailsView(
|
|
||||||
tradeId: tradeId,
|
|
||||||
transactionIfSentFromStack: tx,
|
|
||||||
walletName: manager.walletName,
|
|
||||||
walletId: walletIds.first,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const RouteSettings(
|
|
||||||
name: TradeDetailsView.routeName,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
];
|
|
||||||
},
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
unawaited(
|
return Container(
|
||||||
showDialog<void>(
|
decoration: BoxDecoration(
|
||||||
context: context,
|
color: Theme.of(context).extension<StackColors>()!.popupBG,
|
||||||
builder: (context) => Navigator(
|
borderRadius: radius,
|
||||||
initialRoute: TradeDetailsView.routeName,
|
),
|
||||||
onGenerateRoute: RouteGenerator.generateRoute,
|
child: TradeCard(
|
||||||
onGenerateInitialRoutes: (_, __) {
|
key: Key("tradeCard_${trades[index].uuid}"),
|
||||||
return [
|
trade: trades[index],
|
||||||
FadePageRoute(
|
onTap: () async {
|
||||||
DesktopDialog(
|
final String tradeId = trades[index].tradeId;
|
||||||
// maxHeight:
|
|
||||||
// MediaQuery.of(context).size.height - 64,
|
final lookup =
|
||||||
maxHeight: double.infinity,
|
ref.read(tradeSentFromStackLookupProvider).all;
|
||||||
maxWidth: 580,
|
|
||||||
child: Column(
|
debugPrint("ALL: $lookup");
|
||||||
mainAxisSize: MainAxisSize.min,
|
|
||||||
children: [
|
final String? txid = ref
|
||||||
Padding(
|
.read(tradeSentFromStackLookupProvider)
|
||||||
padding: const EdgeInsets.only(
|
.getTxidForTradeId(tradeId);
|
||||||
left: 32,
|
final List<String>? walletIds = ref
|
||||||
bottom: 16,
|
.read(tradeSentFromStackLookupProvider)
|
||||||
|
.getWalletIdsForTradeId(tradeId);
|
||||||
|
|
||||||
|
if (txid != null &&
|
||||||
|
walletIds != null &&
|
||||||
|
walletIds.isNotEmpty) {
|
||||||
|
final manager = ref
|
||||||
|
.read(walletsChangeNotifierProvider)
|
||||||
|
.getManager(walletIds.first);
|
||||||
|
|
||||||
|
debugPrint("name: ${manager.walletName}");
|
||||||
|
|
||||||
|
// TODO store tx data completely locally in isar so we don't lock up ui here when querying txData
|
||||||
|
final txData = await manager.transactionData;
|
||||||
|
|
||||||
|
final tx = txData.getAllTransactions()[txid];
|
||||||
|
|
||||||
|
if (mounted) {
|
||||||
|
await showDialog<void>(
|
||||||
|
context: context,
|
||||||
|
builder: (context) => Navigator(
|
||||||
|
initialRoute: TradeDetailsView.routeName,
|
||||||
|
onGenerateRoute: RouteGenerator.generateRoute,
|
||||||
|
onGenerateInitialRoutes: (_, __) {
|
||||||
|
return [
|
||||||
|
FadePageRoute(
|
||||||
|
DesktopDialog(
|
||||||
|
// maxHeight:
|
||||||
|
// MediaQuery.of(context).size.height - 64,
|
||||||
|
maxHeight: double.infinity,
|
||||||
|
maxWidth: 580,
|
||||||
|
child: Column(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: [
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.only(
|
||||||
|
left: 32,
|
||||||
|
bottom: 16,
|
||||||
|
),
|
||||||
|
child: Row(
|
||||||
|
mainAxisAlignment:
|
||||||
|
MainAxisAlignment
|
||||||
|
.spaceBetween,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
"Trade details",
|
||||||
|
style: STextStyles.desktopH3(
|
||||||
|
context),
|
||||||
|
),
|
||||||
|
DesktopDialogCloseButton(
|
||||||
|
onPressedOverride:
|
||||||
|
Navigator.of(
|
||||||
|
context,
|
||||||
|
rootNavigator: true,
|
||||||
|
).pop,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Flexible(
|
||||||
|
child: TradeDetailsView(
|
||||||
|
tradeId: tradeId,
|
||||||
|
transactionIfSentFromStack: tx,
|
||||||
|
walletName: manager.walletName,
|
||||||
|
walletId: walletIds.first,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
),
|
),
|
||||||
child: Row(
|
const RouteSettings(
|
||||||
mainAxisAlignment:
|
name: TradeDetailsView.routeName,
|
||||||
MainAxisAlignment.spaceBetween,
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
"Trade details",
|
|
||||||
style: STextStyles.desktopH3(context),
|
|
||||||
),
|
|
||||||
DesktopDialogCloseButton(
|
|
||||||
onPressedOverride: Navigator.of(
|
|
||||||
context,
|
|
||||||
rootNavigator: true,
|
|
||||||
).pop,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Flexible(
|
];
|
||||||
child: TradeDetailsView(
|
},
|
||||||
tradeId: tradeId,
|
|
||||||
transactionIfSentFromStack: null,
|
|
||||||
walletName: null,
|
|
||||||
walletId: walletIds?.first,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
const RouteSettings(
|
);
|
||||||
name: TradeDetailsView.routeName,
|
}
|
||||||
|
} else {
|
||||||
|
unawaited(
|
||||||
|
showDialog<void>(
|
||||||
|
context: context,
|
||||||
|
builder: (context) => Navigator(
|
||||||
|
initialRoute: TradeDetailsView.routeName,
|
||||||
|
onGenerateRoute: RouteGenerator.generateRoute,
|
||||||
|
onGenerateInitialRoutes: (_, __) {
|
||||||
|
return [
|
||||||
|
FadePageRoute(
|
||||||
|
DesktopDialog(
|
||||||
|
// maxHeight:
|
||||||
|
// MediaQuery.of(context).size.height - 64,
|
||||||
|
maxHeight: double.infinity,
|
||||||
|
maxWidth: 580,
|
||||||
|
child: Column(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: [
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.only(
|
||||||
|
left: 32,
|
||||||
|
bottom: 16,
|
||||||
|
),
|
||||||
|
child: Row(
|
||||||
|
mainAxisAlignment:
|
||||||
|
MainAxisAlignment
|
||||||
|
.spaceBetween,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
"Trade details",
|
||||||
|
style: STextStyles.desktopH3(
|
||||||
|
context),
|
||||||
|
),
|
||||||
|
DesktopDialogCloseButton(
|
||||||
|
onPressedOverride:
|
||||||
|
Navigator.of(
|
||||||
|
context,
|
||||||
|
rootNavigator: true,
|
||||||
|
).pop,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Flexible(
|
||||||
|
child: TradeDetailsView(
|
||||||
|
tradeId: tradeId,
|
||||||
|
transactionIfSentFromStack: null,
|
||||||
|
walletName: null,
|
||||||
|
walletId: walletIds?.first,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const RouteSettings(
|
||||||
|
name: TradeDetailsView.routeName,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
];
|
||||||
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
];
|
);
|
||||||
},
|
}
|
||||||
),
|
},
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
},
|
||||||
},
|
separatorBuilder: (context, index) {
|
||||||
);
|
return Container(
|
||||||
},
|
height: 1,
|
||||||
separatorBuilder: (context, index) {
|
color: Theme.of(context).extension<StackColors>()!.background,
|
||||||
return Container(
|
);
|
||||||
height: 1,
|
},
|
||||||
color: Theme.of(context).extension<StackColors>()!.background,
|
itemCount: tradeCount,
|
||||||
);
|
),
|
||||||
},
|
),
|
||||||
itemCount: tradeCount,
|
],
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
return RoundedWhiteContainer(
|
return RoundedWhiteContainer(
|
||||||
|
|
Loading…
Reference in a new issue