From e1d827a03b09c162772cb0ce3fd401c5f98334da Mon Sep 17 00:00:00 2001 From: poppingmoon <63451158+poppingmoon@users.noreply.github.com> Date: Mon, 31 Jul 2023 19:13:09 +0900 Subject: [PATCH] =?UTF-8?q?=E3=83=AA=E3=82=A2=E3=82=AF=E3=82=B7=E3=83=A7?= =?UTF-8?q?=E3=83=B3=E3=83=87=E3=83=83=E3=82=AD=E4=B8=80=E6=8B=AC=E8=BF=BD?= =?UTF-8?q?=E5=8A=A0=E3=83=80=E3=82=A4=E3=82=A2=E3=83=AD=E3=82=B0=E3=82=92?= =?UTF-8?q?=E3=82=B9=E3=82=AF=E3=83=AD=E3=83=BC=E3=83=AB=E3=81=A7=E3=81=8D?= =?UTF-8?q?=E3=82=8B=E3=82=88=E3=81=86=E3=81=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../add_reactions_dialog.dart | 177 ++++++++---------- 1 file changed, 77 insertions(+), 100 deletions(-) diff --git a/lib/view/several_account_settings_page/reaction_deck_page/add_reactions_dialog.dart b/lib/view/several_account_settings_page/reaction_deck_page/add_reactions_dialog.dart index 1cc50cf5a..8336eb498 100644 --- a/lib/view/several_account_settings_page/reaction_deck_page/add_reactions_dialog.dart +++ b/lib/view/several_account_settings_page/reaction_deck_page/add_reactions_dialog.dart @@ -17,7 +17,6 @@ class AddReactionsDialog extends StatefulWidget { class _AddReactionsDialogState extends State { final controller = TextEditingController(); final formKey = GlobalKey(); - bool showDescription = true; @override void dispose() { @@ -42,112 +41,90 @@ class _AddReactionsDialogState extends State { ); return AlertDialog( title: const Text("一括追加"), - content: SizedBox( - width: MediaQuery.of(context).size.width * 0.8, - height: MediaQuery.of(context).size.height * 0.8, - child: Form( - key: formKey, - child: Column( - children: [ - Visibility( - visible: showDescription, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - const ListTile( - title: Text("1"), - subtitle: Text( - "お使いのブラウザでリアクションデッキをコピーしたい" - "アカウントにログインしてください", - ), - ), - ListTile( - title: const Text("2"), - subtitle: Text.rich( + scrollable: true, + content: Form( + key: formKey, + child: Column( + children: [ + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + const ListTile( + title: Text("1"), + subtitle: Text( + "お使いのブラウザでリアクションデッキをコピーしたい" + "アカウントにログインしてください", + ), + ), + ListTile( + title: const Text("2"), + subtitle: Text.rich( + TextSpan( + children: [ + const TextSpan(text: "同じブラウザで "), TextSpan( - children: [ - const TextSpan(text: "同じブラウザで "), - TextSpan( - text: uri.toString(), - style: AppTheme.of(context).linkStyle, - recognizer: TapGestureRecognizer() - ..onTap = () => launchUrl( - uri, - mode: LaunchMode.externalApplication, - ), - ), - const TextSpan( - text: // - " にアクセスして「値 (JSON)」の内容をすべて選択して" - "コピーしてください", - ) - ], + text: uri.toString(), + style: AppTheme.of(context).linkStyle, + recognizer: TapGestureRecognizer() + ..onTap = () => launchUrl( + uri, + mode: LaunchMode.externalApplication, + ), ), - ), + const TextSpan( + text: // + " にアクセスして「値 (JSON)」の内容をすべて選択して" + "コピーしてください", + ) + ], ), - const ListTile( - title: Text("3"), - subtitle: Text( - "コピーしたものを下のテキストボックスに貼り付けてください", - ), - ), - ], + ), ), - ), - TextButton( - onPressed: () => setState(() { - showDescription = !showDescription; - }), - child: Text((showDescription) ? "説明を隠す" : "説明を表示する"), - ), - Expanded( - child: Focus( - onFocusChange: (focus) { - if (focus) { - setState(() { - showDescription = false; - }); - } - }, - child: TextFormField( - decoration: const InputDecoration( - hintText: "ここに貼り付け", - contentPadding: EdgeInsets.all(10), - isDense: true, - ), - keyboardType: TextInputType.multiline, - maxLines: null, - expands: true, - textAlignVertical: TextAlignVertical.top, - validator: (value) { - if (value == null || value.isEmpty) { - return "値が入力されていません"; - } - try { - final emojiNames = JSON5.parse(value) as List; - emojiNames.map((name) => name as String); - } catch (e) { - return "入力が有効な値ではありません"; - } - return null; - }, - autovalidateMode: AutovalidateMode.onUserInteraction, - onSaved: (value) { - if (formKey.currentState!.validate()) { - final emojiNames = JSON5.parse(value!) as List; - Navigator.of(context).pop( - emojiNames.map((name) => name as String).toList()); - } - }, + const ListTile( + title: Text("3"), + subtitle: Text( + "コピーしたものを下のテキストボックスに貼り付けてください", ), ), + ], + ), + const SizedBox(height: 10), + TextFormField( + decoration: const InputDecoration( + hintText: "ここに貼り付け", + contentPadding: EdgeInsets.all(10), + isDense: true, ), - ElevatedButton( - onPressed: () => formKey.currentState?.save.call(), - child: const Text("確定"), - ), - ], - ), + keyboardType: TextInputType.multiline, + maxLines: null, + minLines: 10, + textAlignVertical: TextAlignVertical.top, + validator: (value) { + if (value == null || value.isEmpty) { + return "値が入力されていません"; + } + try { + final emojiNames = JSON5.parse(value) as List; + emojiNames.map((name) => name as String); + } catch (e) { + return "入力が有効な値ではありません"; + } + return null; + }, + autovalidateMode: AutovalidateMode.onUserInteraction, + onSaved: (value) { + if (formKey.currentState!.validate()) { + final emojiNames = JSON5.parse(value!) as List; + Navigator.of(context) + .pop(emojiNames.map((name) => name as String).toList()); + } + }, + ), + ElevatedButton( + onPressed: () => formKey.currentState?.save.call(), + child: const Text("確定"), + ), + ], ), ), );