diff --git a/lib/pages/send_view/send_view.dart b/lib/pages/send_view/send_view.dart index 246f9dd5e..9309600d6 100644 --- a/lib/pages/send_view/send_view.dart +++ b/lib/pages/send_view/send_view.dart @@ -978,21 +978,27 @@ class _SendViewState extends ConsumerState { mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Text( - isPaynymSend ? "Send to PayNym address" : "Send to", + isPaynymSend + ? "Send to PayNym address" + : "Send to", style: STextStyles.smallMed12(context), textAlign: TextAlign.left, ), - if (coin == Coin.monero) - CustomTextButton( - text: "Use OpenAlias", - onTap: () async { - await showModalBottomSheet(context: context, builder: (context) => OpenAliasBottomSheet( - onSelected: (address) { - sendToController.text = address; - }, - )); - }, - ) + // if (coin == Coin.monero) + // CustomTextButton( + // text: "Use OpenAlias", + // onTap: () async { + // await showModalBottomSheet( + // context: context, + // builder: (context) => + // OpenAliasBottomSheet( + // onSelected: (address) { + // sendToController.text = address; + // }, + // ), + // ); + // }, + // ), ], ), const SizedBox( diff --git a/lib/pages/send_view/sub_widgets/openalias_sheet.dart b/lib/pages/send_view/sub_widgets/openalias_sheet.dart index a19265bcb..d2bf5d302 100644 --- a/lib/pages/send_view/sub_widgets/openalias_sheet.dart +++ b/lib/pages/send_view/sub_widgets/openalias_sheet.dart @@ -1,148 +1,151 @@ -/* - * 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/cupertino.dart'; -import 'package:flutter/material.dart'; -import 'package:flutter_riverpod/flutter_riverpod.dart'; - -import '../../../themes/stack_colors.dart'; -import '../../../utilities/constants.dart'; -import '../../../utilities/text_styles.dart'; - -import 'package:basic_utils/basic_utils.dart'; - -class OpenAliasBottomSheet extends ConsumerStatefulWidget { - const OpenAliasBottomSheet({ - Key? key, - required this.onSelected, - }) : super(key: key); - - final Null Function(String) onSelected; - - @override - ConsumerState createState() => - _OpenAliasBottomSheetState(); -} - -class _OpenAliasBottomSheetState extends ConsumerState { - late TextEditingController textEditingController; - - @override - void initState() { - super.initState(); - textEditingController = TextEditingController(); - } - - @override - Widget build(BuildContext context) { - return SingleChildScrollView( - child: Padding( - padding: EdgeInsets.only(bottom: MediaQuery.of(context).viewInsets.bottom), - child: Container( - decoration: BoxDecoration( - color: Theme.of(context).extension()!.popupBG, - borderRadius: const BorderRadius.vertical( - top: Radius.circular(20), - ), - ), - child: Padding( - padding: const EdgeInsets.only( - top: 20, - left: 20, - right: 20, - bottom: 20, - ), - child: Column( - mainAxisSize: MainAxisSize.min, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Center( - child: Container( - decoration: BoxDecoration( - color: Theme.of(context) - .extension()! - .textFieldDefaultBG, - borderRadius: BorderRadius.circular( - Constants.size.circularBorderRadius, - ), - ), - width: 60, - height: 4, - ), - ), - const SizedBox( - height: 36, - ), - Text( - 'OpenAlias Address', - style: STextStyles.smallMed12(context), - textAlign: TextAlign.left, - ), - const SizedBox( - height: 8, - ), - TextField( - controller: textEditingController, - decoration: const InputDecoration( - border: OutlineInputBorder(), - ), - ), - const SizedBox( - height: 16, - ), - Align( - alignment: Alignment.bottomCenter, - child: ConstrainedBox( - constraints: const BoxConstraints( - minWidth: 480, - minHeight: 70, - ), - child: TextButton( - style: Theme.of(context) - .extension()! - .getPrimaryEnabledButtonStyle(context), - onPressed: () async { - String text = textEditingController.text.trim().replaceAll("@", "."); - List? result = await DnsUtils.lookupRecord(text, RRecordType.TXT); - String address = ""; - if (result != null && result.isNotEmpty) { - for (RRecord record in result) { - if (record.data.startsWith("oa1:xmr")) { - List datas = record.data.split(" "); - for (String data in datas) { - if (data.startsWith("recipient_address=")) { - address = data.substring("recipient_address=".length).replaceAll(";", ""); - break; - } - } - break; - } - } - } - widget.onSelected(address!); - Navigator.of(context).pop(); - }, - child: Text( - "Enter", - style: STextStyles.button(context), - ), - ), - ), - ) - ], - ), - ), - ), - ), - ); - } -} - - +// /* +// * 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:basic_utils/basic_utils.dart'; +// import 'package:flutter/material.dart'; +// import 'package:flutter_riverpod/flutter_riverpod.dart'; +// import 'package:stackwallet/themes/stack_colors.dart'; +// import 'package:stackwallet/utilities/constants.dart'; +// import 'package:stackwallet/utilities/text_styles.dart'; +// +// class OpenAliasBottomSheet extends ConsumerStatefulWidget { +// const OpenAliasBottomSheet({ +// Key? key, +// required this.onSelected, +// }) : super(key: key); +// +// final Null Function(String) onSelected; +// +// @override +// ConsumerState createState() => +// _OpenAliasBottomSheetState(); +// } +// +// class _OpenAliasBottomSheetState extends ConsumerState { +// late TextEditingController textEditingController; +// +// @override +// void initState() { +// super.initState(); +// textEditingController = TextEditingController(); +// } +// +// @override +// Widget build(BuildContext context) { +// return SingleChildScrollView( +// child: Padding( +// padding: +// EdgeInsets.only(bottom: MediaQuery.of(context).viewInsets.bottom), +// child: Container( +// decoration: BoxDecoration( +// color: Theme.of(context).extension()!.popupBG, +// borderRadius: const BorderRadius.vertical( +// top: Radius.circular(20), +// ), +// ), +// child: Padding( +// padding: const EdgeInsets.only( +// top: 20, +// left: 20, +// right: 20, +// bottom: 20, +// ), +// child: Column( +// mainAxisSize: MainAxisSize.min, +// crossAxisAlignment: CrossAxisAlignment.start, +// children: [ +// Center( +// child: Container( +// decoration: BoxDecoration( +// color: Theme.of(context) +// .extension()! +// .textFieldDefaultBG, +// borderRadius: BorderRadius.circular( +// Constants.size.circularBorderRadius, +// ), +// ), +// width: 60, +// height: 4, +// ), +// ), +// const SizedBox( +// height: 36, +// ), +// Text( +// 'OpenAlias Address', +// style: STextStyles.smallMed12(context), +// textAlign: TextAlign.left, +// ), +// const SizedBox( +// height: 8, +// ), +// TextField( +// controller: textEditingController, +// decoration: const InputDecoration( +// border: OutlineInputBorder(), +// ), +// ), +// const SizedBox( +// height: 16, +// ), +// Align( +// alignment: Alignment.bottomCenter, +// child: ConstrainedBox( +// constraints: const BoxConstraints( +// minWidth: 480, +// minHeight: 70, +// ), +// child: TextButton( +// style: Theme.of(context) +// .extension()! +// .getPrimaryEnabledButtonStyle(context), +// onPressed: () async { +// String text = textEditingController.text +// .trim() +// .replaceAll("@", "."); +// List? result = +// await DnsUtils.lookupRecord(text, RRecordType.TXT); +// String address = ""; +// if (result != null && result.isNotEmpty) { +// for (RRecord record in result) { +// if (record.data.startsWith("oa1:xmr")) { +// List datas = record.data.split(" "); +// for (String data in datas) { +// if (data.startsWith("recipient_address=")) { +// address = data +// .substring("recipient_address=".length) +// .replaceAll(";", ""); +// break; +// } +// } +// break; +// } +// } +// } +// widget.onSelected(address); +// if (mounted) { +// Navigator.of(context).pop(); +// } +// }, +// child: Text( +// "Enter", +// style: STextStyles.button(context), +// ), +// ), +// ), +// ) +// ], +// ), +// ), +// ), +// ), +// ); +// } +// }