고원빈

[frontend] 회원가입 연동

......@@ -51,3 +51,7 @@ appbar 관련 디자인은 추후 구현 예정
+ API 연동 중에 추가로 개발 예정
+ build용 파일 구현
### 2021-05-17
+ server test 완료
### 2021-05-18
+ 회원 가입 SERVER 연동
......
SERVER_URL=포트 주소
\ No newline at end of file
......@@ -10,6 +10,7 @@
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<application
android:name="io.flutter.app.FlutterApplication"
......
import 'package:flutter/material.dart';
import './src/screens/Homepage.dart';
void main() {
import 'package:flutter_dotenv/flutter_dotenv.dart';
Future main() async {
await DotEnv().load('.env');
runApp(MyApp());
}
......
import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:http/http.dart' as http;
import 'package:flutter_dotenv/flutter_dotenv.dart';
class SignUpLocal extends StatefulWidget {
@override
......@@ -20,6 +22,17 @@ class _SignUpLocalState extends State<SignUpLocal> {
bool passwordVisible = false;
bool passwordValidationVisible = true;
Future<String> signup_Validate() async {
http.Response response = await http.post(
Uri.encodeFull(DotEnv().env['SERVER_URL'] + 'auth/register'),
headers: {"Content-Type": "application/json"},
body: jsonEncode({
'userId': emailController.text,
'password': passwordController.text,
'passwordCheck': passwordValidController.text
}));
}
@override
Widget build(BuildContext context) {
final Size size = MediaQuery.of(context).size;
......@@ -64,6 +77,7 @@ class _SignUpLocalState extends State<SignUpLocal> {
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
TextFormField(
controller: emailController,
keyboardType: TextInputType.text,
decoration: InputDecoration(
labelText: '이메일',
......@@ -161,7 +175,14 @@ class _SignUpLocalState extends State<SignUpLocal> {
height: 80,
padding: const EdgeInsets.fromLTRB(20, 20, 20, 20),
child: RaisedButton(
onPressed: () async {},
onPressed: () async {
String saveMessage = await signup_Validate();
print('saveMessage');
print(saveMessage);
print(emailController.text);
print(passwordController.text);
print(passwordValidController.text);
},
shape: RoundedRectangleBorder(
borderRadius: new BorderRadius.circular(18.0),
side: BorderSide(color: Colors.blue)),
......
......@@ -104,6 +104,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.5.0"
flutter_dotenv:
dependency: "direct main"
description:
name: flutter_dotenv
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.0"
flutter_local_notifications:
dependency: "direct main"
description:
......@@ -135,6 +142,20 @@ packages:
description: flutter
source: sdk
version: "0.0.0"
http:
dependency: "direct main"
description:
name: http
url: "https://pub.dartlang.org"
source: hosted
version: "0.12.2"
http_parser:
dependency: transitive
description:
name: http_parser
url: "https://pub.dartlang.org"
source: hosted
version: "3.1.4"
intl:
dependency: "direct main"
description:
......
......@@ -35,6 +35,8 @@ dependencies:
shared_preferences: ^0.5.6+1
flutter_blue: ^0.7.2
cupertino_icons: ^0.1.3
http: ^0.12.0+4
flutter_dotenv: ^2.1.0
dev_dependencies:
flutter_test:
......@@ -46,6 +48,7 @@ flutter:
uses-material-design: true
assets:
- .env
- images/
- images/main_logo.png
- images/setting.png
......