From 52ba9468a4ab691ab9886895566e3e7bb6ba2b81 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20Ku=C3=9Fowski?= Date: Sun, 1 Jun 2025 11:07:46 +0200 Subject: [PATCH 1/4] chore: Follow up add check list --- lib/pages/chat/chat.dart | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/pages/chat/chat.dart b/lib/pages/chat/chat.dart index 212210b4e..b312429d4 100644 --- a/lib/pages/chat/chat.dart +++ b/lib/pages/chat/chat.dart @@ -1192,6 +1192,7 @@ class ChatController extends State } else { sendController.text += '\n- [ ] '; } + onInputBarChanged(sendController.text); inputFocus.requestFocus(); } } From 5fb882955c6cf9a63eaa325aafa03904b631960f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20Ku=C3=9Fowski?= Date: Sun, 1 Jun 2025 11:31:09 +0200 Subject: [PATCH 2/4] chore: Follow up create check list UX --- lib/pages/chat/chat.dart | 9 -------- lib/pages/chat/chat_input_row.dart | 12 ---------- lib/utils/markdown_context_builder.dart | 29 +++++++++++++++++++++++++ 3 files changed, 29 insertions(+), 21 deletions(-) diff --git a/lib/pages/chat/chat.dart b/lib/pages/chat/chat.dart index b312429d4..e5e741fc9 100644 --- a/lib/pages/chat/chat.dart +++ b/lib/pages/chat/chat.dart @@ -1186,15 +1186,6 @@ class ChatController extends State if (choice == 'location') { sendLocationAction(); } - if (choice == 'checklist') { - if (sendController.text.isEmpty) { - sendController.text = '- [ ] '; - } else { - sendController.text += '\n- [ ] '; - } - onInputBarChanged(sendController.text); - inputFocus.requestFocus(); - } } unpinEvent(String eventId) async { diff --git a/lib/pages/chat/chat_input_row.dart b/lib/pages/chat/chat_input_row.dart index f5464f27c..6a673bded 100644 --- a/lib/pages/chat/chat_input_row.dart +++ b/lib/pages/chat/chat_input_row.dart @@ -124,18 +124,6 @@ class ChatInputRow extends StatelessWidget { onSelected: controller.onAddPopupMenuButtonSelected, itemBuilder: (BuildContext context) => >[ - PopupMenuItem( - value: 'checklist', - child: ListTile( - leading: CircleAvatar( - backgroundColor: theme.colorScheme.onPrimaryContainer, - foregroundColor: theme.colorScheme.primaryContainer, - child: const Icon(Icons.check_circle_outlined), - ), - title: Text(L10n.of(context).checkList), - contentPadding: const EdgeInsets.all(0), - ), - ), if (PlatformInfos.isMobile) PopupMenuItem( value: 'location', diff --git a/lib/utils/markdown_context_builder.dart b/lib/utils/markdown_context_builder.dart index ac6348553..9404d3504 100644 --- a/lib/utils/markdown_context_builder.dart +++ b/lib/utils/markdown_context_builder.dart @@ -54,6 +54,35 @@ Widget markdownContextBuilder( ContextMenuController.removeAny(); }, ), + ContextMenuButtonItem( + label: l10n.checkList, + onPressed: () { + final text = controller.text; + final selection = controller.selection; + + var start = selection.textBefore(text).lastIndexOf('\n'); + if (start == -1) start = 0; + final end = selection.end; + + final fullLineSelection = + TextSelection(baseOffset: start, extentOffset: end); + + const checkBox = '- [ ]'; + + final replacedRange = fullLineSelection + .textInside(text) + .split('\n') + .map( + (line) => line.startsWith(checkBox) || line.isEmpty + ? line + : '$checkBox $line', + ) + .join('\n'); + controller.text = + controller.text.replaceRange(start, end, replacedRange); + ContextMenuController.removeAny(); + }, + ), ContextMenuButtonItem( label: l10n.boldText, onPressed: () { From dbdd25aeb26243e4ba735c7d62439e001fe44b39 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20Ku=C3=9Fowski?= Date: Sun, 1 Jun 2025 11:33:02 +0200 Subject: [PATCH 3/4] chore: Nicer checkboxes --- lib/pages/chat/events/html_message.dart | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/pages/chat/events/html_message.dart b/lib/pages/chat/events/html_message.dart index 4e6877735..4b82f6be9 100644 --- a/lib/pages/chat/events/html_message.dart +++ b/lib/pages/chat/events/html_message.dart @@ -1,3 +1,4 @@ +import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:collection/collection.dart'; @@ -262,12 +263,11 @@ class HtmlMessage extends StatelessWidget { child: Padding( padding: const EdgeInsets.symmetric(horizontal: 8.0), child: SizedBox.square( - dimension: fontSize, - child: Checkbox.adaptive( + dimension: fontSize + 2, + child: CupertinoCheckbox( checkColor: textColor, side: BorderSide(color: textColor), activeColor: textColor.withAlpha(64), - visualDensity: VisualDensity.compact, value: staticallyChecked || checkedByReaction != null, onChanged: eventId == null || From c52209ccdd5a2cc0558244bfe3b29909e5e937f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20Ku=C3=9Fowski?= Date: Sun, 1 Jun 2025 11:38:49 +0200 Subject: [PATCH 4/4] build: Upgrade to flutter 3.32.1 --- .github/workflows/versions.env | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/versions.env b/.github/workflows/versions.env index 3cad68ef4..1d646f732 100644 --- a/.github/workflows/versions.env +++ b/.github/workflows/versions.env @@ -1,2 +1,2 @@ -FLUTTER_VERSION=3.32.0 +FLUTTER_VERSION=3.32.1 JAVA_VERSION=17