Open AI Scribe from bottom bar button

This commit is contained in:
Théo Poizat
2025-12-04 17:12:24 +01:00
committed by Dat H. Pham
parent b122928a38
commit 96c95866c6
11 changed files with 134 additions and 2 deletions
@@ -14,6 +14,8 @@ class TabletBottomBarComposerWidget extends StatelessWidget {
final VoidCallback sendMessageAction;
final VoidCallback requestReadReceiptAction;
final VoidCallback toggleMarkAsImportantAction;
final VoidCallback? onOpenAIScribe;
final GlobalKey? aiScribeButtonKey;
const TabletBottomBarComposerWidget({
super.key,
@@ -25,6 +27,8 @@ class TabletBottomBarComposerWidget extends StatelessWidget {
required this.sendMessageAction,
required this.requestReadReceiptAction,
required this.toggleMarkAsImportantAction,
this.onOpenAIScribe,
this.aiScribeButtonKey,
});
@override
@@ -71,6 +75,18 @@ class TabletBottomBarComposerWidget extends StatelessWidget {
: AppLocalizations.of(context).turnOnRequestReadReceipt,
onTapActionCallback: requestReadReceiptAction,
),
if (onOpenAIScribe != null) ...[
const SizedBox(width: TabletBottomBarComposerWidgetStyle.space),
TMailButtonWidget.fromIcon(
key: aiScribeButtonKey,
icon: imagePaths.icSparkle,
borderRadius: TabletBottomBarComposerWidgetStyle.iconRadius,
padding: TabletBottomBarComposerWidgetStyle.iconPadding,
iconSize: TabletBottomBarComposerWidgetStyle.iconSize,
tooltipMessage: AppLocalizations.of(context).aiAssistant,
onTapActionCallback: onOpenAIScribe!,
),
],
const SizedBox(width: TabletBottomBarComposerWidgetStyle.space),
TMailButtonWidget.fromIcon(
icon: imagePaths.icSaveToDraft,
@@ -31,6 +31,8 @@ class BottomBarComposerWidget extends StatelessWidget {
final VoidCallback toggleMarkAsImportantAction;
final VoidCallback saveAsTemplateAction;
final VoidCallback onOpenInsertLink;
final VoidCallback? onOpenAIScribe;
final GlobalKey? aiScribeButtonKey;
final OnMenuChanged? onPopupMenuChanged;
const BottomBarComposerWidget({
@@ -54,6 +56,8 @@ class BottomBarComposerWidget extends StatelessWidget {
required this.toggleMarkAsImportantAction,
required this.saveAsTemplateAction,
required this.onOpenInsertLink,
this.onOpenAIScribe,
this.aiScribeButtonKey,
this.onPopupMenuChanged,
});
@@ -127,6 +131,25 @@ class BottomBarComposerWidget extends StatelessWidget {
onTapActionCallback: onOpenInsertLink,
),
),
if (onOpenAIScribe != null) ...[
const SizedBox(width: BottomBarComposerWidgetStyle.space),
AbsorbPointer(
absorbing: isCodeViewEnabled,
child: TMailButtonWidget.fromIcon(
key: aiScribeButtonKey,
icon: imagePaths.icSparkle,
iconColor: isCodeViewEnabled
? BottomBarComposerWidgetStyle.disabledIconColor
: BottomBarComposerWidgetStyle.iconColor,
borderRadius: BottomBarComposerWidgetStyle.iconRadius,
backgroundColor: Colors.transparent,
padding: BottomBarComposerWidgetStyle.iconPadding,
iconSize: BottomBarComposerWidgetStyle.iconSize,
tooltipMessage: AppLocalizations.of(context).aiAssistant,
onTapActionCallback: onOpenAIScribe!,
),
),
],
const SizedBox(width: BottomBarComposerWidgetStyle.space),
PopupMenuOverlayWidget(
controller: menuMoreOptionController,