Skip to content

Commit

Permalink
Package updated to 1.0.18
Browse files Browse the repository at this point in the history
- Input Text Direction functionality added
  • Loading branch information
fayeed committed Mar 29, 2020
1 parent dbdf69c commit 6a66caa
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 30 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## [1.0.18]

- `inputTextDirection` property added.

## [1.0.17]

- Ability to set custom focus node for input.
Expand Down
4 changes: 2 additions & 2 deletions lib/dash_chat.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
import 'package:flutter/services.dart';
import 'package:uuid/uuid.dart';
import 'package:intl/intl.dart';
import 'package:intl/intl.dart' hide TextDirection;
import 'package:flutter_parsed_text/flutter_parsed_text.dart';
import 'package:transparent_image/transparent_image.dart';

export 'package:intl/intl.dart';
export 'package:intl/intl.dart' hide TextDirection;
export 'package:flutter_parsed_text/flutter_parsed_text.dart';

part 'src/chat_view.dart';
Expand Down
59 changes: 32 additions & 27 deletions lib/src/chat_input_toolbar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,11 @@ class ChatInputToolbar extends StatelessWidget {
final FocusNode focusNode;
final EdgeInsets inputToolbarPadding;
final EdgeInsets inputToolbarMargin;
final TextDirection textDirection;

ChatInputToolbar({
Key key,
this.textDirection = TextDirection.ltr,
this.focusNode,
this.scrollController,
this.text,
Expand Down Expand Up @@ -81,33 +83,36 @@ class ChatInputToolbar extends StatelessWidget {
Expanded(
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 8.0),
child: TextField(
focusNode: focusNode,
onChanged: (value) {
onTextChange(value);
},
buildCounter: (
BuildContext context, {
int currentLength,
int maxLength,
bool isFocused,
}) =>
null,
decoration: inputDecoration != null
? inputDecoration
: InputDecoration.collapsed(
hintText: "",
fillColor: Colors.white,
),
textCapitalization: textCapitalization,
controller: controller,
style: inputTextStyle,
maxLength: maxInputLength,
minLines: 1,
maxLines: inputMaxLines,
showCursor: showInputCursor,
cursorColor: inputCursorColor,
cursorWidth: inputCursorWidth,
child: Directionality(
textDirection: textDirection,
child: TextField(
focusNode: focusNode,
onChanged: (value) {
onTextChange(value);
},
buildCounter: (
BuildContext context, {
int currentLength,
int maxLength,
bool isFocused,
}) =>
null,
decoration: inputDecoration != null
? inputDecoration
: InputDecoration.collapsed(
hintText: "",
fillColor: Colors.white,
),
textCapitalization: textCapitalization,
controller: controller,
style: inputTextStyle,
maxLength: maxInputLength,
minLines: 1,
maxLines: inputMaxLines,
showCursor: showInputCursor,
cursorColor: inputCursorColor,
cursorWidth: inputCursorWidth,
),
),
),
),
Expand Down
9 changes: 9 additions & 0 deletions lib/src/chat_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,13 @@ class DashChat extends StatefulWidget {
/// If provided, this focus node will be used for the text input.
final FocusNode focusNode;

/// Use to change the direction of the text ltr is used for
/// launguages that start from left like English &
/// rtl is used for languages like Arabic
///
/// Defaults to `TextDirection.ltr`
final TextDirection inputTextDirection;

/// If provided will stop using the default controller
/// i.e [TextEditingController] and will use this to update the
/// text input field.
Expand Down Expand Up @@ -220,6 +227,7 @@ class DashChat extends StatefulWidget {

DashChat({
Key key,
this.inputTextDirection = TextDirection.ltr,
this.inputToolbarMargin = const EdgeInsets.all(0.0),
this.inputToolbarPadding = const EdgeInsets.all(0.0),
this.shouldShowLoadEarlier = false,
Expand Down Expand Up @@ -482,6 +490,7 @@ class DashChatState extends State<DashChat> {
ChatInputToolbar(
key: inputKey,
inputToolbarPadding: widget.inputToolbarPadding,
textDirection: widget.inputTextDirection,
inputToolbarMargin: widget.inputToolbarMargin,
showTraillingBeforeSend: widget.showTraillingBeforeSend,
inputMaxLines: widget.inputMaxLines,
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: dash_chat
description: The most complete Chat UI for flutter inspired by react-native-gifted-chat.
version: 1.0.17
version: 1.0.18
homepage: https://github.com/fayeed/dash_chat

environment:
Expand Down

0 comments on commit 6a66caa

Please sign in to comment.