TF-1899 Display From field when no network
(cherry picked from commit fada6e635753415e24b0efac1db0b020f6858256)
This commit is contained in:
@@ -1703,4 +1703,6 @@ class ComposerController extends BaseController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool get isNetworkConnectionAvailable => networkConnectionController.isNetworkConnectionAvailable();
|
bool get isNetworkConnectionAvailable => networkConnectionController.isNetworkConnectionAvailable();
|
||||||
|
|
||||||
|
UserProfile? get userProfile => mailboxDashBoardController.userProfile.value;
|
||||||
}
|
}
|
||||||
@@ -4,6 +4,7 @@ import 'package:core/presentation/extensions/html_extension.dart';
|
|||||||
import 'package:core/presentation/extensions/string_extension.dart';
|
import 'package:core/presentation/extensions/string_extension.dart';
|
||||||
import 'package:core/presentation/resources/image_paths.dart';
|
import 'package:core/presentation/resources/image_paths.dart';
|
||||||
import 'package:core/presentation/utils/responsive_utils.dart';
|
import 'package:core/presentation/utils/responsive_utils.dart';
|
||||||
|
import 'package:core/presentation/utils/style_utils.dart';
|
||||||
import 'package:core/presentation/views/button/icon_button_web.dart';
|
import 'package:core/presentation/views/button/icon_button_web.dart';
|
||||||
import 'package:core/presentation/views/context_menu/simple_context_menu_action_builder.dart';
|
import 'package:core/presentation/views/context_menu/simple_context_menu_action_builder.dart';
|
||||||
import 'package:core/presentation/views/image/avatar_builder.dart';
|
import 'package:core/presentation/views/image/avatar_builder.dart';
|
||||||
@@ -284,81 +285,108 @@ class ComposerView extends GetWidget<ComposerController>
|
|||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildFromEmailAddress(BuildContext context) {
|
Widget _buildFromEmailAddress(BuildContext context) {
|
||||||
return Padding(
|
return Obx(() {
|
||||||
padding: EdgeInsets.only(
|
return Padding(
|
||||||
|
padding: EdgeInsets.only(
|
||||||
left: AppUtils.isDirectionRTL(context) ? 0 : responsiveUtils.isMobile(context) ? 16 : 0,
|
left: AppUtils.isDirectionRTL(context) ? 0 : responsiveUtils.isMobile(context) ? 16 : 0,
|
||||||
right: AppUtils.isDirectionRTL(context) ? responsiveUtils.isMobile(context) ? 16 : 0 : 0,
|
right: AppUtils.isDirectionRTL(context) ? responsiveUtils.isMobile(context) ? 16 : 0 : 0,
|
||||||
top: 12,
|
top: 12,
|
||||||
bottom: 12),
|
bottom: 12),
|
||||||
child: Row(children: [
|
child: Row(children: [
|
||||||
Text('${AppLocalizations.of(context).from_email_address_prefix}:',
|
Text(
|
||||||
style: const TextStyle(fontSize: 15, color: AppColor.colorHintEmailAddressInput)),
|
'${AppLocalizations.of(context).from_email_address_prefix}:',
|
||||||
const SizedBox(width: 12),
|
style: const TextStyle(
|
||||||
DropdownButtonHideUnderline(
|
fontSize: 15,
|
||||||
child: DropdownButton2<Identity>(
|
color: AppColor.colorHintEmailAddressInput
|
||||||
isExpanded: true,
|
)
|
||||||
customButton: SvgPicture.asset(imagePaths.icEditIdentity),
|
),
|
||||||
items: controller.listIdentities.map((item) => DropdownMenuItem<Identity>(
|
const SizedBox(width: 12),
|
||||||
value: item,
|
if (controller.listIdentities.isNotEmpty)
|
||||||
child: Container(
|
DropdownButtonHideUnderline(child: DropdownButton2<Identity>(
|
||||||
alignment: Alignment.centerLeft,
|
isExpanded: true,
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 8),
|
customButton: SvgPicture.asset(imagePaths.icEditIdentity),
|
||||||
decoration: BoxDecoration(
|
items: controller.listIdentities.map((item) => DropdownMenuItem<Identity>(
|
||||||
|
value: item,
|
||||||
|
child: Container(
|
||||||
|
alignment: Alignment.centerLeft,
|
||||||
|
padding: const EdgeInsets.symmetric(horizontal: 8),
|
||||||
|
decoration: BoxDecoration(
|
||||||
borderRadius: BorderRadius.circular(12),
|
borderRadius: BorderRadius.circular(12),
|
||||||
color: item == controller.identitySelected.value ? AppColor.colorBgMenuItemDropDownSelected : Colors.transparent),
|
color: item == controller.identitySelected.value
|
||||||
child: Column(
|
? AppColor.colorBgMenuItemDropDownSelected
|
||||||
|
: Colors.transparent
|
||||||
|
),
|
||||||
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
item.name ?? '',
|
item.name ?? '',
|
||||||
style: const TextStyle(fontSize: 16, fontWeight: FontWeight.normal, color: Colors.black),
|
style: const TextStyle(
|
||||||
|
fontSize: 16,
|
||||||
|
fontWeight: FontWeight.normal,
|
||||||
|
color: Colors.black
|
||||||
|
),
|
||||||
maxLines: 1,
|
maxLines: 1,
|
||||||
overflow: TextOverflow.ellipsis,
|
overflow: CommonTextStyle.defaultTextOverFlow,
|
||||||
|
softWrap: CommonTextStyle.defaultSoftWrap,
|
||||||
),
|
),
|
||||||
Text(
|
Text(
|
||||||
item.email ?? '',
|
item.email ?? '',
|
||||||
style: const TextStyle(fontSize: 13, fontWeight: FontWeight.normal, color: AppColor.colorHintSearchBar),
|
style: const TextStyle(
|
||||||
|
fontSize: 13,
|
||||||
|
fontWeight: FontWeight.normal,
|
||||||
|
color: AppColor.colorHintSearchBar
|
||||||
|
),
|
||||||
maxLines: 1,
|
maxLines: 1,
|
||||||
overflow: TextOverflow.ellipsis,
|
overflow: CommonTextStyle.defaultTextOverFlow,
|
||||||
|
softWrap: CommonTextStyle.defaultSoftWrap,
|
||||||
)
|
)
|
||||||
]
|
]
|
||||||
|
),
|
||||||
|
),
|
||||||
|
)).toList(),
|
||||||
|
onChanged: (newIdentity) => controller.selectIdentity(newIdentity),
|
||||||
|
dropdownStyleData: DropdownStyleData(
|
||||||
|
maxHeight: 240,
|
||||||
|
width: 300,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
borderRadius: BorderRadius.circular(20),
|
||||||
|
color: Colors.white),
|
||||||
|
elevation: 4,
|
||||||
|
scrollbarTheme: ScrollbarThemeData(
|
||||||
|
radius: const Radius.circular(40),
|
||||||
|
thickness: MaterialStateProperty.all<double>(6),
|
||||||
|
thumbVisibility: MaterialStateProperty.all<bool>(true),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
)).toList(),
|
menuItemStyleData: const MenuItemStyleData(
|
||||||
onChanged: (newIdentity) => controller.selectIdentity(newIdentity),
|
height: 55,
|
||||||
dropdownStyleData: DropdownStyleData(
|
padding: EdgeInsets.symmetric(horizontal: 8),
|
||||||
maxHeight: 240,
|
)
|
||||||
width: 300,
|
)),
|
||||||
decoration: BoxDecoration(
|
Expanded(child: Padding(
|
||||||
borderRadius: BorderRadius.circular(20),
|
|
||||||
color: Colors.white),
|
|
||||||
elevation: 4,
|
|
||||||
scrollbarTheme: ScrollbarThemeData(
|
|
||||||
radius: const Radius.circular(40),
|
|
||||||
thickness: MaterialStateProperty.all<double>(6),
|
|
||||||
thumbVisibility: MaterialStateProperty.all<bool>(true),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
menuItemStyleData: const MenuItemStyleData(
|
|
||||||
height: 55,
|
|
||||||
padding: EdgeInsets.symmetric(horizontal: 8),
|
|
||||||
)
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Expanded(child: Padding(
|
|
||||||
padding: EdgeInsets.only(
|
padding: EdgeInsets.only(
|
||||||
right: AppUtils.isDirectionRTL(context) ? 12 : 8,
|
right: AppUtils.isDirectionRTL(context) ? 12 : 8,
|
||||||
left: AppUtils.isDirectionRTL(context) ? 8 : 12
|
left: AppUtils.isDirectionRTL(context) ? 8 : 12
|
||||||
),
|
),
|
||||||
child: Text(
|
child: Text(
|
||||||
(controller.identitySelected.value?.email ?? '').withUnicodeCharacter,
|
controller.identitySelected.value != null
|
||||||
|
? (controller.identitySelected.value?.email ?? '').withUnicodeCharacter
|
||||||
|
: (controller.userProfile?.email ?? '').withUnicodeCharacter,
|
||||||
maxLines: 1,
|
maxLines: 1,
|
||||||
overflow: TextOverflow.ellipsis,
|
overflow: CommonTextStyle.defaultTextOverFlow,
|
||||||
style: const TextStyle(fontSize: 17, fontWeight: FontWeight.normal, color: AppColor.colorEmailAddressPrefix),
|
softWrap: CommonTextStyle.defaultSoftWrap,
|
||||||
))),
|
style: const TextStyle(
|
||||||
]),
|
fontSize: 17,
|
||||||
);
|
fontWeight: FontWeight.normal,
|
||||||
|
color: AppColor.colorEmailAddressPrefix
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)),
|
||||||
|
]),
|
||||||
|
);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildEmailAddress(BuildContext context) {
|
Widget _buildEmailAddress(BuildContext context) {
|
||||||
@@ -510,9 +538,7 @@ class ComposerView extends GetWidget<ComposerController>
|
|||||||
return Column(
|
return Column(
|
||||||
key: controller.headerEditorMobileWidgetKey,
|
key: controller.headerEditorMobileWidgetKey,
|
||||||
children: [
|
children: [
|
||||||
Obx(() => controller.identitySelected.value != null
|
_buildFromEmailAddress(context),
|
||||||
? _buildFromEmailAddress(context)
|
|
||||||
: const SizedBox.shrink()),
|
|
||||||
Obx(() => controller.identitySelected.value != null
|
Obx(() => controller.identitySelected.value != null
|
||||||
? const Divider(color: AppColor.colorDividerComposer, height: 1)
|
? const Divider(color: AppColor.colorDividerComposer, height: 1)
|
||||||
: const SizedBox.shrink()),
|
: const SizedBox.shrink()),
|
||||||
@@ -549,9 +575,7 @@ class ComposerView extends GetWidget<ComposerController>
|
|||||||
Expanded(child: Padding(
|
Expanded(child: Padding(
|
||||||
padding: const EdgeInsets.only(left: 16),
|
padding: const EdgeInsets.only(left: 16),
|
||||||
child: Column(children: [
|
child: Column(children: [
|
||||||
Obx(() => controller.identitySelected.value != null
|
_buildFromEmailAddress(context),
|
||||||
? _buildFromEmailAddress(context)
|
|
||||||
: const SizedBox.shrink()),
|
|
||||||
Obx(() => controller.identitySelected.value != null
|
Obx(() => controller.identitySelected.value != null
|
||||||
? const Divider(color: AppColor.colorDividerComposer, height: 1)
|
? const Divider(color: AppColor.colorDividerComposer, height: 1)
|
||||||
: const SizedBox.shrink()),
|
: const SizedBox.shrink()),
|
||||||
|
|||||||
Reference in New Issue
Block a user