You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
title: Placeholder in Flutter Chat widget | Syncfusion
4
-
description: Learn here about the Right to Left(RTL) support in Syncfusion Flutter Chat (SfChat) widget and more.
3
+
title: Placeholder in Flutter AIAssistView widget | Syncfusion
4
+
description: Learn here about the RTL support in Syncfusion Flutter AIAssistView (SfAIAssistView) widget and more.
5
5
platform: flutter
6
-
control: SfChat
6
+
control: SfAIAssistView
7
7
documentation: ug
8
8
---
9
9
10
10
11
-
# Right To Left (RTL) in Flutter Chat (SfChat)
11
+
# Right To Left (RTL) in Flutter AIAssistView (SfAIAssistView)
12
12
13
13
14
-
Chat supports the right to left rendering for all the elements in the Chat widget.
14
+
AIAssistView supports the right to left rendering for all the elements in the AIAssistView widget.
15
15
16
16
## RTL rendering ways
17
17
18
18
Right to left rendering can be switched in the following ways:
19
19
20
-
### Wrapping the SfChat with Directionality widget
20
+
### Wrapping the SfAIAssistView with Directionality widget
21
21
22
-
To change the rendering direction from right to left, you can wrap the [`SfChat`](https://pub.dev/documentation/syncfusion_flutter_chat/latest/chat/SfChat-class.html) widget inside the [`Directionality`](https://api.flutter.dev/flutter/widgets/Directionality-class.html) widget and set the [`textDirection`](https://api.flutter.dev/flutter/widgets/Directionality/textDirection.html) property as [`TextDirection.rtl`](https://api.flutter.dev/flutter/dart-ui/TextDirection.html).
22
+
To change the rendering direction from right to left, you can wrap the [`SfAIAssistView`](https://pub.dev/documentation/syncfusion_flutter_chat/latest/assist_view/SfAIAssistView-class.html) widget inside the [`Directionality`](https://api.flutter.dev/flutter/widgets/Directionality-class.html) widget and set the [`textDirection`](https://api.flutter.dev/flutter/widgets/Directionality/textDirection.html) property as [`TextDirection.rtl`](https://api.flutter.dev/flutter/dart-ui/TextDirection.html).
23
23
24
24
{% tabs %}
25
25
{% highlight dart hl_lines="5" %}
@@ -29,7 +29,7 @@ To change the rendering direction from right to left, you can wrap the [`SfChat`
29
29
return Scaffold(
30
30
body: Directionality(
31
31
textDirection: TextDirection.rtl,
32
-
child: SfChat(
32
+
child: SfAIAssistView(
33
33
//...
34
34
),
35
35
),
@@ -40,51 +40,73 @@ To change the rendering direction from right to left, you can wrap the [`SfChat`
40
40
{% endtabs %}
41
41
42
42
43
-
## RTL supported chat elements
43
+
## RTL supported AIAssistView elements
44
44
45
45
### Placeholder
46
46
47
-
Right to left (RTL) rendering is supported for the [`placeholderBuilder`](https://pub.dev/documentation/syncfusion_flutter_chat/latest/chat/SfChat/placeholderBuilder.html) in the chat. The widget added in the placeholderBuilder will be rendered from right to left direction. But, the text widget or text entered in the widget will render from left to right direction.
47
+
Right to left (RTL) rendering is supported for the [`placeholderBuilder`](https://pub.dev/documentation/syncfusion_flutter_chat/latest/assist_view/SfAIAssistView/placeholderBuilder.html) in the AIAssistView. The widget added in the placeholderBuilder will be rendered from right to left direction. But, the text widget or text entered in the widget will render from left to right direction.
48
48
49
49
{% tabs %}
50
-
{% highlight dart hl_lines="5 9" %}
51
-
52
-
@override
53
-
Widget build(BuildContext context) {
54
-
return Scaffold(
55
-
body: Directionality(
56
-
textDirection: TextDirection.rtl,
57
-
child: SfChat(
58
-
outgoingUser: '1010',
59
-
messages: _messages,
60
-
placeholderBuilder: (context) {
61
-
return const Center(
62
-
child: Row(
63
-
mainAxisAlignment: MainAxisAlignment.center,
64
-
children: [
65
-
SizedBox(width: 10),
66
-
Icon(
67
-
size: 30,
68
-
Icons.emoji_people_rounded,
69
-
color: Colors.red,
70
-
),
71
-
SizedBox(width: 5),
72
-
Text(
73
-
'Start a conversation',
74
-
style: TextStyle(
75
-
color: Colors.deepPurple,
76
-
fontSize: 16,
77
-
fontWeight: FontWeight.bold,
78
-
),
79
-
),
80
-
],
81
-
),
82
-
);
83
-
},
84
-
),
85
-
),
86
-
);
87
-
}
50
+
{% highlight dart hl_lines="5 10" %}
51
+
52
+
@override
53
+
Widget build(BuildContext context) {
54
+
return Scaffold(
55
+
body: Directionality(
56
+
textDirection: TextDirection.rtl,
57
+
child: Padding(
58
+
padding: const EdgeInsets.all(20.0),
59
+
child: SfAIAssistView(
60
+
messages: _messages,
61
+
placeholderBuilder: (context) {
62
+
return Column(
63
+
mainAxisAlignment: MainAxisAlignment.center,
64
+
children: [
65
+
const Text(
66
+
'Ask AI Anything',
67
+
style: TextStyle(
68
+
color: Colors.deepPurple,
69
+
fontSize: 18,
70
+
fontWeight: FontWeight.bold,
71
+
),
72
+
),
73
+
const SizedBox(height: 20),
74
+
Row(
75
+
mainAxisAlignment: MainAxisAlignment.center,
76
+
children: [
77
+
OutlinedButton(
78
+
onPressed: () {},
79
+
child: const Row(
80
+
mainAxisSize: MainAxisSize.min,
81
+
children: [
82
+
Text('Music'),
83
+
SizedBox(width: 5),
84
+
Icon(Icons.music_note)
85
+
],
86
+
),
87
+
),
88
+
const SizedBox(width: 5),
89
+
OutlinedButton(
90
+
onPressed: () {},
91
+
child: const Row(
92
+
mainAxisSize: MainAxisSize.min,
93
+
children: [
94
+
Text('Movies'),
95
+
SizedBox(width: 5),
96
+
Icon(Icons.movie_creation_rounded)
97
+
],
98
+
),
99
+
),
100
+
],
101
+
),
102
+
],
103
+
);
104
+
},
105
+
),
106
+
),
107
+
),
108
+
);
109
+
}
88
110
89
111
{% endhighlight %}
90
112
{% endtabs %}
@@ -94,27 +116,27 @@ Right to left (RTL) rendering is supported for the [`placeholderBuilder`](https:
94
116
95
117
### Composer
96
118
97
-
Right to left (RTL) rendering is supported for the [`composer`](https://pub.dev/documentation/syncfusion_flutter_chat/latest/chat/SfChat/composer.html) in the chat. Composer will be rendered from right to left direction. But, the text entered in the composer will render from the left to right in the composer.
119
+
Right to left (RTL) rendering is supported for the [`composer`](https://pub.dev/documentation/syncfusion_flutter_chat/latest/assist_view/SfAIAssistView/composer.html) in the AIAssistView. Composer will be rendered from right to left direction. But, the text entered in the composer will render from the left to right in the composer.
98
120
99
121
{% tabs %}
100
-
{% highlight dart hl_lines="5 9" %}
122
+
{% highlight dart hl_lines="5 8" %}
101
123
102
-
@override
103
-
Widget build(BuildContext context) {
104
-
return Scaffold(
105
-
body: Directionality(
106
-
textDirection: TextDirection.rtl,
107
-
child: SfChat(
108
-
outgoingUser: '1010',
109
-
messages: _messages,
110
-
composer: const ChatComposer(
124
+
@override
125
+
Widget build(BuildContext context) {
126
+
return Scaffold(
127
+
body: Directionality(
128
+
textDirection: TextDirection.rtl,
129
+
child: SfAIAssistView(
130
+
messages: _messages,
131
+
composer: const AssistComposer(
111
132
decoration: InputDecoration(
112
-
hintText: 'Enter Message here',
113
-
)),
133
+
hintText: 'Ask AI anything',
134
+
),
135
+
),
136
+
),
114
137
),
115
-
),
116
-
);
117
-
}
138
+
);
139
+
}
118
140
119
141
{% endhighlight %}
120
142
{% endtabs %}
@@ -125,91 +147,97 @@ Right to left (RTL) rendering is supported for the [`composer`](https://pub.dev/
125
147
126
148
### Action Button
127
149
128
-
Right to left (RTL) rendering is supported for the [`actionButton`](https://pub.dev/documentation/syncfusion_flutter_chat/latest/chat/SfChat/actionButton.html) in the chat. Action button will be rendered from right to left direction.
150
+
Right to left (RTL) rendering is supported for the [`actionButton`](https://pub.dev/documentation/syncfusion_flutter_chat/latest/assist_view/SfAIAssistView/actionButton.html) in the AIAssistView. Action button will be rendered from right to left direction.
Right to left (RTL) rendering is supported for [`Messages`](https://pub.dev/documentation/syncfusion_flutter_chat/latest/chat/ChatMessage-class.html) in the chat conversation area. In RTL mode, message content, header and suggestions will render the widget in right to left direction.
180
+
Right to left (RTL) rendering is supported for both [`request`](https://pub.dev/documentation/syncfusion_flutter_chat/latest/assist_view/AssistMessage/AssistMessage.request.html) and [`response`](https://pub.dev/documentation/syncfusion_flutter_chat/latest/assist_view/AssistMessage/AssistMessage.response.html)[`Messages`](https://pub.dev/documentation/syncfusion_flutter_chat/latest/assist_view/SfAIAssistView/messages.html) in the AIAssistView conversation area. In RTL mode, request and response message, header and suggestions will render the widget in right to left direction.
0 commit comments