Skip to content

Commit

Permalink
Merge pull request #150 from Samdid/changeUsername
Browse files Browse the repository at this point in the history
Added the change username and password screen
  • Loading branch information
himanshusharma89 authored Mar 25, 2021
2 parents a242b29 + a7f57e7 commit 3c55640
Show file tree
Hide file tree
Showing 4 changed files with 262 additions and 2 deletions.
3 changes: 2 additions & 1 deletion lib/helpers/constants.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ class RouteConstant {
static const String ADDRESS_SCREEN = '/address-screen';
static const String SIGN_UP_SCREEN = '/sign-up-screen';
static const String MANAGE_ADDRESS_SCREEN = '/manage-address-screen';
static const String PAYMENT_SUCCESSFULL = '/payment-successfull';
static const String PAYMENT_SUCCESSFULL = '/payment-successful';
static const String CHANGE_USERNAME_SCREEN = '/change_username';
}

class RelicColors {
Expand Down
6 changes: 5 additions & 1 deletion lib/helpers/route_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import 'package:retro_shopping/helpers/slide_route.dart';
import 'package:retro_shopping/model/product_model.dart';
import 'package:retro_shopping/views/auth/signup_view.dart';
import 'package:retro_shopping/views/profile/orders.dart';

import 'package:retro_shopping/views/change_username_password.dart';
import 'package:retro_shopping/views/auth/login_view.dart';

import 'package:retro_shopping/views/cart_view.dart';
Expand Down Expand Up @@ -91,6 +91,10 @@ class RoutePage {
return SlideLeftRoute(
page: FaqsScreen(),
);
case RouteConstant.CHANGE_USERNAME_SCREEN:
return SlideLeftRoute(
page: ChangeUsername(),
);
case RouteConstant.ADDRESS_SCREEN:
return SlideLeftRoute(
page: AddressScreen(),
Expand Down
253 changes: 253 additions & 0 deletions lib/views/change_username_password.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,253 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:retro_shopping/helpers/constants.dart';
import 'package:retro_shopping/widgets/retro_button.dart';


class ChangeUsername extends StatefulWidget{
@override
State<StatefulWidget> createState() {
return ChangeUsernameState();
}
}

TextEditingController _userNameController = TextEditingController();
TextEditingController _passwordController = TextEditingController();
TextEditingController _confirmPasswordController = TextEditingController();


String _username = '';
String _password = '';
String _confirmPassword = '';

class ChangeUsernameState extends State<ChangeUsername>{
@override
Widget build(BuildContext context) {
final double height = MediaQuery.of(context).size.height;
final double width = MediaQuery.of(context).size.width;

return Scaffold(
appBar: AppBar(
backgroundColor: RelicColors.backgroundColor,
leading: Padding(
padding: const EdgeInsets.all(8.0),
child: GestureDetector(
onTap: () {
Navigator.pop(context);
},
child: RetroButton(
upperColor: Colors.white,
lowerColor: Colors.black,
width: 35,
height: 35,
borderColor: Colors.white,
child: const Icon(
Icons.arrow_back,
color: Colors.black,
),
),
),
),
elevation: 0.0,
),
body: Stack(
children: <Widget>[
Positioned(
top: 70,
right: 20,
child: Center(
child: Stack(
children:<Widget>[
Transform.translate(
offset: const Offset(5,5),
child: Container(
width: width * 0.88,
height: height * 0.615,
decoration: const BoxDecoration(color: Colors.black),
),
),
Container(
height: height * 0.61,
//height: 458,
width: width * 0.87,
decoration: const BoxDecoration(color: RelicColors.primaryColor),
child: Center(
child: SingleChildScrollView(
child: Column(
children: <Widget>[
Padding(
padding: const EdgeInsets.symmetric(horizontal: 20,vertical: 10.0),
child: Row(
children:const <Widget>[
Expanded(
child: Text('Change Username or Password',
style: TextStyle(
fontSize: 35,
color: Colors.white,
fontFamily: 'pix M 8pt',
fontWeight: FontWeight.bold
),),
),
],
),
),
SizedBox(
height: height*0.011,
),
Stack(
children:<Widget>[
Transform.translate(
offset: const Offset(25,10),
child: Container(
color: Colors.black,
width: width * 0.77,
height: height * 0.08,
),
),
Padding(
padding: const EdgeInsets.only(left:20.0, right: 20.0),
child: TextFormField(
controller: _userNameController,
onChanged: (String value){
_username = value;
},
decoration: const InputDecoration(
labelText: 'Username',
labelStyle: TextStyle(
fontSize: 20.0,
color: Colors.black
),
filled: true,
fillColor: Colors.white,
border: OutlineInputBorder(
borderRadius: BorderRadius.zero
)
)
),
),
]
),

SizedBox(
height: height*0.030,
),
Stack(
children:<Widget>[
Transform.translate(
offset: const Offset(25,10),
child: Container(
color: Colors.black,
width: width * 0.77,
height: height * 0.08,
),
),
Padding(
padding: const EdgeInsets.only(left:20.0, right: 20.0),
child: TextFormField(
controller: _passwordController,
onChanged: (String value){
_password = value;
},

decoration: const InputDecoration(
labelText: 'Password',
labelStyle: TextStyle(
fontSize: 20.0,
color: Colors.black
),
filled: true,
fillColor: Colors.white,
border: OutlineInputBorder(
borderRadius: BorderRadius.zero
)
)
),
),
]
),
SizedBox(
height: height*0.030,
),
Stack(
children:<Widget>[
Transform.translate(
offset: const Offset(25,10),
child: Container(
color: Colors.black,
width: width * 0.77,
height: height * 0.08,
),
),
Padding(
padding: const EdgeInsets.only(left:20.0, right: 20.0),
child: TextFormField(
controller: _confirmPasswordController,
onChanged: (String value){
_confirmPassword = value;
},
decoration: const InputDecoration(
labelText: 'Confirm Password',
labelStyle: TextStyle(
fontSize: 20.0,
color: Colors.black
),
filled: true,
fillColor: Colors.white,
border: OutlineInputBorder(
borderRadius: BorderRadius.zero
)
)
),
),
]
),
SizedBox(
height: height*0.030,
),
Row(
children: <Widget>[
Padding(
padding: const EdgeInsets.only(left:20.0, right: 20.0),
child: InkWell(
onTap: (){
debugPrint('Save!!');
},
child: RetroButton(
upperColor: Colors.black,
lowerColor: Colors.white,
height: height * 0.065,
width: width * 0.40,
borderColor: Colors.white,
child: const Center(
child: Text(
'Save',
style: TextStyle(
fontSize: 20,
fontWeight: FontWeight.bold,
color: Colors.white,
),
),
),
),
),
),
],
),
SizedBox(
height: height*0.040,
),

],
),
),
)
),
],
),
),
),
],
),
);
}
}
2 changes: 2 additions & 0 deletions lib/views/profile/settings/settings_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ class _SettingsState extends State<Settings> {
context,
'Change Username/\nPassword',
Icons.person,
routeName: RouteConstant.CHANGE_USERNAME_SCREEN,
push: true,
),
Padding(
padding: const EdgeInsets.only(left: 16.0, right: 16.0),
Expand Down

0 comments on commit 3c55640

Please sign in to comment.