/* * This file is part of Stack Wallet. * * Copyright (c) 2023 Cypher Stack * All Rights Reserved. * The code is distributed under GPLv3 license, see LICENSE file for details. * Generated by Cypher Stack on 2023-05-26 * */ import 'package:flutter/material.dart'; import '../../utilities/text_styles.dart'; import '../../utilities/util.dart'; import '../desktop/desktop_dialog.dart'; import '../desktop/desktop_dialog_close_button.dart'; import '../stack_dialog.dart'; class BasicDialog extends StatelessWidget { const BasicDialog({ Key? key, this.leftButton, this.rightButton, this.icon, required this.title, this.message, this.desktopHeight = 474, this.desktopWidth = 641, this.canPopWithBackButton = false, this.flex = false, }) : super(key: key); final Widget? leftButton; final Widget? rightButton; final Widget? icon; final String title; final String? message; final double? desktopHeight; final double desktopWidth; final bool canPopWithBackButton; final bool flex; @override Widget build(BuildContext context) { final isDesktop = Util.isDesktop; if (isDesktop) { return DesktopDialog( maxHeight: desktopHeight, maxWidth: desktopWidth, child: Column( children: [ Padding( padding: const EdgeInsets.only(left: 32), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Text( title, style: STextStyles.desktopH3(context), ), const DesktopDialogCloseButton(), ], ), ), if (flex) const Spacer( flex: 2, ), if (message != null) Padding( padding: const EdgeInsets.symmetric(horizontal: 32), child: Text( message!, style: STextStyles.desktopTextSmall(context), ), ), if (flex) const Spacer( flex: 3, ), if (leftButton != null || rightButton != null) const SizedBox( height: 32, ), if (leftButton != null || rightButton != null) Padding( padding: const EdgeInsets.all(32), child: Row( children: [ leftButton != null ? Expanded(child: leftButton!) : const Spacer(), const SizedBox( width: 16, ), rightButton != null ? Expanded(child: rightButton!) : const Spacer(), ], ), ) ], ), ); } else { return WillPopScope( onWillPop: () async { return canPopWithBackButton; }, child: StackDialog( title: title, leftButton: leftButton, rightButton: rightButton, icon: icon, message: message, ), ); } } }