openCom-Companion/sbapp/kivymd/tools/patterns/MVC/View/FirstScreen/first_screen.kv

73 lines
2.2 KiB
Plaintext
Raw Normal View History

2022-07-07 22:16:10 +02:00
#:import images_path kivymd.images_path
#:import colors kivymd.color_definitions.colors
#:import get_color_from_hex kivy.utils.get_color_from_hex
<%s>
FitImage:
source:
( \
f"{images_path}restdb-logo.png" \
if root.model.database.name == "RestDB" else \
f"{images_path}firebase-logo.png" \
) \
if hasattr(root.model, "database") else \
f"{images_path}transparent.png"
MDBoxLayout:
orientation: "vertical"
MDToolbar:
id: toolbar
title: "%s"
right_action_items: [["web", lambda x: %s]]
md_bg_color:
( \
get_color_from_hex(colors["Yellow"]["700"]) \
if root.model.database.name == "Firebase" else \
get_color_from_hex(colors["Blue"]["300"]) \
) \
if hasattr(root.model, "database") else \
app.theme_cls.primary_color
MDFloatLayout:
MDBoxLayout:
orientation: "vertical"
adaptive_height: True
size_hint_x: None
width: root.width - dp(72)
radius: 12
padding: "12dp"
md_bg_color: 1, 1, 1, .5
pos_hint: {"center_x": .5, "center_y": .5}
MDLabel:
id: prev_label
text: %s
font_style: "H6"
adaptive_height: True
halign: "center"
color: 1, 1, 1, 1
MDBoxLayout:
orientation: "vertical"
adaptive_height: True
padding: "50dp"
spacing: "20dp"
MDTextField:
hint_text: %s
on_text: root.controller.set_user_data("login", self.text)
MDTextField:
hint_text: %s
on_text: root.controller.set_user_data("password", self.text)
MDFillRoundFlatButton:
text: %s
on_release: root.controller.on_tap_button_login()
pos_hint: {"center_x": .5, "center_y": .1}
md_bg_color: toolbar.md_bg_color