update
This commit is contained in:
@@ -1,5 +1,9 @@
|
||||
import 'package:firebase_auth/firebase_auth.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:prosappco/src/authentication/authentication_repository.dart';
|
||||
import 'package:cloud_firestore/cloud_firestore.dart';
|
||||
import 'package:prosappco/src/controllers/add_name_email_city.dart';
|
||||
|
||||
class WelcomeScreen extends StatefulWidget {
|
||||
const WelcomeScreen({super.key});
|
||||
@@ -9,8 +13,36 @@ class WelcomeScreen extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _WelcomeScreenState extends State<WelcomeScreen> {
|
||||
final uid = AuthenticationRepository.instance.getCurrentUserUid();
|
||||
final _formKey = GlobalKey<FormState>();
|
||||
final controller = Get.put(NameEmailCityController());
|
||||
var _nombre = 'Cargando...';
|
||||
var _ciudad = '...';
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
if (_nombre == 'Cargando...') {
|
||||
AuthenticationRepository.instance
|
||||
.getName(uid.toString())
|
||||
.then((String s) => setState(() {
|
||||
_nombre = s;
|
||||
}));
|
||||
}
|
||||
if (_ciudad == '...') {
|
||||
AuthenticationRepository.instance
|
||||
.getCity(uid.toString())
|
||||
.then((String s) => setState(() {
|
||||
_ciudad = s;
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
String name = _nombre.toString();
|
||||
String city = _ciudad.toString();
|
||||
|
||||
return SafeArea(
|
||||
child: Scaffold(
|
||||
drawer: Drawer(
|
||||
@@ -20,15 +52,73 @@ class _WelcomeScreenState extends State<WelcomeScreen> {
|
||||
color: Colors.white,
|
||||
child: Column(
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 20, bottom: 20),
|
||||
child: Row(
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 20, right: 20),
|
||||
child: Container(
|
||||
width: 60,
|
||||
height: 60,
|
||||
decoration: BoxDecoration(
|
||||
color: Color(0xFF2BA4EC),
|
||||
borderRadius: BorderRadius.circular(50),
|
||||
),
|
||||
child: Icon(
|
||||
Icons.person,
|
||||
size: 50,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
),
|
||||
Column(
|
||||
children: [
|
||||
Text(
|
||||
'$name',
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.bold, fontSize: 12),
|
||||
),
|
||||
Text(
|
||||
AuthenticationRepository.instance
|
||||
.getCurrentUserPhone()
|
||||
.toString(),
|
||||
style: TextStyle(fontSize: 10),
|
||||
),
|
||||
Text(
|
||||
'$city',
|
||||
style: TextStyle(fontSize: 10),
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(width: 85),
|
||||
Icon(
|
||||
Icons.keyboard_arrow_right_outlined,
|
||||
color: Color(0xFF2BA4EC),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Container(
|
||||
width: double.infinity,
|
||||
height: 100,
|
||||
height: 1.0,
|
||||
color: Colors.grey.withOpacity(0.1),
|
||||
),
|
||||
Container(
|
||||
height: 2.0,
|
||||
decoration: BoxDecoration(
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: Colors.grey.withOpacity(0.2),
|
||||
spreadRadius: 1,
|
||||
blurRadius: 2,
|
||||
offset: Offset(0, 1),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Container(
|
||||
margin: EdgeInsets.only(top: 30),
|
||||
padding: EdgeInsets.all(20),
|
||||
width: double.infinity,
|
||||
color: Colors.grey[100],
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(Icons.history),
|
||||
@@ -40,7 +130,6 @@ class _WelcomeScreenState extends State<WelcomeScreen> {
|
||||
Container(
|
||||
padding: EdgeInsets.all(20),
|
||||
width: double.infinity,
|
||||
color: Colors.grey[100],
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(Icons.person_outline),
|
||||
@@ -52,7 +141,6 @@ class _WelcomeScreenState extends State<WelcomeScreen> {
|
||||
Container(
|
||||
padding: EdgeInsets.all(20),
|
||||
width: double.infinity,
|
||||
color: Colors.grey[100],
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(Icons.construction_outlined),
|
||||
@@ -66,7 +154,6 @@ class _WelcomeScreenState extends State<WelcomeScreen> {
|
||||
Container(
|
||||
padding: EdgeInsets.all(20),
|
||||
width: double.infinity,
|
||||
color: Colors.grey[100],
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(Icons.question_mark_rounded),
|
||||
@@ -78,7 +165,6 @@ class _WelcomeScreenState extends State<WelcomeScreen> {
|
||||
Container(
|
||||
padding: EdgeInsets.all(20),
|
||||
width: double.infinity,
|
||||
color: Colors.grey[100],
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(Icons.messenger_outline),
|
||||
@@ -254,6 +340,24 @@ class _WelcomeScreenState extends State<WelcomeScreen> {
|
||||
),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
padding: const EdgeInsets.only(top: 370),
|
||||
child: Form(
|
||||
key: _formKey,
|
||||
child: Column(
|
||||
children: [
|
||||
TextField(
|
||||
controller: controller.name,
|
||||
),
|
||||
TextField(
|
||||
controller: controller.email,
|
||||
),
|
||||
TextField(
|
||||
controller: controller.city,
|
||||
),
|
||||
],
|
||||
)),
|
||||
),
|
||||
Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 0, vertical: 20),
|
||||
margin: const EdgeInsets.only(top: 280, left: 50, right: 50),
|
||||
@@ -262,7 +366,14 @@ class _WelcomeScreenState extends State<WelcomeScreen> {
|
||||
padding: const EdgeInsets.only(bottom: 40),
|
||||
child: Center(
|
||||
child: ElevatedButton(
|
||||
onPressed: () {},
|
||||
onPressed: () {
|
||||
AuthenticationRepository.instance.addNameAndEmail(
|
||||
uid,
|
||||
controller.name.text.trim(),
|
||||
controller.email.text.trim(),
|
||||
controller.city.text.trim(),
|
||||
);
|
||||
},
|
||||
child: Text(
|
||||
'Solicitar un servicio',
|
||||
style: TextStyle(
|
||||
|
||||
Reference in New Issue
Block a user