-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcreateaccountscreen.kv
150 lines (140 loc) · 6.27 KB
/
createaccountscreen.kv
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
<CreateAccountScreen>:
GridLayout:
cols: 2
GridLayout:
cols: 1
canvas.before:
Color:
rgb:(255,255,255)
Rectangle:
size: self.size
pos: self.pos
Image:
source: "logo.png"
FloatLayout:
canvas.before:
Color:
rgba: 0, 0.584, 1,1
Rectangle:
pos: self.pos
size: self.size
ThemedButton:
size_hint: .4, .05
pos_hint: {"center_x": .5, "top": .32}
text: "[u]Back[/u]"
bg_color: (.4,.4,.4,1)
color: 1,1,1,1
on_release:
root.parent.current = "sign_in_screen"
TextInput:
id: email
size_hint: .7 ,.08
pos_hint: {"top": .7, "right": 0.95}
multiline: False
write_tab: False
padding: 7, self.height / 2.0 - (self.line_height / 2.0) * len(self._lines)
bg_color: (1,1,1,1)
highlight_color1: root.parent.parent.secondary_color if root.parent else (0,0,0,1)
highlight_color2: root.parent.parent.tertiary_color if root.parent else (0,0,0,1)
bottom_color: self.highlight_color1
on_text_validate: password.focus = True
canvas.before:
Color:
rgba: self.bottom_color if self.bottom_color else (0,0,0,1)
Rectangle:
size: (self.size[0], self.size[1]/15.)
pos: self.pos
on_focus:
self.bottom_color = self.highlight_color2 if self.focused else self.highlight_color1
Animation(animated_center_y=(0.68 if (self.focused) else 0.65)).start(the_label)
Label:
id: the_label
color: (1,0,0,1)
text: "email"
valign: "middle"
size_hint: None, None
size: self.texture_size
animated_center_y: .65
animated_x: .93
pos_hint: {"center_y": self.animated_center_y, "right": self.animated_x}
TextInput:
id: password
size_hint: .7 ,.08
pos_hint: {"center_x": .6, "top": .575}
password: True
multiline: False
write_tab: False
padding: 7, self.height / 2.0 - (self.line_height / 2.0) * len(self._lines)
bg_color: (1,1,1,1)
highlight_color1: root.parent.parent.secondary_color if root.parent else (0,0,0,1)
highlight_color2: root.parent.parent.tertiary_color if root.parent else (0,0,0,1)
on_text_validate:
root.parent.parent.sign_up(email.text, password.text)
Animation(opacity=0, duration=0.5).start(message)
sign_in_button.opacity = 0
sign_in_button.disabled = True
root.parent.parent.display_loading_screen()
canvas.before:
Color:
rgba: self.bottom_color if self.bottom_color else (0,0,0,1)
Rectangle:
size: (self.size[0], self.size[1]/15.)
pos: self.pos
on_focus:
self.bottom_color = self.highlight_color2 if self.focused else self.highlight_color1
Animation(animated_center_y=(0.55 if (self.focused) else 0.52)).start(the_label1)
Label:
id: the_label1
color: (1,0,0,1)
text: "password"
valign: "middle"
size_hint: None, None
size: self.texture_size
animated_center_y: .52
animated_x: .93
pos_hint: {"center_y": self.animated_center_y, "right": self.animated_x}
ThemedButton:
text: "[u]Create Account[/u]"
size_hint: .4 ,.05
pos_hint: {"center_x": .5, "top": .42}
bg_color: (.357,.686,.294,1)
color: 1,1,1,1
on_release:
# Need to refer to the FirebaseLoginScreen
root.parent.parent.sign_up(email.text, password.text)
Animation(opacity=0, duration=0.5).start(message)
sign_in_button.opacity = 0
sign_in_button.disabled = True
root.parent.parent.display_loading_screen()
ThemedMessage:
id: message
size_hint: .9 ,.1
pos_hint: {"center_x": .5, "center_y": .1}
opacity: 0
bg_color: (root.parent.parent.primary_color[:3] + [.7] if (type(root.parent.parent.primary_color) != tuple) else root.parent.parent.primary_color[:3] + tuple([.7])) if root.parent else (0,0,0,1)
color: root.parent.parent.secondary_color if root.parent else (0,0,0,1)
on_text:
Animation(opacity=1, duration=0.5).start(self)
Label:
text: "Email:"
font_size: 18
background_color: 1,1,1,1
pos_hint: {"center_x": .15, "top":1.15}
Label:
text: "Password:"
font_size: 18
background_color: 1,1,1,1
pos_hint: {"center_x": .148, "top":1.03}
ThemedButton:
id: sign_in_button
text: "[u]Sign in[/u]"
size_hint: .2 ,.05
pos_hint: {"right": .85, "center_y": .1}
opacity: 0
disabled: True
bg_color: (0,0,0,0)# root.parent.parent.primary_color if root.parent else (0,0,0,1)
color: root.parent.parent.secondary_color if root.parent else (0,0,0,1)
on_release:
root.parent.current = "sign_in_screen"
root.parent.parent.ids.sign_in_screen.ids.email.text = email.text
root.parent.parent.ids.sign_in_screen.ids.password.text = password.text