Ver código fonte

hectors commit

hector.sierra 4 anos atrás
pai
commit
22804f77cf
3 arquivos alterados com 395 adições e 0 exclusões
  1. 33
    0
      hector/main.dart
  2. 161
    0
      hector/register.dart
  3. 201
    0
      hector/welcome.dart

+ 33
- 0
hector/main.dart Ver arquivo

@@ -0,0 +1,33 @@
1
+
2
+import 'package:flutter/cupertino.dart';
3
+import 'package:flutter_login/flutter_login.dart';
4
+import 'package:flutter/material.dart';
5
+import 'package:google_fonts/google_fonts.dart';
6
+import 'register.dart';
7
+import 'welcome.dart';
8
+
9
+// import 'dashboard_screen.dart';
10
+
11
+
12
+
13
+void main() =>  runApp(MyApp());
14
+
15
+
16
+
17
+class MyApp extends StatelessWidget{
18
+  
19
+  static const String title = "FastMed";
20
+
21
+  @override
22
+  Widget build(BuildContext context){
23
+    final textTheme = Theme.of(context).textTheme;
24
+    return MaterialApp(
25
+      title: title,
26
+      theme: ThemeData(
27
+        textTheme: GoogleFonts.cabinTextTheme(textTheme),
28
+        ),
29
+      home: WelcomePage(),
30
+    );
31
+  }
32
+
33
+}

+ 161
- 0
hector/register.dart Ver arquivo

@@ -0,0 +1,161 @@
1
+import 'package:flutter_login/flutter_login.dart';
2
+import 'package:flutter/material.dart';
3
+import 'package:google_fonts/google_fonts.dart';
4
+
5
+//
6
+//Still to add: 
7
+//  Email verification, that the input has "@" and "."
8
+//  Send email and password to database
9
+//
10
+//
11
+//
12
+
13
+class RegisterPage extends StatefulWidget{
14
+  
15
+  RegisterPage({Key key, this.title}) : super(key: key);
16
+  final String title;
17
+
18
+  @override
19
+  _RegisterPageState createState() => _RegisterPageState();
20
+}
21
+
22
+class _RegisterPageState extends State<RegisterPage> {
23
+
24
+  TextEditingController email;
25
+  TextEditingController password;
26
+  TextEditingController confirmpass;
27
+
28
+  // Future<List> send_data() async {
29
+  //   final data = await
30
+  // }
31
+
32
+  String _SamePass(){
33
+    if(password == confirmpass){
34
+      return "Same password";
35
+    }
36
+    else{
37
+      return "Different passwords";
38
+    }
39
+  }
40
+
41
+  Widget _BackButton(BuildContext context){
42
+    return InkWell(
43
+      onTap: (){
44
+        Navigator.pop(context);
45
+      },
46
+      child: Row(
47
+        children: <Widget>[
48
+          Container(
49
+            padding: EdgeInsets.only(left: 0, top: 10, bottom: 10),
50
+            child: Icon(Icons.arrow_back_ios, color: Colors.black),
51
+          ),
52
+          Text("Back",
53
+          style: TextStyle(fontSize: 12, fontWeight: FontWeight.w500))
54
+        ]
55
+      ),
56
+    );
57
+  }
58
+
59
+  Widget _SubmitButton(BuildContext context){
60
+    return InkWell(
61
+       onTap: (){
62
+
63
+       },
64
+      child: Container(
65
+        padding: EdgeInsets.symmetric(vertical: 10),
66
+        width: 250,
67
+        alignment: Alignment.center,
68
+        decoration: BoxDecoration(
69
+          color: Colors.red,
70
+          borderRadius: BorderRadius.circular(30),
71
+        ),
72
+        child: Text(
73
+          "Submit",
74
+          style: TextStyle(fontSize: 22, color: Colors.white),
75
+        ),
76
+      ),
77
+    );
78
+  }
79
+
80
+  Widget _EntryField(String title, TextEditingController controller, {bool pass = false}){
81
+    return Container(
82
+      padding: EdgeInsets.only(left: 0, top: 10, bottom: 10),
83
+      child: Column(
84
+        crossAxisAlignment: CrossAxisAlignment.start,
85
+      
86
+        children: <Widget> [
87
+          Text(
88
+            title,
89
+            style: TextStyle(fontWeight: FontWeight.bold, fontSize: 15),
90
+          ),
91
+          SizedBox(
92
+            height: 30
93
+          ),
94
+          TextField(
95
+            controller: controller,
96
+            obscureText: pass,
97
+            decoration: InputDecoration(
98
+              border: (
99
+                  UnderlineInputBorder()
100
+              ),
101
+            ),
102
+          )
103
+        ]
104
+      ),
105
+      
106
+    );
107
+  }
108
+
109
+  Widget _Fills(){
110
+    return Column(
111
+      children: <Widget> [
112
+      _EntryField("Email", email),
113
+      _EntryField("Password", password, pass: true),
114
+      _EntryField("Confirm Password", confirmpass, pass: true)
115
+    
116
+    ]
117
+    );
118
+  }
119
+
120
+//add column or stack
121
+  @override
122
+  Widget build(BuildContext context) {
123
+    final height = MediaQuery.of(context).size.height;
124
+    return Scaffold(
125
+      body: Container(
126
+        height: height,
127
+        child: Stack(
128
+          
129
+          children: <Widget>[
130
+            Container(
131
+              padding: EdgeInsets.symmetric(horizontal: 20),
132
+              child: SingleChildScrollView(
133
+                child: Column(
134
+                  crossAxisAlignment: CrossAxisAlignment.center,
135
+                  mainAxisAlignment: MainAxisAlignment.center,
136
+                  children: <Widget>[
137
+                     SizedBox(
138
+                      height: 200,
139
+                    ),
140
+                    _Fills(),
141
+                    //Add code to verify if password and confirm password match
142
+                    SizedBox(
143
+                      height: 20,
144
+                    ),
145
+                    _SubmitButton(context),
146
+                  ],
147
+                ),
148
+              )
149
+            ),
150
+            Positioned(
151
+            top: 12, left: 20, child: _BackButton(context),
152
+          ),
153
+          ],
154
+          
155
+        ),
156
+      )
157
+    );
158
+  }
159
+    
160
+}
161
+

