-
Notifications
You must be signed in to change notification settings - Fork 55
/
Copy pathProfileScreen.dart
94 lines (86 loc) · 2.33 KB
/
ProfileScreen.dart
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
import 'package:blogapp/NetworkHandler.dart';
import 'package:blogapp/Profile/CreatProfile.dart';
import 'package:flutter/material.dart';
import 'MainProfile.dart';
class ProfileScreen extends StatefulWidget {
ProfileScreen({Key key}) : super(key: key);
@override
_ProfileScreenState createState() => _ProfileScreenState();
}
class _ProfileScreenState extends State<ProfileScreen> {
NetworkHandler networkHandler = NetworkHandler();
Widget page = CircularProgressIndicator();
@override
void initState() {
// TODO: implement initState
super.initState();
checkProfile();
}
void checkProfile() async {
var response = await networkHandler.get("/profile/checkProfile");
if (response["status"] == true) {
setState(() {
page = MainProfile();
});
} else {
setState(() {
page = button();
});
}
}
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Color(0xffEEEEFF),
body: page,
);
}
Widget showProfile() {
return Center(child: Text("Profile Data is Avalable"));
}
Widget button() {
return Padding(
padding: const EdgeInsets.symmetric(horizontal: 70),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Text(
"Tap to button to add profile data",
textAlign: TextAlign.center,
style: TextStyle(
color: Colors.deepOrange,
fontSize: 18,
),
),
SizedBox(
height: 30,
),
InkWell(
onTap: () => {
Navigator.push(context,
MaterialPageRoute(builder: (context) => CreatProfile()))
},
child: Container(
height: 60,
width: 150,
decoration: BoxDecoration(
color: Colors.blueGrey,
borderRadius: BorderRadius.circular(20),
),
child: Center(
child: Text(
"Add Proile",
style: TextStyle(
color: Colors.white,
fontSize: 18,
),
),
),
),
),
],
),
);
}
}