working condition
This commit is contained in:
parent
417e54da96
commit
511e0b0379
517 changed files with 29187 additions and 32696 deletions
|
@ -0,0 +1 @@
|
|||
from .badge import MDBadge # NOQA F401
|
Binary file not shown.
Binary file not shown.
|
@ -0,0 +1,19 @@
|
|||
<MDBadge>
|
||||
font_style: "Label"
|
||||
role: "small"
|
||||
radius: [self.texture_size[1] / 2, ]
|
||||
pos_hint: {"center_x": 0.5, "center_y": 0.5}
|
||||
padding: "4dp", "2dp"
|
||||
halign: "center"
|
||||
valign: "center"
|
||||
adaptive_size: True
|
||||
md_bg_color: self.theme_cls.errorColor
|
||||
text_color: self.theme_cls.onErrorColor
|
||||
size_hint: None, None
|
||||
size: self.texture_size
|
||||
pos:
|
||||
( \
|
||||
self.parent.x + (self.parent.width / 2), \
|
||||
self.parent.y + (self.parent.height / 2) \
|
||||
) \
|
||||
if self.parent else (0, 0)
|
|
@ -0,0 +1,74 @@
|
|||
"""
|
||||
Components/Badge
|
||||
================
|
||||
|
||||
.. versionadded:: 2.0.0
|
||||
|
||||
|
||||
.. seealso::
|
||||
|
||||
`Material Design 3 spec, Badge <https://m3.material.io/components/badges/overview>`_
|
||||
|
||||
.. rubric:: Badges show notifications, counts, or status information on
|
||||
navigation items and icons.
|
||||
|
||||
.. image:: https://github.com/HeaTTheatR/KivyMD-data/raw/master/gallery/kivymddoc/badges.png
|
||||
:align: center
|
||||
|
||||
Example
|
||||
-------
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
from kivy.lang import Builder
|
||||
|
||||
from kivymd.app import MDApp
|
||||
|
||||
KV = '''
|
||||
MDScreen:
|
||||
md_bg_color: self.theme_cls.backgroundColor
|
||||
|
||||
MDIcon:
|
||||
icon: "gmail"
|
||||
pos_hint: {'center_x': .5, 'center_y': .5}
|
||||
|
||||
MDBadge:
|
||||
text: "12"
|
||||
'''
|
||||
|
||||
|
||||
class Example(MDApp):
|
||||
def build(self):
|
||||
return Builder.load_string(KV)
|
||||
|
||||
|
||||
Example().run()
|
||||
|
||||
.. image:: https://github.com/HeaTTheatR/KivyMD-data/raw/master/gallery/kivymddoc/badges-example.png
|
||||
:align: center
|
||||
"""
|
||||
|
||||
__all__ = ("MDBadge",)
|
||||
|
||||
import os
|
||||
|
||||
from kivy.lang import Builder
|
||||
|
||||
from kivymd.uix.label import MDLabel
|
||||
from kivymd import uix_path
|
||||
|
||||
with open(
|
||||
os.path.join(uix_path, "badge", "badge.kv"), encoding="utf-8"
|
||||
) as kv_file:
|
||||
Builder.load_string(kv_file.read())
|
||||
|
||||
|
||||
class MDBadge(MDLabel):
|
||||
"""
|
||||
Badge class.
|
||||
|
||||
.. versionadded:: 2.0.0
|
||||
|
||||
For more information see in the
|
||||
:class:`~kivymd.uix.label.label.MDLabel` class documentation.
|
||||
"""
|
Loading…
Add table
Add a link
Reference in a new issue