Skip to content

Instantly share code, notes, and snippets.

@mancj
Created June 30, 2020 11:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mancj/c298c72320666a58d0682d5ba80b74b6 to your computer and use it in GitHub Desktop.
Save mancj/c298c72320666a58d0682d5ba80b74b6 to your computer and use it in GitHub Desktop.
@override
Widget build(BuildContext context) {
return Scaffold(
body: Container(
color: CustomColors.ultraLightGray,
child: Column(
children: [
AppBarFactory.appBarWithCustomBack(
context,
title: AppLocalizations
.of(context)
.chat,
onTap: () => NavigationManager(null, context).back(),
),
if (isLoading)
Container(
child: PlatformCircularProgressIndicator(
android: (c) => MaterialProgressIndicatorData(strokeWidth: 2),
),
padding: EdgeInsets.all(8),
width: 32,
height: 32,
),
Expanded(
child: DashChat(
onLoadEarlier: () {},
scrollController: _scrollController,
textInputAction: TextInputAction.newline,
sendOnEnter: false,
messageTimeBuilder: (url, [message]) => Offstage(),
sendButtonBuilder:
_isSendingMessage ? (context) => Text("Sending") : null,
inputMaxLines: 5,
showUserAvatar: true,
scrollToBottom: false,
timeFormat: DateFormat(StringUtils.displayTimeFormat),
dateFormat: DateFormat(StringUtils.displayDateFormat),
messages: _messages,
user: presenter.user,
leading: <Widget>[
Container(
child: Image.asset(
CustomIcons.paperclip,
scale: 3,
),
width: 48,
height: 48,
)
],
messageTextBuilder: (text, [message]) {
// TODO здесь можно обрабатывать сообщения с файлами
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text(message.user.name,
style: TextStyle(color: CustomColors.lightGray)),
OffsetSpace.vertical(OffsetValue.small),
Text(text),
],
);
},
onSend: (message) => presenter.onSendMessage(message),
),
)
],
),
),
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment