/
LoginPage.xaml
223 lines (194 loc) · 11 KB
/
LoginPage.xaml
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
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage
x:Class="EssentialUIKit.Views.Forms.LoginPage"
xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:behaviour="clr-namespace:EssentialUIKit.Behaviors.Forms"
xmlns:border="clr-namespace:Syncfusion.XForms.Border;assembly=Syncfusion.Core.XForms"
xmlns:buttons="clr-namespace:Syncfusion.XForms.Buttons;assembly=Syncfusion.Buttons.XForms"
xmlns:control="clr-namespace:EssentialUIKit.Controls"
xmlns:converter="clr-namespace:EssentialUIKit.Converters"
xmlns:core="clr-namespace:Syncfusion.XForms.Core;assembly=Syncfusion.Core.XForms"
xmlns:gradient="clr-namespace:Syncfusion.XForms.Graphics;assembly=Syncfusion.Core.XForms"
xmlns:local="clr-namespace:EssentialUIKit.Views.Forms"
xmlns:viewModel="clr-namespace:EssentialUIKit.ViewModels.Forms"
BackgroundImageSource="{core:OnPlatformOrientationStringValue Default=LoginBackground.png,
iOSPhoneLandscape=LoginBackground-Landscape.png,
iOSTabletLandscape=LoginBackground-Landscape.png}"
NavigationPage.HasNavigationBar="False">
<ContentPage.Resources>
<ResourceDictionary>
<converter:BooleanToColorConverter x:Key="ColorConverter" />
<converter:InverseBoolConverter x:Key="InverseBoolConverter" />
<converter:NameValidationConverter x:Key="FirstValidationErrorConverter" />
</ResourceDictionary>
</ContentPage.Resources>
<!-- Binding context for login page -->
<ContentPage.BindingContext>
<viewModel:LoginPageViewModel />
</ContentPage.BindingContext>
<ContentPage.Content>
<Grid>
<gradient:SfGradientView Style="{StaticResource BlueGradientStyle}" />
<ScrollView HorizontalOptions="Center">
<ScrollView.VerticalOptions>
<OnIdiom
x:TypeArguments="LayoutOptions"
Default="CenterAndExpand"
Phone="FillAndExpand" />
</ScrollView.VerticalOptions>
<StackLayout
Margin="{core:OnPlatformOrientationThickness PhonePortrait='20,32',
PhoneLandscape='150,32',
TabletPortrait='200,50',
TabletLandscape='300,50',
Desktop='30'}"
Spacing="0"
VerticalOptions="FillAndExpand"
WidthRequest="{OnPlatform Default='-1',
UWP='350'}">
<Grid
RowDefinitions="Auto, Auto, Auto, Auto, Auto, Auto, Auto, Auto"
RowSpacing="0"
VerticalOptions="CenterAndExpand">
<!-- Label to display the title of this page -->
<Label
FontSize="20"
Style="{StaticResource TitleLabelStyle}"
Text="Log In"
TextColor="{DynamicResource Gray-White}" />
<!-- Label to display the description of this page -->
<Label
Grid.Row="1"
Margin="0,8"
Style="{StaticResource DescriptionLabelStyle}"
Text="Let's get to work"
TextColor="{DynamicResource Gray-White}" />
<!-- Entry to get email ID from user -->
<local:EmailEntry Grid.Row="2" Padding="0,24" />
<StackLayout Grid.Row="3">
<!-- Entry to get password from user -->
<border:SfBorder BorderColor="{Binding Source={x:Reference PasswordEntry}, Path=IsFocused, Converter={StaticResource ColorConverter}, ConverterParameter=0}" Style="{StaticResource LoginFormBorderlessEntryBorderStyle}">
<Grid ColumnDefinitions="*, Auto">
<control:BorderlessEntry
x:Name="PasswordEntry"
Margin="15,0"
HeightRequest="40"
IsPassword="True"
Placeholder="Password"
PlaceholderColor="{StaticResource EntryPlaceholderColor}"
Style="{StaticResource BorderlessEntryStyle}"
Text="{Binding Password.Value}"
TextColor="{StaticResource Gray-White}">
<Entry.Behaviors>
<behaviour:EntryLineValidationBehaviour IsValid="{Binding Password.IsValid}" />
</Entry.Behaviors>
</control:BorderlessEntry>
<!-- Label to display error icon -->
<Label
Grid.Column="1"
IsVisible="{Binding Path=IsVisible, Source={x:Reference PasswordValidationLabel}}"
Style="{StaticResource ErrorIconLabelStyle}"
Text="{StaticResource Error}" />
</Grid>
</border:SfBorder>
<!-- Label to display error message -->
<Label
x:Name="PasswordValidationLabel"
Margin="15,-3,0,0"
IsVisible="{Binding Password.IsValid, Converter={StaticResource InverseBoolConverter}}"
Style="{StaticResource SimpleLabelStyle}"
Text="{Binding Password.Errors, Converter={StaticResource FirstValidationErrorConverter}}"
TextColor="{DynamicResource Red}"
VerticalOptions="FillAndExpand" />
</StackLayout>
<!-- Forgot password link -->
<buttons:SfButton
x:Name="ForgotPasswordLabel"
Grid.Row="4"
Margin="0,16"
Command="{Binding ForgotPasswordCommand}"
FontSize="12"
HorizontalOptions="End"
Style="{StaticResource TransparentButtonStyle}"
Text="FORGOT PASSWORD?"
TextColor="{DynamicResource Gray-White}" />
<!-- Login button -->
<buttons:SfButton
Grid.Row="5"
Margin="0,16"
Command="{Binding LoginCommand}"
HorizontalOptions="Fill"
Style="{StaticResource GradientButtonStyle}"
Text="LOG IN" />
<Label
Grid.Row="6"
Style="{StaticResource DescriptionLabelStyle}"
Text="Or log in with your Facebook credentials"
TextColor="{DynamicResource Gray-White}" />
<!-- Login through facebook account -->
<buttons:SfButton
Grid.Row="7"
Margin="0,16,0,16"
BackgroundColor="{DynamicResource FacebookBlue}"
Command="{Binding SocialMediaLoginCommand}"
CornerRadius="20"
HeightRequest="40">
<buttons:SfButton.Content>
<StackLayout
HorizontalOptions="CenterAndExpand"
Orientation="Horizontal"
VerticalOptions="Center">
<Label
FontFamily="FontIcons"
FontSize="18"
Text=""
TextColor="{DynamicResource Gray-White}"
VerticalTextAlignment="Center" />
<Label
FontFamily="Montserrat-Medium"
FontSize="16"
Text="Log In with Facebook"
TextColor="{DynamicResource Gray-White}" />
</StackLayout>
</buttons:SfButton.Content>
</buttons:SfButton>
</Grid>
<StackLayout
HorizontalOptions="Center"
Orientation="Horizontal"
Spacing="1"
VerticalOptions="End">
<StackLayout.Padding>
<OnIdiom
x:DataType="Thickness"
Default="0, 48, 0, 0"
Phone="0" />
</StackLayout.Padding>
<Label
Style="{StaticResource DescriptionLabelStyle}"
Text="Don't have an account?"
TextColor="{DynamicResource Gray-White}"
VerticalTextAlignment="Center" />
<!-- Sign-up button -->
<buttons:SfButton
Command="{Binding SignUpCommand}"
Style="{StaticResource TransparentButtonStyle}"
Text="Sign Up"
TextColor="{DynamicResource PrimaryColor}" />
</StackLayout>
</StackLayout>
</ScrollView>
<!-- Close button -->
<buttons:SfButton
Margin="8"
Command="{Binding BackButtonCommand}"
FontSize="20"
HorizontalOptions="End"
Style="{StaticResource IconButtonStyle}"
Text="{StaticResource Close}"
TextColor="{DynamicResource Gray-White}"
VerticalOptions="Start" />
</Grid>
</ContentPage.Content>
</ContentPage>