TF-1959 Fix invalid email red border is displayed over the address field in RTL mode
(cherry picked from commit 0165705626bce7755cbefe94ce45d126bfd9771a)
This commit is contained in:
@@ -8,6 +8,8 @@ abstract class DirectionUtils {
|
|||||||
|
|
||||||
static bool isDirectionRTLByEndsText(String text) => intl.Bidi.endsWithRtl(text);
|
static bool isDirectionRTLByEndsText(String text) => intl.Bidi.endsWithRtl(text);
|
||||||
|
|
||||||
|
static bool isDirectionRTLByHasAnyRtl(String text) => intl.Bidi.hasAnyRtl(text);
|
||||||
|
|
||||||
static TextDirection getDirectionByLanguage(BuildContext context) => isDirectionRTLByLanguage(context) ? TextDirection.rtl : TextDirection.ltr;
|
static TextDirection getDirectionByLanguage(BuildContext context) => isDirectionRTLByLanguage(context) ? TextDirection.rtl : TextDirection.ltr;
|
||||||
|
|
||||||
static TextDirection getDirectionByEndsText(String text) => isDirectionRTLByEndsText(text) ? TextDirection.rtl : TextDirection.ltr;
|
static TextDirection getDirectionByEndsText(String text) => isDirectionRTLByEndsText(text) ? TextDirection.rtl : TextDirection.ltr;
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import 'dart:async';
|
|||||||
|
|
||||||
import 'package:collection/collection.dart';
|
import 'package:collection/collection.dart';
|
||||||
import 'package:core/core.dart';
|
import 'package:core/core.dart';
|
||||||
import 'package:flutter/foundation.dart';
|
import 'package:core/utils/direction_utils.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
import 'package:flutter_svg/flutter_svg.dart';
|
import 'package:flutter_svg/flutter_svg.dart';
|
||||||
@@ -211,19 +211,30 @@ class EmailAddressInputBuilder {
|
|||||||
tagBuilder: (context, index) {
|
tagBuilder: (context, index) {
|
||||||
final isLastEmail = index == listEmailAddress.length - 1;
|
final isLastEmail = index == listEmailAddress.length - 1;
|
||||||
return Stack(
|
return Stack(
|
||||||
alignment: Alignment.centerRight,
|
alignment: AlignmentDirectional.centerEnd,
|
||||||
children: [
|
children: [
|
||||||
Padding(
|
Padding(
|
||||||
padding: EdgeInsets.only(
|
padding: EdgeInsetsDirectional.only(
|
||||||
top: kIsWeb ? 8 : 0,
|
top: PlatformInfo.isWeb ? 8 : 0,
|
||||||
right: _isCollapse ? 50 : 0),
|
end: _isCollapse ? 50 : 0),
|
||||||
child: InkWell(
|
child: InkWell(
|
||||||
onTap: () => _isCollapse
|
onTap: () => _isCollapse
|
||||||
? _onShowFullListEmailAddressAction?.call(_prefixEmailAddress)
|
? _onShowFullListEmailAddressAction?.call(_prefixEmailAddress)
|
||||||
: null,
|
: null,
|
||||||
child: Chip(
|
child: Chip(
|
||||||
labelPadding: const EdgeInsets.only(left: 12, right: 12, bottom: 2),
|
padding: DirectionUtils.isDirectionRTLByLanguage(context)
|
||||||
label: Text(newListEmailAddress[index].asString(), maxLines: 1, overflow: kIsWeb ? null : TextOverflow.ellipsis),
|
? EdgeInsets.zero
|
||||||
|
: null,
|
||||||
|
labelPadding: EdgeInsetsDirectional.symmetric(
|
||||||
|
horizontal: 12,
|
||||||
|
vertical: DirectionUtils.isDirectionRTLByHasAnyRtl(newListEmailAddress[index].asString()) ? 0 : 2
|
||||||
|
),
|
||||||
|
label: Text(
|
||||||
|
newListEmailAddress[index].asString(),
|
||||||
|
maxLines: 1,
|
||||||
|
overflow: CommonTextStyle.defaultTextOverFlow,
|
||||||
|
softWrap: CommonTextStyle.defaultSoftWrap,
|
||||||
|
),
|
||||||
deleteIcon: SvgPicture.asset(_imagePaths.icClose, fit: BoxFit.fill),
|
deleteIcon: SvgPicture.asset(_imagePaths.icClose, fit: BoxFit.fill),
|
||||||
labelStyle: const TextStyle(color: Colors.black, fontSize: 17, fontWeight: FontWeight.normal),
|
labelStyle: const TextStyle(color: Colors.black, fontSize: 17, fontWeight: FontWeight.normal),
|
||||||
backgroundColor: _getTagBackgroundColor(listEmailAddress[index], isLastEmail),
|
backgroundColor: _getTagBackgroundColor(listEmailAddress[index], isLastEmail),
|
||||||
@@ -309,12 +320,16 @@ class EmailAddressInputBuilder {
|
|||||||
|
|
||||||
Widget _buildCounter(BuildContext context, int count) {
|
Widget _buildCounter(BuildContext context, int count) {
|
||||||
return Padding(
|
return Padding(
|
||||||
padding: const EdgeInsets.only(left: 8, top: kIsWeb ? 8 : 0),
|
padding: const EdgeInsetsDirectional.only(start: 8, top: PlatformInfo.isWeb ? 8 : 0),
|
||||||
child: InkWell(
|
child: InkWell(
|
||||||
onTap: () => _onShowFullListEmailAddressAction?.call(_prefixEmailAddress),
|
onTap: () => _onShowFullListEmailAddressAction?.call(_prefixEmailAddress),
|
||||||
child: Chip(
|
child: Chip(
|
||||||
labelPadding: const EdgeInsets.symmetric(horizontal: 8),
|
labelPadding: const EdgeInsets.symmetric(horizontal: 8),
|
||||||
label: Text('+$count', maxLines: 1, overflow: kIsWeb ? null : TextOverflow.ellipsis),
|
label: Text(
|
||||||
|
'+$count',
|
||||||
|
maxLines: 1,
|
||||||
|
overflow: CommonTextStyle.defaultTextOverFlow,
|
||||||
|
softWrap: CommonTextStyle.defaultSoftWrap),
|
||||||
labelStyle: const TextStyle(color: Colors.black, fontSize: 17, fontWeight: FontWeight.normal),
|
labelStyle: const TextStyle(color: Colors.black, fontSize: 17, fontWeight: FontWeight.normal),
|
||||||
backgroundColor: AppColor.colorEmailAddressTag,
|
backgroundColor: AppColor.colorEmailAddressTag,
|
||||||
shape: RoundedRectangleBorder(
|
shape: RoundedRectangleBorder(
|
||||||
|
|||||||
@@ -195,13 +195,17 @@ class MailboxView extends BaseMailboxView {
|
|||||||
end: 16),
|
end: 16),
|
||||||
padding: const EdgeInsetsDirectional.only(start: 8),
|
padding: const EdgeInsetsDirectional.only(start: 8),
|
||||||
child: Row(
|
child: Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
||||||
children: [
|
children: [
|
||||||
Text(AppLocalizations.of(context).mailBoxes,
|
Expanded(
|
||||||
style: const TextStyle(
|
child: Text(
|
||||||
fontSize: 20,
|
AppLocalizations.of(context).mailBoxes,
|
||||||
color: Colors.black,
|
style: const TextStyle(
|
||||||
fontWeight: FontWeight.bold)),
|
fontSize: 20,
|
||||||
|
color: Colors.black,
|
||||||
|
fontWeight: FontWeight.bold
|
||||||
|
)
|
||||||
|
),
|
||||||
|
),
|
||||||
Row(children: [
|
Row(children: [
|
||||||
buildIconWeb(
|
buildIconWeb(
|
||||||
minSize: 40,
|
minSize: 40,
|
||||||
|
|||||||
@@ -115,11 +115,14 @@ class MailboxView extends BaseMailboxView {
|
|||||||
child: Row(
|
child: Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
children: [
|
children: [
|
||||||
Text(AppLocalizations.of(context).mailBoxes,
|
Expanded(child: Text(
|
||||||
style: const TextStyle(
|
AppLocalizations.of(context).mailBoxes,
|
||||||
fontSize: 17,
|
style: const TextStyle(
|
||||||
color: Colors.black,
|
fontSize: 17,
|
||||||
fontWeight: FontWeight.bold)),
|
color: Colors.black,
|
||||||
|
fontWeight: FontWeight.bold
|
||||||
|
)
|
||||||
|
)),
|
||||||
Padding(
|
Padding(
|
||||||
padding: EdgeInsetsDirectional.only(end: responsiveUtils.isDesktop(context) ? 0 : 12),
|
padding: EdgeInsetsDirectional.only(end: responsiveUtils.isDesktop(context) ? 0 : 12),
|
||||||
child: Row(
|
child: Row(
|
||||||
|
|||||||
Reference in New Issue
Block a user