diff --git a/lib/client/language_tool_client.dart b/lib/client/language_tool_client.dart index e328c9c..48e70a9 100644 --- a/lib/client/language_tool_client.dart +++ b/lib/client/language_tool_client.dart @@ -38,7 +38,7 @@ class LanguageToolClient { ); final languageToolAnswer = LanguageToolRaw.fromJson( - json.decode(result.body) as Map, + json.decode(utf8.decode(result.bodyBytes)) as Map, ); return _parseRawAnswer(languageToolAnswer); diff --git a/lib/presentation/language_tool_text_field.dart b/lib/presentation/language_tool_text_field.dart index bbb41b7..78c7b27 100644 --- a/lib/presentation/language_tool_text_field.dart +++ b/lib/presentation/language_tool_text_field.dart @@ -32,6 +32,13 @@ class LanguageToolTextField extends StatefulWidget { /// ```language``` = 'auto' by default. final String language; + /// Determine text alignment + /// textAlign = [TextAlign.start] by default. + final TextAlign textAlign; + + /// Determine text Direction + final TextDirection? textDirection; + /// Creates a widget that checks grammar errors. const LanguageToolTextField({ required this.controller, @@ -42,6 +49,8 @@ class LanguageToolTextField extends StatefulWidget { this.maxLines = 1, this.minLines, this.expands = false, + this.textAlign = TextAlign.start, + this.textDirection, super.key, }); @@ -92,6 +101,8 @@ class _LanguageToolTextFieldState extends State { padding: const EdgeInsets.all(_padding), child: Center( child: TextField( + textAlign: widget.textAlign, + textDirection: widget.textDirection, focusNode: _focusNode, controller: widget.controller, scrollController: _scrollController,