TF-3410 Use TextTheme apply almost text style for text widget
Signed-off-by: dab246 <tdvu@linagora.com>
This commit is contained in:
@@ -1,5 +1,10 @@
|
||||
|
||||
import 'package:core/core.dart';
|
||||
import 'package:core/presentation/extensions/color_extension.dart';
|
||||
import 'package:core/presentation/resources/image_paths.dart';
|
||||
import 'package:core/presentation/utils/responsive_utils.dart';
|
||||
import 'package:core/presentation/views/bottom_popup/confirmation_dialog_action_sheet_builder.dart';
|
||||
import 'package:core/presentation/views/dialog/confirmation_dialog_builder.dart';
|
||||
import 'package:core/utils/platform_info.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:pointer_interceptor/pointer_interceptor.dart';
|
||||
@@ -46,51 +51,40 @@ mixin MessageDialogActionMixin {
|
||||
|
||||
if (alignCenter) {
|
||||
final childWidget = PointerInterceptor(
|
||||
child: (ConfirmDialogBuilder(
|
||||
imagePaths,
|
||||
listTextSpan: listTextSpan,
|
||||
titleActionButtonMaxLines: titleActionButtonMaxLines,
|
||||
isArrangeActionButtonsVertical: isArrangeActionButtonsVertical,
|
||||
useIconAsBasicLogo: useIconAsBasicLogo,
|
||||
)
|
||||
..key(key)
|
||||
..title(title ?? '')
|
||||
..content(message)
|
||||
..addIcon(icon)
|
||||
..colorConfirmButton(actionButtonColor ?? AppColor.blue700)
|
||||
..colorCancelButton(cancelButtonColor ?? AppColor.colorF3F6F9)
|
||||
..radiusButton(12)
|
||||
..styleTitle(titleStyle)
|
||||
..styleContent(messageStyle)
|
||||
..styleTextCancelButton(cancelStyle ?? const TextStyle(
|
||||
fontSize: 17,
|
||||
height: 24 / 17,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: AppColor.steelGray600,
|
||||
))
|
||||
..styleTextConfirmButton(actionStyle ?? const TextStyle(
|
||||
fontSize: 17,
|
||||
height: 24 / 17,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: Colors.white,
|
||||
))
|
||||
..onConfirmButtonAction(actionName, () {
|
||||
child: ConfirmationDialogBuilder(
|
||||
key: key,
|
||||
imagePath: imagePaths,
|
||||
listTextSpan: listTextSpan,
|
||||
titleActionButtonMaxLines: titleActionButtonMaxLines,
|
||||
isArrangeActionButtonsVertical: isArrangeActionButtonsVertical,
|
||||
useIconAsBasicLogo: useIconAsBasicLogo,
|
||||
title: title ?? '',
|
||||
textContent: message,
|
||||
confirmText: actionName,
|
||||
cancelText: hasCancelButton ? cancelTitle ?? AppLocalizations.of(context).cancel : '',
|
||||
iconWidget: icon,
|
||||
colorCancelButton: cancelButtonColor,
|
||||
colorConfirmButton: actionButtonColor,
|
||||
styleTextCancelButton: cancelStyle,
|
||||
styleTextConfirmButton: actionStyle,
|
||||
styleTitle: titleStyle,
|
||||
styleContent: messageStyle,
|
||||
paddingButton: paddingButton,
|
||||
marginIcon: marginIcon,
|
||||
onConfirmButtonAction: () {
|
||||
if (autoPerformPopBack) {
|
||||
popBack();
|
||||
}
|
||||
onConfirmAction?.call();
|
||||
})
|
||||
..onCancelButtonAction(
|
||||
hasCancelButton ? cancelTitle ?? AppLocalizations.of(context).cancel : '',
|
||||
() {
|
||||
if (autoPerformPopBack) {
|
||||
popBack();
|
||||
}
|
||||
onCancelAction?.call();
|
||||
}
|
||||
)
|
||||
..onCloseButtonAction(onCloseButtonAction)
|
||||
).build()
|
||||
},
|
||||
onCancelButtonAction: () {
|
||||
if (autoPerformPopBack) {
|
||||
popBack();
|
||||
}
|
||||
onCancelAction?.call();
|
||||
},
|
||||
onCloseButtonAction: onCloseButtonAction,
|
||||
),
|
||||
);
|
||||
return await Get.dialog(
|
||||
usePopScope && PlatformInfo.isMobile
|
||||
@@ -102,53 +96,41 @@ mixin MessageDialogActionMixin {
|
||||
} else {
|
||||
if (responsiveUtils.isMobile(context)) {
|
||||
final childWidget = PointerInterceptor(
|
||||
child: (ConfirmDialogBuilder(
|
||||
imagePaths,
|
||||
showAsBottomSheet: true,
|
||||
listTextSpan: listTextSpan,
|
||||
maxWith: responsiveUtils.getSizeScreenShortestSide(context) - 16,
|
||||
titleActionButtonMaxLines: titleActionButtonMaxLines,
|
||||
isArrangeActionButtonsVertical: isArrangeActionButtonsVertical,
|
||||
useIconAsBasicLogo: useIconAsBasicLogo,
|
||||
)
|
||||
..key(key)
|
||||
..title(title ?? '')
|
||||
..content(message)
|
||||
..addIcon(icon)
|
||||
..widthDialog(responsiveUtils.getSizeScreenWidth(context))
|
||||
..colorConfirmButton(actionButtonColor ?? AppColor.blue700)
|
||||
..colorCancelButton(cancelButtonColor ?? AppColor.colorF3F6F9)
|
||||
..styleTitle(titleStyle)
|
||||
..styleContent(messageStyle)
|
||||
..styleTextCancelButton(cancelStyle ?? const TextStyle(
|
||||
fontSize: 17,
|
||||
height: 24 / 17,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: AppColor.steelGray600,
|
||||
))
|
||||
..styleTextConfirmButton(actionStyle ?? const TextStyle(
|
||||
fontSize: 17,
|
||||
height: 24 / 17,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: Colors.white,
|
||||
))
|
||||
..onConfirmButtonAction(actionName, () {
|
||||
child: ConfirmationDialogBuilder(
|
||||
key: key,
|
||||
imagePath: imagePaths,
|
||||
showAsBottomSheet: true,
|
||||
listTextSpan: listTextSpan,
|
||||
maxWidth: responsiveUtils.getSizeScreenShortestSide(context) - 16,
|
||||
titleActionButtonMaxLines: titleActionButtonMaxLines,
|
||||
isArrangeActionButtonsVertical: isArrangeActionButtonsVertical,
|
||||
textContent: message,
|
||||
title: title ?? '',
|
||||
iconWidget: icon,
|
||||
widthDialog: responsiveUtils.getSizeScreenWidth(context),
|
||||
colorConfirmButton: actionButtonColor,
|
||||
colorCancelButton: cancelButtonColor,
|
||||
styleContent: messageStyle,
|
||||
styleTitle: titleStyle,
|
||||
styleTextCancelButton: cancelStyle,
|
||||
styleTextConfirmButton: actionStyle,
|
||||
confirmText: actionName,
|
||||
cancelText: hasCancelButton ? cancelTitle ?? AppLocalizations.of(context).cancel : '',
|
||||
useIconAsBasicLogo: useIconAsBasicLogo,
|
||||
onConfirmButtonAction: () {
|
||||
if (autoPerformPopBack) {
|
||||
popBack();
|
||||
}
|
||||
onConfirmAction?.call();
|
||||
})
|
||||
..onCancelButtonAction(
|
||||
hasCancelButton ? cancelTitle ?? AppLocalizations.of(context).cancel : '',
|
||||
() {
|
||||
if (autoPerformPopBack) {
|
||||
popBack();
|
||||
}
|
||||
onCancelAction?.call();
|
||||
}
|
||||
)
|
||||
..onCloseButtonAction(onCloseButtonAction ?? () => popBack())
|
||||
).build()
|
||||
},
|
||||
onCancelButtonAction: () {
|
||||
if (autoPerformPopBack) {
|
||||
popBack();
|
||||
}
|
||||
onCancelAction?.call();
|
||||
},
|
||||
onCloseButtonAction: onCloseButtonAction ?? popBack
|
||||
),
|
||||
);
|
||||
if (showAsBottomSheet) {
|
||||
return await Get.bottomSheet(
|
||||
@@ -166,7 +148,7 @@ mixin MessageDialogActionMixin {
|
||||
} else {
|
||||
return (ConfirmationDialogActionSheetBuilder(context, listTextSpan: listTextSpan)
|
||||
..messageText(message)
|
||||
..styleConfirmButton(const TextStyle(fontSize: 20, fontWeight: FontWeight.normal, color: Colors.black))
|
||||
..styleConfirmButton(actionStyle)
|
||||
..styleMessage(messageStyle)
|
||||
..styleCancelButton(cancelStyle)
|
||||
..onCancelAction(
|
||||
@@ -187,50 +169,39 @@ mixin MessageDialogActionMixin {
|
||||
}
|
||||
} else {
|
||||
final childWidget = PointerInterceptor(
|
||||
child: (ConfirmDialogBuilder(
|
||||
imagePaths,
|
||||
listTextSpan: listTextSpan,
|
||||
titleActionButtonMaxLines: titleActionButtonMaxLines,
|
||||
isArrangeActionButtonsVertical: isArrangeActionButtonsVertical,
|
||||
useIconAsBasicLogo: useIconAsBasicLogo,
|
||||
)
|
||||
..key(key)
|
||||
..title(title ?? '')
|
||||
..content(message)
|
||||
..addIcon(icon)
|
||||
..colorConfirmButton(actionButtonColor ?? AppColor.blue700)
|
||||
..colorCancelButton(cancelButtonColor ?? AppColor.colorF3F6F9)
|
||||
..styleTitle(titleStyle)
|
||||
..styleContent(messageStyle)
|
||||
..styleTextCancelButton(cancelStyle ?? const TextStyle(
|
||||
fontSize: 17,
|
||||
height: 24 / 17,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: AppColor.steelGray600,
|
||||
))
|
||||
..styleTextConfirmButton(actionStyle ?? const TextStyle(
|
||||
fontSize: 17,
|
||||
height: 24 / 17,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: Colors.white,
|
||||
))
|
||||
..onConfirmButtonAction(actionName, () {
|
||||
child: ConfirmationDialogBuilder(
|
||||
key: key,
|
||||
imagePath: imagePaths,
|
||||
listTextSpan: listTextSpan,
|
||||
titleActionButtonMaxLines: titleActionButtonMaxLines,
|
||||
isArrangeActionButtonsVertical: isArrangeActionButtonsVertical,
|
||||
useIconAsBasicLogo: useIconAsBasicLogo,
|
||||
title: title ?? '',
|
||||
textContent: message,
|
||||
iconWidget: icon,
|
||||
colorConfirmButton: actionButtonColor,
|
||||
colorCancelButton: cancelButtonColor,
|
||||
styleContent: messageStyle,
|
||||
styleTitle: titleStyle,
|
||||
styleTextCancelButton: cancelStyle,
|
||||
styleTextConfirmButton: actionStyle,
|
||||
confirmText: actionName,
|
||||
cancelText: hasCancelButton ? cancelTitle ?? AppLocalizations.of(context).cancel : '',
|
||||
onConfirmButtonAction: () {
|
||||
if (autoPerformPopBack) {
|
||||
popBack();
|
||||
}
|
||||
onConfirmAction?.call();
|
||||
})
|
||||
..onCancelButtonAction(
|
||||
hasCancelButton ? cancelTitle ?? AppLocalizations.of(context).cancel : '',
|
||||
() {
|
||||
if (autoPerformPopBack) {
|
||||
popBack();
|
||||
}
|
||||
onCancelAction?.call();
|
||||
}
|
||||
)
|
||||
..onCloseButtonAction(onCloseButtonAction ?? () => popBack())
|
||||
).build()
|
||||
},
|
||||
onCancelButtonAction: () {
|
||||
if (autoPerformPopBack) {
|
||||
popBack();
|
||||
} else {
|
||||
onCancelAction?.call();
|
||||
}
|
||||
},
|
||||
onCloseButtonAction: onCloseButtonAction ?? popBack,
|
||||
),
|
||||
);
|
||||
return await Get.dialog(
|
||||
usePopScope && PlatformInfo.isMobile
|
||||
|
||||
Reference in New Issue
Block a user