This commit is contained in:
Felipe
2023-12-21 15:54:22 -05:00
parent 8f042d9ef8
commit cce805664e
3 changed files with 46 additions and 23 deletions
+32 -3
View File
@@ -2,6 +2,7 @@ import 'dart:async';
import 'dart:convert';
import 'dart:io';
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:firebase_auth/firebase_auth.dart';
import 'package:firebase_messaging/firebase_messaging.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
@@ -86,6 +87,9 @@ class _ServiceScreenState extends State<ServiceScreen> {
String? settings;
late final FirebaseAuth _auth;
final _nameController = TextEditingController();
@override
void initState() {
super.initState();
@@ -94,12 +98,17 @@ class _ServiceScreenState extends State<ServiceScreen> {
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) {
SettingModel.getSettings().then(
(SettingModel value) => (value) {
print('App version:3 $value');
if (mounted) {
setState(() {
settings = value.version;
@@ -329,6 +338,16 @@ class _ServiceScreenState extends State<ServiceScreen> {
controller: _serviceTypeController,
readOnly: true,
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(
context,
CupertinoPageRoute(
@@ -459,6 +478,16 @@ class _ServiceScreenState extends State<ServiceScreen> {
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(
context,
CupertinoPageRoute(