def __init__(self, **kwargs): self._layout = MaterialBoxLayout self._title_layout = RelativeLayout() self._title_header = MaterialLabel() self._title_bg = Image() self._list = List() super(DetailView, self).__init__(**kwargs) self._layout.add_widget(self._title_layout) self._layout.add_widget(self.list)
def __init__(self, **kwargs): self._msg_label = MaterialLabel(font_style='Caption', theme_text_color='Error', halign='left', valign='middle') self._hint_lbl = MaterialLabel(font_style='Subhead', halign='left', valign='middle') super(SingleLineTextField, self).__init__(**kwargs) self.line_color_normal = self._theme_cls.divider_color() self.line_color_focus = self._theme_cls.primary_color self.error_color = self._theme_cls.error_color self._hint_txt_color = self._theme_cls.hint_text_color() self.hint_text_color = (1, 1, 1, 0) self.cursor_color = self._theme_cls.primary_color self.bind(error_message=self._set_msg, hint_text=self._set_hint, _hint_lbl_font_size=self._hint_lbl.setter('font_size'))
def build(self): root = Builder.load_string(kitchen_sink_kv) root.toolbar.nav_button = ["md-menu", lambda *x: root.nav.toggle()] root.toolbar.add_action_button("md-refresh") root.toolbar.add_action_button("md-more-vert") root.r_btn_1.bind(on_release=lambda *x: setattr( root.dialog_btn, 'disabled', not root.dialog_btn.disabled)) self.tile_data = [{ 'text': "Button 1", 'secondary_text': "With a secondary text" }, { 'text': "Button 2", 'secondary_text': "With a secondary text" }, { 'text': "Button 3", 'secondary_text': "With a secondary text" }, { 'text': "Button 4", 'secondary_text': "With a secondary text" }] self.tile_single_data = [{ 'text': "Button 1" }, { 'text': "Button 2" }, { 'text': "Button 3" }, { 'text': "Button 4" }] self.tile_icon_data = [{ 'icon': 'md-alarm', 'text': 'Alarm', 'secondary_text': "An alarm button", 'callback': root.nav.dismiss }, { 'icon': 'md-event', 'text': 'Event', 'secondary_text': "An event button", 'callback': root.nav.dismiss }, { 'icon': 'md-search', 'text': 'Search', 'secondary_text': "A search button", 'callback': root.nav.dismiss }, { 'icon': 'md-thumb-up', 'text': 'Like', 'secondary_text': "A like button", 'callback': root.nav.dismiss }] self.tile_avatar_data = [{ 'avatar': images_path + 'default_avatar.jpg', 'text': 'Avatar tile', 'secondary_text': "That's a handsome dude!" }, { 'avatar': images_path + 'default_avatar.jpg', 'text': 'Avatar tile', 'secondary_text': "Very handsome indeed" }, { 'avatar': images_path + 'default_avatar.jpg', 'text': 'Avatar tile', 'secondary_text': "Extraordinary handsome" }, { 'avatar': images_path + 'default_avatar.jpg', 'text': 'Avatar tile', 'secondary_text': "Super handsome" }] content = MaterialLabel( font_style='Body1', theme_text_color='Secondary', text= "This is a Dialog with a title and some text. That's pretty awesome right!", valign='top') content.bind(size=content.setter('text_size')) self.dialog = Dialog(title="This is a test dialog", content=content, size_hint=(.8, None), height=dp(200), auto_dismiss=True) self.dialog.add_action_button("Dismiss", action=lambda *x: self.dialog.dismiss()) root.textfield.bind(on_text_validate=self.set_error_message, on_focus=self.set_error_message) root.dialog_btn.bind(on_release=self.dialog.open) return root