Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class WelcomePageState extends StatefulWidget {
- @override
- WelcomePage createState() => WelcomePage();
- }
- class WelcomePage extends State<WelcomePageState> {
- Widget scaffoldBody;
- @override
- Widget build(BuildContext context) {
- return Consumer<UserProvider>(
- builder: (BuildContext context, UserProvider userp, _) => Scaffold(
- appBar: AppBar(
- backgroundColor: Color.fromARGB(255, 98, 235, 248),
- title: Text(
- 'My AirBNB',
- style: TextStyle(color: Colors.black),
- ),
- centerTitle: true,
- elevation: 0,
- ),
- body: scaffoldBody,
- drawer: Drawer(
- child: Container(
- constraints: BoxConstraints.expand(),
- decoration: BoxDecoration(
- gradient: LinearGradient(
- begin: Alignment(0.31089, 1.09827),
- end: Alignment(0.68911, -0.09827),
- stops: [
- 0,
- 1,
- ],
- colors: [
- Color.fromARGB(255, 140, 28, 140),
- Color.fromARGB(255, 98, 235, 248),
- ],
- ),
- ),
- child: Column(
- children: <Widget>[
- UserAccountsDrawerHeader(
- decoration: BoxDecoration(
- color: Color.fromARGB(255, 255, 255, 255),
- ),
- currentAccountPicture: userp.user_name != null
- ? Image.memory(base64Decode(userp.user_name.image))
- : Text(''),
- accountName: userp.user_name != null
- ? Text(
- '${userp.user_name.name} ${userp.user_name.surname}',
- style: TextStyle(color: Colors.black))
- : Text(''),
- accountEmail: userp.user_name != null
- ? Text('${userp.user_name.email}',
- style: TextStyle(color: Colors.black))
- : Text(''),
- ),
- FlatButton(
- onPressed: () {
- onTappedAddProp();
- Navigator.pop(context);
- },
- child: Row(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: <Widget>[
- Text(
- 'Add a proposal',
- style: TextStyle(
- color: Colors.black,
- ),
- ),
- Icon(
- Icons.add,
- color: Colors.black,
- )
- ],
- ),
- ),
- Divider(
- color: Colors.black,
- ),
- FlatButton(
- onPressed: () {
- onTappedEditProp();
- Navigator.pop(context);
- },
- child: Row(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: <Widget>[
- Text(
- 'Edit a proposal',
- style: TextStyle(
- color: Colors.black,
- ),
- ),
- Icon(
- Icons.edit,
- color: Colors.black,
- )
- ],
- ),
- ),
- Divider(
- color: Colors.black,
- ),
- FlatButton(
- onPressed: () {},
- child: Row(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: <Widget>[
- Text(
- 'Delete a proposal',
- style: TextStyle(
- color: Colors.black,
- ),
- ),
- Icon(
- Icons.delete,
- color: Colors.black,
- )
- ],
- ),
- ),
- Divider(
- color: Colors.black,
- ),
- FlatButton(
- onPressed: () {},
- child: Row(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: <Widget>[
- Text(
- 'See notifications',
- style: TextStyle(
- color: Colors.black,
- ),
- ),
- Icon(
- Icons.notifications,
- color: Colors.black,
- )
- ],
- ),
- ),
- Divider(
- color: Colors.black,
- ),
- FlatButton(
- onPressed: () {
- AddProposalPage().onTappedAddFeed();
- Navigator.pop(context);
- },
- child: Row(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: <Widget>[
- Text(
- 'Add a feedback',
- style: TextStyle(
- color: Colors.black,
- ),
- ),
- Icon(
- Icons.feedback,
- color: Colors.black,
- )
- ],
- ),
- ),
- Divider(
- color: Colors.black,
- ),
- Spacer(),
- FlatButton(
- onPressed: () {
- Navigator.pushReplacementNamed(context, '/login');
- },
- child: Row(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: <Widget>[
- Text(
- 'LOGOUT',
- style: TextStyle(
- color: Colors.black,
- ),
- ),
- Icon(
- Icons.exit_to_app,
- color: Colors.black,
- )
- ],
- ),
- ),
- ],
- ),
- ),
- ),
- ),
- );
- }
- @override
- void initState() {
- // Initializing it with the first body we want visible.
- scaffoldBody = Consumer<UserProvider>(
- builder: (BuildContext context, UserProvider userp, _) => Container(
- constraints: BoxConstraints.expand(),
- decoration: BoxDecoration(
- gradient: LinearGradient(
- begin: Alignment(0.31089, 1.09827),
- end: Alignment(0.68911, -0.09827),
- stops: [
- 0,
- 1,
- ],
- colors: [
- Color.fromARGB(255, 140, 28, 140),
- Color.fromARGB(255, 98, 235, 248),
- ],
- ),
- ),
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.stretch,
- children: <Widget>[
- Align(
- alignment: Alignment.topCenter,
- child: Container(
- margin: EdgeInsets.only(top: 50),
- child: userp.user_name != null
- ? Text(
- "Welcome in myAirBNB ${userp.user_name.name} ${userp.user_name.surname}",
- textAlign: TextAlign.center,
- style: TextStyle(
- color: Color.fromARGB(255, 255, 255, 255),
- fontFamily: "Lato",
- fontWeight: FontWeight.w400,
- fontSize: 35,
- letterSpacing: -1,
- ),
- )
- : CircularProgressIndicator(),
- ),
- ),
- ],
- ),
- ));
- }
- void onTappedAddProp() {
- // Calling setState changing the body
- setState(() {
- scaffoldBody = Consumer<UserProvider>(
- builder: (BuildContext context, UserProvider userp, _) => Container(
- constraints: BoxConstraints.expand(),
- decoration: BoxDecoration(
- gradient: LinearGradient(
- begin: Alignment(0.31089, 1.09827),
- end: Alignment(0.68911, -0.09827),
- stops: [
- 0,
- 1,
- ],
- colors: [
- Color.fromARGB(255, 140, 28, 140),
- Color.fromARGB(255, 98, 235, 248),
- ],
- ),
- ),
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.stretch,
- children: <Widget>[
- Align(
- alignment: Alignment.topCenter,
- child: Container(
- margin: EdgeInsets.only(top: 50),
- child: userp.user_name != null
- ? Text(
- "add proposal",
- textAlign: TextAlign.center,
- style: TextStyle(
- color: Color.fromARGB(255, 255, 255, 255),
- fontFamily: "Lato",
- fontWeight: FontWeight.w400,
- fontSize: 35,
- letterSpacing: -1,
- ),
- )
- : CircularProgressIndicator(),
- ),
- ),
- ],
- ),
- ));
- });
- }
- void onTappedEditProp() {
- // Calling setState changing the body
- setState(() {
- scaffoldBody = Consumer<UserProvider>(
- builder: (BuildContext context, UserProvider userp, _) => Container(
- constraints: BoxConstraints.expand(),
- decoration: BoxDecoration(
- gradient: LinearGradient(
- begin: Alignment(0.31089, 1.09827),
- end: Alignment(0.68911, -0.09827),
- stops: [
- 0,
- 1,
- ],
- colors: [
- Color.fromARGB(255, 140, 28, 140),
- Color.fromARGB(255, 98, 235, 248),
- ],
- ),
- ),
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.stretch,
- children: <Widget>[
- Align(
- alignment: Alignment.topCenter,
- child: Container(
- margin: EdgeInsets.only(top: 50),
- child: userp.user_name != null
- ? Text(
- "edit proposal",
- textAlign: TextAlign.center,
- style: TextStyle(
- color: Color.fromARGB(255, 255, 255, 255),
- fontFamily: "Lato",
- fontWeight: FontWeight.w400,
- fontSize: 35,
- letterSpacing: -1,
- ),
- )
- : CircularProgressIndicator(),
- ),
- ),
- ],
- ),
- ));
- });
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement