This commit is contained in:
Felipe
2023-11-01 10:37:57 -05:00
parent d37eb9b190
commit 9a41d12cc7
6 changed files with 98 additions and 64 deletions
+5 -4
View File
@@ -561,10 +561,11 @@ class ProfessionalProfileScreenState extends State<ProfessionalProfileScreen> {
return SafeArea( return SafeArea(
child: Scaffold( child: Scaffold(
appBar: PopAppbar( appBar: PopAppbar(
onPressed: () { onPressed: () {
Navigator.pop(context); Navigator.pop(context);
}, },
label: 'Perfil profesional'), label: 'Perfil profesional',
),
body: SingleChildScrollView( body: SingleChildScrollView(
reverse: true, reverse: true,
child: Center( child: Center(
+34 -27
View File
@@ -33,9 +33,11 @@ class _ProfileProScreenState extends State<ProfileProScreen> {
File? image_portada; File? image_portada;
File? imagen_to_upload; File? imagen_to_upload;
bool domicilioValue = false;
bool tarifaValue = false; bool tarifaValue = false;
bool domicilioValue = true;
bool sitioValue = false; bool sitioValue = false;
var photoTemp = ''; var photoTemp = '';
var _photo = '...'; var _photo = '...';
@@ -385,6 +387,24 @@ class _ProfileProScreenState extends State<ProfileProScreen> {
); );
} }
void toggleDomicilio(bool newValue) {
setState(() {
domicilioValue = newValue;
if (newValue == false && sitioValue == false) {
sitioValue = true;
}
});
}
void toggleSitio(bool newValue) {
setState(() {
sitioValue = newValue;
if (newValue == false && domicilioValue == false) {
domicilioValue = true;
}
});
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
String address = _direccion.toString(); String address = _direccion.toString();
@@ -455,20 +475,9 @@ class _ProfileProScreenState extends State<ProfileProScreen> {
), ),
if (settings?.domicilios == true) if (settings?.domicilios == true)
customSwitch( customSwitch(
'Servicio a domicilio', 'Servicio a domicilio', domicilioValue, toggleDomicilio),
domicilioValue,
(value) {
domicilioValue = value;
},
),
const Divider(), const Divider(),
customSwitch( customSwitch('Servicio en sitio', sitioValue, toggleSitio),
'Servicio en sitio',
sitioValue,
(value) {
sitioValue = value;
},
),
sitioValue sitioValue
? Padding( ? Padding(
padding: padding:
@@ -540,7 +549,7 @@ class _ProfileProScreenState extends State<ProfileProScreen> {
TableCell( TableCell(
child: Container( child: Container(
padding: const EdgeInsets.all(8.0), padding: const EdgeInsets.all(8.0),
child: Text('Lunes'), child: const Text('Lunes'),
), ),
), ),
TableCell( TableCell(
@@ -672,7 +681,8 @@ class _ProfileProScreenState extends State<ProfileProScreen> {
); );
} }
customSwitch(String text, bool switchValue, ValueChanged<bool> onChanged) { Widget customSwitch(
String text, bool switchValue, ValueChanged<bool> onChanged) {
return Padding( return Padding(
padding: const EdgeInsets.symmetric(horizontal: 30), padding: const EdgeInsets.symmetric(horizontal: 30),
child: SizedBox( child: SizedBox(
@@ -680,22 +690,19 @@ class _ProfileProScreenState extends State<ProfileProScreen> {
child: Row( child: Row(
children: [ children: [
Expanded( Expanded(
child: Text( child: Text(
text, text,
style: const TextStyle( style: const TextStyle(
fontSize: 15, fontSize: 15,
color: Colors.black, color: Colors.black,
),
), ),
)), ),
Transform.scale( Transform.scale(
scale: 1.2, scale: 1.2,
child: Switch( child: Switch(
value: switchValue, value: switchValue,
onChanged: (bool newValue) { onChanged: onChanged,
setState(() {
onChanged(newValue);
});
},
), ),
), ),
], ],
+31 -26
View File
@@ -33,7 +33,7 @@ class _ProfileProWebScreenState extends State<ProfileProWebScreen> {
double latUser = 0.0; double latUser = 0.0;
double lngUser = 0.0; double lngUser = 0.0;
bool domicilioValue = false; bool domicilioValue = true;
bool tarifaValue = false; bool tarifaValue = false;
bool sitioValue = false; bool sitioValue = false;
var photoTemp = ''; var photoTemp = '';
@@ -314,6 +314,24 @@ class _ProfileProWebScreenState extends State<ProfileProWebScreen> {
} }
} }
void toggleDomicilio(bool newValue) {
setState(() {
domicilioValue = newValue;
if (newValue == false && sitioValue == false) {
sitioValue = true;
}
});
}
void toggleSitio(bool newValue) {
setState(() {
sitioValue = newValue;
if (newValue == false && domicilioValue == false) {
domicilioValue = true;
}
});
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
@@ -368,20 +386,9 @@ class _ProfileProWebScreenState extends State<ProfileProWebScreen> {
), ),
if (settings?.domicilios == true) if (settings?.domicilios == true)
customSwitch( customSwitch(
'Servicio a domicilio', 'Servicio a domicilio', domicilioValue, toggleDomicilio),
domicilioValue,
(value) {
domicilioValue = value;
},
),
const Divider(), const Divider(),
customSwitch( customSwitch('Servicio en sitio', sitioValue, toggleSitio),
'Servicio en sitio',
sitioValue,
(value) {
sitioValue = value;
},
),
sitioValue sitioValue
? Padding( ? Padding(
padding: padding:
@@ -589,7 +596,8 @@ class _ProfileProWebScreenState extends State<ProfileProWebScreen> {
); );
} }
customSwitch(String text, bool switchValue, ValueChanged<bool> onChanged) { Widget customSwitch(
String text, bool switchValue, ValueChanged<bool> onChanged) {
return Padding( return Padding(
padding: const EdgeInsets.symmetric(horizontal: 30), padding: const EdgeInsets.symmetric(horizontal: 30),
child: SizedBox( child: SizedBox(
@@ -597,22 +605,19 @@ class _ProfileProWebScreenState extends State<ProfileProWebScreen> {
child: Row( child: Row(
children: [ children: [
Expanded( Expanded(
child: Text( child: Text(
text, text,
style: const TextStyle( style: const TextStyle(
fontSize: 15, fontSize: 15,
color: Colors.black, color: Colors.black,
),
), ),
)), ),
Transform.scale( Transform.scale(
scale: 1.2, scale: 1.2,
child: Switch( child: Switch(
value: switchValue, value: switchValue,
onChanged: (bool newValue) { onChanged: onChanged,
setState(() {
onChanged(newValue);
});
},
), ),
), ),
], ],
+1 -1
View File
@@ -261,7 +261,7 @@ class _ServiceScreenState extends State<ServiceScreen> {
} }
void _checkForUpdate(String? settings) { void _checkForUpdate(String? settings) {
if (appVersion == settings) { if (appVersion != settings) {
showDialog( showDialog(
context: context, context: context,
builder: (context) { builder: (context) {
+26 -5
View File
@@ -12,16 +12,30 @@ class WebViewScreen extends StatefulWidget {
} }
class _WebViewScreenState extends State<WebViewScreen> { class _WebViewScreenState extends State<WebViewScreen> {
bool isLoading = true;
late WebViewController controller;
@override @override
Widget build(BuildContext context) { void initState() {
final controller = WebViewController() super.initState();
controller = WebViewController()
..setJavaScriptMode(JavaScriptMode.unrestricted) ..setJavaScriptMode(JavaScriptMode.unrestricted)
..setBackgroundColor(const Color(0x00000000)) ..setBackgroundColor(const Color(0x00000000))
..setNavigationDelegate( ..setNavigationDelegate(
NavigationDelegate( NavigationDelegate(
onProgress: (int progress) {}, onProgress: (int progress) {},
onPageStarted: (String url) {}, onPageStarted: (String url) {
onPageFinished: (String url) {}, setState(() {
isLoading = true;
});
},
onPageFinished: (String url) {
setState(() {
isLoading = false;
});
},
onWebResourceError: (WebResourceError error) {}, onWebResourceError: (WebResourceError error) {},
onNavigationRequest: (NavigationRequest request) { onNavigationRequest: (NavigationRequest request) {
if (request.url.startsWith('https://www.youtube.com/')) { if (request.url.startsWith('https://www.youtube.com/')) {
@@ -32,6 +46,10 @@ class _WebViewScreenState extends State<WebViewScreen> {
), ),
) )
..loadRequest(Uri.parse(widget.link)); ..loadRequest(Uri.parse(widget.link));
}
@override
Widget build(BuildContext context) {
return Scaffold( return Scaffold(
appBar: PopAppbar( appBar: PopAppbar(
onPressed: () { onPressed: () {
@@ -41,7 +59,10 @@ class _WebViewScreenState extends State<WebViewScreen> {
), ),
body: Stack( body: Stack(
children: [ children: [
const Center(child: CircularProgressIndicator()), if (isLoading)
const Center(child: CircularProgressIndicator())
else
const SizedBox(),
WebViewWidget(controller: controller), WebViewWidget(controller: controller),
], ],
), ),
+1 -1
View File
@@ -62,7 +62,7 @@ dependencies:
url_launcher: ^6.1.10 url_launcher: ^6.1.10
community_material_icon: ^5.9.55 community_material_icon: ^5.9.55
flutter_email_sender: ^5.2.0 flutter_email_sender: ^5.2.0
webview_flutter: ^4.2.0 webview_flutter: ^4.4.1
firebase_storage: ^11.2.2 firebase_storage: ^11.2.2
responsive_builder: ^0.7.0 responsive_builder: ^0.7.0
flutter_local_notifications: ^14.1.1 flutter_local_notifications: ^14.1.1