Skip to content

Commit

Permalink
2.0.0 - Material Design 3
Browse files Browse the repository at this point in the history
Edit doc string.
  • Loading branch information
HeaTTheatR committed Dec 19, 2023
1 parent b885930 commit f0d254a
Showing 1 changed file with 15 additions and 55 deletions.
70 changes: 15 additions & 55 deletions kivymd/uix/fitimage/fitimage.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,51 +2,8 @@
Components/FitImage
===================
Example:
========
.. tabs::
.. tab:: Declarative KV styles
.. code-block:: kv
MDBoxLayout:
size_hint_y: None
height: "200dp"
orientation: 'vertical'
FitImage:
size_hint_y: 3
source: 'images/img1.jpg'
FitImage:
size_hint_y: 1
source: 'images/img2.jpg'
.. tab:: Declarative python styles
.. code-block:: python
MDBoxLayout(
FitImage(
size_hint_y=0.3,
source='images/img1.jpg',
),
FitImage(
size_hint_y=0.7,
source='images/img2.jpg',
),
size_hint_y=None,
height="200dp",
orientation='vertical',
)
Example with round corners:
===========================
.. image:: https://github.com/HeaTTheatR/KivyMD-data/raw/master/gallery/kivymddoc/fitimage-round-corners.png
:align: center
Example
=======
.. tabs::
Expand All @@ -60,29 +17,30 @@
KV = '''
MDScreen:
md_bg_color: self.theme_cls.backgroundColor
MDCard:
radius: dp(36)
md_bg_color: "grey"
MDBoxLayout:
radius: "36dp"
pos_hint: {"center_x": .5, "center_y": .5}
size_hint: .4, .8
md_bg_color: self.theme_cls.onSurfaceVariantColor
FitImage:
source: "bg.jpg"
source: "image.png"
size_hint_y: .35
pos_hint: {"top": 1}
radius: dp(36), dp(36), 0, 0
radius: "36dp", "36dp", 0, 0
'''
class Example(MDApp):
def build(self):
self.theme_cls.theme_style = "Dark"
return Builder.load_string(KV)
Example().run()
.. tab:: Declarative python styles
.. code-block:: python
Expand All @@ -97,18 +55,17 @@ def build(self):
class Example(MDApp):
def build(self):
self.theme_cls.theme_style = "Dark"
return (
MDScreen(
MDCard(
MDBoxLayout(
FitImage(
source="bg.jpg",
source="image.png",
size_hint_y=0.35,
pos_hint={"top": 1},
radius=(dp(36), dp(36), 0, 0),
),
radius=dp(36),
md_bg_color="grey",
md_bg_color=self.theme_cls.onSurfaceVariantColor,
pos_hint={"center_x": 0.5, "center_y": 0.5},
size_hint=(0.4, 0.8),
),
Expand All @@ -117,6 +74,9 @@ def build(self):
Example().run()
.. image:: https://github.com/HeaTTheatR/KivyMD-data/raw/master/gallery/kivymddoc/fitimage-round-corners.png
:align: center
"""

__all__ = ("FitImage",)
Expand Down

0 comments on commit f0d254a

Please sign in to comment.