Skip to content

Commit e9adc23

Browse files
committed
main profile page added
1 parent f3eb0a5 commit e9adc23

File tree

3 files changed

+105
-1
lines changed

3 files changed

+105
-1
lines changed

lib/NetworkHandler.dart

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import 'dart:convert';
22

3+
import 'package:flutter/cupertino.dart';
34
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
45
import 'package:http/http.dart' as http;
56
import 'package:logger/logger.dart';
@@ -56,4 +57,9 @@ class NetworkHandler {
5657
String formater(String url) {
5758
return baseurl + url;
5859
}
60+
61+
NetworkImage getImage(String username) {
62+
String url = formater("/uploads//$username.jpg");
63+
return NetworkImage(url);
64+
}
5965
}

lib/Profile/MainProfile.dart

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
import 'package:blogapp/NetworkHandler.dart';
2+
import 'package:flutter/material.dart';
3+
4+
class MainProfile extends StatefulWidget {
5+
MainProfile({Key key}) : super(key: key);
6+
7+
@override
8+
_MainProfileState createState() => _MainProfileState();
9+
}
10+
11+
class _MainProfileState extends State<MainProfile> {
12+
@override
13+
Widget build(BuildContext context) {
14+
return Scaffold(
15+
appBar: AppBar(
16+
elevation: 0,
17+
backgroundColor: Colors.white10,
18+
leading: IconButton(
19+
icon: Icon(Icons.arrow_back),
20+
onPressed: () {},
21+
color: Colors.black,
22+
),
23+
actions: <Widget>[
24+
IconButton(
25+
icon: Icon(Icons.edit),
26+
onPressed: () {},
27+
color: Colors.black,
28+
),
29+
],
30+
),
31+
body: ListView(
32+
children: <Widget>[
33+
head(),
34+
Divider(
35+
thickness: 0.8,
36+
),
37+
otherDetails("About",
38+
" I am a balram rathore a fullstack developer also a web and app developer"),
39+
otherDetails("Name", "Balram Rathore"),
40+
Divider(
41+
thickness: 0.8,
42+
),
43+
],
44+
),
45+
);
46+
}
47+
48+
Widget head() {
49+
return Padding(
50+
padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 5),
51+
child: Column(
52+
crossAxisAlignment: CrossAxisAlignment.start,
53+
children: <Widget>[
54+
Center(
55+
child: CircleAvatar(
56+
radius: 50,
57+
backgroundImage: NetworkHandler().getImage("devStack06"),
58+
),
59+
),
60+
Text(
61+
"DevStack06",
62+
style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold),
63+
),
64+
SizedBox(
65+
height: 10,
66+
),
67+
Text("App Developer || Full Stack Developer, App and Web Developer")
68+
],
69+
),
70+
);
71+
}
72+
73+
Widget otherDetails(String label, String value) {
74+
return Padding(
75+
padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 5),
76+
child: Column(
77+
crossAxisAlignment: CrossAxisAlignment.start,
78+
children: <Widget>[
79+
Text(
80+
"$label :",
81+
style: TextStyle(
82+
fontSize: 17,
83+
fontWeight: FontWeight.bold,
84+
),
85+
),
86+
SizedBox(
87+
height: 5,
88+
),
89+
Text(
90+
value,
91+
style: TextStyle(fontSize: 15),
92+
)
93+
],
94+
),
95+
);
96+
}
97+
}

lib/main.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import 'package:blogapp/Pages/HomePage.dart';
2+
import 'package:blogapp/Profile/MainProfile.dart';
23
import 'package:flutter/material.dart';
34
import 'package:google_fonts/google_fonts.dart';
45
import 'Pages/LoadingPage.dart';
@@ -45,7 +46,7 @@ class _MyAppState extends State<MyApp> {
4546
Theme.of(context).textTheme,
4647
),
4748
),
48-
home: page,
49+
home: MainProfile(),
4950
);
5051
}
5152
}

0 commit comments

Comments
 (0)