Advertisement
Guest User

Untitled

a guest
May 22nd, 2019
163
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Dart 10.16 KB | None | 0 0
  1. import 'dart:io';
  2.  
  3. import 'package:cloud_firestore/cloud_firestore.dart';
  4. import 'package:firebase_auth/firebase_auth.dart';
  5. import 'package:flutter/material.dart';
  6. import 'package:firebase_storage/firebase_storage.dart';
  7. import 'package:sportshareapp/BackgroundGradient.dart';
  8. import 'package:rflutter_alert/rflutter_alert.dart';
  9.  
  10. import '../auth.dart';
  11. class ProfilePage extends StatefulWidget
  12. {
  13.   @override
  14.   ProfilePage({this.uid, this.auth});
  15.   final String uid;
  16.   final BaseAuth auth;
  17.  
  18.   State<StatefulWidget> createState() => _ProfilePageState();
  19.  
  20. }
  21.  
  22. class _ProfilePageState extends State<ProfilePage> {
  23.  
  24.   Future getEvents() async {
  25.     var firestore = Firestore.instance;
  26.     QuerySnapshot qn = await firestore.collection("events").document(widget.uid).collection("UserEvents").getDocuments();
  27.     return qn.documents;
  28.   }
  29.  
  30.   Future<void> signOut() async{
  31.       await widget.auth.signOut();
  32.   }
  33.  
  34.   final ref = FirebaseStorage.instance.ref().child('testimage');
  35.   @override
  36.   Widget build(BuildContext context) {
  37.     return Scaffold(
  38.       body: new Stack(
  39.         children: <Widget>[
  40.           BackgroundGradient(),
  41.           ListView(
  42.           children: <Widget>[
  43.             new Row(
  44.             mainAxisAlignment: MainAxisAlignment.spaceBetween,
  45.             children: <Widget>[
  46.               Padding(
  47.                 padding: EdgeInsets.all(2),
  48.                 child: new Container(
  49.                 height: 100,
  50.                 width: 100,
  51.                 child: new Column(
  52.                   children: <Widget>[
  53.                     new GestureDetector(
  54.                       onTap: (){
  55.                         _showDialog();
  56.  
  57.                       },
  58.                       child:new Card(
  59.                       shape: RoundedRectangleBorder(
  60.                         borderRadius: BorderRadius.circular(15)
  61.                       ),
  62.                       color: Colors.white10,
  63.                       child: Padding(
  64.                         padding: EdgeInsets.all(10),
  65.                         child: new Text('EDIT ',
  66.                         style: TextStyle(
  67.                           fontSize: 20,
  68.                           fontFamily: 'Architects',
  69.                           color: Colors.white
  70.                         ),),
  71.                       ),
  72.                     ),
  73.                     )
  74.  
  75.                   ],
  76.                 )
  77.               ),
  78.               ),
  79.               new Container(
  80.                 height: 100,
  81.                 width: 120,
  82.                 child: new Column(
  83.                   children: <Widget>[
  84.                     new GestureDetector(
  85.                           onTap: () {
  86.                             signOut();
  87.                           },
  88.                       child: new Card(
  89.                       shape: RoundedRectangleBorder(
  90.                         borderRadius: BorderRadius.circular(15)
  91.                       ),
  92.                       color: Colors.white10,
  93.                       child: Padding(
  94.                         padding: EdgeInsets.all(10),
  95.                         child: new Text('Logout ',
  96.                         style: TextStyle(
  97.                           fontSize: 20,
  98.                           fontFamily: 'Architects',
  99.                           color: Colors.white
  100.                         ),),
  101.                       ),
  102.                     ),
  103.                     )
  104.                   ],
  105.                 )
  106.               ),
  107.             ],
  108.           ),
  109.           Column(
  110.             children: <Widget>[
  111.               Hero(
  112.                 tag: 'assets/guti.jpg',
  113.                 child: new Column(
  114.                   children: <Widget>[
  115.                     BackgroundGradient(),
  116.                     GestureDetector(
  117.                       child: Container(
  118.                         height: 125.0,
  119.                         width: 125.0,
  120.                         decoration: BoxDecoration(                    
  121.                         borderRadius: BorderRadius.circular(62.5),
  122.                         image: DecorationImage(
  123.                             fit: BoxFit.cover,
  124.                             image: AssetImage('assets/guti.jpg'),      
  125.                           ),
  126.                         ),
  127.                       ),
  128.                     )
  129.                   ],
  130.                 ),
  131.               ),
  132.               SizedBox(height: 25.0),
  133.               Text(
  134.                 'El Guti',
  135.                 style: TextStyle(
  136.                     fontFamily: 'Architects',
  137.                     fontSize: 20.0,
  138.                     fontWeight: FontWeight.bold,
  139.                     color: Colors.white),
  140.               ),
  141.               SizedBox(height: 4.0),
  142.               Text(
  143.                 'Palamós',
  144.                 style: TextStyle(fontFamily: 'Montserrat', color: Colors.white),
  145.               ),
  146.                             Padding(
  147.                 padding: EdgeInsets.all(30.0),
  148.                 child: Row(
  149.                   mainAxisAlignment: MainAxisAlignment.spaceBetween,
  150.                   children: <Widget>[
  151.                     Column(
  152.                       mainAxisAlignment: MainAxisAlignment.center,
  153.                       children: <Widget>[
  154.                         Text(
  155.                           '∞',
  156.                           style: TextStyle(
  157.                               fontFamily: 'Montserrat',
  158.                               fontWeight: FontWeight.bold,
  159.                               fontSize: 20),
  160.                         ),
  161.                         SizedBox(height: 5.0),
  162.                         Text(
  163.                           'FOLLOWERS',
  164.                           style: TextStyle(
  165.                               fontFamily: 'Montserrat',
  166.                               color: Colors.white),
  167.                         )
  168.                       ],
  169.                     ),
  170.                     Column(
  171.                       mainAxisAlignment: MainAxisAlignment.center,
  172.                       children: <Widget>[
  173.                         Text(
  174.                           '∞',
  175.                           style: TextStyle(
  176.                               fontFamily: 'Montserrat',
  177.                               fontWeight: FontWeight.bold,
  178.                               fontSize: 20),
  179.                         ),
  180.                         SizedBox(height: 5.0),
  181.                         Text(
  182.                           'EVENTS',
  183.                           style: TextStyle(
  184.                               fontFamily: 'Montserrat',
  185.                               color: Colors.white),
  186.                         )
  187.                       ],
  188.                     ),
  189.                     Column(
  190.                       mainAxisAlignment: MainAxisAlignment.center,
  191.                       children: <Widget>[
  192.                         Text(
  193.                           '∞',
  194.                           style: TextStyle(
  195.                               fontFamily: 'Montserrat',
  196.                               fontWeight: FontWeight.bold,
  197.                               fontSize: 20),
  198.                         ),
  199.                         SizedBox(height: 5.0),
  200.                         Text(
  201.                           'FIRENDS',
  202.                           style: TextStyle(
  203.                               fontFamily: 'Montserrat',
  204.                               color: Colors.white),
  205.                             )
  206.                           ],
  207.                         ),
  208.                       ],
  209.                     ),
  210.                   ),
  211.               SizedBox(height: 10.0),
  212.               new Row(
  213.                 children: <Widget>[  
  214.                   Padding(
  215.                     padding: EdgeInsets.all(10),
  216.                     child: Text(
  217.                       'Description: ',
  218.                       style: TextStyle(
  219.                         fontFamily: 'Architects',
  220.                         color: Colors.white,
  221.                          fontSize: 23,
  222.                          fontWeight: FontWeight.bold
  223.                         ),
  224.                     ),
  225.                   )
  226.                 ],
  227.               ),
  228.               new Column(
  229.                 children: <Widget>[
  230.                   new Container(
  231.                   height: 150.0,
  232.                   color: Colors.transparent,
  233.                   child: new Container(
  234.                       decoration: new BoxDecoration(
  235.                           color: Colors.redAccent,  
  236.                           borderRadius: new BorderRadius.only(
  237.                               topLeft: const Radius.circular(40.0),
  238.                               topRight: const Radius.circular(40.0),
  239.                               bottomLeft: const Radius.circular(40.0),
  240.                               bottomRight: const Radius.circular(40.0))),
  241.                       child: new Center(
  242.                         child: new Text(
  243.                           '"Thats only two lines of code"',
  244.                         style: TextStyle(
  245.                           color: Colors.white,
  246.                           fontFamily: 'Architects',
  247.                           fontSize: 20
  248.                         ),
  249.                         ),
  250.                       )),
  251.                     ),
  252.                     ],
  253.                   ),
  254.                 ],
  255.               ),
  256.             ],
  257.           ),  
  258.         ],
  259.       )
  260.     );
  261.   }
  262.  
  263.   Future<Widget> _showDialog() async {
  264.     await showDialog<String>(
  265.       context: context,
  266.       child: new AlertDialog(
  267.         contentPadding: const EdgeInsets.all(16.0),
  268.         content: new Row(
  269.           children: <Widget>[
  270.             new Expanded(
  271.               child: new TextField(
  272.                 autofocus: true,
  273.                 decoration: new InputDecoration(
  274.                     labelText: 'Full Name', hintText: 'eg. John Smith'),
  275.               ),
  276.             )
  277.           ],
  278.         ),
  279.         actions: <Widget>[
  280.           new FlatButton(
  281.               child: const Text('CANCEL', style: TextStyle(color: Colors.red),),
  282.               onPressed: () {
  283.                 Navigator.pop(context);
  284.               }),
  285.           new FlatButton(
  286.               child: const Text('OPEN'),
  287.               onPressed: () {
  288.                 Navigator.pop(context);
  289.               })
  290.         ],
  291.       ),
  292.     );
  293.   }
  294. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement