update
This commit is contained in:
@@ -2,6 +2,7 @@ import 'dart:async';
|
|||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
import 'package:cloud_firestore/cloud_firestore.dart';
|
import 'package:cloud_firestore/cloud_firestore.dart';
|
||||||
|
import 'package:firebase_auth/firebase_auth.dart';
|
||||||
import 'package:firebase_messaging/firebase_messaging.dart';
|
import 'package:firebase_messaging/firebase_messaging.dart';
|
||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
@@ -86,6 +87,9 @@ class _ServiceScreenState extends State<ServiceScreen> {
|
|||||||
|
|
||||||
String? settings;
|
String? settings;
|
||||||
|
|
||||||
|
late final FirebaseAuth _auth;
|
||||||
|
final _nameController = TextEditingController();
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
@@ -94,12 +98,17 @@ class _ServiceScreenState extends State<ServiceScreen> {
|
|||||||
|
|
||||||
getLocationUpdates();
|
getLocationUpdates();
|
||||||
|
|
||||||
print('App version: 2 $settings');
|
_auth = FirebaseAuth.instance;
|
||||||
|
|
||||||
|
final currentUser = _auth.currentUser;
|
||||||
|
|
||||||
|
if (currentUser != null && currentUser.displayName != null) {
|
||||||
|
_nameController.text = currentUser.displayName!;
|
||||||
|
}
|
||||||
|
|
||||||
if (settings == null) {
|
if (settings == null) {
|
||||||
SettingModel.getSettings().then(
|
SettingModel.getSettings().then(
|
||||||
(SettingModel value) => (value) {
|
(SettingModel value) => (value) {
|
||||||
print('App version:3 $value');
|
|
||||||
|
|
||||||
if (mounted) {
|
if (mounted) {
|
||||||
setState(() {
|
setState(() {
|
||||||
settings = value.version;
|
settings = value.version;
|
||||||
@@ -329,6 +338,16 @@ class _ServiceScreenState extends State<ServiceScreen> {
|
|||||||
controller: _serviceTypeController,
|
controller: _serviceTypeController,
|
||||||
readOnly: true,
|
readOnly: true,
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
|
if (_nameController.text == '') {
|
||||||
|
WarningSnackbar.show(
|
||||||
|
title: 'Completa tu perfil',
|
||||||
|
message:
|
||||||
|
'Asegurate de llenar todos los campos de tu perfil antes de seleccionar un tipo de servicio.',
|
||||||
|
);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
final String? serviceType = await Navigator.push(
|
final String? serviceType = await Navigator.push(
|
||||||
context,
|
context,
|
||||||
CupertinoPageRoute(
|
CupertinoPageRoute(
|
||||||
@@ -459,6 +478,16 @@ class _ServiceScreenState extends State<ServiceScreen> {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (_nameController.text == '') {
|
||||||
|
WarningSnackbar.show(
|
||||||
|
title: 'Completa tu perfil',
|
||||||
|
message:
|
||||||
|
'Asegurate de llenar todos los campos de tu perfil antes de seleccionar un profesional.',
|
||||||
|
);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
datos = await Navigator.push(
|
datos = await Navigator.push(
|
||||||
context,
|
context,
|
||||||
CupertinoPageRoute(
|
CupertinoPageRoute(
|
||||||
|
|||||||
@@ -740,7 +740,9 @@ class _ProfileScreenState extends State<ProfileScreen> {
|
|||||||
hintText: '+57',
|
hintText: '+57',
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(height: 20.0),
|
genderDb == ''
|
||||||
|
? const SizedBox(height: 20.0)
|
||||||
|
: const SizedBox(),
|
||||||
genderDb == ''
|
genderDb == ''
|
||||||
? GenderDropdown(
|
? GenderDropdown(
|
||||||
onChanged: (selectedGender) {
|
onChanged: (selectedGender) {
|
||||||
@@ -767,7 +769,10 @@ class _ProfileScreenState extends State<ProfileScreen> {
|
|||||||
),
|
),
|
||||||
)
|
)
|
||||||
: const SizedBox(),
|
: const SizedBox(),
|
||||||
_email != null
|
_email != null && _email != ''
|
||||||
|
? const SizedBox(height: 20.0)
|
||||||
|
: const SizedBox(),
|
||||||
|
_email != null && _email != ''
|
||||||
? TextFormField(
|
? TextFormField(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
_showEmailUpdateDialog(context);
|
_showEmailUpdateDialog(context);
|
||||||
@@ -775,12 +780,13 @@ class _ProfileScreenState extends State<ProfileScreen> {
|
|||||||
readOnly: true,
|
readOnly: true,
|
||||||
controller: _emailController,
|
controller: _emailController,
|
||||||
decoration: const InputDecoration(
|
decoration: const InputDecoration(
|
||||||
prefixIcon: Icon(Icons.email_outlined),
|
prefixIcon: Icon(Icons.email_outlined),
|
||||||
hintText: 'Email (Obligatorio)'),
|
hintText: 'Email (Obligatorio)',
|
||||||
|
),
|
||||||
)
|
)
|
||||||
: const SizedBox(),
|
: const SizedBox(),
|
||||||
const SizedBox(height: 20),
|
const SizedBox(height: 20),
|
||||||
_email == null
|
_email == null || _email == ''
|
||||||
? PrimaryCheckbox(
|
? PrimaryCheckbox(
|
||||||
text:
|
text:
|
||||||
'Habilitar inicio de sesión con correo (Opcional)',
|
'Habilitar inicio de sesión con correo (Opcional)',
|
||||||
@@ -828,7 +834,7 @@ class _ProfileScreenState extends State<ProfileScreen> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(height: 20.0),
|
const SizedBox(height: 20.0),
|
||||||
_email != null
|
_email != null && _email != ''
|
||||||
? const SizedBox.shrink()
|
? const SizedBox.shrink()
|
||||||
: TextFormField(
|
: TextFormField(
|
||||||
controller: _passwordController,
|
controller: _passwordController,
|
||||||
@@ -866,7 +872,7 @@ class _ProfileScreenState extends State<ProfileScreen> {
|
|||||||
),
|
),
|
||||||
hintText: 'Contraseña'),
|
hintText: 'Contraseña'),
|
||||||
),
|
),
|
||||||
_email != null
|
_email != null && _email != ''
|
||||||
? const SizedBox.shrink()
|
? const SizedBox.shrink()
|
||||||
: const SizedBox(height: 20),
|
: const SizedBox(height: 20),
|
||||||
Container(
|
Container(
|
||||||
@@ -924,7 +930,7 @@ class _ProfileScreenState extends State<ProfileScreen> {
|
|||||||
padding: const EdgeInsets.only(bottom: 30),
|
padding: const EdgeInsets.only(bottom: 30),
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
_email != null
|
_email != null && _email != ''
|
||||||
? PrimaryButton(
|
? PrimaryButton(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
Navigator.push(
|
Navigator.push(
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ import 'package:flutter/cupertino.dart';
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:prosappco/src/components/pop_appbar.dart';
|
import 'package:prosappco/src/components/pop_appbar.dart';
|
||||||
import 'package:prosappco/src/presentation/screens/profession.dart';
|
import 'package:prosappco/src/presentation/screens/profession.dart';
|
||||||
import 'package:prosappco/src/presentation/screens/professional.dart';
|
|
||||||
|
|
||||||
class ServiceTypeScreen extends StatefulWidget {
|
class ServiceTypeScreen extends StatefulWidget {
|
||||||
const ServiceTypeScreen({super.key});
|
const ServiceTypeScreen({super.key});
|
||||||
@@ -88,17 +87,6 @@ class _ServiceTypeScreenState extends State<ServiceTypeScreen> {
|
|||||||
),
|
),
|
||||||
onTap: () {
|
onTap: () {
|
||||||
Navigator.pop(context, professions[index]);
|
Navigator.pop(context, professions[index]);
|
||||||
|
|
||||||
// Navigator.push(
|
|
||||||
// context,
|
|
||||||
// CupertinoPageRoute(
|
|
||||||
// builder: (BuildContext context) {
|
|
||||||
// return ProfessionalScreen(
|
|
||||||
// profession: professions[index],
|
|
||||||
// );
|
|
||||||
// },
|
|
||||||
// ),
|
|
||||||
// );
|
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user