diff cagou/plugins/plugin_wid_chat.kv @ 326:d9d2b56f46db

plugin chat: infinite scroll: each when use scroll on top of current history, 30 new messages are prepended.
author Goffi <goffi@goffi.org>
date Fri, 06 Dec 2019 13:25:33 +0100
parents 5868a5575e01
children aa860c10acfc
line wrap: on
line diff
--- a/cagou/plugins/plugin_wid_chat.kv	Fri Dec 06 13:25:31 2019 +0100
+++ b/cagou/plugins/plugin_wid_chat.kv	Fri Dec 06 13:25:33 2019 +0100
@@ -19,6 +19,7 @@
 #:import escape kivy.utils.escape_markup
 #:import SimpleXHTMLWidget cagou.core.simple_xhtml.SimpleXHTMLWidget
 #:import DelayedBoxLayout cagou.core.common_widgets.DelayedBoxLayout
+#:import ScrollEffect kivy.effects.scroll.ScrollEffect
 
 
 <MessAvatar>:
@@ -98,11 +99,15 @@
 <Chat>:
     message_input: message_input
     messages_widget: messages_widget
+    history_scroll: history_scroll
     ScrollView:
+        id: history_scroll
         scroll_y: 0
+        on_scroll_y: root.onScroll(*args)
         do_scroll_x: False
         scroll_type: ['bars', 'content']
-        bar_width: dp(6)
+        bar_width: dp(10)
+        effect_cls: ScrollEffect
         DelayedBoxLayout:
             id: messages_widget
             size_hint_y: None