parent
51452337d1
commit
2bcacdcb92
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,19 +0,0 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:healthcare_user/common/settings.dart';
|
||||
|
||||
class Invitations extends StatefulWidget {
|
||||
const Invitations({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
State<Invitations> createState() => _InvitationsState();
|
||||
}
|
||||
|
||||
class _InvitationsState extends State<Invitations> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppSettings.appBar('Invitations'),
|
||||
body: Container(),
|
||||
);
|
||||
}
|
||||
}
|
@ -0,0 +1,74 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:healthcare_user/common/settings.dart';
|
||||
import 'package:flutter_native_contact_picker/flutter_native_contact_picker.dart';
|
||||
|
||||
|
||||
class Invitations extends StatefulWidget {
|
||||
const Invitations({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
State<Invitations> createState() => _InvitationsState();
|
||||
}
|
||||
|
||||
class _InvitationsState extends State<Invitations> {
|
||||
|
||||
TextEditingController mobileNumberController = TextEditingController();
|
||||
TextEditingController nameController = TextEditingController();
|
||||
|
||||
final FlutterContactPicker _contactPicker = new FlutterContactPicker();
|
||||
Contact? _contact;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppSettings.appBar('Invitations'),
|
||||
body: GestureDetector(
|
||||
onTap: () {
|
||||
FocusManager.instance.primaryFocus?.unfocus();
|
||||
},
|
||||
child: SafeArea(
|
||||
child: SingleChildScrollView(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(10),
|
||||
child: Column(
|
||||
children: [
|
||||
Container(
|
||||
child: TextFormField(
|
||||
cursorColor: greyColor,
|
||||
controller: nameController,
|
||||
decoration: textFormFieldDecoration(Icons.phone,'Enter Name'),
|
||||
|
||||
),
|
||||
),
|
||||
SizedBox(height:MediaQuery.of(context).size.height * .02,),
|
||||
Container(
|
||||
child: TextFormField(
|
||||
cursorColor: greyColor,
|
||||
controller: mobileNumberController,
|
||||
keyboardType: TextInputType.number,
|
||||
decoration: textFormFieldDecoration(Icons.phone,'Enter MobileNumber'),
|
||||
|
||||
),
|
||||
),
|
||||
SizedBox(height:MediaQuery.of(context).size.height * .02,),
|
||||
Container(
|
||||
child: Text('Or',style: TextStyle(color: primaryColor,fontWeight: FontWeight.bold,fontSize: 20),),
|
||||
),
|
||||
SizedBox(height:MediaQuery.of(context).size.height * .02,),
|
||||
TextButton(
|
||||
child: const Text(
|
||||
'Select from contacts',
|
||||
style: TextStyle(decoration: TextDecoration.underline,color: primaryColor,fontSize: 20),
|
||||
),
|
||||
onPressed: () async{
|
||||
Contact? contact = await _contactPicker.selectContact();
|
||||
setState(() {
|
||||
_contact = contact;
|
||||
});
|
||||
},
|
||||
)
|
||||
],
|
||||
)
|
||||
)))));
|
||||
}
|
||||
}
|
@ -0,0 +1,214 @@
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:healthcare_user/common/settings.dart';
|
||||
import 'package:google_maps_flutter_android/google_maps_flutter_android.dart';
|
||||
import 'package:google_maps_flutter_platform_interface/google_maps_flutter_platform_interface.dart';
|
||||
import 'package:location/location.dart' as locationmap;
|
||||
import '../google_maps_place_picker_mb/src/models/pick_result.dart';
|
||||
import '../google_maps_place_picker_mb/src/place_picker.dart';
|
||||
import 'package:google_maps_flutter/google_maps_flutter.dart';
|
||||
import 'package:healthcare_user/google_maps_place_picker_mb/google_maps_place_picker.dart';
|
||||
import 'package:healthcare_user/keys.dart';
|
||||
|
||||
|
||||
|
||||
class UpdateMyLocation extends StatefulWidget {
|
||||
const UpdateMyLocation({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
State<UpdateMyLocation> createState() => _UpdateMyLocationState();
|
||||
}
|
||||
|
||||
class _UpdateMyLocationState extends State<UpdateMyLocation> {
|
||||
|
||||
PickResult? selectedPlace;
|
||||
bool _mapsInitialized = false;
|
||||
final String _mapsRenderer = "latest";
|
||||
var kInitialPosition = const LatLng(15.462477, 78.717401);
|
||||
locationmap.Location location = locationmap.Location();
|
||||
final GoogleMapsFlutterPlatform mapsImplementation = GoogleMapsFlutterPlatform.instance;
|
||||
double lat=0;
|
||||
double lng=0;
|
||||
|
||||
void initRenderer() {
|
||||
if (_mapsInitialized) return;
|
||||
if (mapsImplementation is GoogleMapsFlutterAndroid) {
|
||||
switch (_mapsRenderer) {
|
||||
case "legacy":
|
||||
(mapsImplementation as GoogleMapsFlutterAndroid)
|
||||
.initializeWithRenderer(AndroidMapRenderer.legacy);
|
||||
break;
|
||||
case "latest":
|
||||
(mapsImplementation as GoogleMapsFlutterAndroid)
|
||||
.initializeWithRenderer(AndroidMapRenderer.latest);
|
||||
break;
|
||||
}
|
||||
}
|
||||
setState(() {
|
||||
_mapsInitialized = true;
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppSettings.appBar('Update My Location'),
|
||||
body: Padding(
|
||||
padding: EdgeInsets.all(10),
|
||||
child: Column(
|
||||
children: [
|
||||
Container(
|
||||
child: Row(
|
||||
children: [
|
||||
Text('Current Location :',style: labelTextStyle(),),
|
||||
SizedBox(width:MediaQuery.of(context).size.width * .02,),
|
||||
Text(AppSettings.userAddress,style:wrapTextStyleBlack(),)
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(height:MediaQuery.of(context).size.height * .04,),
|
||||
Container(
|
||||
width:double.infinity,
|
||||
height: MediaQuery.of(context).size.height * .05,
|
||||
child: ElevatedButton(
|
||||
style: ElevatedButton.styleFrom(
|
||||
primary: buttonColors, // background
|
||||
onPrimary: Colors.black, // foreground
|
||||
),
|
||||
onPressed: () async{
|
||||
|
||||
|
||||
//=============================================================================================
|
||||
|
||||
location.serviceEnabled().then((value) {
|
||||
if (value) {
|
||||
initRenderer();
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) {
|
||||
return PlacePicker(
|
||||
resizeToAvoidBottomInset: false,
|
||||
hintText: "Find a place ...",
|
||||
searchingText: "Please wait ...",
|
||||
selectText: "Select place",
|
||||
outsideOfPickAreaText: "Place not in area",
|
||||
initialPosition: kInitialPosition,
|
||||
useCurrentLocation: true,
|
||||
selectInitialPosition: true,
|
||||
usePinPointingSearch: true,
|
||||
usePlaceDetailSearch: true,
|
||||
zoomGesturesEnabled: true,
|
||||
zoomControlsEnabled: true,
|
||||
onMapCreated: (GoogleMapController controller) {},
|
||||
onPlacePicked: (PickResult result) async {
|
||||
|
||||
|
||||
setState(() {
|
||||
selectedPlace = result;
|
||||
lat=selectedPlace!.geometry!.location.lat;
|
||||
lng=selectedPlace!.geometry!.location.lng;
|
||||
|
||||
|
||||
/*if(selectedPlace!.types!.length==1){
|
||||
userAddressCapturingController.text =
|
||||
selectedPlace!.formattedAddress!;
|
||||
}
|
||||
else{
|
||||
userAddressCapturingController.text =selectedPlace!.name!+', '+selectedPlace!.formattedAddress!;
|
||||
}*/
|
||||
Navigator.of(context).pop();
|
||||
});
|
||||
|
||||
var payload = new Map<String, dynamic>();
|
||||
payload["latitude"] = lat;
|
||||
payload["longitude"] = lng;
|
||||
bool updateStatus = await AppSettings.updateLocation(payload);
|
||||
if(updateStatus){
|
||||
setState(() {
|
||||
if(selectedPlace!.types!.length==1){
|
||||
AppSettings.userAddress =
|
||||
selectedPlace!.formattedAddress!;
|
||||
}
|
||||
else{
|
||||
AppSettings.userAddress=selectedPlace!.name!+', '+selectedPlace!.formattedAddress!;
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
else{
|
||||
AppSettings.longFailedToast(
|
||||
"Failed to update location");
|
||||
}
|
||||
|
||||
},
|
||||
onMapTypeChanged: (MapType mapType) {},
|
||||
apiKey: Platform.isAndroid
|
||||
? APIKeys.androidApiKey
|
||||
: APIKeys.iosApiKey,
|
||||
forceAndroidLocationManager: true,
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
} else {
|
||||
showGeneralDialog(
|
||||
context: context,
|
||||
pageBuilder: (context, x, y) {
|
||||
return Scaffold(
|
||||
backgroundColor: Colors.grey.withOpacity(.5),
|
||||
body: Center(
|
||||
child: Container(
|
||||
width: double.infinity,
|
||||
height: 150,
|
||||
padding:
|
||||
const EdgeInsets.symmetric(horizontal: 20),
|
||||
child: Card(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(10.0),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
const Text(
|
||||
"Please enable the location",
|
||||
style: TextStyle(
|
||||
fontSize:18,
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
ElevatedButton(
|
||||
onPressed: () {
|
||||
Navigator.pop(context);
|
||||
},
|
||||
child: const Text("Cancel"),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
},
|
||||
child: const Text('Update My Location'),
|
||||
)),
|
||||
|
||||
|
||||
|
||||
],
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:healthcare_user/common/settings.dart';
|
||||
|
||||
class UpdatePin extends StatefulWidget {
|
||||
const UpdatePin({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
State<UpdatePin> createState() => _UpdatePinState();
|
||||
}
|
||||
|
||||
class _UpdatePinState extends State<UpdatePin> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppSettings.appBar('Update Pin'),
|
||||
body: Container(),
|
||||
);
|
||||
|
||||
}
|
||||
}
|
Loading…
Reference in new issue