TF-2237 Add loading circular for send button
(cherry picked from commit d9db8f467942f16b70140113e222985b61db047a)
This commit is contained in:
@@ -37,6 +37,7 @@ class TMailButtonWidget extends StatelessWidget {
|
|||||||
final TextDirection iconAlignment;
|
final TextDirection iconAlignment;
|
||||||
final int? maxLines;
|
final int? maxLines;
|
||||||
final MainAxisSize mainAxisSize;
|
final MainAxisSize mainAxisSize;
|
||||||
|
final bool? isLoading;
|
||||||
|
|
||||||
const TMailButtonWidget({
|
const TMailButtonWidget({
|
||||||
super.key,
|
super.key,
|
||||||
@@ -68,6 +69,7 @@ class TMailButtonWidget extends StatelessWidget {
|
|||||||
this.iconAlignment = TextDirection.ltr,
|
this.iconAlignment = TextDirection.ltr,
|
||||||
this.maxLines,
|
this.maxLines,
|
||||||
this.mainAxisSize = MainAxisSize.max,
|
this.mainAxisSize = MainAxisSize.max,
|
||||||
|
this.isLoading = false,
|
||||||
});
|
});
|
||||||
|
|
||||||
factory TMailButtonWidget.fromIcon({
|
factory TMailButtonWidget.fromIcon({
|
||||||
@@ -287,13 +289,23 @@ class TMailButtonWidget extends StatelessWidget {
|
|||||||
softWrap: maxLines == 1 ? CommonTextStyle.defaultSoftWrap : null,
|
softWrap: maxLines == 1 ? CommonTextStyle.defaultSoftWrap : null,
|
||||||
),
|
),
|
||||||
SizedBox(width: iconSpace),
|
SizedBox(width: iconSpace),
|
||||||
SvgPicture.asset(
|
if (!isLoading!)
|
||||||
icon!,
|
SvgPicture.asset(
|
||||||
width: iconSize,
|
icon!,
|
||||||
height: iconSize,
|
width: iconSize,
|
||||||
fit: BoxFit.fill,
|
height: iconSize,
|
||||||
colorFilter: iconColor?.asFilter()
|
fit: BoxFit.fill,
|
||||||
),
|
colorFilter: iconColor?.asFilter()
|
||||||
|
)
|
||||||
|
else
|
||||||
|
SizedBox(
|
||||||
|
width: iconSize,
|
||||||
|
height: iconSize,
|
||||||
|
child: const CircularProgressIndicator(
|
||||||
|
color: Colors.white,
|
||||||
|
strokeWidth: 2,
|
||||||
|
)
|
||||||
|
),
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -435,6 +435,7 @@ class ComposerView extends GetWidget<ComposerController> {
|
|||||||
radius: ComposerStyle.popupMenuRadius
|
radius: ComposerStyle.popupMenuRadius
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
isSending: controller.isSendEmailLoading.value,
|
||||||
)),
|
)),
|
||||||
]);
|
]);
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ class BottomBarComposerWidget extends StatelessWidget {
|
|||||||
final VoidCallback saveToDraftAction;
|
final VoidCallback saveToDraftAction;
|
||||||
final VoidCallback sendMessageAction;
|
final VoidCallback sendMessageAction;
|
||||||
final OnRequestReadReceiptAction? requestReadReceiptAction;
|
final OnRequestReadReceiptAction? requestReadReceiptAction;
|
||||||
|
final bool? isSending;
|
||||||
|
|
||||||
final _imagePaths = Get.find<ImagePaths>();
|
final _imagePaths = Get.find<ImagePaths>();
|
||||||
|
|
||||||
@@ -34,6 +35,7 @@ class BottomBarComposerWidget extends StatelessWidget {
|
|||||||
required this.saveToDraftAction,
|
required this.saveToDraftAction,
|
||||||
required this.sendMessageAction,
|
required this.sendMessageAction,
|
||||||
this.requestReadReceiptAction,
|
this.requestReadReceiptAction,
|
||||||
|
this.isSending,
|
||||||
});
|
});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -126,7 +128,7 @@ class BottomBarComposerWidget extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
const SizedBox(width: BottomBarComposerWidgetStyle.sendButtonSpace),
|
const SizedBox(width: BottomBarComposerWidgetStyle.sendButtonSpace),
|
||||||
TMailButtonWidget(
|
TMailButtonWidget(
|
||||||
text: AppLocalizations.of(context).send,
|
text: isSending! ? AppLocalizations.of(context).sending : AppLocalizations.of(context).send,
|
||||||
icon: _imagePaths.icSend,
|
icon: _imagePaths.icSend,
|
||||||
iconAlignment: TextDirection.rtl,
|
iconAlignment: TextDirection.rtl,
|
||||||
padding: BottomBarComposerWidgetStyle.sendButtonPadding,
|
padding: BottomBarComposerWidgetStyle.sendButtonPadding,
|
||||||
@@ -136,6 +138,7 @@ class BottomBarComposerWidget extends StatelessWidget {
|
|||||||
backgroundColor: BottomBarComposerWidgetStyle.sendButtonBackgroundColor,
|
backgroundColor: BottomBarComposerWidgetStyle.sendButtonBackgroundColor,
|
||||||
borderRadius: BottomBarComposerWidgetStyle.sendButtonRadius,
|
borderRadius: BottomBarComposerWidgetStyle.sendButtonRadius,
|
||||||
onTapActionCallback: sendMessageAction,
|
onTapActionCallback: sendMessageAction,
|
||||||
|
isLoading: isSending,
|
||||||
)
|
)
|
||||||
]
|
]
|
||||||
),
|
),
|
||||||
|
|||||||
Reference in New Issue
Block a user