1
1
import 'package:flutter/cupertino.dart' ;
2
2
import 'package:flutter/material.dart' ;
3
3
import 'package:restaurant/Widget/NavigatePage.dart' ;
4
+ import 'package:restaurant/inmat/auth/inmat_auth.dart' ;
5
+ import 'package:restaurant/inmat/auth/user_model.dart' ;
6
+ import 'package:restaurant/inmat/inMatAPI/inMatHttp.dart' ;
4
7
5
- import 'Widget/SignIn.dart' ;
6
- import 'Widget/SignIn2.dart' ;
7
- import 'Widget/SignUp.dart' ;
8
- import 'Widget/PasswordFind.dart' ;
8
+ import 'Widget/Account/ChooseSignIn.dart' ;
9
+ import 'Widget/account2/SignIn.dart' ;
10
+ import 'Widget/account2/SignIn2.dart' ;
11
+ import 'Widget/account2/SignUp.dart' ;
12
+ import 'Widget/account2/PasswordFind.dart' ;
9
13
10
14
class AuthCheck extends StatefulWidget {
11
15
const AuthCheck ({Key ? key}) : super (key: key);
@@ -17,6 +21,7 @@ class AuthCheck extends StatefulWidget {
17
21
class _AuthCheckState extends State <AuthCheck > {
18
22
@override
19
23
Widget build (BuildContext context) {
24
+ User ? user = InMatAuth .instance.currentUser;
20
25
return Scaffold (
21
26
appBar: AppBar (
22
27
title: Text ("회원 체크" ),
@@ -25,18 +30,20 @@ class _AuthCheckState extends State<AuthCheck> {
25
30
child: Column (
26
31
mainAxisAlignment: MainAxisAlignment .center,
27
32
children: [
33
+
34
+ Text ("user information: ${user ?? "null" }" ),
28
35
Padding (
29
36
padding: const EdgeInsets .all (8.0 ),
30
37
child: CupertinoButton (
31
38
color: Colors .grey,
32
39
child: Text ("메인 페이지 이동" ),
33
40
onPressed: () {
34
- Navigator .pushAndRemoveUntil (
35
- context,
36
- CupertinoPageRoute (
37
- builder: (context) => const NavigatePage (),
38
- ),
39
- (route) => false );
41
+ Navigator .push (
42
+ context,
43
+ CupertinoPageRoute (
44
+ builder: (context) => const NavigatePage (),
45
+ ),
46
+ );
40
47
}),
41
48
),
42
49
Padding (
@@ -46,10 +53,67 @@ class _AuthCheckState extends State<AuthCheck> {
46
53
child: Text ("로그인 페이지 이동" ),
47
54
onPressed: () {
48
55
Navigator .push (
49
- context,
50
- CupertinoPageRoute (
51
- builder: (context) => const SignIn (),
52
- ),
56
+ context,
57
+ CupertinoPageRoute (
58
+ builder: (context) => const ChooseSignIn (),
59
+ ),
60
+ );
61
+ }),
62
+ ),
63
+ Padding (
64
+ padding: const EdgeInsets .all (8.0 ),
65
+ child: CupertinoButton (
66
+ color: Colors .redAccent,
67
+ child: Text ("로그아웃" ),
68
+ onPressed: () {
69
+ InMatAuth .instance.signOut ();
70
+ }),
71
+ ),
72
+ Padding (
73
+ padding: const EdgeInsets .all (8.0 ),
74
+ child: CupertinoButton (
75
+ color: Colors .lightGreen,
76
+ child: Text ("회원 정보 수정" ),
77
+ onPressed: () async {
78
+ try {
79
+ await InMatAuth .instance.updateProfile ({
80
+ "age" : 20 ,
81
+ "gender" : "F" ,
82
+ });
83
+ } on ExpirationAccessToken {
84
+ // 액세스 토큰 만료: 로그아웃 후 다시 로그인
85
+ } on AccessDenied {
86
+ // 접근 권한 없음
87
+ } on OverlappingNickName {
88
+ // 닉네임 중복 알림
89
+ } catch (e) {
90
+ print (e);
91
+ // 오류 메세지 알림
92
+ }
93
+ }),
94
+ ),
95
+ Padding (
96
+ padding: const EdgeInsets .all (8.0 ),
97
+ child: CupertinoButton (
98
+ color: Colors .blue,
99
+ child: Text ("새로고침" ),
100
+ onPressed: () {
101
+ setState (() {
102
+
103
+ });
104
+ }),
105
+ ),
106
+ Padding (
107
+ padding: const EdgeInsets .all (8.0 ),
108
+ child: CupertinoButton (
109
+ color: Colors .grey,
110
+ child: Text ("로그인 페이지 1 이동" ),
111
+ onPressed: () {
112
+ Navigator .push (
113
+ context,
114
+ CupertinoPageRoute (
115
+ builder: (context) => const SignIn (),
116
+ ),
53
117
);
54
118
}),
55
119
),
@@ -60,10 +124,10 @@ class _AuthCheckState extends State<AuthCheck> {
60
124
child: Text ("로그인 페이지 2 이동" ),
61
125
onPressed: () {
62
126
Navigator .push (
63
- context,
64
- CupertinoPageRoute (
65
- builder: (context) => const SignIn2 (),
66
- ),
127
+ context,
128
+ CupertinoPageRoute (
129
+ builder: (context) => const SignIn2 (),
130
+ ),
67
131
);
68
132
}),
69
133
),
@@ -74,11 +138,11 @@ class _AuthCheckState extends State<AuthCheck> {
74
138
child: Text ("회원가입 페이지 이동" ),
75
139
onPressed: () {
76
140
Navigator .push (
77
- context,
78
- CupertinoPageRoute (
79
- builder: (context) => const SignUp (),
80
- ),
81
- );
141
+ context,
142
+ CupertinoPageRoute (
143
+ builder: (context) => const SignUp (),
144
+ ),
145
+ );
82
146
}),
83
147
),
84
148
Padding (
@@ -88,16 +152,17 @@ class _AuthCheckState extends State<AuthCheck> {
88
152
child: Text ("비밀번호 찾기 페이지 이동" ),
89
153
onPressed: () {
90
154
Navigator .push (
91
- context,
92
- CupertinoPageRoute (
93
- builder: (context) => const PasswordFind (),
94
- ),
95
- );
155
+ context,
156
+ CupertinoPageRoute (
157
+ builder: (context) => const PasswordFind (),
158
+ ),
159
+ );
96
160
}),
97
- )
161
+ ),
98
162
],
99
163
),
100
164
),
101
165
);
102
166
}
103
167
}
168
+
0 commit comments