FadingEdgeEffect#

New in version 1.0.0.

The FadingEdgeEffect class implements a fade effect for KivyMD widgets:

from kivy.lang import Builder
from kivy.uix.scrollview import ScrollView

from kivymd.app import MDApp
from kivymd.effects.fadingedge.fadingedge import FadingEdgeEffect
from kivymd.uix.list import OneLineListItem

KV = '''
MDScreen:

    FadeScrollView:
        fade_height: self.height / 2
        fade_color: root.md_bg_color

        MDList:
            id: container
'''


class FadeScrollView(FadingEdgeEffect, ScrollView):
    pass


class Test(MDApp):
    def build(self):
        return Builder.load_string(KV)

    def on_start(self):
        for i in range(20):
            self.root.ids.container.add_widget(
                OneLineListItem(text=f"Single-line item {i}")
            )


Test().run()
https://github.com/HeaTTheatR/KivyMD-data/raw/master/gallery/kivymddoc/fading-edge-effect-white.gif

Note

Use the same color value for the fade_color parameter as for the parent widget.

API - kivymd.effects.fadingedge.fadingedge#

class kivymd.effects.fadingedge.fadingedge.FadingEdgeEffect(**kwargs)#

The class implements the fade effect.

New in version 1.0.0.

fade_color#

Fade color.

fade_color is an ColorProperty and defaults to None.

fade_height#

Fade height.

fade_height is an ColorProperty and defaults to 0.

edge_top#

Display fade edge top.

edge_top is an BooleanProperty and defaults to True.

edge_bottom#

Display fade edge bottom.

edge_bottom is an BooleanProperty and defaults to True.

set_fade(self, interval: Union[int, float])#

Draws a bottom and top fade border on the canvas.

update_canvas(self, instance_fadind_edge_effect, size: list[int, int], rectangle_top: Rectangle, rectangle_bottom: Rectangle, index: int)#

Updates the position and size of the fade border on the canvas. Called when the application screen is resized.