TF-2940 Add spell check for subject email
This commit is contained in:
@@ -4,6 +4,7 @@ extension AppColor on Color {
|
||||
static const primaryColor = Color(0xFF007AFF);
|
||||
static const primaryDarkColor = Color(0xFF1C1C1C);
|
||||
static const primaryLightColor = Color(0xFFFFFFFF);
|
||||
static const primarySelectedColor = Color(0xFFDFEEFF);
|
||||
static const baseTextColor = Color(0xFF7E869B);
|
||||
static const textFieldTextColor = Color(0xFF7E869B);
|
||||
static const textFieldLabelColor = Color(0xFF7E869B);
|
||||
@@ -16,11 +17,8 @@ extension AppColor on Color {
|
||||
static const loginTextFieldFocusedBorder = Color(0xFF007AFF);
|
||||
static const loginTextFieldHintColor = Color(0xff818C99);
|
||||
static const loginTextFieldBackgroundColor = Color(0xFFF2F3F5);
|
||||
static const loginTextFieldBackgroundErrorColor = Color(0xFFFAEBEB);
|
||||
static const buttonColor = Color(0xFF837DFF);
|
||||
static const appColor = Color(0xFF3840F7);
|
||||
static const nameUserColor = Color(0xFF182952);
|
||||
static const emailUserColor = Color(0xFF7E869B);
|
||||
static const userInformationBackgroundColor = Color(0xFFF5F5F7);
|
||||
static const searchBorderColor = Color(0xFFEAEAEA);
|
||||
static const searchHintTextColor = Color(0xFF7E869B);
|
||||
@@ -29,7 +27,6 @@ extension AppColor on Color {
|
||||
static const mailboxSelectedTextColor = Color(0xFF3840F7);
|
||||
static const mailboxTextColor = Color(0xFF182952);
|
||||
static const mailboxSelectedTextNumberColor = Color(0xFF182952);
|
||||
static const mailboxTextNumberColor = Color(0xFF837DFF);
|
||||
static const mailboxSelectedIconColor = Color(0xFF3840F7);
|
||||
static const mailboxIconColor = Color(0xFF7E869B);
|
||||
static const storageBackgroundColor = Color(0xFFF5F5F7);
|
||||
|
||||
@@ -11,6 +11,7 @@ class ThemeUtils {
|
||||
fontFamily: ConstantsUI.fontApp,
|
||||
appBarTheme: _appBarTheme,
|
||||
textTheme: _textTheme,
|
||||
textSelectionTheme: _textSelectionTheme,
|
||||
dividerTheme: _dividerTheme,
|
||||
visualDensity: VisualDensity.adaptivePlatformDensity,
|
||||
scrollbarTheme: ScrollbarThemeData(
|
||||
@@ -27,6 +28,14 @@ class ThemeUtils {
|
||||
);
|
||||
}
|
||||
|
||||
static TextSelectionThemeData get _textSelectionTheme {
|
||||
return const TextSelectionThemeData(
|
||||
cursorColor: AppColor.primaryColor,
|
||||
selectionHandleColor: AppColor.primaryColor,
|
||||
selectionColor: AppColor.primarySelectedColor,
|
||||
);
|
||||
}
|
||||
|
||||
static AppBarTheme get _appBarTheme {
|
||||
return const AppBarTheme(
|
||||
color: Colors.white,
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import 'package:core/presentation/extensions/color_extension.dart';
|
||||
import 'package:core/utils/direction_utils.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:languagetool_textfield/languagetool_textfield.dart';
|
||||
|
||||
class TextFieldBuilder extends StatefulWidget {
|
||||
|
||||
@@ -10,7 +11,7 @@ class TextFieldBuilder extends StatefulWidget {
|
||||
final TapRegionCallback? onTapOutside;
|
||||
final TextStyle? textStyle;
|
||||
final TextInputAction? textInputAction;
|
||||
final InputDecoration? decoration;
|
||||
final InputDecoration decoration;
|
||||
final bool obscureText;
|
||||
final int? maxLines;
|
||||
final int? minLines;
|
||||
@@ -25,6 +26,7 @@ class TextFieldBuilder extends StatefulWidget {
|
||||
final TextDirection textDirection;
|
||||
final bool readOnly;
|
||||
final MouseCursor? mouseCursor;
|
||||
final LanguageToolController? languageToolController;
|
||||
|
||||
const TextFieldBuilder({
|
||||
super.key,
|
||||
@@ -36,10 +38,11 @@ class TextFieldBuilder extends StatefulWidget {
|
||||
this.textStyle = const TextStyle(color: AppColor.textFieldTextColor),
|
||||
this.textDirection = TextDirection.ltr,
|
||||
this.textInputAction,
|
||||
this.decoration,
|
||||
this.decoration = const InputDecoration(),
|
||||
this.maxLines,
|
||||
this.minLines,
|
||||
this.controller,
|
||||
this.languageToolController,
|
||||
this.keyboardType,
|
||||
this.focusNode,
|
||||
this.fromValue,
|
||||
@@ -57,22 +60,67 @@ class TextFieldBuilder extends StatefulWidget {
|
||||
|
||||
class _TextFieldBuilderState extends State<TextFieldBuilder> {
|
||||
|
||||
late TextEditingController _controller;
|
||||
TextEditingController? _controller;
|
||||
LanguageToolController? _languageToolController;
|
||||
|
||||
late TextDirection _textDirection;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
if (widget.fromValue != null) {
|
||||
_controller = TextEditingController.fromValue(TextEditingValue(text: widget.fromValue!));
|
||||
if (widget.languageToolController != null) {
|
||||
_languageToolController = widget.languageToolController;
|
||||
if (widget.fromValue != null) {
|
||||
_languageToolController?.value = TextEditingValue(text: widget.fromValue!);
|
||||
}
|
||||
} else {
|
||||
_controller = widget.controller ?? TextEditingController();
|
||||
if (widget.fromValue != null) {
|
||||
_controller = TextEditingController.fromValue(TextEditingValue(text: widget.fromValue!));
|
||||
} else {
|
||||
_controller = widget.controller ?? TextEditingController();
|
||||
}
|
||||
}
|
||||
_textDirection = widget.textDirection;
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
if (_languageToolController != null) {
|
||||
return LanguageToolTextField(
|
||||
key: widget.key,
|
||||
controller: _languageToolController!,
|
||||
cursorColor: widget.cursorColor,
|
||||
autocorrect: widget.autocorrect,
|
||||
textInputAction: widget.textInputAction,
|
||||
decoration: widget.decoration,
|
||||
maxLines: widget.maxLines,
|
||||
minLines: widget.minLines,
|
||||
keyboardAppearance: widget.keyboardAppearance,
|
||||
style: widget.textStyle,
|
||||
keyboardType: widget.keyboardType,
|
||||
autoFocus: widget.autoFocus,
|
||||
focusNode: widget.focusNode,
|
||||
alignCenter: false,
|
||||
textDirection: _textDirection,
|
||||
readOnly: widget.readOnly,
|
||||
mouseCursor: widget.mouseCursor,
|
||||
onTextChange: (value) {
|
||||
widget.onTextChange?.call(value);
|
||||
if (value.isNotEmpty) {
|
||||
final directionByText = DirectionUtils.getDirectionByEndsText(value);
|
||||
if (directionByText != _textDirection) {
|
||||
setState(() {
|
||||
_textDirection = directionByText;
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
onTextSubmitted: widget.onTextSubmitted,
|
||||
onTap: widget.onTap,
|
||||
onTapOutside: widget.onTapOutside,
|
||||
);
|
||||
}
|
||||
|
||||
return TextField(
|
||||
key: widget.key,
|
||||
controller: _controller,
|
||||
@@ -110,8 +158,11 @@ class _TextFieldBuilderState extends State<TextFieldBuilder> {
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
if (widget.fromValue == null && widget.controller == null) {
|
||||
_controller.dispose();
|
||||
if (widget.controller == null) {
|
||||
_controller?.dispose();
|
||||
}
|
||||
if (widget.languageToolController == null) {
|
||||
_languageToolController?.dispose();
|
||||
}
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@@ -648,6 +648,15 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "4.9.0"
|
||||
languagetool_textfield:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
path: "."
|
||||
ref: twake-supported
|
||||
resolved-ref: f47dd9829e145acc795b4e3e62f8bc668135fcd6
|
||||
url: "https://github.com/dab246/languagetool_textfield.git"
|
||||
source: git
|
||||
version: "0.1.0"
|
||||
leak_tracker:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -1021,6 +1030,14 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.7.0"
|
||||
throttling:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: throttling
|
||||
sha256: e48a4c681b1838b8bf99c1a4f822efe43bb69132f9a56091cd5b7d931c862255
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.0.1"
|
||||
timing:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
||||
@@ -26,6 +26,14 @@ dependencies:
|
||||
flutter:
|
||||
sdk: flutter
|
||||
|
||||
### Dependencies from git ###
|
||||
# TODO: We will change it when the PR in upstream repository will be merged
|
||||
# https://github.com/solid-software/languagetool_textfield/pull/83
|
||||
languagetool_textfield:
|
||||
git:
|
||||
url: https://github.com/dab246/languagetool_textfield.git
|
||||
ref: twake-supported
|
||||
|
||||
### Dependencies from pub.dev ###
|
||||
cupertino_icons: 1.0.6
|
||||
|
||||
|
||||
Reference in New Issue
Block a user