Local message history with authors, typing indicators and send events. sent confirms local acceptance, not server delivery.
TxChat
| Parameter | Type | Default | Meaning |
|---|---|---|---|
| user | TxChatUser | required | Current chat author. |
| items | List<TxChatMessage>? | null | Entries; replaced by dataSource when bound. |
| dataSource | Object? | null | List, configuration or DataSource instance; takes precedence over items. |
| onItemsChanged | ValueChanged<List<TxChatMessage>>? | null | Reports items; update controlled state in the callback. |
| controller | TextEditingController? | null | External text controller; the application disposes it. |
| initialText | String | '' | Initial draft without an external controller. |
| onInputFieldTextChanged | ValueChanged<String>? | null | Reports inputFieldText; update controlled state in the callback. |
| onMessageEntered | ValueChanged<TxChange<TxChatMessage>>? | null | Before local acceptance: TxChange<TxChatMessage>; set cancel synchronously to take over processing. |
| onMessageSent | ValueChanged<TxChatMessage>? | null | Provides the locally accepted TxChatMessage; not a server delivery receipt. |
| onTypingStart | ValueChanged<TxChatUser>? | null | Reports the start of typing with the affected TxChatUser. |
| onTypingEnd | ValueChanged<TxChatUser>? | null | Reports the end of typing with the affected TxChatUser. |
| title | String | 'Chat' | View title. |
| subtitle | String | '' | Additional subtitle. |
| label | String | 'Chat' | Label or accessible name. |
| placeholder | String | 'Nachricht schreiben …' | Hint for an empty input. |
| emptyText | String | 'Noch keine Nachrichten. Starte die Unterhaltung.' | Empty state text. |
| disabled | bool | false | Disables interaction. |
| readOnly | bool | false | Prevents value changes. |
| loading | bool | false | Shows the loading state. |
| sending | bool | false | Disables sending during an application request. |
| maxLength | int | 4000 | Maximum text length. |
| typingUsers | List<TxChatUser> | const [] | Authors currently typing. |
| showAvatar | bool | true | Shows author avatars. |
| showUserName | bool | true | Shows author names. |
| showDayHeaders | bool | true | Groups messages using day headers. |
| showMessageTimestamp | bool | true | Shows message timestamps. |
| locale | String | 'de' | Locale for date/time formatting. |
| height | double | 560 | Height; Vue numbers use pixels, Flutter uses logical pixels. |
| header | Widget? | null | Custom header. |
| empty | Widget? | null | Custom empty state. |
| messageBuilder | Widget Function(BuildContext context, TxChatMessage message, bool isOwn)? | null | Builds custom content; callback arguments and return type are given in the signature. |
import 'package:flutter/material.dart';
import 'package:tecexpress/tecexpress.dart';
Widget example() {
var messages = <TxChatMessage>[];
return StatefulBuilder(
builder: (context, setState) => TxChat(user: TxChatUser(id: 'me', name: 'Alex'), items: messages, onItemsChanged: (v) => setState(() => messages = v)),
);
}