update
This commit is contained in:
@@ -2,6 +2,7 @@ import 'package:cloud_firestore/cloud_firestore.dart';
|
||||
|
||||
class SettingModel {
|
||||
final bool domicilios;
|
||||
final bool google;
|
||||
final bool tarifas;
|
||||
final String titulo;
|
||||
final String parrafo;
|
||||
@@ -15,6 +16,7 @@ class SettingModel {
|
||||
|
||||
SettingModel(
|
||||
this.domicilios,
|
||||
this.google,
|
||||
this.tarifas,
|
||||
this.titulo,
|
||||
this.parrafo,
|
||||
@@ -30,10 +32,12 @@ class SettingModel {
|
||||
static Future<SettingModel> fromJson(Map<String, dynamic> json) async {
|
||||
try {
|
||||
if (json == null)
|
||||
return SettingModel(false, false, '', '', '', '', '', '', '', '', '');
|
||||
return SettingModel(
|
||||
false, false, false, '', '', '', '', '', '', '', '', '');
|
||||
|
||||
return SettingModel(
|
||||
json['domicilio'],
|
||||
json['google'],
|
||||
json['tarifa'],
|
||||
json['titulo_soporte'],
|
||||
json['parrafo_soporte'],
|
||||
@@ -47,7 +51,8 @@ class SettingModel {
|
||||
);
|
||||
} catch (e) {
|
||||
print('Error settings: $e');
|
||||
return SettingModel(false, false, '', '', '', '', '', '', '', '', '');
|
||||
return SettingModel(
|
||||
false, false, false, '', '', '', '', '', '', '', '', '');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,13 +69,14 @@ class SettingModel {
|
||||
return fromJson(data!);
|
||||
} catch (e) {
|
||||
print('Error getting settings: $e');
|
||||
return SettingModel(false, false, '', '', '', '', '', '', '', '', '');
|
||||
return SettingModel(
|
||||
false, false, false, '', '', '', '', '', '', '', '', '');
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'SettingModel { domicilios: $domicilios, tarifas: $tarifas, '
|
||||
return 'SettingModel { domicilios: $domicilios,google: $google, tarifas: $tarifas, '
|
||||
'titulo: $titulo, parrafo: $parrafo, numero: $numero, '
|
||||
'email: $email, dias: $dias, horas: $horas, '
|
||||
'version: $version, politicasPrivacidad: $proliticasPrivacidad, '
|
||||
|
||||
@@ -5,6 +5,7 @@ import 'package:get/get.dart';
|
||||
import 'package:prosappco/src/authentication/authentication_repository.dart';
|
||||
import 'package:prosappco/src/components/primary_btn.dart';
|
||||
import 'package:prosappco/src/controllers/login_email_controller.dart';
|
||||
import 'package:prosappco/src/models/setting_model.dart';
|
||||
import 'package:prosappco/src/providers/user_provider.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:responsive_builder/responsive_builder.dart';
|
||||
@@ -20,6 +21,19 @@ class _LoginEmailScreenState extends State<LoginEmailScreen> {
|
||||
bool _obscureText = true;
|
||||
final controller = Get.put(LoginEmailController());
|
||||
final _formKey = GlobalKey<FormState>();
|
||||
SettingModel? settings;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
if (settings == null) {
|
||||
SettingModel.getSettings().then(
|
||||
(SettingModel value) => setState(() {
|
||||
settings = value;
|
||||
}),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -96,7 +110,7 @@ class _LoginEmailScreenState extends State<LoginEmailScreen> {
|
||||
margin: const EdgeInsets.only(top: 210, left: 50, right: 50),
|
||||
child: Column(
|
||||
children: [
|
||||
!isIOS && !kIsWeb
|
||||
!isIOS && !kIsWeb && settings?.google == true
|
||||
? Padding(
|
||||
padding: const EdgeInsets.only(bottom: 20),
|
||||
child: ElevatedButton(
|
||||
@@ -134,7 +148,7 @@ class _LoginEmailScreenState extends State<LoginEmailScreen> {
|
||||
)),
|
||||
)
|
||||
: const SizedBox(),
|
||||
!isIOS && !kIsWeb
|
||||
!isIOS && !kIsWeb && settings?.google == true
|
||||
? const Padding(
|
||||
padding: EdgeInsets.symmetric(vertical: 5),
|
||||
child: Row(
|
||||
|
||||
@@ -125,7 +125,7 @@ class _RegisterScreenState extends State<RegisterScreen> {
|
||||
margin: const EdgeInsets.only(top: 200, left: 50, right: 50),
|
||||
child: Column(
|
||||
children: [
|
||||
!isIOS && !kIsWeb
|
||||
!isIOS && !kIsWeb && settings?.google == true
|
||||
? Padding(
|
||||
padding: const EdgeInsets.only(bottom: 20),
|
||||
child: ElevatedButton(
|
||||
@@ -158,7 +158,7 @@ class _RegisterScreenState extends State<RegisterScreen> {
|
||||
)),
|
||||
)
|
||||
: const SizedBox(),
|
||||
!isIOS && !kIsWeb
|
||||
!isIOS && !kIsWeb && settings?.google == true
|
||||
? const Padding(
|
||||
padding: EdgeInsets.symmetric(vertical: 0),
|
||||
child: Row(
|
||||
|
||||
@@ -552,22 +552,11 @@ class _ServiceScreenState extends State<ServiceScreen> {
|
||||
if (_profesionalController.text.isNotEmpty) {
|
||||
_selectDate(context);
|
||||
} else {
|
||||
final snackBar = SnackBar(
|
||||
backgroundColor: Colors.blue,
|
||||
content: const Text(
|
||||
'Selecciona un profesional',
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
elevation: 8.0,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(10.0),
|
||||
),
|
||||
Get.snackbar(
|
||||
'Selecciona un profesional',
|
||||
'Selecciona un profesional antes de elegir la fecha y la hora de la cita.',
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
);
|
||||
|
||||
ScaffoldMessenger.of(context).showSnackBar(snackBar);
|
||||
}
|
||||
},
|
||||
readOnly: true,
|
||||
@@ -589,22 +578,11 @@ class _ServiceScreenState extends State<ServiceScreen> {
|
||||
if (_profesionalController.text.isNotEmpty) {
|
||||
_selectTime(context);
|
||||
} else {
|
||||
final snackBar = SnackBar(
|
||||
backgroundColor: Colors.blue,
|
||||
content: const Text(
|
||||
'Selecciona un profesional',
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
elevation: 8.0,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(10.0),
|
||||
),
|
||||
Get.snackbar(
|
||||
'Selecciona un profesional',
|
||||
'Selecciona un profesional antes de elegir la fecha y la hora de la cita.',
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
);
|
||||
|
||||
ScaffoldMessenger.of(context).showSnackBar(snackBar);
|
||||
}
|
||||
},
|
||||
readOnly: true,
|
||||
@@ -1107,24 +1085,11 @@ class _ServiceScreenState extends State<ServiceScreen> {
|
||||
.text.isNotEmpty) {
|
||||
_selectDate(context);
|
||||
} else {
|
||||
final snackBar = SnackBar(
|
||||
backgroundColor: Colors.blue,
|
||||
content: const Text(
|
||||
'Selecciona un profesional',
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
elevation: 8.0,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius:
|
||||
BorderRadius.circular(10.0),
|
||||
),
|
||||
Get.snackbar(
|
||||
'Selecciona un profesional',
|
||||
'Selecciona un profesional antes de elegir la fecha y la hora de la cita.',
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
);
|
||||
|
||||
ScaffoldMessenger.of(context)
|
||||
.showSnackBar(snackBar);
|
||||
}
|
||||
},
|
||||
readOnly: true,
|
||||
@@ -1151,24 +1116,11 @@ class _ServiceScreenState extends State<ServiceScreen> {
|
||||
.text.isNotEmpty) {
|
||||
_selectTime(context);
|
||||
} else {
|
||||
final snackBar = SnackBar(
|
||||
backgroundColor: Colors.blue,
|
||||
content: const Text(
|
||||
'Selecciona un profesional',
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
elevation: 8.0,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius:
|
||||
BorderRadius.circular(10.0),
|
||||
),
|
||||
Get.snackbar(
|
||||
'Selecciona un profesional',
|
||||
'Selecciona un profesional antes de elegir la fecha y la hora de la cita.',
|
||||
snackPosition: SnackPosition.BOTTOM,
|
||||
);
|
||||
|
||||
ScaffoldMessenger.of(context)
|
||||
.showSnackBar(snackBar);
|
||||
}
|
||||
},
|
||||
readOnly: true,
|
||||
|
||||
Reference in New Issue
Block a user