Created
October 8, 2019 19:14
-
-
Save rpsnaik/01fe4cb2366a431d07f18e49b1dff72e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class CreateAccount extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
final sessionObj = Provider.of<CreateUserAccount>(context); | |
final uiComponents = Provider.of<ShowCustomAlertDialog>(context); | |
return Scaffold( | |
backgroundColor: Colors.black, | |
appBar: AppBar( | |
centerTitle: true, | |
elevation: 0.0, | |
backgroundColor: Colors.black, | |
title: Text("Create account", style: TextStyle( | |
fontWeight: FontWeight.bold, | |
),), | |
), | |
body: PageView( | |
controller: sessionObj.pctrl, | |
physics: ScrollPhysics(parent: NeverScrollableScrollPhysics()), | |
children: <Widget>[ | |
Container( | |
padding: EdgeInsets.all(10.0), | |
alignment: Alignment.topLeft, | |
child: Column( | |
mainAxisAlignment: MainAxisAlignment.start, | |
crossAxisAlignment: CrossAxisAlignment.start, | |
children: <Widget>[ | |
Text("What's your email?",style: TextStyle( | |
fontSize: 30.0, | |
fontFamily: 'Proxima Nova Bold', | |
),), | |
SizedBox( | |
height: 10.0, | |
), | |
TextFormField( | |
autofocus: false, | |
decoration: InputDecoration( | |
contentPadding: EdgeInsets.all(16.0), | |
fillColor: Colors.grey, | |
filled: true, | |
border: OutlineInputBorder() | |
), | |
onChanged: (String text){ | |
sessionObj.emailNextButtonListener(text); | |
sessionObj.email = text; | |
}, | |
), | |
SizedBox( | |
height: 20.0, | |
), | |
Center( | |
child: RaisedButton( | |
padding: EdgeInsets.fromLTRB(45.0, 15.0, 45.0, 15.0), | |
onPressed: (){ | |
FocusScope.of(context).unfocus(); | |
sessionObj.emailNextEnabled ? sessionObj.pctrl.nextPage(duration: Duration(milliseconds: 500), curve: Curves.easeIn) : uiComponents.showCustomDialog(context, "Please Enter your Email"); | |
}, | |
color: sessionObj.emailNextEnabled ? Colors.white : Colors.grey, | |
shape: RoundedRectangleBorder( | |
borderRadius: BorderRadius.circular(100.0), | |
), | |
child: Text("NEXT", style: TextStyle( | |
color: Colors.black, | |
fontSize: 18.0, | |
fontFamily: 'Proxima Nova Bold' | |
),), | |
), | |
) | |
], | |
), | |
), | |
Container( | |
padding: EdgeInsets.all(10.0), | |
alignment: Alignment.topLeft, | |
child: Column( | |
mainAxisAlignment: MainAxisAlignment.start, | |
crossAxisAlignment: CrossAxisAlignment.start, | |
children: <Widget>[ | |
Text("Create a Password",style: TextStyle( | |
fontSize: 30.0, | |
fontFamily: 'Proxima Nova Bold', | |
),), | |
SizedBox( | |
height: 10.0, | |
), | |
TextFormField( | |
obscureText: !sessionObj.showPassword, | |
autofocus: false, | |
decoration: InputDecoration( | |
contentPadding: EdgeInsets.all(16.0), | |
fillColor: Colors.grey, | |
filled: true, | |
border: OutlineInputBorder(), | |
suffixIcon: IconButton( | |
onPressed: (){ | |
sessionObj.showPassFun(); | |
}, | |
icon: sessionObj.showPassword ? Icon(Icons.visibility, color: Colors.white,) : Icon(Icons.visibility_off , color: Colors.white,), | |
) | |
), | |
onChanged: (String text){ | |
sessionObj.passNextButtonListener(text); | |
sessionObj.password = text; | |
}, | |
), | |
SizedBox( | |
height: 20.0, | |
), | |
Center( | |
child: RaisedButton( | |
padding: EdgeInsets.fromLTRB(45.0, 15.0, 45.0, 15.0), | |
onPressed: (){ | |
FocusScope.of(context).unfocus(); | |
sessionObj.passNextEnabled ? sessionObj.pctrl.nextPage(duration: Duration(milliseconds: 500), curve: Curves.easeIn) : uiComponents.showCustomDialog(context, "Password must of atleast 8 Charecters") ; | |
}, | |
color: sessionObj.passNextEnabled ? Colors.white : Colors.grey, | |
shape: RoundedRectangleBorder( | |
borderRadius: BorderRadius.circular(100.0), | |
), | |
child: Text("NEXT", style: TextStyle( | |
color: Colors.black, | |
fontSize: 18.0, | |
fontFamily: 'Proxima Nova Bold' | |
),), | |
), | |
) | |
], | |
), | |
), | |
Container( | |
padding: EdgeInsets.all(10.0), | |
alignment: Alignment.topLeft, | |
child: Column( | |
mainAxisAlignment: MainAxisAlignment.start, | |
crossAxisAlignment: CrossAxisAlignment.start, | |
children: <Widget>[ | |
Text("What's your name?",style: TextStyle( | |
fontSize: 30.0, | |
fontFamily: 'Proxima Nova Bold', | |
),), | |
SizedBox( | |
height: 10.0, | |
), | |
TextFormField( | |
autofocus: false, | |
decoration: InputDecoration( | |
contentPadding: EdgeInsets.all(16.0), | |
fillColor: Colors.grey, | |
filled: true, | |
border: OutlineInputBorder(), | |
), | |
onChanged: (String text){ | |
sessionObj.nameNextButtonListener(text); | |
sessionObj.name = text; | |
}, | |
), | |
Padding( | |
padding: EdgeInsets.fromLTRB(0.0, 10.0, 5.0, 5.0), | |
child: Text("This appears on your Spotify profile."), | |
), | |
SizedBox( | |
height: 20.0, | |
), | |
Center( | |
child: sessionObj.isCreatingAccount ? CircularProgressIndicator() : RaisedButton( | |
padding: EdgeInsets.fromLTRB(45.0, 15.0, 45.0, 15.0), | |
onPressed: (){ | |
FocusScope.of(context).unfocus(); | |
sessionObj.nameNextEnabled ? sessionObj.signUp(context ,sessionObj.name ,sessionObj.email, sessionObj.password) : uiComponents.showCustomDialog(context, "Name should be atleast 6 Charecters"); | |
}, | |
color: sessionObj.nameNextEnabled ? Colors.white : Colors.grey, | |
shape: RoundedRectangleBorder( | |
borderRadius: BorderRadius.circular(100.0), | |
), | |
child: Text("Create", style: TextStyle( | |
color: Colors.black, | |
fontSize: 18.0, | |
fontFamily: 'Proxima Nova Bold' | |
),), | |
), | |
), | |
SizedBox( | |
height: 20.0, | |
), | |
Center( | |
child: Column( | |
mainAxisAlignment: MainAxisAlignment.center, | |
crossAxisAlignment: CrossAxisAlignment.center, | |
children: <Widget>[ | |
Text("By creating an account, you agree to Spotify's Terms of Service.", textAlign: TextAlign.center,), | |
SizedBox( | |
height: 20.0, | |
), | |
Text("To learn more about how Spotify collects, uses, shares and protects your personal data please read Spotify's Privacy Policy", textAlign: TextAlign.center,), | |
], | |
), | |
) | |
], | |
), | |
), | |
], | |
), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment