update
This commit is contained in:
@@ -2,6 +2,7 @@ import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:injector/injector.dart';
|
||||
import 'package:package_info_plus/package_info_plus.dart';
|
||||
import 'package:prosappco/components/general_drawer_item.dart';
|
||||
import 'package:prosappco/screens/web/web_view_screen.dart';
|
||||
import 'package:setting_repository/setting_repository.dart';
|
||||
@@ -25,6 +26,7 @@ class _ConfigurationAboutScreenState extends State<ConfigurationAboutScreen> {
|
||||
super.initState();
|
||||
|
||||
_loadSettings();
|
||||
|
||||
}
|
||||
|
||||
void _loadSettings() {
|
||||
@@ -43,6 +45,7 @@ class _ConfigurationAboutScreenState extends State<ConfigurationAboutScreen> {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
|
||||
@@ -11,6 +11,7 @@ import 'package:geolocator/geolocator.dart';
|
||||
import 'package:google_maps_flutter/google_maps_flutter.dart';
|
||||
import 'package:injector/injector.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:package_info_plus/package_info_plus.dart';
|
||||
import 'package:professional_repository/professional_repository.dart';
|
||||
import 'package:prosappco/blocs/my_user_bloc/my_user_bloc.dart';
|
||||
import 'package:prosappco/blocs/notification_bloc/notification_bloc.dart';
|
||||
@@ -23,6 +24,7 @@ import 'package:prosappco/screens/user/user_service_screen.dart';
|
||||
import 'package:prosappco/utils/time_of_day_extension.dart';
|
||||
import 'package:service_repository/service_repository.dart';
|
||||
import 'package:setting_repository/setting_repository.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
|
||||
class UserMapScreen extends StatefulWidget {
|
||||
const UserMapScreen({super.key});
|
||||
@@ -41,6 +43,7 @@ class _UserMapScreenState extends State<UserMapScreen> {
|
||||
|
||||
final settingRepository = Injector.appInstance.get<SettingRepository>();
|
||||
SettingEntity? settings;
|
||||
late String appVersion;
|
||||
|
||||
final DateFormat formatter = DateFormat('dd/MM/yyyy');
|
||||
|
||||
@@ -59,6 +62,11 @@ class _UserMapScreenState extends State<UserMapScreen> {
|
||||
Set<Marker> markers = {};
|
||||
BitmapDescriptor? _markerIcon;
|
||||
|
||||
final Uri _urlIos =
|
||||
Uri.parse('https://apps.apple.com/co/app/prosapp/id6469028900');
|
||||
final Uri _urlAndroid = Uri.parse(
|
||||
'https://play.google.com/store/apps/details?id=com.prosapp.prosapp');
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
@@ -92,14 +100,113 @@ class _UserMapScreenState extends State<UserMapScreen> {
|
||||
// context.read<NotificationBloc>().requestPermission();
|
||||
// }
|
||||
|
||||
void _loadSettings() {
|
||||
_loadSettings() {
|
||||
settingRepository.getSettings().then(
|
||||
(value) => setState(() {
|
||||
settings = value;
|
||||
_getAppVersion();
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
void _getAppVersion() async {
|
||||
PackageInfo packageInfo = await PackageInfo.fromPlatform();
|
||||
String version = packageInfo.version;
|
||||
|
||||
if (mounted) {
|
||||
setState(() {
|
||||
appVersion = version;
|
||||
});
|
||||
}
|
||||
|
||||
if (settings != null) {
|
||||
_checkForUpdate(settings!);
|
||||
}
|
||||
}
|
||||
|
||||
void _checkForUpdate(SettingEntity settings) {
|
||||
if (Platform.isAndroid) {
|
||||
if (appVersion == settings.versionAndroid) {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (context) {
|
||||
return WillPopScope(
|
||||
onWillPop: () async {
|
||||
return false;
|
||||
},
|
||||
child: Center(
|
||||
child: AlertDialog(
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(16.0),
|
||||
),
|
||||
title: const Text(
|
||||
"Debes Actualizar la Aplicación",
|
||||
style: TextStyle(fontWeight: FontWeight.bold),
|
||||
),
|
||||
content: const Text(
|
||||
"Tienes una versión desactualizada de nuestra aplicación. Te recomendamos actualizarla para disfrutar de las últimas características y mejoras.",
|
||||
),
|
||||
actions: [
|
||||
TextButton(
|
||||
child: const Text(
|
||||
"Actualizar",
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w600, fontSize: 20),
|
||||
),
|
||||
onPressed: () {
|
||||
launchUrl(_urlAndroid);
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
if (Platform.isIOS) {
|
||||
if (appVersion == settings.versionIos) {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (context) {
|
||||
return WillPopScope(
|
||||
onWillPop: () async {
|
||||
return false;
|
||||
},
|
||||
child: Center(
|
||||
child: AlertDialog(
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(16.0),
|
||||
),
|
||||
title: const Text(
|
||||
"Debes Actualizar la Aplicación",
|
||||
style: TextStyle(fontWeight: FontWeight.bold),
|
||||
),
|
||||
content: const Text(
|
||||
"Tienes una versión desactualizada de nuestra aplicación. Te recomendamos actualizarla para disfrutar de las últimas características y mejoras.",
|
||||
),
|
||||
actions: [
|
||||
TextButton(
|
||||
child: const Text(
|
||||
"Actualizar",
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w600, fontSize: 20),
|
||||
),
|
||||
onPressed: () {
|
||||
launchUrl(_urlIos);
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return BlocProvider<ServiceBloc>(
|
||||
@@ -265,6 +372,20 @@ class _UserMapScreenState extends State<UserMapScreen> {
|
||||
),
|
||||
readOnly: true,
|
||||
onTap: () async {
|
||||
if (state.user?.name == null ||
|
||||
state.user?.name == '' ||
|
||||
state.user?.phone == '' ||
|
||||
state.user?.phone == null) {
|
||||
ScaffoldMessenger.of(context).clearSnackBars();
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
const SnackBar(
|
||||
content: Text(
|
||||
'Por favor completa tu perfil y agrega tu celular'),
|
||||
),
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
var datos = await Navigator.push(context,
|
||||
CupertinoPageRoute(builder: (context) {
|
||||
return const ProfessionalListScreen();
|
||||
@@ -327,9 +448,6 @@ class _UserMapScreenState extends State<UserMapScreen> {
|
||||
decoration: const InputDecoration(
|
||||
prefixIcon: Icon(Icons.assignment_ind_rounded),
|
||||
suffixIcon: Icon(Icons.arrow_drop_down),
|
||||
// hintText: context.select(
|
||||
// (NotificationBloc bloc) => '${bloc.state.status}',
|
||||
// ),
|
||||
hintText: 'Selecciona un profesional',
|
||||
),
|
||||
),
|
||||
@@ -399,6 +517,21 @@ class _UserMapScreenState extends State<UserMapScreen> {
|
||||
? null
|
||||
: () {
|
||||
if (profesionalSeleccionado == null) return;
|
||||
|
||||
if (state.user?.name == null ||
|
||||
state.user?.name == '' ||
|
||||
state.user?.phone == '' ||
|
||||
state.user?.phone == null) {
|
||||
ScaffoldMessenger.of(context).clearSnackBars();
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
const SnackBar(
|
||||
content: Text(
|
||||
'Por favor completa tu perfil y agrega tu celular'),
|
||||
),
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
if (serviceLocationPreference ==
|
||||
ServiceLocationPreferences.office) {
|
||||
if (settings?.tarifas == true) {
|
||||
|
||||
Reference in New Issue
Block a user