Commit 307ae14e authored by Black Hat's avatar Black Hat

Improve chat interface.

parent 09ee28b0
...@@ -53,8 +53,12 @@ Item { ...@@ -53,8 +53,12 @@ Item {
} }
ListView { ListView {
id: messageListView
Layout.fillWidth: true Layout.fillWidth: true
Layout.fillHeight: true Layout.fillHeight: true
Layout.leftMargin: 16
Layout.rightMargin: 16
displayMarginBeginning: 40 displayMarginBeginning: 40
displayMarginEnd: 40 displayMarginEnd: 40
verticalLayoutDirection: ListView.BottomToTop verticalLayoutDirection: ListView.BottomToTop
...@@ -63,6 +67,9 @@ Item { ...@@ -63,6 +67,9 @@ Item {
delegate: Row { delegate: Row {
readonly property bool sentByMe: index % 2 == 0 readonly property bool sentByMe: index % 2 == 0
id: messageRow
height: 40
anchors.right: sentByMe ? parent.right : undefined anchors.right: sentByMe ? parent.right : undefined
spacing: 6 spacing: 6
...@@ -75,19 +82,23 @@ Item { ...@@ -75,19 +82,23 @@ Item {
} }
Rectangle { Rectangle {
width: 80 width: Math.min(messageText.implicitWidth + 24,
height: 40 messageListView.width - (!sentByMe ? avatar.width + messageRow.spacing : 0))
color: sentByMe ? "lightgrey" : "steelblue" height: parent.height
color: sentByMe ? "lightgrey" : Material.accent
Label { Label {
anchors.centerIn: parent id: messageText
text: index text: index
color: sentByMe ? "black" : "white" color: sentByMe ? "black" : "white"
anchors.fill: parent
anchors.margins: 12
wrapMode: Label.Wrap
} }
} }
} }
ScrollBar.vertical: ScrollBar {} ScrollBar.vertical: ScrollBar { anchors.left: messageListView.right }
} }
Pane { Pane {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment