Showing
7 changed files
with
56 additions
and
2 deletions
frontend/flutter_application_1/.env
0 → 100644
1 | +SERVER_URL=포트 주소 | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
... | @@ -10,6 +10,7 @@ | ... | @@ -10,6 +10,7 @@ |
10 | <uses-permission android:name="android.permission.VIBRATE" /> | 10 | <uses-permission android:name="android.permission.VIBRATE" /> |
11 | <uses-permission android:name="android.permission.BLUETOOTH" /> | 11 | <uses-permission android:name="android.permission.BLUETOOTH" /> |
12 | <uses-permission android:name="android.permission.BLUETOOTH_ADMIN" /> | 12 | <uses-permission android:name="android.permission.BLUETOOTH_ADMIN" /> |
13 | + <uses-permission android:name="android.permission.INTERNET"/> | ||
13 | <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/> | 14 | <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/> |
14 | <application | 15 | <application |
15 | android:name="io.flutter.app.FlutterApplication" | 16 | android:name="io.flutter.app.FlutterApplication" | ... | ... |
1 | import 'package:flutter/material.dart'; | 1 | import 'package:flutter/material.dart'; |
2 | import './src/screens/Homepage.dart'; | 2 | import './src/screens/Homepage.dart'; |
3 | 3 | ||
4 | -void main() { | 4 | +import 'package:flutter_dotenv/flutter_dotenv.dart'; |
5 | + | ||
6 | +Future main() async { | ||
7 | + await DotEnv().load('.env'); | ||
5 | runApp(MyApp()); | 8 | runApp(MyApp()); |
6 | } | 9 | } |
7 | 10 | ... | ... |
1 | import 'dart:convert'; | 1 | import 'dart:convert'; |
2 | import 'package:flutter/material.dart'; | 2 | import 'package:flutter/material.dart'; |
3 | +import 'package:http/http.dart' as http; | ||
4 | +import 'package:flutter_dotenv/flutter_dotenv.dart'; | ||
3 | 5 | ||
4 | class SignUpLocal extends StatefulWidget { | 6 | class SignUpLocal extends StatefulWidget { |
5 | @override | 7 | @override |
... | @@ -20,6 +22,17 @@ class _SignUpLocalState extends State<SignUpLocal> { | ... | @@ -20,6 +22,17 @@ class _SignUpLocalState extends State<SignUpLocal> { |
20 | bool passwordVisible = false; | 22 | bool passwordVisible = false; |
21 | bool passwordValidationVisible = true; | 23 | bool passwordValidationVisible = true; |
22 | 24 | ||
25 | + Future<String> signup_Validate() async { | ||
26 | + http.Response response = await http.post( | ||
27 | + Uri.encodeFull(DotEnv().env['SERVER_URL'] + 'auth/register'), | ||
28 | + headers: {"Content-Type": "application/json"}, | ||
29 | + body: jsonEncode({ | ||
30 | + 'userId': emailController.text, | ||
31 | + 'password': passwordController.text, | ||
32 | + 'passwordCheck': passwordValidController.text | ||
33 | + })); | ||
34 | + } | ||
35 | + | ||
23 | @override | 36 | @override |
24 | Widget build(BuildContext context) { | 37 | Widget build(BuildContext context) { |
25 | final Size size = MediaQuery.of(context).size; | 38 | final Size size = MediaQuery.of(context).size; |
... | @@ -64,6 +77,7 @@ class _SignUpLocalState extends State<SignUpLocal> { | ... | @@ -64,6 +77,7 @@ class _SignUpLocalState extends State<SignUpLocal> { |
64 | mainAxisAlignment: MainAxisAlignment.center, | 77 | mainAxisAlignment: MainAxisAlignment.center, |
65 | children: <Widget>[ | 78 | children: <Widget>[ |
66 | TextFormField( | 79 | TextFormField( |
80 | + controller: emailController, | ||
67 | keyboardType: TextInputType.text, | 81 | keyboardType: TextInputType.text, |
68 | decoration: InputDecoration( | 82 | decoration: InputDecoration( |
69 | labelText: '이메일', | 83 | labelText: '이메일', |
... | @@ -161,7 +175,14 @@ class _SignUpLocalState extends State<SignUpLocal> { | ... | @@ -161,7 +175,14 @@ class _SignUpLocalState extends State<SignUpLocal> { |
161 | height: 80, | 175 | height: 80, |
162 | padding: const EdgeInsets.fromLTRB(20, 20, 20, 20), | 176 | padding: const EdgeInsets.fromLTRB(20, 20, 20, 20), |
163 | child: RaisedButton( | 177 | child: RaisedButton( |
164 | - onPressed: () async {}, | 178 | + onPressed: () async { |
179 | + String saveMessage = await signup_Validate(); | ||
180 | + print('saveMessage'); | ||
181 | + print(saveMessage); | ||
182 | + print(emailController.text); | ||
183 | + print(passwordController.text); | ||
184 | + print(passwordValidController.text); | ||
185 | + }, | ||
165 | shape: RoundedRectangleBorder( | 186 | shape: RoundedRectangleBorder( |
166 | borderRadius: new BorderRadius.circular(18.0), | 187 | borderRadius: new BorderRadius.circular(18.0), |
167 | side: BorderSide(color: Colors.blue)), | 188 | side: BorderSide(color: Colors.blue)), | ... | ... |
... | @@ -104,6 +104,13 @@ packages: | ... | @@ -104,6 +104,13 @@ packages: |
104 | url: "https://pub.dartlang.org" | 104 | url: "https://pub.dartlang.org" |
105 | source: hosted | 105 | source: hosted |
106 | version: "1.5.0" | 106 | version: "1.5.0" |
107 | + flutter_dotenv: | ||
108 | + dependency: "direct main" | ||
109 | + description: | ||
110 | + name: flutter_dotenv | ||
111 | + url: "https://pub.dartlang.org" | ||
112 | + source: hosted | ||
113 | + version: "2.1.0" | ||
107 | flutter_local_notifications: | 114 | flutter_local_notifications: |
108 | dependency: "direct main" | 115 | dependency: "direct main" |
109 | description: | 116 | description: |
... | @@ -135,6 +142,20 @@ packages: | ... | @@ -135,6 +142,20 @@ packages: |
135 | description: flutter | 142 | description: flutter |
136 | source: sdk | 143 | source: sdk |
137 | version: "0.0.0" | 144 | version: "0.0.0" |
145 | + http: | ||
146 | + dependency: "direct main" | ||
147 | + description: | ||
148 | + name: http | ||
149 | + url: "https://pub.dartlang.org" | ||
150 | + source: hosted | ||
151 | + version: "0.12.2" | ||
152 | + http_parser: | ||
153 | + dependency: transitive | ||
154 | + description: | ||
155 | + name: http_parser | ||
156 | + url: "https://pub.dartlang.org" | ||
157 | + source: hosted | ||
158 | + version: "3.1.4" | ||
138 | intl: | 159 | intl: |
139 | dependency: "direct main" | 160 | dependency: "direct main" |
140 | description: | 161 | description: | ... | ... |
... | @@ -35,6 +35,8 @@ dependencies: | ... | @@ -35,6 +35,8 @@ dependencies: |
35 | shared_preferences: ^0.5.6+1 | 35 | shared_preferences: ^0.5.6+1 |
36 | flutter_blue: ^0.7.2 | 36 | flutter_blue: ^0.7.2 |
37 | cupertino_icons: ^0.1.3 | 37 | cupertino_icons: ^0.1.3 |
38 | + http: ^0.12.0+4 | ||
39 | + flutter_dotenv: ^2.1.0 | ||
38 | 40 | ||
39 | dev_dependencies: | 41 | dev_dependencies: |
40 | flutter_test: | 42 | flutter_test: |
... | @@ -46,6 +48,7 @@ flutter: | ... | @@ -46,6 +48,7 @@ flutter: |
46 | uses-material-design: true | 48 | uses-material-design: true |
47 | 49 | ||
48 | assets: | 50 | assets: |
51 | + - .env | ||
49 | - images/ | 52 | - images/ |
50 | - images/main_logo.png | 53 | - images/main_logo.png |
51 | - images/setting.png | 54 | - images/setting.png | ... | ... |
-
Please register or login to post a comment