Skip to content

Commit 3c55640

Browse files
Merge pull request himanshusharma89#150 from Samdid/changeUsername
Added the change username and password screen
2 parents a242b29 + a7f57e7 commit 3c55640

File tree

4 files changed

+262
-2
lines changed

4 files changed

+262
-2
lines changed

lib/helpers/constants.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ class RouteConstant {
2020
static const String ADDRESS_SCREEN = '/address-screen';
2121
static const String SIGN_UP_SCREEN = '/sign-up-screen';
2222
static const String MANAGE_ADDRESS_SCREEN = '/manage-address-screen';
23-
static const String PAYMENT_SUCCESSFULL = '/payment-successfull';
23+
static const String PAYMENT_SUCCESSFULL = '/payment-successful';
24+
static const String CHANGE_USERNAME_SCREEN = '/change_username';
2425
}
2526

2627
class RelicColors {

lib/helpers/route_page.dart

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import 'package:retro_shopping/helpers/slide_route.dart';
55
import 'package:retro_shopping/model/product_model.dart';
66
import 'package:retro_shopping/views/auth/signup_view.dart';
77
import 'package:retro_shopping/views/profile/orders.dart';
8-
8+
import 'package:retro_shopping/views/change_username_password.dart';
99
import 'package:retro_shopping/views/auth/login_view.dart';
1010

1111
import 'package:retro_shopping/views/cart_view.dart';
@@ -91,6 +91,10 @@ class RoutePage {
9191
return SlideLeftRoute(
9292
page: FaqsScreen(),
9393
);
94+
case RouteConstant.CHANGE_USERNAME_SCREEN:
95+
return SlideLeftRoute(
96+
page: ChangeUsername(),
97+
);
9498
case RouteConstant.ADDRESS_SCREEN:
9599
return SlideLeftRoute(
96100
page: AddressScreen(),
Lines changed: 253 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,253 @@
1+
import 'package:flutter/cupertino.dart';
2+
import 'package:flutter/material.dart';
3+
import 'package:retro_shopping/helpers/constants.dart';
4+
import 'package:retro_shopping/widgets/retro_button.dart';
5+
6+
7+
class ChangeUsername extends StatefulWidget{
8+
@override
9+
State<StatefulWidget> createState() {
10+
return ChangeUsernameState();
11+
}
12+
}
13+
14+
TextEditingController _userNameController = TextEditingController();
15+
TextEditingController _passwordController = TextEditingController();
16+
TextEditingController _confirmPasswordController = TextEditingController();
17+
18+
19+
String _username = '';
20+
String _password = '';
21+
String _confirmPassword = '';
22+
23+
class ChangeUsernameState extends State<ChangeUsername>{
24+
@override
25+
Widget build(BuildContext context) {
26+
final double height = MediaQuery.of(context).size.height;
27+
final double width = MediaQuery.of(context).size.width;
28+
29+
return Scaffold(
30+
appBar: AppBar(
31+
backgroundColor: RelicColors.backgroundColor,
32+
leading: Padding(
33+
padding: const EdgeInsets.all(8.0),
34+
child: GestureDetector(
35+
onTap: () {
36+
Navigator.pop(context);
37+
},
38+
child: RetroButton(
39+
upperColor: Colors.white,
40+
lowerColor: Colors.black,
41+
width: 35,
42+
height: 35,
43+
borderColor: Colors.white,
44+
child: const Icon(
45+
Icons.arrow_back,
46+
color: Colors.black,
47+
),
48+
),
49+
),
50+
),
51+
elevation: 0.0,
52+
),
53+
body: Stack(
54+
children: <Widget>[
55+
Positioned(
56+
top: 70,
57+
right: 20,
58+
child: Center(
59+
child: Stack(
60+
children:<Widget>[
61+
Transform.translate(
62+
offset: const Offset(5,5),
63+
child: Container(
64+
width: width * 0.88,
65+
height: height * 0.615,
66+
decoration: const BoxDecoration(color: Colors.black),
67+
),
68+
),
69+
Container(
70+
height: height * 0.61,
71+
//height: 458,
72+
width: width * 0.87,
73+
decoration: const BoxDecoration(color: RelicColors.primaryColor),
74+
child: Center(
75+
child: SingleChildScrollView(
76+
child: Column(
77+
children: <Widget>[
78+
Padding(
79+
padding: const EdgeInsets.symmetric(horizontal: 20,vertical: 10.0),
80+
child: Row(
81+
children:const <Widget>[
82+
Expanded(
83+
child: Text('Change Username or Password',
84+
style: TextStyle(
85+
fontSize: 35,
86+
color: Colors.white,
87+
fontFamily: 'pix M 8pt',
88+
fontWeight: FontWeight.bold
89+
),),
90+
),
91+
],
92+
),
93+
),
94+
SizedBox(
95+
height: height*0.011,
96+
),
97+
Stack(
98+
children:<Widget>[
99+
Transform.translate(
100+
offset: const Offset(25,10),
101+
child: Container(
102+
color: Colors.black,
103+
width: width * 0.77,
104+
height: height * 0.08,
105+
),
106+
),
107+
Padding(
108+
padding: const EdgeInsets.only(left:20.0, right: 20.0),
109+
child: TextFormField(
110+
controller: _userNameController,
111+
onChanged: (String value){
112+
_username = value;
113+
},
114+
decoration: const InputDecoration(
115+
labelText: 'Username',
116+
labelStyle: TextStyle(
117+
fontSize: 20.0,
118+
color: Colors.black
119+
),
120+
filled: true,
121+
fillColor: Colors.white,
122+
border: OutlineInputBorder(
123+
borderRadius: BorderRadius.zero
124+
)
125+
)
126+
),
127+
),
128+
]
129+
),
130+
131+
SizedBox(
132+
height: height*0.030,
133+
),
134+
Stack(
135+
children:<Widget>[
136+
Transform.translate(
137+
offset: const Offset(25,10),
138+
child: Container(
139+
color: Colors.black,
140+
width: width * 0.77,
141+
height: height * 0.08,
142+
),
143+
),
144+
Padding(
145+
padding: const EdgeInsets.only(left:20.0, right: 20.0),
146+
child: TextFormField(
147+
controller: _passwordController,
148+
onChanged: (String value){
149+
_password = value;
150+
},
151+
152+
decoration: const InputDecoration(
153+
labelText: 'Password',
154+
labelStyle: TextStyle(
155+
fontSize: 20.0,
156+
color: Colors.black
157+
),
158+
filled: true,
159+
fillColor: Colors.white,
160+
border: OutlineInputBorder(
161+
borderRadius: BorderRadius.zero
162+
)
163+
)
164+
),
165+
),
166+
]
167+
),
168+
SizedBox(
169+
height: height*0.030,
170+
),
171+
Stack(
172+
children:<Widget>[
173+
Transform.translate(
174+
offset: const Offset(25,10),
175+
child: Container(
176+
color: Colors.black,
177+
width: width * 0.77,
178+
height: height * 0.08,
179+
),
180+
),
181+
Padding(
182+
padding: const EdgeInsets.only(left:20.0, right: 20.0),
183+
child: TextFormField(
184+
controller: _confirmPasswordController,
185+
onChanged: (String value){
186+
_confirmPassword = value;
187+
},
188+
decoration: const InputDecoration(
189+
labelText: 'Confirm Password',
190+
labelStyle: TextStyle(
191+
fontSize: 20.0,
192+
color: Colors.black
193+
),
194+
filled: true,
195+
fillColor: Colors.white,
196+
border: OutlineInputBorder(
197+
borderRadius: BorderRadius.zero
198+
)
199+
)
200+
),
201+
),
202+
]
203+
),
204+
SizedBox(
205+
height: height*0.030,
206+
),
207+
Row(
208+
children: <Widget>[
209+
Padding(
210+
padding: const EdgeInsets.only(left:20.0, right: 20.0),
211+
child: InkWell(
212+
onTap: (){
213+
debugPrint('Save!!');
214+
},
215+
child: RetroButton(
216+
upperColor: Colors.black,
217+
lowerColor: Colors.white,
218+
height: height * 0.065,
219+
width: width * 0.40,
220+
borderColor: Colors.white,
221+
child: const Center(
222+
child: Text(
223+
'Save',
224+
style: TextStyle(
225+
fontSize: 20,
226+
fontWeight: FontWeight.bold,
227+
color: Colors.white,
228+
),
229+
),
230+
),
231+
),
232+
),
233+
),
234+
],
235+
),
236+
SizedBox(
237+
height: height*0.040,
238+
),
239+
240+
],
241+
),
242+
),
243+
)
244+
),
245+
],
246+
),
247+
),
248+
),
249+
],
250+
),
251+
);
252+
}
253+
}

lib/views/profile/settings/settings_view.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,8 @@ class _SettingsState extends State<Settings> {
8080
context,
8181
'Change Username/\nPassword',
8282
Icons.person,
83+
routeName: RouteConstant.CHANGE_USERNAME_SCREEN,
84+
push: true,
8385
),
8486
Padding(
8587
padding: const EdgeInsets.only(left: 16.0, right: 16.0),

0 commit comments

Comments
 (0)