trade details scroll on small desktop screens

This commit is contained in:
julian 2022-11-29 14:20:41 -06:00
parent a7bdbe1c79
commit 2476aa4d1f
4 changed files with 151 additions and 35 deletions

View file

@ -109,9 +109,7 @@ class _TransactionsListState extends ConsumerState<TransactionsList> {
return [ return [
FadePageRoute( FadePageRoute(
DesktopDialog( DesktopDialog(
// maxHeight: maxHeight: null,
// MediaQuery.of(context).size.height - 64,
maxHeight: double.infinity,
maxWidth: 580, maxWidth: 580,
child: Column( child: Column(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,

View file

@ -17,6 +17,8 @@ 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/custom_buttons/app_bar_icon_button.dart'; import 'package:stackwallet/widgets/custom_buttons/app_bar_icon_button.dart';
import 'package:stackwallet/widgets/desktop/desktop_app_bar.dart'; import 'package:stackwallet/widgets/desktop/desktop_app_bar.dart';
import 'package:stackwallet/widgets/desktop/desktop_dialog.dart';
import 'package:stackwallet/widgets/desktop/desktop_dialog_close_button.dart';
import 'package:stackwallet/widgets/desktop/desktop_scaffold.dart'; import 'package:stackwallet/widgets/desktop/desktop_scaffold.dart';
import 'package:stackwallet/widgets/icon_widgets/x_icon.dart'; import 'package:stackwallet/widgets/icon_widgets/x_icon.dart';
import 'package:stackwallet/widgets/rounded_white_container.dart'; import 'package:stackwallet/widgets/rounded_white_container.dart';
@ -24,6 +26,8 @@ import 'package:stackwallet/widgets/stack_text_field.dart';
import 'package:stackwallet/widgets/textfield_icon_button.dart'; import 'package:stackwallet/widgets/textfield_icon_button.dart';
import 'package:tuple/tuple.dart'; import 'package:tuple/tuple.dart';
import '../../route_generator.dart';
class DesktopAllTradesView extends ConsumerStatefulWidget { class DesktopAllTradesView extends ConsumerStatefulWidget {
const DesktopAllTradesView({Key? key}) : super(key: key); const DesktopAllTradesView({Key? key}) : super(key: key);
@ -348,29 +352,140 @@ class _DesktopTradeRowCardState extends ConsumerState<DesktopTradeRowCard> {
final txData = await manager.transactionData; final txData = await manager.transactionData;
final tx = txData.getAllTransactions()[txid]; final tx = txData.getAllTransactions()[txid];
await showDialog<void>(
context: context,
builder: (context) => DesktopDialog(
maxHeight: MediaQuery.of(context).size.height - 64,
maxWidth: 580,
child: TradeDetailsView(
tradeId: tradeId,
transactionIfSentFromStack: tx,
walletName: manager.walletName,
walletId: walletIds.first,
),
),
);
if (mounted) { if (mounted) {
unawaited( unawaited(
Navigator.of(context).pushNamed( showDialog<void>(
TradeDetailsView.routeName, context: context,
arguments: Tuple4( builder: (context) => Navigator(
tradeId, initialRoute: TradeDetailsView.routeName,
tx, onGenerateRoute: RouteGenerator.generateRoute,
walletIds.first, onGenerateInitialRoutes: (_, __) {
manager.walletName, return [
FadePageRoute(
DesktopDialog(
maxHeight: null,
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: SingleChildScrollView(
primary: false,
child: TradeDetailsView(
tradeId: tradeId,
transactionIfSentFromStack: tx,
walletName: manager.walletName,
walletId: walletIds.first,
),
),
),
],
),
),
const RouteSettings(
name: TradeDetailsView.routeName,
),
),
];
},
), ),
), ),
); );
} }
} else { } else {
unawaited( unawaited(
Navigator.of(context).pushNamed( showDialog<void>(
TradeDetailsView.routeName, context: context,
arguments: Tuple4( builder: (context) => Navigator(
tradeId, initialRoute: TradeDetailsView.routeName,
null, onGenerateRoute: RouteGenerator.generateRoute,
walletIds?.first, onGenerateInitialRoutes: (_, __) {
null, return [
FadePageRoute(
DesktopDialog(
maxHeight: null,
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: SingleChildScrollView(
primary: false,
child: TradeDetailsView(
tradeId: tradeId,
transactionIfSentFromStack: null,
walletName: null,
walletId: walletIds?.first,
),
),
),
],
),
),
const RouteSettings(
name: TradeDetailsView.routeName,
),
),
];
},
), ),
), ),
); );

View file

@ -139,9 +139,7 @@ class _DesktopTradeHistoryState extends ConsumerState<DesktopTradeHistory> {
return [ return [
FadePageRoute( FadePageRoute(
DesktopDialog( DesktopDialog(
// maxHeight: maxHeight: null,
// MediaQuery.of(context).size.height - 64,
maxHeight: double.infinity,
maxWidth: 580, maxWidth: 580,
child: Column( child: Column(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
@ -172,11 +170,14 @@ class _DesktopTradeHistoryState extends ConsumerState<DesktopTradeHistory> {
), ),
), ),
Flexible( Flexible(
child: TradeDetailsView( child: SingleChildScrollView(
tradeId: tradeId, primary: false,
transactionIfSentFromStack: tx, child: TradeDetailsView(
walletName: manager.walletName, tradeId: tradeId,
walletId: walletIds.first, transactionIfSentFromStack: tx,
walletName: manager.walletName,
walletId: walletIds.first,
),
), ),
), ),
], ],
@ -202,9 +203,7 @@ class _DesktopTradeHistoryState extends ConsumerState<DesktopTradeHistory> {
return [ return [
FadePageRoute( FadePageRoute(
DesktopDialog( DesktopDialog(
// maxHeight: maxHeight: null,
// MediaQuery.of(context).size.height - 64,
maxHeight: double.infinity,
maxWidth: 580, maxWidth: 580,
child: Column( child: Column(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
@ -235,11 +234,15 @@ class _DesktopTradeHistoryState extends ConsumerState<DesktopTradeHistory> {
), ),
), ),
Flexible( Flexible(
child: TradeDetailsView( child: SingleChildScrollView(
tradeId: tradeId, primary: false,
transactionIfSentFromStack: null, child: TradeDetailsView(
walletName: null, tradeId: tradeId,
walletId: walletIds?.first, transactionIfSentFromStack:
null,
walletName: null,
walletId: walletIds?.first,
),
), ),
), ),
], ],

View file

@ -11,7 +11,7 @@ class DesktopDialog extends StatelessWidget {
final Widget? child; final Widget? child;
final double maxWidth; final double maxWidth;
final double maxHeight; final double? maxHeight;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -22,7 +22,7 @@ class DesktopDialog extends StatelessWidget {
ConstrainedBox( ConstrainedBox(
constraints: BoxConstraints( constraints: BoxConstraints(
maxWidth: maxWidth, maxWidth: maxWidth,
maxHeight: maxHeight, maxHeight: maxHeight ?? MediaQuery.of(context).size.height - 64,
), ),
child: Material( child: Material(
color: Colors.transparent, color: Colors.transparent,