+ 201
- 0
hector/welcome.dart Ver arquivo

@@ -0,0 +1,201 @@
1
+
2
+
3
+import 'package:flutter_login/flutter_login.dart';
4
+import 'package:flutter/material.dart';
5
+import 'package:google_fonts/google_fonts.dart';
6
+import 'register.dart';
7
+
8
+
9
+
10
+
11
+
12
+class WelcomePage extends StatefulWidget {
13
+  WelcomePage({Key key, this.title}) : super(key: key);
14
+
15
+  final String title;
16
+
17
+  @override
18
+  _WelcomePageState createState() => _WelcomePageState();
19
+}
20
+
21
+class _WelcomePageState extends State<WelcomePage> {
22
+
23
+  TextEditingController email;
24
+  TextEditingController password;
25
+
26
+  Widget _message(BuildContext context){
27
+    return RichText(
28
+      textAlign: TextAlign.center,
29
+      text: TextSpan(
30
+          text: "Don't have an account?",
31
+          style: GoogleFonts.cabin(
32
+              fontSize: 18,
33
+              color: Colors.black
34
+          )
35
+      ),
36
+    );
37
+  }
38
+
39
+  Widget _title(BuildContext context){
40
+    return RichText(
41
+      textAlign: TextAlign.center,
42
+      text: TextSpan(
43
+          text: "Welcome to FastMed",
44
+          style: GoogleFonts.cabin(
45
+              fontSize: 30,
46
+              color: Colors.red
47
+          )
48
+      ),
49
+    );
50
+
51
+  }
52
+
53
+  Widget _LoginField(String title, TextEditingController controller, {bool pass = false}){
54
+    return Container(
55
+      padding: EdgeInsets.only(left: 0, top: 10, bottom: 10),
56
+      child: Column(
57
+          crossAxisAlignment: CrossAxisAlignment.start,
58
+
59
+          children: <Widget> [
60
+            Text(
61
+              title,
62
+              style: TextStyle(fontWeight: FontWeight.bold, fontSize: 15),
63
+            ),
64
+            SizedBox(
65
+                height: 30
66
+            ),
67
+            TextField(
68
+              controller: controller,
69
+              obscureText: pass,
70
+              decoration: InputDecoration(
71
+                border: (
72
+                    UnderlineInputBorder(
73
+
74
+                    )
75
+                ),
76
+              ),
77
+            ),
78
+          ]
79
+      ),
80
+
81
+    );
82
+  }
83
+
84
+  Widget _Fills(){
85
+    return Column(
86
+        children: <Widget> [
87
+          _LoginField("Email", email),
88
+          _LoginField("Password", password, pass: true),
89
+
90
+        ]
91
+    );
92
+  }
93
+
94
+
95
+
96
+  // Widget _LogInButton(BuildContext context){
97
+  //   return InkWell(
98
+  //     // onTap: () {
99
+  //     //   Navigator.push(context, MaterialPageRoute(builder: (context)) => __LoginPage())
100
+  //     // },
101
+  //     child: Container(
102
+  //       // width: MediaQuery.of(context).size.width,
103
+  //       width: 200,
104
+  //       // height: ,
105
+  //       padding: EdgeInsets.symmetric(vertical:8),
106
+  //       alignment: Alignment.center,
107
+  //       decoration: BoxDecoration(
108
+  //         color: Colors.red,
109
+  //         // shape:
110
+  //
111
+  //         borderRadius: BorderRadius.circular(30),
112
+  //       ),
113
+  //       child: Text(
114
+  //         "Login",
115
+  //         style: TextStyle(fontSize: 25, color: Colors.white),
116
+  //       ),
117
+  //
118
+  //     )
119
+  //   );
120
+  // }
121
+
122
+  Widget _RegisterButton(BuildContext context){
123
+    return InkWell(
124
+        onTap: () {
125
+          Navigator.push(
126
+              context, MaterialPageRoute(builder: (context) => RegisterPage()));
127
+        },
128
+        child: Container(
129
+          // width: MediaQuery.of(context).size.width,
130
+          width: 180,
131
+          padding: EdgeInsets.symmetric(vertical:8),
132
+          alignment: Alignment.center,
133
+          decoration: BoxDecoration(
134
+            color: Colors.red,
135
+            // shape:
136
+
137
+            borderRadius: BorderRadius.circular(30),
138
+          ),
139
+          child: Text(
140
+            "Register",
141
+            style: TextStyle(fontSize: 22, color: Colors.white),
142
+          ),
143
+
144
+        )
145
+    );
146
+  }
147
+
148
+  @override
149
+  Widget build(BuildContext context) {
150
+    final height = MediaQuery.of(context).size.height;
151
+    return Scaffold(
152
+        body: Container(
153
+          height: height,
154
+          child:Container(
155
+            width: MediaQuery.of(context).size.width,
156
+            padding: EdgeInsets.symmetric(horizontal: 20),
157
+            // height: MediaQuery.of(context).size.height,
158
+            decoration: BoxDecoration(
159
+                borderRadius: BorderRadius.all(Radius.circular(4)),
160
+                boxShadow: [
161
+                  BoxShadow(
162
+                      color: Colors.white,
163
+                      offset: Offset(0,3),
164
+                      blurRadius: 5,
165
+                      spreadRadius: 2)
166
+                ]
167
+
168
+            ),
169
+            child: SingleChildScrollView(
170
+                child: Column(
171
+                  crossAxisAlignment: CrossAxisAlignment.center,
172
+                  mainAxisAlignment: MainAxisAlignment.center,
173
+                  children: <Widget> [
174
+                    SizedBox(
175
+                      height: 80,
176
+                    ),
177
+                    _title(context),
178
+                    SizedBox(
179
+                      height: 150,
180
+                    ),
181
+                    // _LogInButton(context),
182
+                    _Fills(),
183
+                    SizedBox(
184
+                      height: 60,
185
+                    ),
186
+                    _message(context),
187
+                    SizedBox(
188
+                      height: 10,
189
+                    ),
190
+                    _RegisterButton(context),
191
+                    SizedBox(
192
+                      height: 10,
193
+                    )
194
+                  ],
195
+                )
196
+            ),
197
+          ),
198
+        )
199
+    );
200
+  }
201
+}