Compare commits
No commits in common. 'master' and 'dev' have entirely different histories.
@ -1,67 +0,0 @@
|
||||
{
|
||||
"project_info": {
|
||||
"project_number": "60196905754",
|
||||
"project_id": "health-pharma-67443",
|
||||
"storage_bucket": "health-pharma-67443.appspot.com"
|
||||
},
|
||||
"client": [
|
||||
{
|
||||
"client_info": {
|
||||
"mobilesdk_app_id": "1:60196905754:android:05ea9ecef5280e578a42a3",
|
||||
"android_client_info": {
|
||||
"package_name": "com.arminta.healthcare_pharmacy"
|
||||
}
|
||||
},
|
||||
"oauth_client": [],
|
||||
"api_key": [
|
||||
{
|
||||
"current_key": "AIzaSyC89L-Xg53Bd_mdCPvKOu7BcC9Ya6UZeds"
|
||||
}
|
||||
],
|
||||
"services": {
|
||||
"appinvite_service": {
|
||||
"other_platform_oauth_client": []
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"client_info": {
|
||||
"mobilesdk_app_id": "1:60196905754:android:44f95d2cea26698a8a42a3",
|
||||
"android_client_info": {
|
||||
"package_name": "com.arminta.healthcare_user"
|
||||
}
|
||||
},
|
||||
"oauth_client": [],
|
||||
"api_key": [
|
||||
{
|
||||
"current_key": "AIzaSyC89L-Xg53Bd_mdCPvKOu7BcC9Ya6UZeds"
|
||||
}
|
||||
],
|
||||
"services": {
|
||||
"appinvite_service": {
|
||||
"other_platform_oauth_client": []
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"client_info": {
|
||||
"mobilesdk_app_id": "1:60196905754:android:a35c084e291315488a42a3",
|
||||
"android_client_info": {
|
||||
"package_name": "com.arminta.healthparma"
|
||||
}
|
||||
},
|
||||
"oauth_client": [],
|
||||
"api_key": [
|
||||
{
|
||||
"current_key": "AIzaSyC89L-Xg53Bd_mdCPvKOu7BcC9Ya6UZeds"
|
||||
}
|
||||
],
|
||||
"services": {
|
||||
"appinvite_service": {
|
||||
"other_platform_oauth_client": []
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"configuration_version": "1"
|
||||
}
|
@ -1,6 +0,0 @@
|
||||
package com.arminta.healthcare_user;
|
||||
|
||||
import io.flutter.embedding.android.FlutterActivity;
|
||||
|
||||
public class MainActivity extends FlutterActivity {
|
||||
}
|
Before Width: | Height: | Size: 2.0 MiB |
Before Width: | Height: | Size: 1.5 MiB |
@ -1,88 +0,0 @@
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:firebase_storage/firebase_storage.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:cloud_firestore/cloud_firestore.dart';
|
||||
import 'chatmessage.dart';
|
||||
|
||||
|
||||
class ChatController extends GetxController {
|
||||
final CollectionReference _messagesCollection =
|
||||
FirebaseFirestore.instance.collection('messages');
|
||||
|
||||
// Observable list of messages
|
||||
RxList<ChatMessage> messages = <ChatMessage>[].obs;
|
||||
|
||||
void sendMessage(String messageContent, String messageType, bool isText) async {
|
||||
try {
|
||||
await _messagesCollection.add({
|
||||
'messageContent': messageContent,
|
||||
'messageType': messageType,
|
||||
'isText': isText,
|
||||
'timestamp': Timestamp.now(),
|
||||
});
|
||||
print("Message sent successfully");
|
||||
} catch (e) {
|
||||
print('Error sending message: $e');
|
||||
}
|
||||
}
|
||||
|
||||
Future<String> uploadImage(File image, String id) async {
|
||||
try {
|
||||
String fileName = DateTime.now().millisecondsSinceEpoch.toString();
|
||||
Reference storageReference =
|
||||
FirebaseStorage.instance.ref().child('products/$fileName');
|
||||
SettableMetadata metadata = SettableMetadata(contentType: 'image/jpeg');
|
||||
UploadTask uploadTask = storageReference.putFile(image, metadata);
|
||||
|
||||
String temporaryMessageId = UniqueKey().toString();
|
||||
messages.add(ChatMessage(
|
||||
messageContent: 'Uploading...',
|
||||
messageType: id,
|
||||
isText: true,
|
||||
temporaryMessageId: temporaryMessageId,
|
||||
));
|
||||
|
||||
TaskSnapshot taskSnapshot = await uploadTask;
|
||||
String downloadURL = await storageReference.getDownloadURL();
|
||||
|
||||
// Replace the temporary message with the uploaded image
|
||||
int index = messages.indexWhere((message) => message.temporaryMessageId == temporaryMessageId);
|
||||
if (index != -1) {
|
||||
messages[index] = ChatMessage(
|
||||
messageContent: downloadURL,
|
||||
messageType: id,
|
||||
isText: false,
|
||||
temporaryMessageId: '',
|
||||
);
|
||||
}
|
||||
|
||||
print('Image uploaded successfully. Download URL: $downloadURL');
|
||||
return downloadURL;
|
||||
} catch (e) {
|
||||
print('Error uploading image: $e');
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
Stream<QuerySnapshot> getMessagesStream() {
|
||||
return _messagesCollection.orderBy('timestamp').snapshots();
|
||||
}
|
||||
|
||||
@override
|
||||
void onInit() {
|
||||
super.onInit();
|
||||
// Listen for changes in the messages collection and update the local list
|
||||
getMessagesStream().listen((QuerySnapshot snapshot) {
|
||||
messages.assignAll(snapshot.docs.map((doc) => ChatMessage(
|
||||
messageContent: doc['messageContent'],
|
||||
messageType: doc['messageType'],
|
||||
isText: doc['isText'],
|
||||
temporaryMessageId: '',
|
||||
)));
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
}
|
@ -1,15 +0,0 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
|
||||
class ChatMessage {
|
||||
String messageContent;
|
||||
String messageType;
|
||||
bool isText;
|
||||
String temporaryMessageId; // New property for temporary message identifier
|
||||
|
||||
ChatMessage({
|
||||
required this.messageContent,
|
||||
required this.messageType,
|
||||
required this.isText,
|
||||
required this.temporaryMessageId, // Include in the constructor
|
||||
});
|
||||
}
|
@ -1,235 +0,0 @@
|
||||
import 'dart:io';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:healthcare_user/chat/chatzoomable_image.dart';
|
||||
import 'package:healthcare_user/common/settings.dart';
|
||||
import 'package:healthcare_user/pages/index.dart';
|
||||
import 'package:image_picker/image_picker.dart';
|
||||
import 'chat_controller.dart';
|
||||
import 'chatmessage.dart';
|
||||
import 'package:photo_view/photo_view.dart';
|
||||
|
||||
class ChatPage extends StatefulWidget {
|
||||
const ChatPage({Key? key});
|
||||
|
||||
@override
|
||||
State<ChatPage> createState() => _ChatPageState();
|
||||
}
|
||||
|
||||
class _ChatPageState extends State<ChatPage> {
|
||||
final ChatController chatController = Get.put(ChatController());
|
||||
final TextEditingController content = TextEditingController();
|
||||
final ImagePicker _picker = ImagePicker();
|
||||
XFile? _image;
|
||||
var id="1";
|
||||
bool _sending = false;
|
||||
final ScrollController _scrollController = ScrollController();
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_scrollToBottom();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
backgroundColor:Colors.green,
|
||||
elevation: 0,
|
||||
automaticallyImplyLeading: false,
|
||||
flexibleSpace: SafeArea(
|
||||
child: Container(
|
||||
padding: EdgeInsets.only(right: 16),
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
IconButton(
|
||||
onPressed: (){
|
||||
Navigator.pop(context);
|
||||
},
|
||||
icon: Icon(Icons.arrow_back,color: Colors.black,),
|
||||
),
|
||||
SizedBox(width: 2,),
|
||||
CircleAvatar(
|
||||
backgroundImage: NetworkImage(AppSettings.profilePictureUrl),
|
||||
maxRadius: 20,
|
||||
),
|
||||
SizedBox(width: 12,),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: <Widget>[
|
||||
Text(AppSettings.userName,style: TextStyle( fontSize: 16 ,fontWeight: FontWeight.w600),),
|
||||
// SizedBox(height: 6,),
|
||||
// Text("Online",style: TextStyle(color: Colors.grey.shade600, fontSize: 13),),
|
||||
],
|
||||
),
|
||||
),
|
||||
/*IconButton(
|
||||
onPressed: () {
|
||||
UrlLauncher.launch("tel://8328206298");
|
||||
},
|
||||
icon: Icon(Icons.call, color: Colors.black),
|
||||
),*/
|
||||
IconButton(
|
||||
onPressed: () {
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) => IndexPage()),
|
||||
);
|
||||
},
|
||||
icon: Icon(Icons.videocam, color: Colors.black),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
body: Stack(
|
||||
children: [
|
||||
Obx(() => ListView.builder(
|
||||
itemCount: chatController.messages.length,
|
||||
shrinkWrap: true,
|
||||
padding: EdgeInsets.only(top: 10, bottom: 80), // Adjust bottom padding to accommodate the input field
|
||||
physics: ScrollPhysics(),
|
||||
controller: _scrollController,
|
||||
itemBuilder: (context, index) {
|
||||
final data = chatController.messages[index];
|
||||
return Container(
|
||||
padding: EdgeInsets.only(
|
||||
left: 14, right: 14, top: 10, bottom: 10),
|
||||
child: Align(
|
||||
alignment: (data.messageType != id ? Alignment.topLeft : Alignment.topRight),
|
||||
child: GestureDetector(
|
||||
onTap: () {
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) => ChatZoomableImage(data.messageContent),
|
||||
),
|
||||
);
|
||||
},
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
color: (data.messageType != id
|
||||
? Colors.grey.shade200
|
||||
: Colors.blue[200]),
|
||||
),
|
||||
padding: EdgeInsets.all(16),
|
||||
child: data.isText
|
||||
? Text(data.messageContent, style: TextStyle(fontSize: 15))
|
||||
: Image.network(
|
||||
data.messageContent,
|
||||
scale: 3,
|
||||
width: 100,
|
||||
height: 100,
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
),
|
||||
);
|
||||
},
|
||||
)),
|
||||
Align(alignment: Alignment.bottomCenter,child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 8.0),
|
||||
child: Container(
|
||||
height: 60,
|
||||
width: double.infinity,
|
||||
color: Colors.white,
|
||||
child: Row(
|
||||
children: <Widget>[
|
||||
GestureDetector(
|
||||
onTap: getImage,
|
||||
child: Container(
|
||||
height: 30,
|
||||
width: 30,
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.lightBlue,
|
||||
borderRadius: BorderRadius.circular(30),
|
||||
),
|
||||
child: Icon(Icons.add, color: Colors.white, size: 20),
|
||||
),
|
||||
),
|
||||
SizedBox(width: 15),
|
||||
Expanded(
|
||||
child: TextField(
|
||||
controller: content,
|
||||
decoration: InputDecoration(
|
||||
hintText: "Write message...",
|
||||
hintStyle: TextStyle(color: Colors.black54),
|
||||
border: InputBorder.none,
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(width: 15),
|
||||
FloatingActionButton(
|
||||
onPressed: () {
|
||||
sendMessage();
|
||||
},
|
||||
child: Icon(Icons.send, color: Colors.white, size: 18),
|
||||
backgroundColor: Colors.blue,
|
||||
elevation: 0,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),)
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
void _scrollToBottom() {
|
||||
Future.delayed(Duration(milliseconds: 300), () {
|
||||
if (_scrollController.hasClients) {
|
||||
_scrollController.animateTo(
|
||||
_scrollController.position.maxScrollExtent,
|
||||
duration: Duration(milliseconds: 300),
|
||||
curve: Curves.easeInOut,
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Future getImage() async {
|
||||
final XFile? image =
|
||||
await _picker.pickImage(source: ImageSource.gallery);
|
||||
if (image != null) {
|
||||
setState(() {
|
||||
_image = image;
|
||||
});
|
||||
sendMessage(); // Call sendMessage function to send the selected image immediately
|
||||
}
|
||||
}
|
||||
|
||||
void sendMessage() async {
|
||||
String messageContent = content.text.trim();
|
||||
if (messageContent.isNotEmpty || _image != null) {
|
||||
setState(() {
|
||||
_sending = true;
|
||||
});
|
||||
try {
|
||||
if (_image != null) {
|
||||
String imageUrl =
|
||||
await chatController.uploadImage(File(_image!.path),'$id');
|
||||
chatController.sendMessage(imageUrl, '$id', false);
|
||||
_image = null; // Clear the selected image after sending
|
||||
}
|
||||
if (messageContent.isNotEmpty) {
|
||||
chatController.sendMessage(messageContent, '$id', true);
|
||||
content.clear();
|
||||
}
|
||||
} finally {
|
||||
setState(() {
|
||||
_sending = false;
|
||||
});
|
||||
}
|
||||
_scrollToBottom(); // Scroll to the bottom after sending message
|
||||
}
|
||||
}
|
||||
}
|
@ -1,40 +0,0 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:healthcare_user/common/settings.dart';
|
||||
import 'package:photo_view/photo_view.dart';
|
||||
|
||||
class ChatZoomableImage extends StatelessWidget {
|
||||
final String imageUrl;
|
||||
|
||||
ChatZoomableImage(this.imageUrl);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
backgroundColor: primaryColor, // Set the background color
|
||||
title: Text('Preview Image'), // Set the title text
|
||||
actions: [
|
||||
IconButton(
|
||||
icon: Icon(Icons.close),
|
||||
onPressed: () {
|
||||
Navigator.pop(context);
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
body: Center(
|
||||
child: imageUrl.isNotEmpty
|
||||
? PhotoView(
|
||||
imageProvider: NetworkImage(imageUrl),
|
||||
minScale: PhotoViewComputedScale.contained,
|
||||
maxScale: PhotoViewComputedScale.contained * 3.0,
|
||||
)
|
||||
: Image.asset(
|
||||
'images/mobilebg.png', // Path to your default image
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -1,93 +0,0 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:healthcare_user/common/settings.dart';
|
||||
|
||||
class Forgotpassword extends StatefulWidget {
|
||||
@override
|
||||
State<Forgotpassword> createState() => _ForgotpasswordState();
|
||||
}
|
||||
|
||||
class _ForgotpasswordState extends State<Forgotpassword> {
|
||||
TextEditingController emailController = TextEditingController();
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
backgroundColor: primaryColor,
|
||||
body: Stack(children: <Widget>[
|
||||
/*Container(
|
||||
decoration: const BoxDecoration(
|
||||
image: DecorationImage(
|
||||
image: AssetImage("images/backgroundimage.png"),
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
),
|
||||
),*/
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
FocusScope.of(context).requestFocus(new FocusNode());
|
||||
},
|
||||
child: SafeArea(
|
||||
child: SingleChildScrollView(
|
||||
child: Column(children: <Widget>[
|
||||
const SizedBox(
|
||||
height: 50,
|
||||
),
|
||||
Container(
|
||||
child: Image(
|
||||
image: const AssetImage('images/logo.png'),
|
||||
height: MediaQuery.of(context).size.height * .20,
|
||||
)),
|
||||
const SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
Container(
|
||||
padding: const EdgeInsets.all(10),
|
||||
child: const Text(
|
||||
'Enter Your Email Address and we will send a link to reset your password',
|
||||
style: TextStyle(fontSize: 12, color: greyColor),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
padding: const EdgeInsets.all(10),
|
||||
child: TextFormField(
|
||||
cursorColor: greyColor,
|
||||
controller: emailController,
|
||||
decoration: const InputDecoration(
|
||||
prefixIcon: Icon(
|
||||
Icons.email,
|
||||
color: greyColor,
|
||||
),
|
||||
border: OutlineInputBorder(
|
||||
borderSide: BorderSide(color: greyColor)),
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(color: greyColor),
|
||||
),
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(color: greyColor),
|
||||
),
|
||||
labelText: 'Enter email ID',
|
||||
labelStyle: TextStyle(
|
||||
color: greyColor, //<-- SEE HERE
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
Container(
|
||||
width: 400,
|
||||
height: 50,
|
||||
padding: const EdgeInsets.fromLTRB(10, 0, 10, 0),
|
||||
child: ElevatedButton(
|
||||
style: ElevatedButton.styleFrom(
|
||||
primary: primaryColor, // background
|
||||
onPrimary: Colors.white, // foreground
|
||||
),
|
||||
onPressed: () {},
|
||||
child: const Text('Send'),
|
||||
)),
|
||||
])))),
|
||||
]));
|
||||
}
|
||||
}
|
@ -1,269 +0,0 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:healthcare_user/common/login.dart';
|
||||
import 'package:healthcare_user/common/settings.dart';
|
||||
class OtpScreencForgotPassword extends StatefulWidget {
|
||||
const OtpScreencForgotPassword({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
State<OtpScreencForgotPassword> createState() => _OtpScreencForgotPasswordState();
|
||||
}
|
||||
|
||||
class _OtpScreencForgotPasswordState extends State<OtpScreencForgotPassword> {
|
||||
|
||||
final TextEditingController _fieldOne = TextEditingController();
|
||||
final TextEditingController _fieldTwo = TextEditingController();
|
||||
final TextEditingController _fieldThree = TextEditingController();
|
||||
final TextEditingController _fieldFour = TextEditingController();
|
||||
final TextEditingController _fieldFive = TextEditingController();
|
||||
final TextEditingController _fieldSix = TextEditingController();
|
||||
TextEditingController mobileNumberController = TextEditingController();
|
||||
TextEditingController passwordController = TextEditingController();
|
||||
|
||||
bool isTextfieldVisible=true;
|
||||
bool isOtpVisible=false;
|
||||
bool isObscureText=true;
|
||||
|
||||
// This is the entered code
|
||||
// It will be displayed in a Text widget
|
||||
String? _otp;
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
backgroundColor: primaryColor,
|
||||
body: Padding(
|
||||
padding: EdgeInsets.all(10),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
const Text('Phone Number Verification',style: TextStyle(color: Colors.white),),
|
||||
SizedBox(
|
||||
height:MediaQuery.of(context).size.height * .02,
|
||||
),
|
||||
|
||||
Visibility(
|
||||
visible: isTextfieldVisible,
|
||||
child: Container(
|
||||
child: TextFormField(
|
||||
cursorColor: Colors.white,
|
||||
style: TextStyle(color: Colors.white),
|
||||
controller: mobileNumberController,
|
||||
keyboardType: TextInputType.number,
|
||||
decoration: textFormFieldDecoration(Icons.phone,'Enter MobileNumber'),
|
||||
),
|
||||
),),
|
||||
const SizedBox(
|
||||
height: 30,
|
||||
),
|
||||
Visibility(
|
||||
visible: isTextfieldVisible,
|
||||
child: 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 {
|
||||
|
||||
|
||||
if(mobileNumberController.text.length>=10){
|
||||
var payload = new Map<String, dynamic>();
|
||||
payload["phone"] = mobileNumberController.text.toString();
|
||||
|
||||
bool forgotPwd = await AppSettings.forgotPassword(payload);
|
||||
|
||||
if(forgotPwd){
|
||||
setState(() {
|
||||
isTextfieldVisible=false;
|
||||
isOtpVisible=true;
|
||||
});
|
||||
|
||||
}
|
||||
else{
|
||||
AppSettings.longFailedToast('Please enter valid registered mobile number');
|
||||
}
|
||||
|
||||
}
|
||||
else{
|
||||
AppSettings.longFailedToast('Please enter 10 digits of mobile number');
|
||||
}
|
||||
|
||||
},
|
||||
child: const Text('Submit')),
|
||||
),),
|
||||
// Implement 4 input fields
|
||||
Visibility(
|
||||
visible:isOtpVisible,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
children: [
|
||||
OtpInput(_fieldOne, true), // auto focus
|
||||
OtpInput(_fieldTwo, false),
|
||||
OtpInput(_fieldThree, false),
|
||||
OtpInput(_fieldFour, false),
|
||||
OtpInput(_fieldFive, false),
|
||||
OtpInput(_fieldSix, false),
|
||||
],
|
||||
),),
|
||||
const SizedBox(
|
||||
height: 30,
|
||||
),
|
||||
Visibility(
|
||||
visible: isOtpVisible,
|
||||
child: Container(
|
||||
padding: const EdgeInsets.fromLTRB(10, 10, 10, 0),
|
||||
child: TextFormField(
|
||||
cursorColor: Colors.white,
|
||||
style: TextStyle(color: Colors.white),
|
||||
obscureText: isObscureText,
|
||||
controller: passwordController,
|
||||
decoration: InputDecoration(
|
||||
filled: true,
|
||||
fillColor: primaryColor,
|
||||
labelText: 'Password',
|
||||
prefixIcon: const Icon(Icons.password, color: Colors.white,),
|
||||
labelStyle: const TextStyle(
|
||||
color: Colors.white, //<-- SEE HERE
|
||||
),
|
||||
border: const OutlineInputBorder(
|
||||
borderSide: BorderSide(color: Colors.white)),
|
||||
focusedBorder: const OutlineInputBorder(
|
||||
borderSide: BorderSide(color: Colors.white),
|
||||
),
|
||||
enabledBorder: const OutlineInputBorder(
|
||||
borderSide: BorderSide(color: Colors.white),
|
||||
),
|
||||
suffixIcon: IconButton(
|
||||
icon: Icon(
|
||||
Icons.visibility_off_outlined,
|
||||
color: isObscureText==true?buttonColors:Colors.white,
|
||||
),
|
||||
onPressed: () {
|
||||
|
||||
print("show password");
|
||||
setState(() {
|
||||
isObscureText = !isObscureText;
|
||||
});
|
||||
},
|
||||
),
|
||||
|
||||
),
|
||||
|
||||
),
|
||||
),),
|
||||
const SizedBox(
|
||||
height: 30,
|
||||
),
|
||||
Visibility(
|
||||
visible: isOtpVisible,
|
||||
child: 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 {
|
||||
setState(() {
|
||||
_otp = _fieldOne.text +
|
||||
_fieldTwo.text +
|
||||
_fieldThree.text +
|
||||
_fieldFour.text+
|
||||
_fieldFive.text +
|
||||
_fieldSix.text;
|
||||
});
|
||||
|
||||
if (_otp!.length == 6&&passwordController.text!='') {
|
||||
AppSettings.preLoaderDialog(context);
|
||||
|
||||
bool isOnline = await AppSettings.internetConnectivity();
|
||||
|
||||
if(isOnline){
|
||||
var payload = new Map<String, dynamic>();
|
||||
payload["phone"] = mobileNumberController.text.toString();
|
||||
payload["resetPasswordCode"] = _otp.toString();
|
||||
payload["newPassword"] = passwordController.text.toString();
|
||||
|
||||
bool signinStatus = await AppSettings.resetPassword(payload);
|
||||
try{
|
||||
if (signinStatus) {
|
||||
Navigator.of(context,rootNavigator: true).pop();
|
||||
await Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(builder: (context) => Login()),
|
||||
);
|
||||
AppSettings.longSuccessToast("Password reset successfully");
|
||||
|
||||
} else {
|
||||
Navigator.of(context,rootNavigator: true).pop();
|
||||
AppSettings.longFailedToast("Please enter valid details");
|
||||
}
|
||||
}
|
||||
catch(exception){
|
||||
Navigator.of(context,rootNavigator: true).pop();
|
||||
print(exception);
|
||||
}
|
||||
}
|
||||
else{
|
||||
Navigator.of(context,rootNavigator: true).pop();
|
||||
AppSettings.longFailedToast("Please Check internet");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
else{
|
||||
|
||||
AppSettings.longFailedToast("Please enter valid details");
|
||||
}
|
||||
},
|
||||
child: const Text('Submit')),
|
||||
)
|
||||
)
|
||||
],
|
||||
),
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// Create an input widget that takes only one digit
|
||||
class OtpInput extends StatelessWidget {
|
||||
final TextEditingController controller;
|
||||
final bool autoFocus;
|
||||
const OtpInput(this.controller, this.autoFocus, {Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return SizedBox(
|
||||
height: 60,
|
||||
width: 50,
|
||||
child: TextField(
|
||||
autofocus: autoFocus,
|
||||
textAlign: TextAlign.center,
|
||||
keyboardType: TextInputType.number,
|
||||
controller: controller,
|
||||
maxLength: 1,
|
||||
cursorColor: Colors.black,
|
||||
decoration: const InputDecoration(
|
||||
filled: true,
|
||||
fillColor: Colors.white,
|
||||
border: OutlineInputBorder(borderSide: BorderSide(color: primaryColor)),
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(color: primaryColor),
|
||||
),
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(color: primaryColor),
|
||||
),
|
||||
counterText: '',
|
||||
hintStyle: TextStyle(color: Colors.black, fontSize: 20.0)),
|
||||
onChanged: (value) {
|
||||
if (value.length == 1) {
|
||||
FocusScope.of(context).nextFocus();
|
||||
}
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
@ -1,124 +0,0 @@
|
||||
import 'dart:convert';
|
||||
import 'dart:io';
|
||||
import 'dart:ui';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/rendering.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:healthcare_user/common/settings.dart';
|
||||
import 'package:flutter_share/flutter_share.dart';
|
||||
import 'package:share/share.dart';
|
||||
import 'dart:typed_data';
|
||||
import 'package:path_provider/path_provider.dart';
|
||||
import 'package:http/http.dart' as http;
|
||||
import 'package:qr_flutter/qr_flutter.dart';
|
||||
|
||||
|
||||
|
||||
class DisplayQrCode extends StatefulWidget {
|
||||
const DisplayQrCode({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
State<DisplayQrCode> createState() => _DisplayQrCodeState();
|
||||
}
|
||||
|
||||
class _DisplayQrCodeState extends State<DisplayQrCode> {
|
||||
|
||||
|
||||
|
||||
Future<void> share(var qr) async {
|
||||
await FlutterShare.share(
|
||||
title: 'Example share',
|
||||
text: 'Example share text',
|
||||
linkUrl: qr,
|
||||
chooserTitle: 'Example Chooser Title');
|
||||
}
|
||||
|
||||
Future<void> shareQRCodeImage1(qrData) async {
|
||||
|
||||
final tempDir = await getTemporaryDirectory();
|
||||
final file = File('${tempDir.path}/qr_code.png');
|
||||
await file.writeAsBytes(Uint8List.fromList(base64.decode(qrData)));
|
||||
|
||||
// Share the image using the share package
|
||||
Share.shareFiles([file.path], text: 'Check out this QR code');
|
||||
|
||||
}
|
||||
|
||||
String imagePath = '';
|
||||
|
||||
Future<void> downloadQRImage() async {
|
||||
final response = await http.get(Uri.parse(AppSettings.qrCode));
|
||||
|
||||
if (response.statusCode == 200) {
|
||||
final directory = await getApplicationDocumentsDirectory();
|
||||
final filePath = '${directory.path}/qr_image.png';
|
||||
|
||||
final File file = File(filePath);
|
||||
await file.writeAsBytes(response.bodyBytes);
|
||||
|
||||
setState(() {
|
||||
imagePath = filePath;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppSettings.appBar('Qr Code'),
|
||||
body: Container(
|
||||
child: Padding(padding: EdgeInsets.all(10),
|
||||
child: Column(
|
||||
children: [
|
||||
Center(
|
||||
child: Container(
|
||||
padding: EdgeInsets.fromLTRB(0, 20, 0, 0),
|
||||
width: MediaQuery.of(context).size.width * .60, // Set the desired width
|
||||
height: MediaQuery.of(context).size.height * .35, // Set the desired height
|
||||
child:
|
||||
Image.memory(Uint8List.fromList(base64.decode(AppSettings.qrCode),),
|
||||
fit: BoxFit.fill),
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height:MediaQuery.of(context).size.height * .05,
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
IconButton(
|
||||
onPressed: () {
|
||||
//share(AppSettings.qrCode);
|
||||
shareQRCodeImage1(AppSettings.qrCode);
|
||||
},
|
||||
icon: Icon(
|
||||
Icons.share,
|
||||
color: primaryColor,
|
||||
size: 40,
|
||||
),
|
||||
),
|
||||
/*IconButton(
|
||||
onPressed: () {
|
||||
downloadQRImage();
|
||||
},
|
||||
icon: Icon(
|
||||
Icons.download,
|
||||
color: primaryColor,
|
||||
size: 40,
|
||||
),
|
||||
),*/
|
||||
],
|
||||
)
|
||||
/*Container(
|
||||
padding: EdgeInsets.fromLTRB(0, 20, 0, 0),
|
||||
child: Center(child: Image.memory(Uint8List.fromList(base64.decode(AppSettings.qrCode),),),),
|
||||
)*/
|
||||
|
||||
],
|
||||
),),
|
||||
),
|
||||
);
|
||||
|
||||
}
|
||||
}
|
@ -1,35 +0,0 @@
|
||||
|
||||
|
||||
class CartItemsModel {
|
||||
String medicine_name='';
|
||||
String quantity='';
|
||||
String price='';
|
||||
List items=[];
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
CartItemsModel();
|
||||
|
||||
factory CartItemsModel.fromJson(Map<String, dynamic> json){
|
||||
CartItemsModel rtvm = new CartItemsModel();
|
||||
|
||||
//rtvm.items=json['items']??[];
|
||||
rtvm.medicine_name = json['medicinename']?? '';
|
||||
rtvm.quantity =json['quantity'].toString()?? '';
|
||||
rtvm.price = json['price'].toString()?? '';
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
return rtvm;
|
||||
}
|
||||
|
||||
}
|
@ -1,26 +0,0 @@
|
||||
class DynamicCodeModel {
|
||||
String doctorId = '';
|
||||
String dynamicCode = '';
|
||||
String recordId = '';
|
||||
String requestedDoctor = '';
|
||||
String problemDoctorName = '';
|
||||
String problem = '';
|
||||
String problemCategory = '';
|
||||
|
||||
DynamicCodeModel();
|
||||
|
||||
factory DynamicCodeModel.fromJson(Map<String, dynamic> json){
|
||||
DynamicCodeModel rtvm = new DynamicCodeModel();
|
||||
|
||||
rtvm.doctorId = json['doctorId'] ?? '';
|
||||
rtvm.dynamicCode= json['dynamicCode']??'';
|
||||
rtvm.requestedDoctor=json['doctorDetails']['doctorName']??'';
|
||||
rtvm.problem=json['recordDetails']['problem']??'';
|
||||
rtvm.problemDoctorName=json['recordDetails']['doctorName']??'';
|
||||
rtvm.problemCategory=json['recordDetails']['problemCategory']??'';
|
||||
rtvm.recordId= json['recordDetails']['recordId']??'';
|
||||
|
||||
return rtvm;
|
||||
}
|
||||
|
||||
}
|
@ -1,32 +0,0 @@
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
class GetAllOffersModel {
|
||||
String description='';
|
||||
String name='';
|
||||
String code='';
|
||||
String category='';
|
||||
String startDate='';
|
||||
String endDate='';
|
||||
String picture='';
|
||||
String pharmacy_id='';
|
||||
bool isChecked=false;
|
||||
|
||||
|
||||
|
||||
|
||||
GetAllOffersModel();
|
||||
|
||||
factory GetAllOffersModel.fromJson(Map<String, dynamic> json){
|
||||
GetAllOffersModel rtvm = new GetAllOffersModel();
|
||||
rtvm.description = json['description'] ?? '';
|
||||
rtvm.name = json['offer_name'] ?? '';
|
||||
rtvm.code = json['offer_code'] ?? '';
|
||||
rtvm.category = json['category'] ?? '';
|
||||
rtvm.startDate = json['starting_date'] ?? '';
|
||||
rtvm.endDate = json['ending_date'] ?? '';
|
||||
rtvm.picture = json['picture'][0]['url'] ?? '';
|
||||
|
||||
return rtvm;
|
||||
}
|
||||
|
||||
}
|
@ -1,38 +0,0 @@
|
||||
|
||||
|
||||
class GetAllQuotationsModel {
|
||||
String bookingId='';
|
||||
String pharmacyId='';
|
||||
String pharmacyName='';
|
||||
String pharmacyContactNumber='';
|
||||
String pharmacy_address='';
|
||||
List prescriptionImages=[];
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
GetAllQuotationsModel();
|
||||
|
||||
factory GetAllQuotationsModel.fromJson(Map<String, dynamic> json){
|
||||
GetAllQuotationsModel rtvm = new GetAllQuotationsModel();
|
||||
rtvm.bookingId = json['bookingId'] ?? '';
|
||||
rtvm.pharmacyId = json['pharmacyId'] ?? '';
|
||||
if(json['pharmacyInfo']!=null){
|
||||
rtvm.pharmacyName = json['pharmacyInfo']['pharmacyname'] ?? '';
|
||||
rtvm.pharmacyContactNumber = json['pharmacyInfo']['profile']['contactNumber'] ?? '';
|
||||
rtvm.pharmacy_address = json['pharmacyInfo']['profile']['pharmacy_address'] ?? '';
|
||||
}
|
||||
else{
|
||||
rtvm.pharmacyName = '';
|
||||
rtvm.pharmacyContactNumber = '';
|
||||
rtvm.pharmacy_address ='';
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
return rtvm;
|
||||
}
|
||||
|
||||
}
|
@ -1,30 +0,0 @@
|
||||
|
||||
|
||||
class GetConnectedDoctorsModel {
|
||||
String doctor_name='';
|
||||
String doctor_id='';
|
||||
String specialization='';
|
||||
String qualification='';
|
||||
String practiceplace1='';
|
||||
String practiceplace2='';
|
||||
String practiceplace3='';
|
||||
String hospital_name='';
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
GetConnectedDoctorsModel();
|
||||
|
||||
factory GetConnectedDoctorsModel.fromJson(Map<String, dynamic> json){
|
||||
GetConnectedDoctorsModel rtvm = new GetConnectedDoctorsModel();
|
||||
rtvm.doctor_name = json['doctorName'] ?? '';
|
||||
rtvm.specialization = json['specialization'] ?? '';
|
||||
rtvm.qualification = json['qualification'] ?? '';
|
||||
rtvm.doctor_id = json['doctorId'] ?? '';
|
||||
rtvm.hospital_name = json['placeOfPractice'][0]['hospitalName'] ?? '';
|
||||
|
||||
return rtvm;
|
||||
}
|
||||
|
||||
}
|
@ -1,79 +0,0 @@
|
||||
import 'dart:convert';
|
||||
|
||||
List<GetOffersDetailsModel> listdadFromJson(String str) => List<GetOffersDetailsModel >.from(json.decode(str).map((x) => GetOffersDetailsModel .fromJson(x)));
|
||||
|
||||
String listdadToJson(List<GetOffersDetailsModel > data) => json.encode(List<dynamic>.from(data.map((x) => x.toJson())));
|
||||
|
||||
class GetOffersDetailsModel {
|
||||
String ? description;
|
||||
String ? starting_date;
|
||||
String ? ending_date;
|
||||
String ? offer_code;
|
||||
List<Picture> picture;
|
||||
String ? offer_name;
|
||||
String ? category;
|
||||
String ? pharmacyId;
|
||||
String request_status='';
|
||||
|
||||
|
||||
GetOffersDetailsModel ({
|
||||
required this.description,
|
||||
required this.starting_date,
|
||||
required this.ending_date,
|
||||
required this.offer_code,
|
||||
required this.picture,
|
||||
required this.offer_name ,
|
||||
required this.category ,
|
||||
required this.pharmacyId ,
|
||||
required this.request_status ,
|
||||
});
|
||||
|
||||
factory GetOffersDetailsModel .fromJson(Map<String, dynamic> json) => GetOffersDetailsModel (
|
||||
description: json["description"],
|
||||
starting_date: json["starting_date"],
|
||||
ending_date: json["ending_date"],
|
||||
offer_code: json["offer_code"],
|
||||
category: json["category"],
|
||||
|
||||
picture: List<Picture>.from(json["picture"].map((x) => Picture.fromJson(x))),
|
||||
offer_name : json["offer_name"],
|
||||
pharmacyId : json["pharmacyId"],
|
||||
request_status : json["request_status"],
|
||||
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
"description": description,
|
||||
"starting_date": starting_date,
|
||||
"ending_date": ending_date,
|
||||
"offer_code": offer_code,
|
||||
"picture": List<dynamic>.from(picture.map((x) => x.toJson())),
|
||||
"offer_name": offer_name,
|
||||
"category": category,
|
||||
"pharmacyId": pharmacyId,
|
||||
"request_status": request_status,
|
||||
|
||||
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
class Picture {
|
||||
String id;
|
||||
String url;
|
||||
|
||||
Picture({
|
||||
required this.id,
|
||||
required this.url,
|
||||
});
|
||||
|
||||
factory Picture.fromJson(Map<String, dynamic> json) => Picture(
|
||||
id: json["_id"],
|
||||
url: json["url"],
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
"_id": id,
|
||||
"url": url,
|
||||
};
|
||||
}
|
@ -1,616 +0,0 @@
|
||||
import 'dart:convert';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:healthcare_user/common/settings.dart';
|
||||
import 'package:flutter_barcode_scanner/flutter_barcode_scanner.dart';
|
||||
|
||||
class AddDoctor extends StatefulWidget {
|
||||
const AddDoctor({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
State<AddDoctor> createState() => _AddDoctorState();
|
||||
}
|
||||
|
||||
class _AddDoctorState extends State<AddDoctor> {
|
||||
bool isPwdObscureText=true;
|
||||
TextEditingController doctorIdController = TextEditingController();
|
||||
bool isFirstAddButtonShow=false;
|
||||
bool isSecondAddButtonShow=false;
|
||||
bool is2ndPlaceOfPracticeControllerVisible=false;
|
||||
bool is3rdPlaceOfPracticeControllerVisible=false;
|
||||
bool isConfirmPwdObscureText=true;
|
||||
TextEditingController nameController = TextEditingController();
|
||||
TextEditingController mobileNumberController = TextEditingController();
|
||||
TextEditingController emailController = TextEditingController();
|
||||
/*TextEditingController ageController = TextEditingController();*/
|
||||
TextEditingController specializationController = TextEditingController();
|
||||
TextEditingController qualificationController = TextEditingController();
|
||||
TextEditingController hospitalNameController1 = TextEditingController();
|
||||
TextEditingController hospitalNameController2 = TextEditingController();
|
||||
TextEditingController hospitalNameController3 = TextEditingController();
|
||||
TextEditingController practiceAddressController1 = TextEditingController();
|
||||
TextEditingController practiceAddressController2 = TextEditingController();
|
||||
TextEditingController practiceAddressController3 = TextEditingController();
|
||||
String? gender;
|
||||
List placeOfPractices=[];
|
||||
final GlobalKey qrKey = GlobalKey(debugLabel: 'QR');
|
||||
bool isQrScannerVisible=false;
|
||||
String doctorId='';
|
||||
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
|
||||
super.initState();
|
||||
}
|
||||
|
||||
|
||||
|
||||
Future<void> scanQR() async {
|
||||
String barcodeScanRes;
|
||||
// Platform messages may fail, so we use a try/catch PlatformException.
|
||||
try {
|
||||
barcodeScanRes = await FlutterBarcodeScanner.scanBarcode(
|
||||
'#ff6666', 'Cancel', true, ScanMode.QR);
|
||||
print(barcodeScanRes);
|
||||
setState(() {
|
||||
doctorId=jsonDecode(barcodeScanRes)['doctorId'];
|
||||
doctorIdController.text=doctorId;
|
||||
});
|
||||
} on PlatformException {
|
||||
barcodeScanRes = 'Failed to get platform version.';
|
||||
}}
|
||||
|
||||
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
||||
return Scaffold(
|
||||
appBar:AppSettings.appBar('Add Doctor'),
|
||||
body: Stack(children: <Widget>[
|
||||
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
FocusScope.of(context).requestFocus(new FocusNode());
|
||||
},
|
||||
child: SafeArea(
|
||||
child: SingleChildScrollView(
|
||||
child: Padding(
|
||||
padding: EdgeInsets.all(10),
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
SizedBox(
|
||||
height:MediaQuery.of(context).size.height * .02,
|
||||
),
|
||||
Container(
|
||||
|
||||
child: Column(
|
||||
children: [
|
||||
IconButton(
|
||||
onPressed: (){
|
||||
scanQR();
|
||||
},
|
||||
icon: Icon(
|
||||
Icons.qr_code_scanner,
|
||||
color: primaryColor,
|
||||
),
|
||||
),
|
||||
Text('Scan Qr Code',style: TextStyle(fontSize: 12,color: secondaryColor),)
|
||||
],
|
||||
)
|
||||
),
|
||||
|
||||
SizedBox(height:MediaQuery.of(context).size.height * .02,),
|
||||
Container(
|
||||
child: TextFormField(
|
||||
cursorColor: greyColor,
|
||||
controller: doctorIdController,
|
||||
textCapitalization: TextCapitalization.characters,
|
||||
decoration: const InputDecoration(
|
||||
prefixIcon: Icon(
|
||||
Icons.person,
|
||||
color: greyColor,
|
||||
),
|
||||
border: OutlineInputBorder(
|
||||
borderSide: BorderSide(color: greyColor)),
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(color: greyColor),
|
||||
),
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(color: greyColor),
|
||||
),
|
||||
labelText: 'Doctor Id',
|
||||
labelStyle: TextStyle(
|
||||
color: greyColor, //<-- SEE HERE
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(height:MediaQuery.of(context).size.height * .02,),
|
||||
Container(
|
||||
child: TextFormField(
|
||||
cursorColor: greyColor,
|
||||
controller: nameController,
|
||||
textCapitalization: TextCapitalization.words,
|
||||
decoration: const InputDecoration(
|
||||
prefixIcon: Icon(
|
||||
Icons.person,
|
||||
color: greyColor,
|
||||
),
|
||||
border: OutlineInputBorder(
|
||||
borderSide: BorderSide(color: greyColor)),
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(color: greyColor),
|
||||
),
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(color: greyColor),
|
||||
),
|
||||
labelText: 'DoctorName',
|
||||
labelStyle: TextStyle(
|
||||
color: greyColor, //<-- SEE HERE
|
||||
),
|
||||
),
|
||||
),
|
||||
),//name
|
||||
SizedBox(height:MediaQuery.of(context).size.height * .02,),
|
||||
Container(
|
||||
child: TextFormField(
|
||||
cursorColor: greyColor,
|
||||
controller: mobileNumberController,
|
||||
keyboardType: TextInputType.number,
|
||||
decoration: const InputDecoration(
|
||||
prefixIcon: Icon(
|
||||
Icons.phone_android,
|
||||
color: greyColor,
|
||||
),
|
||||
border: OutlineInputBorder(
|
||||
borderSide: BorderSide(color: greyColor)),
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(color: greyColor),
|
||||
),
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(color: greyColor),
|
||||
),
|
||||
labelText: 'Enter Mobile Number',
|
||||
labelStyle: TextStyle(
|
||||
color: greyColor, //<-- SEE HERE
|
||||
),
|
||||
),
|
||||
),
|
||||
), //mobile
|
||||
/*SizedBox(height:MediaQuery.of(context).size.height * .02,),
|
||||
Container(
|
||||
child: TextFormField(
|
||||
cursorColor: greyColor,
|
||||
controller: ageController,
|
||||
keyboardType: TextInputType.number,
|
||||
decoration: const InputDecoration(
|
||||
prefixIcon: Icon(
|
||||
Icons.person,
|
||||
color: greyColor,
|
||||
),
|
||||
border: OutlineInputBorder(
|
||||
borderSide: BorderSide(color: greyColor)),
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(color: greyColor),
|
||||
),
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(color: greyColor),
|
||||
),
|
||||
labelText: 'Enter age',
|
||||
labelStyle: TextStyle(
|
||||
color: greyColor, //<-- SEE HERE
|
||||
),
|
||||
),
|
||||
),
|
||||
),*/
|
||||
SizedBox(height:MediaQuery.of(context).size.height * .02,),
|
||||
Text('Select Gender',style: TextStyle(color: primaryColor,fontSize: 14,fontWeight: FontWeight.bold),),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
|
||||
Expanded(child: RadioListTile(
|
||||
title: Text("Male",style: TextStyle(color: primaryColor,fontSize: 11)),
|
||||
value: "male",
|
||||
groupValue: gender,
|
||||
activeColor: primaryColor,
|
||||
onChanged: (value){
|
||||
setState(() {
|
||||
gender = value.toString();
|
||||
});
|
||||
},
|
||||
),),
|
||||
Expanded(child: RadioListTile(
|
||||
title: Text("Female",style:TextStyle(color: primaryColor,fontSize: 11)),
|
||||
value: "female",
|
||||
groupValue: gender,
|
||||
activeColor: primaryColor,
|
||||
onChanged: (value){
|
||||
setState(() {
|
||||
gender = value.toString();
|
||||
});
|
||||
},
|
||||
),),
|
||||
Expanded(child: RadioListTile(
|
||||
title: Text("Others",style: TextStyle(color: primaryColor,fontSize: 11)),
|
||||
value: "other",
|
||||
groupValue: gender,
|
||||
activeColor: primaryColor,
|
||||
|
||||
onChanged: (value){
|
||||
setState(() {
|
||||
gender = value.toString();
|
||||
});
|
||||
},
|
||||
),),
|
||||
],
|
||||
),
|
||||
SizedBox(height:MediaQuery.of(context).size.height * .02,),
|
||||
Container(
|
||||
child: TextFormField(
|
||||
cursorColor: greyColor,
|
||||
controller: qualificationController,
|
||||
textCapitalization: TextCapitalization.words,
|
||||
decoration: const InputDecoration(
|
||||
prefixIcon: Icon(
|
||||
Icons.quickreply,
|
||||
color: greyColor,
|
||||
),
|
||||
border: OutlineInputBorder(
|
||||
borderSide: BorderSide(color: greyColor)),
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(color: greyColor),
|
||||
),
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(color: greyColor),
|
||||
),
|
||||
labelText: 'Enter qualifications',
|
||||
labelStyle: TextStyle(
|
||||
color: greyColor, //<-- SEE HERE
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(height:MediaQuery.of(context).size.height * .02,),
|
||||
Container(
|
||||
child: TextFormField(
|
||||
cursorColor: greyColor,
|
||||
controller: specializationController,
|
||||
textCapitalization: TextCapitalization.words,
|
||||
decoration: const InputDecoration(
|
||||
prefixIcon: Icon(
|
||||
Icons.folder_special,
|
||||
color: greyColor,
|
||||
),
|
||||
border: OutlineInputBorder(
|
||||
borderSide: BorderSide(color: greyColor)),
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(color: greyColor),
|
||||
),
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(color: greyColor),
|
||||
),
|
||||
labelText: 'Enter specializations',
|
||||
labelStyle: TextStyle(
|
||||
color: greyColor, //<-- SEE HERE
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(height:MediaQuery.of(context).size.height * .02,),
|
||||
Text('Place of practice',style: TextStyle(color: primaryColor,fontSize: 14,fontWeight: FontWeight.bold),),
|
||||
SizedBox(height:MediaQuery.of(context).size.height * .02,),
|
||||
Container(
|
||||
width: double.infinity,
|
||||
decoration: BoxDecoration(
|
||||
color: secondaryColor,
|
||||
border: Border.all(
|
||||
//width: 10,
|
||||
color: Colors.white,
|
||||
),
|
||||
borderRadius: BorderRadius.circular(
|
||||
20,
|
||||
)),
|
||||
child: Padding(
|
||||
padding: EdgeInsets.all(10),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
children: [
|
||||
TextFormField(
|
||||
cursorColor: greyColor,
|
||||
controller: hospitalNameController1,
|
||||
textCapitalization: TextCapitalization.words,
|
||||
decoration: const InputDecoration(
|
||||
prefixIcon: Icon(
|
||||
Icons.location_city,
|
||||
color: greyColor,
|
||||
),
|
||||
border: OutlineInputBorder(
|
||||
borderSide: BorderSide(color: greyColor)),
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(color: greyColor),
|
||||
),
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(color: greyColor),
|
||||
),
|
||||
labelText: 'Enter hospital name',
|
||||
labelStyle: TextStyle(
|
||||
color: greyColor, //<-- SEE HERE
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(height:MediaQuery.of(context).size.height * .02,),
|
||||
TextFormField(
|
||||
cursorColor: greyColor,
|
||||
controller: practiceAddressController1,
|
||||
textCapitalization: TextCapitalization.words,
|
||||
decoration: const InputDecoration(
|
||||
prefixIcon: Icon(
|
||||
Icons.location_on,
|
||||
color: greyColor,
|
||||
),
|
||||
border: OutlineInputBorder(
|
||||
borderSide: BorderSide(color: greyColor)),
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(color: greyColor),
|
||||
),
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(color: greyColor),
|
||||
),
|
||||
labelText: 'Enter practice address',
|
||||
labelStyle: TextStyle(
|
||||
color: greyColor, //<-- SEE HERE
|
||||
),
|
||||
),
|
||||
),
|
||||
Visibility(
|
||||
visible: hospitalNameController1.text!='',
|
||||
child: IconButton(
|
||||
onPressed: (){
|
||||
|
||||
setState(() {
|
||||
is2ndPlaceOfPracticeControllerVisible=true;
|
||||
});
|
||||
},
|
||||
icon: Icon(Icons.add_box, color: primaryColor,)))
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(height:MediaQuery.of(context).size.height * .02,),
|
||||
Visibility(
|
||||
visible:hospitalNameController2.text!=''&&hospitalNameController2.text!='null'||is2ndPlaceOfPracticeControllerVisible,
|
||||
child: Container(
|
||||
width: double.infinity,
|
||||
decoration: BoxDecoration(
|
||||
color: secondaryColor,
|
||||
border: Border.all(
|
||||
//width: 10,
|
||||
color: Colors.white,
|
||||
),
|
||||
borderRadius: BorderRadius.circular(
|
||||
20,
|
||||
)),
|
||||
child: Padding(
|
||||
padding: EdgeInsets.all(10),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
children: [
|
||||
TextFormField(
|
||||
cursorColor: greyColor,
|
||||
controller: hospitalNameController2,
|
||||
textCapitalization: TextCapitalization.words,
|
||||
decoration: const InputDecoration(
|
||||
prefixIcon: Icon(
|
||||
Icons.location_city,
|
||||
color: greyColor,
|
||||
),
|
||||
border: OutlineInputBorder(
|
||||
borderSide: BorderSide(color: greyColor)),
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(color: greyColor),
|
||||
),
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(color: greyColor),
|
||||
),
|
||||
labelText: 'Enter hospital name',
|
||||
labelStyle: TextStyle(
|
||||
color: greyColor, //<-- SEE HERE
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(height:MediaQuery.of(context).size.height * .02,),
|
||||
TextFormField(
|
||||
cursorColor: greyColor,
|
||||
controller: practiceAddressController2,
|
||||
textCapitalization: TextCapitalization.words,
|
||||
decoration: const InputDecoration(
|
||||
prefixIcon: Icon(
|
||||
Icons.location_on,
|
||||
color: greyColor,
|
||||
),
|
||||
border: OutlineInputBorder(
|
||||
borderSide: BorderSide(color: greyColor)),
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(color: greyColor),
|
||||
),
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(color: greyColor),
|
||||
),
|
||||
labelText: 'Enter practice place',
|
||||
labelStyle: TextStyle(
|
||||
color: greyColor, //<-- SEE HERE
|
||||
),
|
||||
),
|
||||
),
|
||||
Visibility(
|
||||
visible: hospitalNameController2.text!='',
|
||||
child: IconButton(
|
||||
onPressed: (){
|
||||
|
||||
setState(() {
|
||||
is3rdPlaceOfPracticeControllerVisible=true;
|
||||
});
|
||||
},
|
||||
icon: Icon(Icons.add_box, color: primaryColor,)))
|
||||
],
|
||||
),
|
||||
),
|
||||
),),
|
||||
SizedBox(height:MediaQuery.of(context).size.height * .02,),
|
||||
Visibility(
|
||||
visible: hospitalNameController3.text!=''&&hospitalNameController3.text!='null'||is3rdPlaceOfPracticeControllerVisible,
|
||||
child: Container(
|
||||
width: double.infinity,
|
||||
decoration: BoxDecoration(
|
||||
color: secondaryColor,
|
||||
border: Border.all(
|
||||
//width: 10,
|
||||
color: Colors.white,
|
||||
),
|
||||
borderRadius: BorderRadius.circular(
|
||||
20,
|
||||
)),
|
||||
child: Padding(
|
||||
padding: EdgeInsets.all(10),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
children: [
|
||||
TextFormField(
|
||||
cursorColor: greyColor,
|
||||
controller: hospitalNameController3,
|
||||
textCapitalization: TextCapitalization.words,
|
||||
decoration: const InputDecoration(
|
||||
prefixIcon: Icon(
|
||||
Icons.location_city,
|
||||
color: greyColor,
|
||||
),
|
||||
border: OutlineInputBorder(
|
||||
borderSide: BorderSide(color: greyColor)),
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(color: greyColor),
|
||||
),
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(color: greyColor),
|
||||
),
|
||||
labelText: 'Enter hospital name',
|
||||
labelStyle: TextStyle(
|
||||
color: greyColor, //<-- SEE HERE
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(height:MediaQuery.of(context).size.height * .02,),
|
||||
TextFormField(
|
||||
cursorColor: greyColor,
|
||||
controller: practiceAddressController3,
|
||||
textCapitalization: TextCapitalization.words,
|
||||
onChanged:(val) {
|
||||
|
||||
},
|
||||
decoration: const InputDecoration(
|
||||
prefixIcon: Icon(
|
||||
Icons.location_on,
|
||||
color: greyColor,
|
||||
),
|
||||
border: OutlineInputBorder(
|
||||
borderSide: BorderSide(color: greyColor)),
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(color: greyColor),
|
||||
),
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(color: greyColor),
|
||||
),
|
||||
labelText: 'Enter practice place',
|
||||
labelStyle: TextStyle(
|
||||
color: greyColor, //<-- SEE HERE
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),),
|
||||
SizedBox(height:MediaQuery.of(context).size.height * .02,),
|
||||
SizedBox(height:MediaQuery.of(context).size.height * .02,),
|
||||
Container(
|
||||
width:double.infinity,
|
||||
height: MediaQuery.of(context).size.height * .06,
|
||||
child: ElevatedButton(
|
||||
style: ElevatedButton.styleFrom(
|
||||
primary: primaryColor, // background
|
||||
onPrimary: Colors.white, // foreground
|
||||
),
|
||||
onPressed: () async{
|
||||
if(doctorIdController.text!=''&&nameController.text!=''&&gender!=null){
|
||||
if(hospitalNameController1!=''){
|
||||
placeOfPractices.add({
|
||||
'hospitalName': hospitalNameController1.text,
|
||||
'address': practiceAddressController1.text
|
||||
});
|
||||
}
|
||||
if(hospitalNameController2!=''){
|
||||
placeOfPractices.add({
|
||||
'hospitalName': hospitalNameController2.text,
|
||||
'address': practiceAddressController2.text
|
||||
});
|
||||
}
|
||||
if(hospitalNameController3!=''){
|
||||
placeOfPractices.add({
|
||||
'hospitalName': hospitalNameController3.text,
|
||||
'address': practiceAddressController3.text
|
||||
});
|
||||
}
|
||||
|
||||
int age=0;
|
||||
/*if(ageController.text.toString()!=''||ageController.text.toString()!='null'){
|
||||
age=int.parse(ageController.text.toString());
|
||||
}
|
||||
else{
|
||||
age=0;
|
||||
}*/
|
||||
|
||||
|
||||
AppSettings.preLoaderDialog(context);
|
||||
var payload = new Map<String, dynamic>();
|
||||
|
||||
payload["doctorId"] =doctorIdController.text.toString();
|
||||
payload["doctorName"] = nameController.text.toString();
|
||||
payload["phone"] = mobileNumberController.text.toString();
|
||||
payload["age"] = age;
|
||||
payload["gender"] = gender;
|
||||
payload["specialization"] = specializationController.text;
|
||||
payload["qualification"] =qualificationController.text ;
|
||||
payload["placeOfPractice"] =placeOfPractices ;
|
||||
|
||||
bool status = await AppSettings.addDoctor(payload);
|
||||
if(status){
|
||||
Navigator.of(context,rootNavigator: true).pop();
|
||||
AppSettings.longSuccessToast('Doctor added successfully');
|
||||
Navigator.pop(context);
|
||||
}
|
||||
else{
|
||||
Navigator.of(context,rootNavigator: true).pop();
|
||||
AppSettings.longFailedToast('There is a problem for adding doctor');
|
||||
}
|
||||
}
|
||||
else{
|
||||
AppSettings.longFailedToast('Please enter valid details');
|
||||
}
|
||||
|
||||
},
|
||||
child: Text('Add Doctor'),
|
||||
)
|
||||
),
|
||||
|
||||
|
||||
],
|
||||
),
|
||||
)
|
||||
)),
|
||||
),
|
||||
]));
|
||||
}
|
||||
}
|
@ -1,262 +0,0 @@
|
||||
import 'dart:convert';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:healthcare_user/common/settings.dart';
|
||||
import 'package:healthcare_user/models/get_connected_doctors_model.dart';
|
||||
import 'package:healthcare_user/my_connections/add-doctor.dart';
|
||||
|
||||
class AllConnections extends StatefulWidget {
|
||||
const AllConnections({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
State<AllConnections> createState() => _AllConnectionsState();
|
||||
}
|
||||
|
||||
class _AllConnectionsState extends State<AllConnections>
|
||||
with TickerProviderStateMixin {
|
||||
late TabController _controller;
|
||||
bool isConnectedDoctorsDataLoading=false;
|
||||
bool isSereverIssue=false;
|
||||
|
||||
final List<Tab> topTabs = <Tab>[
|
||||
Tab(
|
||||
child: Text(
|
||||
'Doctors',
|
||||
style: TextStyle(fontSize: 14),
|
||||
)),
|
||||
Tab(
|
||||
child: Text(
|
||||
'Pharmacies',
|
||||
style: TextStyle(fontSize: 14),
|
||||
)),
|
||||
];
|
||||
List<GetConnectedDoctorsModel> connectedDoctorsListOriginal = [];
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
_controller = TabController(vsync: this, length: topTabs.length);
|
||||
getAllConnectedDoctors();
|
||||
super.initState();
|
||||
}
|
||||
|
||||
Future<void> getAllConnectedDoctors() async {
|
||||
isConnectedDoctorsDataLoading=true;
|
||||
try {
|
||||
var response = await AppSettings.getAllConnectedDoctors();
|
||||
|
||||
setState(() {
|
||||
connectedDoctorsListOriginal = ((jsonDecode(response)['doctors']) as List)
|
||||
.map((dynamic model) {
|
||||
return GetConnectedDoctorsModel.fromJson(model);
|
||||
}).toList();
|
||||
connectedDoctorsListOriginal=connectedDoctorsListOriginal.reversed.toList();
|
||||
isConnectedDoctorsDataLoading = false;
|
||||
});
|
||||
} catch (e) {
|
||||
setState(() {
|
||||
isConnectedDoctorsDataLoading = false;
|
||||
isSereverIssue = true;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Widget _doctors(){
|
||||
if(connectedDoctorsListOriginal.length!=0){
|
||||
return ListView.builder(
|
||||
padding: EdgeInsets.all(0),
|
||||
itemCount: connectedDoctorsListOriginal.length,
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
return GestureDetector(
|
||||
onTap: (){
|
||||
|
||||
},
|
||||
child: Card(
|
||||
|
||||
//color: prescriptionsList[index].cardColor,
|
||||
child: Padding(
|
||||
padding:EdgeInsets.all(10) ,
|
||||
child: Row(
|
||||
children: [
|
||||
Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
'Doctor Name',
|
||||
style: labelTextStyle(),
|
||||
),
|
||||
|
||||
SizedBox(height:MediaQuery.of(context).size.height * .01,),
|
||||
Text(
|
||||
'Specialization',
|
||||
style: labelTextStyle(),
|
||||
),
|
||||
SizedBox(height:MediaQuery.of(context).size.height * .01,),
|
||||
Text(
|
||||
'Qualification',
|
||||
style: labelTextStyle(),
|
||||
),
|
||||
SizedBox(height:MediaQuery.of(context).size.height * .01,),
|
||||
Text(
|
||||
'Hospital',
|
||||
style: labelTextStyle(),
|
||||
),
|
||||
|
||||
],
|
||||
),
|
||||
SizedBox(width:MediaQuery.of(context).size.width * .01,),
|
||||
Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
':',
|
||||
style: labelTextStyle(),
|
||||
),
|
||||
SizedBox(height:MediaQuery.of(context).size.height * .01,),
|
||||
Text(
|
||||
':',
|
||||
style: labelTextStyle(),
|
||||
),
|
||||
SizedBox(height:MediaQuery.of(context).size.height * .01,),
|
||||
Text(
|
||||
':',
|
||||
style: labelTextStyle(),
|
||||
),
|
||||
SizedBox(height:MediaQuery.of(context).size.height * .01,),
|
||||
Text(
|
||||
':',
|
||||
style: labelTextStyle(),
|
||||
),
|
||||
|
||||
],
|
||||
),
|
||||
SizedBox(width:MediaQuery.of(context).size.width * .01,),
|
||||
Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(connectedDoctorsListOriginal[index].doctor_name.toString().toUpperCase(),style: valuesTextStyle()),
|
||||
|
||||
SizedBox(height:MediaQuery.of(context).size.height * .01,),
|
||||
Text(
|
||||
connectedDoctorsListOriginal[index].specialization,
|
||||
style: valuesTextStyle(),
|
||||
),
|
||||
SizedBox(height:MediaQuery.of(context).size.height * .01,),
|
||||
Text(
|
||||
connectedDoctorsListOriginal[index].qualification,
|
||||
style: valuesTextStyle(),
|
||||
),
|
||||
SizedBox(height:MediaQuery.of(context).size.height * .01,),
|
||||
Text(
|
||||
connectedDoctorsListOriginal[index].hospital_name,
|
||||
style: valuesTextStyle(),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
});
|
||||
}
|
||||
else{
|
||||
return Center(
|
||||
child: Padding(
|
||||
padding: EdgeInsets.fromLTRB(0, 40, 0, 0),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
SizedBox(height: MediaQuery.of(context).size.height * .25,),
|
||||
Text('Click below icon to add new doctor'),
|
||||
SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
CircleAvatar(
|
||||
backgroundColor: primaryColor,
|
||||
radius: 40,
|
||||
child: IconButton(
|
||||
iconSize: 40,
|
||||
icon: const Icon(
|
||||
Icons.add,
|
||||
color: Colors.white,
|
||||
),
|
||||
onPressed: () async {
|
||||
Navigator.push(context, MaterialPageRoute(builder: (context) => AddDoctor())).then((value) {
|
||||
getAllConnectedDoctors();
|
||||
});
|
||||
},
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Widget _pharmacies(){
|
||||
return Container();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text('My Connections'),
|
||||
backgroundColor: primaryColor,
|
||||
bottom: TabBar(
|
||||
controller: _controller,
|
||||
tabs: topTabs,
|
||||
indicatorColor: buttonColors,
|
||||
unselectedLabelColor: Colors.white60,
|
||||
indicatorWeight: 2,
|
||||
),
|
||||
),
|
||||
body: Container(
|
||||
child: TabBarView(controller: _controller, children: [
|
||||
Padding(padding: EdgeInsets.all(10),
|
||||
child:isConnectedDoctorsDataLoading?Center(
|
||||
child: CircularProgressIndicator(
|
||||
color: primaryColor,
|
||||
strokeWidth: 5.0,
|
||||
),
|
||||
): _doctors(),
|
||||
),
|
||||
Padding(
|
||||
padding: EdgeInsets.all(10),
|
||||
)
|
||||
]),
|
||||
),
|
||||
floatingActionButton: Visibility(
|
||||
visible:connectedDoctorsListOriginal.length!=0,
|
||||
child: CircleAvatar(
|
||||
backgroundColor: buttonColors,
|
||||
radius: 40,
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: <Widget>[
|
||||
IconButton(
|
||||
iconSize: 40,
|
||||
icon: const Icon(
|
||||
Icons.add,
|
||||
color: Colors.black,
|
||||
),
|
||||
onPressed: () async{
|
||||
|
||||
Navigator.push(context, MaterialPageRoute(builder: (context) => AddDoctor())).then((value) {
|
||||
getAllConnectedDoctors();
|
||||
});
|
||||
},
|
||||
),
|
||||
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
@ -1,350 +0,0 @@
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:healthcare_user/common/settings.dart';
|
||||
import 'package:healthcare_user/models/dynamic_code_model.dart';
|
||||
import 'package:pull_to_refresh/pull_to_refresh.dart';
|
||||
|
||||
class DynamicCode extends StatefulWidget {
|
||||
const DynamicCode({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
State<DynamicCode> createState() => _DynamicCodeState();
|
||||
}
|
||||
|
||||
class _DynamicCodeState extends State<DynamicCode> {
|
||||
|
||||
bool isDataLoading=false;
|
||||
bool isSereverIssue = false;
|
||||
List<DynamicCodeModel> originalList = [];
|
||||
RefreshController _refreshController =
|
||||
RefreshController(initialRefresh: true);
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
getAllDynamicCodes();
|
||||
super.initState();
|
||||
}
|
||||
|
||||
Future<void> getAllDynamicCodes() async {
|
||||
isDataLoading=true;
|
||||
try {
|
||||
var response = await AppSettings.getDynamicCode();
|
||||
|
||||
setState(() {
|
||||
originalList = ((jsonDecode(response)) as List)
|
||||
.map((dynamic model) {
|
||||
return DynamicCodeModel.fromJson(model);
|
||||
}).toList();
|
||||
//originalList=originalList.reversed.toList();
|
||||
isDataLoading = false;
|
||||
});
|
||||
} catch (e) {
|
||||
setState(() {
|
||||
isDataLoading = false;
|
||||
isSereverIssue = true;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
void _onRefresh() async{
|
||||
// monitor network fetch
|
||||
await Future.delayed(Duration(milliseconds: 1000));
|
||||
// if failed,use refreshFailed()
|
||||
/*items.remove((items.length-1).toString());
|
||||
if(mounted)
|
||||
setState(() {
|
||||
|
||||
});*/
|
||||
await getAllDynamicCodes();
|
||||
_refreshController.refreshCompleted(
|
||||
resetFooterState: true,
|
||||
);
|
||||
}
|
||||
|
||||
void _onLoading() async{
|
||||
// monitor network fetch
|
||||
await Future.delayed(Duration(milliseconds: 1000));
|
||||
// if failed,use loadFailed(),if no data return,use LoadNodata()
|
||||
_refreshController.loadComplete();
|
||||
}
|
||||
|
||||
Widget _renderUi(){
|
||||
//12. originalList=originalList.reversed.toList();
|
||||
if(originalList.length!=0){
|
||||
return ListView.builder(
|
||||
padding: EdgeInsets.all(0),
|
||||
itemCount: originalList.length,
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
return GestureDetector(
|
||||
onTap: (){
|
||||
|
||||
},
|
||||
child: Card(
|
||||
|
||||
//color: prescriptionsList[index].cardColor,
|
||||
child: Padding(
|
||||
padding:EdgeInsets.all(8) ,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
|
||||
Container(
|
||||
|
||||
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
'Requested Doctor',
|
||||
style: labelTextStyle(),
|
||||
),
|
||||
SizedBox(height:MediaQuery.of(context).size.height * .01,),
|
||||
Text(
|
||||
'Dynamic code',
|
||||
style: labelTextStyle(),
|
||||
),
|
||||
SizedBox(height:MediaQuery.of(context).size.height * .01,),
|
||||
Text(
|
||||
'Record Id',
|
||||
style: labelTextStyle(),
|
||||
),
|
||||
|
||||
],
|
||||
),
|
||||
SizedBox(width:MediaQuery.of(context).size.width * .01,),
|
||||
Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
':',
|
||||
style: labelTextStyle(),
|
||||
),
|
||||
SizedBox(height:MediaQuery.of(context).size.height * .01,),
|
||||
Text(
|
||||
':',
|
||||
style: labelTextStyle(),
|
||||
),
|
||||
SizedBox(height:MediaQuery.of(context).size.height * .01,),
|
||||
Text(
|
||||
':',
|
||||
style: labelTextStyle(),
|
||||
),
|
||||
|
||||
|
||||
],
|
||||
),
|
||||
SizedBox(width:MediaQuery.of(context).size.width * .01,),
|
||||
Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text('Dr. '+originalList[index].requestedDoctor.toString().toUpperCase(),style: valuesTextStyle()),
|
||||
SizedBox(height:MediaQuery.of(context).size.height * .01,),
|
||||
Text(
|
||||
originalList[index].dynamicCode,
|
||||
style: valuesTextStyle(),
|
||||
),
|
||||
SizedBox(height:MediaQuery.of(context).size.height * .01,),
|
||||
Text(
|
||||
originalList[index].recordId,
|
||||
style: valuesTextStyle(),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(height:MediaQuery.of(context).size.height * .01,),
|
||||
Text('Problem Details',style: problemTextStyle(),),
|
||||
SizedBox(height:MediaQuery.of(context).size.height * .01,),
|
||||
Row(
|
||||
children: [
|
||||
Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
'Problem',
|
||||
style: labelTextStyle(),
|
||||
),
|
||||
SizedBox(height:MediaQuery.of(context).size.height * .01,),
|
||||
Text(
|
||||
'Doctor Name',
|
||||
style: labelTextStyle(),
|
||||
),
|
||||
SizedBox(height:MediaQuery.of(context).size.height * .01,),
|
||||
Text(
|
||||
'Problem Category',
|
||||
style: labelTextStyle(),
|
||||
),
|
||||
|
||||
],
|
||||
),
|
||||
SizedBox(width:MediaQuery.of(context).size.width * .01,),
|
||||
Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
':',
|
||||
style: labelTextStyle(),
|
||||
),
|
||||
SizedBox(height:MediaQuery.of(context).size.height * .01,),
|
||||
Text(
|
||||
':',
|
||||
style: labelTextStyle(),
|
||||
),
|
||||
SizedBox(height:MediaQuery.of(context).size.height * .01,),
|
||||
Text(
|
||||
':',
|
||||
style: labelTextStyle(),
|
||||
),
|
||||
|
||||
|
||||
],
|
||||
),
|
||||
SizedBox(width:MediaQuery.of(context).size.width * .01,),
|
||||
Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(originalList[index].problem.toString().toUpperCase(),style: valuesTextStyle()),
|
||||
SizedBox(height:MediaQuery.of(context).size.height * .01,),
|
||||
Text(
|
||||
'Dr. '+originalList[index].problemDoctorName.toUpperCase(),
|
||||
style: valuesTextStyle(),
|
||||
),
|
||||
SizedBox(height:MediaQuery.of(context).size.height * .01,),
|
||||
Text(
|
||||
originalList[index].problemCategory.toUpperCase(),
|
||||
style: valuesTextStyle(),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
|
||||
|
||||
|
||||
),
|
||||
|
||||
],
|
||||
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
});
|
||||
}
|
||||
else{
|
||||
return Center(
|
||||
child: Padding(
|
||||
padding: EdgeInsets.fromLTRB(0, 40, 0, 0),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
SizedBox(height: MediaQuery.of(context).size.height * .25,),
|
||||
Text('No Dynamic Codes available'),
|
||||
SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
CircleAvatar(
|
||||
backgroundColor: primaryColor,
|
||||
radius: 40,
|
||||
child: IconButton(
|
||||
iconSize: 40,
|
||||
icon: const Icon(
|
||||
Icons.info,
|
||||
color: Colors.white,
|
||||
),
|
||||
onPressed: () async {
|
||||
|
||||
},
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppSettings.appBar('Dynamic Code'),
|
||||
body: SmartRefresher(
|
||||
enablePullDown: true,
|
||||
enablePullUp: false,
|
||||
/* header: WaterDropHeader(
|
||||
waterDropColor: primaryColor,
|
||||
),*/
|
||||
header: CustomHeader(
|
||||
builder: (BuildContext context, RefreshStatus? mode) {
|
||||
return Container(
|
||||
child: Center(
|
||||
child: CircularProgressIndicator(
|
||||
// Set the color of the circular progress indicator
|
||||
valueColor: AlwaysStoppedAnimation<Color>(primaryColor),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
footer: CustomFooter(
|
||||
builder: (BuildContext context,LoadStatus? mode){
|
||||
Widget body ;
|
||||
if(mode==LoadStatus.idle){
|
||||
body = Text("pull up load");
|
||||
}
|
||||
else if(mode==LoadStatus.loading){
|
||||
body = Container();
|
||||
}
|
||||
else if(mode == LoadStatus.failed){
|
||||
body = Text("Load Failed!Click retry!");
|
||||
}
|
||||
else if(mode == LoadStatus.canLoading){
|
||||
body = Text("release to load more");
|
||||
}
|
||||
else{
|
||||
body = Text("No more Data");
|
||||
}
|
||||
return Container(
|
||||
height: 55.0,
|
||||
child: Center(child:body),
|
||||
);
|
||||
},
|
||||
),
|
||||
controller: _refreshController,
|
||||
onRefresh: _onRefresh,
|
||||
onLoading: _onLoading,
|
||||
|
||||
child:_renderUi()
|
||||
|
||||
/*ListView.builder(
|
||||
itemBuilder: (c, i) => Card(child: Center(child: Text(items[i]))),
|
||||
itemExtent: 100.0,
|
||||
itemCount: items.length,
|
||||
),*/
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
@ -1,345 +0,0 @@
|
||||
import 'dart:convert';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:healthcare_user/common/settings.dart';
|
||||
import 'package:healthcare_user/common/zoom_image.dart';
|
||||
import 'package:healthcare_user/models/cart_items_model.dart';
|
||||
import 'package:healthcare_user/models/get_all_offers_model.dart';
|
||||
import 'package:healthcare_user/models/get_connected_doctors_model.dart';
|
||||
import 'package:healthcare_user/models/get_offer_details_model.dart';
|
||||
import 'package:healthcare_user/my_connections/add-doctor.dart';
|
||||
import 'package:healthcare_user/orders/cart-items.dart';
|
||||
|
||||
import '../models/get_all_quotations.dart';
|
||||
|
||||
class CartItems extends StatefulWidget {
|
||||
var myObject;
|
||||
CartItems({this.myObject});
|
||||
|
||||
@override
|
||||
State<CartItems> createState() => _CartItemsState();
|
||||
}
|
||||
|
||||
class _CartItemsState extends State<CartItems>
|
||||
with TickerProviderStateMixin {
|
||||
late TabController _controller;
|
||||
bool isDataLoading = false;
|
||||
bool isOffersLoading = false;
|
||||
bool isSereverIssue = false;
|
||||
String bookingId='';
|
||||
String totalCartPrice='';
|
||||
String totalCartPriceAfterDiscount='';
|
||||
|
||||
final List<Tab> topTabs = <Tab>[
|
||||
Tab(
|
||||
child: Text(
|
||||
'Pending',
|
||||
style: TextStyle(fontSize: 14),
|
||||
)),
|
||||
Tab(
|
||||
child: Text(
|
||||
'Completed',
|
||||
style: TextStyle(fontSize: 14),
|
||||
)),
|
||||
];
|
||||
List<CartItemsModel> cartItemsList = [];
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
_controller = TabController(vsync: this, length: topTabs.length);
|
||||
getAllCartItems();
|
||||
super.initState();
|
||||
}
|
||||
|
||||
Future<void> getAllCartItems() async {
|
||||
isDataLoading = true;
|
||||
try {
|
||||
var payload = new Map<String, dynamic>();
|
||||
payload["pharmacyId"] = widget.myObject.pharmacyId;
|
||||
payload["customerId"] =AppSettings.customerId;
|
||||
var response = await AppSettings.getAllCartItems(widget.myObject.bookingId,payload);
|
||||
|
||||
setState(() {
|
||||
cartItemsList =
|
||||
((jsonDecode(response)['data'][0]['items']) as List).map((dynamic model) {
|
||||
return CartItemsModel.fromJson(model);
|
||||
}).toList();
|
||||
cartItemsList = cartItemsList.reversed.toList();
|
||||
bookingId=jsonDecode(response)['data'][0]['bookingId'];
|
||||
totalCartPrice=jsonDecode(response)['data'][0]['totalCartPrice'].toString();
|
||||
totalCartPriceAfterDiscount=jsonDecode(response)['data'][0]['totalCartPriceAfterDiscount'].toString();
|
||||
isDataLoading = false;
|
||||
});
|
||||
} catch (e) {
|
||||
setState(() {
|
||||
isDataLoading = false;
|
||||
isSereverIssue = true;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Widget _cartItems() {
|
||||
if (cartItemsList.length != 0) {
|
||||
return Column(
|
||||
children: [
|
||||
Expanded(child: ListView.builder(
|
||||
padding: EdgeInsets.all(0),
|
||||
itemCount: cartItemsList.length,
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
return GestureDetector(
|
||||
onTap: () async{
|
||||
|
||||
},
|
||||
child: Card(
|
||||
//color: prescriptionsList[index].cardColor,
|
||||
child: Padding(
|
||||
padding: EdgeInsets.all(10),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
'Medicine Name',
|
||||
style: labelTextStyle(),
|
||||
),
|
||||
SizedBox(
|
||||
height:
|
||||
MediaQuery.of(context).size.height * .01,
|
||||
),
|
||||
Text(
|
||||
'Quantity',
|
||||
style: labelTextStyle(),
|
||||
),
|
||||
SizedBox(
|
||||
height:
|
||||
MediaQuery.of(context).size.height * .01,
|
||||
),
|
||||
Text(
|
||||
'Price',
|
||||
style: labelTextStyle(),
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
width: MediaQuery.of(context).size.width * .01,
|
||||
),
|
||||
Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
':',
|
||||
style: labelTextStyle(),
|
||||
),
|
||||
SizedBox(
|
||||
height:
|
||||
MediaQuery.of(context).size.height * .01,
|
||||
),
|
||||
Text(
|
||||
':',
|
||||
style: labelTextStyle(),
|
||||
),
|
||||
SizedBox(
|
||||
height:
|
||||
MediaQuery.of(context).size.height * .01,
|
||||
),
|
||||
Text(
|
||||
':',
|
||||
style: labelTextStyle(),
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
width: MediaQuery.of(context).size.width * .01,
|
||||
),
|
||||
Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
cartItemsList[index]
|
||||
.medicine_name
|
||||
.toString()
|
||||
.toUpperCase(),
|
||||
style: valuesTextStyle()),
|
||||
SizedBox(
|
||||
height:
|
||||
MediaQuery.of(context).size.height * .01,
|
||||
),
|
||||
Text(
|
||||
cartItemsList[index].quantity,
|
||||
style: valuesTextStyle(),
|
||||
),
|
||||
SizedBox(
|
||||
height:
|
||||
MediaQuery.of(context).size.height * .01,
|
||||
),
|
||||
Text(
|
||||
cartItemsList[index]
|
||||
.price
|
||||
,
|
||||
style: valuesTextStyle(),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
)),
|
||||
),
|
||||
);
|
||||
})),
|
||||
Container(
|
||||
width:double.infinity,
|
||||
height: MediaQuery.of(context).size.height * .06,
|
||||
child: ElevatedButton(
|
||||
style: ElevatedButton.styleFrom(
|
||||
primary: buttonColors, // background
|
||||
onPrimary: Colors.black, // foreground
|
||||
),
|
||||
onPressed: () async {
|
||||
|
||||
},
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text('Total cart price: $totalCartPrice'),
|
||||
Text('Total cart price after discount: $totalCartPriceAfterDiscount'),
|
||||
],
|
||||
),
|
||||
)),
|
||||
SizedBox(height:MediaQuery.of(context).size.height * .02,),
|
||||
Container(
|
||||
width:double.infinity,
|
||||
height: MediaQuery.of(context).size.height * .06,
|
||||
child: ElevatedButton(
|
||||
style: ElevatedButton.styleFrom(
|
||||
primary: buttonColors, // background
|
||||
onPrimary: Colors.black, // foreground
|
||||
),
|
||||
onPressed: () async {
|
||||
AppSettings.preLoaderDialog(context);
|
||||
bool isOnline = await AppSettings.internetConnectivity();
|
||||
if(isOnline){
|
||||
var payload = new Map<String, dynamic>();
|
||||
|
||||
payload["user"] = {"profile": {"firstName": AppSettings.userName.toString(),
|
||||
"lastName": '',
|
||||
"contactNumber": AppSettings.phoneNumber.toString(),
|
||||
"address1": AppSettings.userAddress.toString(),
|
||||
"address2": AppSettings.detailedAddress.toString(),
|
||||
"country": ''
|
||||
},};
|
||||
payload["pharmacies"] = [
|
||||
{
|
||||
"pharmacyId": widget.myObject.pharmacyId.toString(),
|
||||
"pharmacyname": widget.myObject.pharmacyName.toString(),
|
||||
"phone":widget.myObject.pharmacyContactNumber.toString(),
|
||||
"profile": "?"
|
||||
}
|
||||
];
|
||||
payload["prescriptionPicture"] =
|
||||
{
|
||||
"pictureUrl": [
|
||||
"string"
|
||||
]
|
||||
};
|
||||
payload["amount"] =
|
||||
{
|
||||
"biddingAmount": totalCartPriceAfterDiscount!='null'?int.parse(totalCartPriceAfterDiscount):0,
|
||||
"totalAmount": totalCartPrice!='null'?int.parse(totalCartPrice):0,
|
||||
"discountAmount":0,
|
||||
};
|
||||
|
||||
bool orderStatus = await AppSettings.orderNow(payload,widget.myObject.bookingId);
|
||||
|
||||
try {
|
||||
if(orderStatus){
|
||||
Navigator.of(context, rootNavigator: true).pop();
|
||||
AppSettings.longSuccessToast("order placed successfully");
|
||||
|
||||
|
||||
}
|
||||
else{
|
||||
Navigator.of(context, rootNavigator: true).pop();
|
||||
AppSettings.longFailedToast("failed to order");
|
||||
}
|
||||
} catch (exception) {
|
||||
print(exception);
|
||||
Navigator.of(context, rootNavigator: true).pop();
|
||||
AppSettings.longFailedToast("failed to order");
|
||||
}
|
||||
|
||||
}
|
||||
else{
|
||||
Navigator.of(context,rootNavigator: true).pop();
|
||||
AppSettings.longFailedToast(
|
||||
"Please check your internet");
|
||||
}
|
||||
},
|
||||
child: Text('Order now'),
|
||||
)),
|
||||
],
|
||||
);
|
||||
} else {
|
||||
return Center(
|
||||
child: Padding(
|
||||
padding: EdgeInsets.fromLTRB(0, 40, 0, 0),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
SizedBox(
|
||||
height: MediaQuery.of(context).size.height * .25,
|
||||
),
|
||||
Text('No Cart items found'),
|
||||
SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
CircleAvatar(
|
||||
backgroundColor: primaryColor,
|
||||
radius: 40,
|
||||
child: IconButton(
|
||||
iconSize: 40,
|
||||
icon: const Icon(
|
||||
Icons.info,
|
||||
color: Colors.white,
|
||||
),
|
||||
onPressed: () async {},
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text('Cart Items'),
|
||||
backgroundColor: primaryColor,
|
||||
),
|
||||
body: Container(
|
||||
child: Padding(
|
||||
padding: EdgeInsets.all(10),
|
||||
child: isDataLoading
|
||||
? Center(
|
||||
child: CircularProgressIndicator(
|
||||
color: primaryColor,
|
||||
strokeWidth: 5.0,
|
||||
),
|
||||
)
|
||||
: _cartItems(),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
@ -1,805 +0,0 @@
|
||||
import 'dart:convert';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:healthcare_user/common/settings.dart';
|
||||
import 'package:healthcare_user/common/zoom_image.dart';
|
||||
import 'package:healthcare_user/models/get_all_offers_model.dart';
|
||||
import 'package:healthcare_user/models/get_connected_doctors_model.dart';
|
||||
import 'package:healthcare_user/models/get_offer_details_model.dart';
|
||||
import 'package:healthcare_user/my_connections/add-doctor.dart';
|
||||
import 'package:healthcare_user/orders/cart-items.dart';
|
||||
|
||||
import '../models/get_all_quotations.dart';
|
||||
|
||||
class AllQuotations extends StatefulWidget {
|
||||
const AllQuotations({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
State<AllQuotations> createState() => _AllQuotationsState();
|
||||
}
|
||||
|
||||
class _AllQuotationsState extends State<AllQuotations>
|
||||
with TickerProviderStateMixin {
|
||||
late TabController _controller;
|
||||
bool isDataLoading = false;
|
||||
bool isOffersLoading = false;
|
||||
bool isSereverIssue = false;
|
||||
|
||||
final List<Tab> topTabs = <Tab>[
|
||||
Tab(
|
||||
child: Text(
|
||||
'Pending',
|
||||
style: TextStyle(fontSize: 14),
|
||||
)),
|
||||
Tab(
|
||||
child: Text(
|
||||
'Completed',
|
||||
style: TextStyle(fontSize: 14),
|
||||
)),
|
||||
];
|
||||
List<GetAllQuotationsModel> quotationsListOriginal = [];
|
||||
List<GetAllOffersModel> offersListOriginal = [];
|
||||
List<GetOffersDetailsModel> offersList = [];
|
||||
List pharmaciesCheckboxes = [];
|
||||
List pharmaciesCheckboxesInDialog = [];
|
||||
List selectedPharmacies = [];
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
_controller = TabController(vsync: this, length: topTabs.length);
|
||||
getAllQuotations();
|
||||
super.initState();
|
||||
}
|
||||
|
||||
Future<void> getAllQuotations() async {
|
||||
isDataLoading = true;
|
||||
try {
|
||||
var response = await AppSettings.getAllQuotations();
|
||||
|
||||
setState(() {
|
||||
quotationsListOriginal =
|
||||
((jsonDecode(response)['data']) as List).map((dynamic model) {
|
||||
return GetAllQuotationsModel.fromJson(model);
|
||||
}).toList();
|
||||
quotationsListOriginal = quotationsListOriginal.reversed.toList();
|
||||
isDataLoading = false;
|
||||
});
|
||||
} catch (e) {
|
||||
setState(() {
|
||||
isDataLoading = false;
|
||||
isSereverIssue = true;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> getAllOffers(pharmacyId) async {
|
||||
isOffersLoading = true;
|
||||
try {
|
||||
var response = await AppSettings.getAllOffersUnderPharmacy(pharmacyId);
|
||||
|
||||
setState(() {
|
||||
offersListOriginal =
|
||||
((jsonDecode(response)['data']) as List).map((dynamic model) {
|
||||
return GetAllOffersModel.fromJson(model);
|
||||
}).toList();
|
||||
offersListOriginal = offersListOriginal.reversed.toList();
|
||||
isOffersLoading = false;
|
||||
});
|
||||
} catch (e) {
|
||||
setState(() {
|
||||
isOffersLoading = false;
|
||||
isSereverIssue = true;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Widget _pendingQuotations() {
|
||||
if (quotationsListOriginal.length != 0) {
|
||||
return ListView.builder(
|
||||
padding: EdgeInsets.all(0),
|
||||
itemCount: quotationsListOriginal.length,
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
return GestureDetector(
|
||||
onTap: () async{
|
||||
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) => CartItems(myObject: quotationsListOriginal[index],)),
|
||||
);
|
||||
},
|
||||
child: Card(
|
||||
//color: prescriptionsList[index].cardColor,
|
||||
child: Padding(
|
||||
padding: EdgeInsets.all(10),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
'Booking Id',
|
||||
style: labelTextStyle(),
|
||||
),
|
||||
SizedBox(
|
||||
height:
|
||||
MediaQuery.of(context).size.height * .01,
|
||||
),
|
||||
Text(
|
||||
'Pharmacy Name',
|
||||
style: labelTextStyle(),
|
||||
),
|
||||
SizedBox(
|
||||
height:
|
||||
MediaQuery.of(context).size.height * .01,
|
||||
),
|
||||
Text(
|
||||
'Pharmacy ContactNumber',
|
||||
style: labelTextStyle(),
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
width: MediaQuery.of(context).size.width * .01,
|
||||
),
|
||||
Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
':',
|
||||
style: labelTextStyle(),
|
||||
),
|
||||
SizedBox(
|
||||
height:
|
||||
MediaQuery.of(context).size.height * .01,
|
||||
),
|
||||
Text(
|
||||
':',
|
||||
style: labelTextStyle(),
|
||||
),
|
||||
SizedBox(
|
||||
height:
|
||||
MediaQuery.of(context).size.height * .01,
|
||||
),
|
||||
Text(
|
||||
':',
|
||||
style: labelTextStyle(),
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
width: MediaQuery.of(context).size.width * .01,
|
||||
),
|
||||
Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
quotationsListOriginal[index]
|
||||
.bookingId
|
||||
.toString()
|
||||
.toUpperCase(),
|
||||
style: valuesTextStyle()),
|
||||
SizedBox(
|
||||
height:
|
||||
MediaQuery.of(context).size.height * .01,
|
||||
),
|
||||
Text(
|
||||
quotationsListOriginal[index].pharmacyName,
|
||||
style: valuesTextStyle(),
|
||||
),
|
||||
SizedBox(
|
||||
height:
|
||||
MediaQuery.of(context).size.height * .01,
|
||||
),
|
||||
Text(
|
||||
quotationsListOriginal[index]
|
||||
.pharmacyContactNumber,
|
||||
style: valuesTextStyle(),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
/*ElevatedButton(
|
||||
style: ElevatedButton.styleFrom(
|
||||
primary: buttonColors, // background
|
||||
onPrimary: Colors.black, // foreground
|
||||
),
|
||||
onPressed: () async {
|
||||
await getAllOffers(quotationsListOriginal[index]
|
||||
.pharmacyId
|
||||
.toString());
|
||||
showModalBottomSheet<void>(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return SizedBox(
|
||||
child: isOffersLoading
|
||||
? Center(
|
||||
child: CircularProgressIndicator(
|
||||
color: primaryColor,
|
||||
strokeWidth: 5.0,
|
||||
),
|
||||
)
|
||||
: _offersData(),
|
||||
);
|
||||
});
|
||||
},
|
||||
child: Text('Check Offers'),
|
||||
),*/
|
||||
],
|
||||
)),
|
||||
),
|
||||
);
|
||||
});
|
||||
} else {
|
||||
return Center(
|
||||
child: Padding(
|
||||
padding: EdgeInsets.fromLTRB(0, 40, 0, 0),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
SizedBox(
|
||||
height: MediaQuery.of(context).size.height * .25,
|
||||
),
|
||||
Text('No pending quotations'),
|
||||
SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
CircleAvatar(
|
||||
backgroundColor: primaryColor,
|
||||
radius: 40,
|
||||
child: IconButton(
|
||||
iconSize: 40,
|
||||
icon: const Icon(
|
||||
Icons.info,
|
||||
color: Colors.white,
|
||||
),
|
||||
onPressed: () async {},
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
Widget _offers() {
|
||||
if (offersListOriginal.length != 0) {
|
||||
return ListView.builder(
|
||||
padding: EdgeInsets.all(10),
|
||||
itemCount: offersListOriginal.length,
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
return GestureDetector(
|
||||
onTap: () {},
|
||||
child: Card(
|
||||
//color: prescriptionsList[index].cardColor,
|
||||
child: Padding(
|
||||
padding: EdgeInsets.all(10),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
'Booking Id',
|
||||
style: labelTextStyle(),
|
||||
),
|
||||
/*
|
||||
SizedBox(height:MediaQuery.of(context).size.height * .01,),
|
||||
Text(
|
||||
'Specialization',
|
||||
style: labelTextStyle(),
|
||||
),
|
||||
SizedBox(height:MediaQuery.of(context).size.height * .01,),
|
||||
Text(
|
||||
'Qualification',
|
||||
style: labelTextStyle(),
|
||||
),
|
||||
SizedBox(height:MediaQuery.of(context).size.height * .01,),
|
||||
Text(
|
||||
'Hospital',
|
||||
style: labelTextStyle(),
|
||||
),*/
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
width: MediaQuery.of(context).size.width * .01,
|
||||
),
|
||||
Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
':',
|
||||
style: labelTextStyle(),
|
||||
),
|
||||
/* SizedBox(height:MediaQuery.of(context).size.height * .01,),
|
||||
Text(
|
||||
':',
|
||||
style: labelTextStyle(),
|
||||
),
|
||||
SizedBox(height:MediaQuery.of(context).size.height * .01,),
|
||||
Text(
|
||||
':',
|
||||
style: labelTextStyle(),
|
||||
),
|
||||
SizedBox(height:MediaQuery.of(context).size.height * .01,),
|
||||
Text(
|
||||
':',
|
||||
style: labelTextStyle(),
|
||||
),*/
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
width: MediaQuery.of(context).size.width * .01,
|
||||
),
|
||||
Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
offersListOriginal[index]
|
||||
.description
|
||||
.toString()
|
||||
.toUpperCase(),
|
||||
style: valuesTextStyle()),
|
||||
|
||||
/* SizedBox(height:MediaQuery.of(context).size.height * .01,),
|
||||
Text(
|
||||
quotationsListOriginal[index].specialization,
|
||||
style: valuesTextStyle(),
|
||||
),
|
||||
SizedBox(height:MediaQuery.of(context).size.height * .01,),
|
||||
Text(
|
||||
quotationsListOriginal[index].qualification,
|
||||
style: valuesTextStyle(),
|
||||
),
|
||||
SizedBox(height:MediaQuery.of(context).size.height * .01,),
|
||||
Text(
|
||||
quotationsListOriginal[index].hospital_name,
|
||||
style: valuesTextStyle(),
|
||||
),*/
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
)),
|
||||
),
|
||||
);
|
||||
});
|
||||
} else {
|
||||
return Center(
|
||||
child: Padding(
|
||||
padding: EdgeInsets.fromLTRB(0, 40, 0, 0),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
SizedBox(
|
||||
height: MediaQuery.of(context).size.height * .25,
|
||||
),
|
||||
Text('No pending quotations'),
|
||||
SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
CircleAvatar(
|
||||
backgroundColor: primaryColor,
|
||||
radius: 40,
|
||||
child: IconButton(
|
||||
iconSize: 40,
|
||||
icon: const Icon(
|
||||
Icons.info,
|
||||
color: Colors.white,
|
||||
),
|
||||
onPressed: () async {},
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
Widget _offersData() {
|
||||
if (offersListOriginal.length != 0) {
|
||||
return Container(
|
||||
color: Colors.white60,
|
||||
child: Column(crossAxisAlignment: CrossAxisAlignment.end, children: [
|
||||
Expanded(
|
||||
child: GridView.builder(
|
||||
itemCount: offersListOriginal.length,
|
||||
itemBuilder: (context, index) {
|
||||
return Card(
|
||||
color: Colors.white,
|
||||
elevation: 3.0,
|
||||
child: CheckboxListTile(
|
||||
title: Padding(
|
||||
padding: EdgeInsets.fromLTRB(0, 10, 0, 0),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Column(
|
||||
children: [
|
||||
Expanded(
|
||||
child: GestureDetector(
|
||||
onTap: () {
|
||||
Navigator.push(
|
||||
context,
|
||||
new MaterialPageRoute(
|
||||
builder: (__) =>
|
||||
new ImageZoomPage(
|
||||
imageName: 'Reports',
|
||||
imageDetails:
|
||||
offersListOriginal[
|
||||
index]
|
||||
.picture)));
|
||||
},
|
||||
child: Container(
|
||||
width: MediaQuery.of(context).size.width *
|
||||
.18,
|
||||
height:
|
||||
MediaQuery.of(context).size.height *
|
||||
.10,
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.rectangle,
|
||||
image: DecorationImage(
|
||||
image: offersListOriginal[index]
|
||||
.picture ==
|
||||
''
|
||||
? AssetImage(
|
||||
"images/logo.png")
|
||||
: NetworkImage(
|
||||
offersListOriginal[
|
||||
index]
|
||||
.picture)
|
||||
as ImageProvider, // picked file
|
||||
fit: BoxFit.contain)),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
width: 5,
|
||||
),
|
||||
Expanded(
|
||||
child: Container(
|
||||
//width: MediaQuery.of(context).size.width * .70,
|
||||
child: Row(
|
||||
children: [
|
||||
Column(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.start,
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
'Name',
|
||||
style: labelTextStyle(),
|
||||
),
|
||||
SizedBox(
|
||||
height: MediaQuery.of(context)
|
||||
.size
|
||||
.height *
|
||||
.01,
|
||||
),
|
||||
Text(
|
||||
'Code',
|
||||
style: labelTextStyle(),
|
||||
),
|
||||
SizedBox(
|
||||
height: MediaQuery.of(context)
|
||||
.size
|
||||
.height *
|
||||
.01,
|
||||
),
|
||||
Text(
|
||||
'Description',
|
||||
style: labelTextStyle(),
|
||||
),
|
||||
SizedBox(
|
||||
height: MediaQuery.of(context)
|
||||
.size
|
||||
.height *
|
||||
.01,
|
||||
),
|
||||
Text(
|
||||
'Category',
|
||||
style: labelTextStyle(),
|
||||
),
|
||||
SizedBox(
|
||||
height: MediaQuery.of(context)
|
||||
.size
|
||||
.height *
|
||||
.01,
|
||||
),
|
||||
Text(
|
||||
'Start Date',
|
||||
style: labelTextStyle(),
|
||||
),
|
||||
SizedBox(
|
||||
height: MediaQuery.of(context)
|
||||
.size
|
||||
.height *
|
||||
.01,
|
||||
),
|
||||
Text(
|
||||
'End Date',
|
||||
style: labelTextStyle(),
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
width: MediaQuery.of(context).size.width *
|
||||
.01,
|
||||
),
|
||||
Column(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.start,
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
':',
|
||||
style: labelTextStyle(),
|
||||
),
|
||||
SizedBox(
|
||||
height: MediaQuery.of(context)
|
||||
.size
|
||||
.height *
|
||||
.01,
|
||||
),
|
||||
Text(
|
||||
':',
|
||||
style: labelTextStyle(),
|
||||
),
|
||||
SizedBox(
|
||||
height: MediaQuery.of(context)
|
||||
.size
|
||||
.height *
|
||||
.01,
|
||||
),
|
||||
Text(
|
||||
':',
|
||||
style: labelTextStyle(),
|
||||
),
|
||||
SizedBox(
|
||||
height: MediaQuery.of(context)
|
||||
.size
|
||||
.height *
|
||||
.01,
|
||||
),
|
||||
Text(
|
||||
':',
|
||||
style: labelTextStyle(),
|
||||
),
|
||||
SizedBox(
|
||||
height: MediaQuery.of(context)
|
||||
.size
|
||||
.height *
|
||||
.01,
|
||||
),
|
||||
Text(
|
||||
':',
|
||||
style: labelTextStyle(),
|
||||
),
|
||||
SizedBox(
|
||||
height: MediaQuery.of(context)
|
||||
.size
|
||||
.height *
|
||||
.01,
|
||||
),
|
||||
Text(
|
||||
':',
|
||||
style: labelTextStyle(),
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
width: MediaQuery.of(context).size.width *
|
||||
.01,
|
||||
),
|
||||
Column(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.start,
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
offersListOriginal[index]
|
||||
.name
|
||||
.toString()
|
||||
.toUpperCase(),
|
||||
style: valuesTextStyle()),
|
||||
SizedBox(
|
||||
height: MediaQuery.of(context)
|
||||
.size
|
||||
.height *
|
||||
.01,
|
||||
),
|
||||
Text(
|
||||
offersListOriginal[index].code,
|
||||
style: valuesTextStyle(),
|
||||
),
|
||||
SizedBox(
|
||||
height: MediaQuery.of(context)
|
||||
.size
|
||||
.height *
|
||||
.01,
|
||||
),
|
||||
Text(
|
||||
offersListOriginal[index].description,
|
||||
style: valuesTextStyle(),
|
||||
),
|
||||
SizedBox(
|
||||
height: MediaQuery.of(context)
|
||||
.size
|
||||
.height *
|
||||
.01,
|
||||
),
|
||||
Text(
|
||||
offersListOriginal[index].category,
|
||||
style: valuesTextStyle(),
|
||||
),
|
||||
SizedBox(
|
||||
height: MediaQuery.of(context)
|
||||
.size
|
||||
.height *
|
||||
.01,
|
||||
),
|
||||
Text(
|
||||
offersListOriginal[index].startDate,
|
||||
style: valuesTextStyle(),
|
||||
),
|
||||
SizedBox(
|
||||
height: MediaQuery.of(context)
|
||||
.size
|
||||
.height *
|
||||
.01,
|
||||
),
|
||||
Text(
|
||||
offersListOriginal[index].endDate,
|
||||
style: valuesTextStyle(),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
)),
|
||||
checkColor: Colors.white,
|
||||
activeColor: primaryColor,
|
||||
value: offersListOriginal[index].isChecked,
|
||||
onChanged: (val) {
|
||||
setState(
|
||||
() {
|
||||
offersListOriginal[index].isChecked = val!;
|
||||
},
|
||||
);
|
||||
/*if (offersListOriginal[index].isChecked) {
|
||||
pharmaciesCheckboxes.add({
|
||||
'pharmacyId': offersListOriginal[index].pharmacy_id,
|
||||
});
|
||||
selectedPharmacies.add(offersListOriginal[index]);
|
||||
} else {
|
||||
pharmaciesCheckboxes.removeWhere((e) =>
|
||||
e['pharmacyId'].toString().toUpperCase() ==
|
||||
offersListOriginal[index]
|
||||
.pharmacy_id
|
||||
.toString()
|
||||
.toUpperCase());
|
||||
selectedPharmacies.remove(offersListOriginal[index]);
|
||||
}*/
|
||||
},
|
||||
),
|
||||
);
|
||||
},
|
||||
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
|
||||
crossAxisCount: 1, //.size.width * .33,
|
||||
childAspectRatio: MediaQuery.of(context).size.width /
|
||||
(MediaQuery.of(context).size.height / 5)),
|
||||
),
|
||||
),
|
||||
]),
|
||||
);
|
||||
} else {
|
||||
return Center(
|
||||
child: Padding(
|
||||
padding: EdgeInsets.fromLTRB(0, 40, 0, 0),
|
||||
child: isSereverIssue
|
||||
? Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Image(
|
||||
image: AssetImage('images/serverissue.png'),
|
||||
// height: MediaQuery.of(context).size.height * .10,
|
||||
),
|
||||
SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
Text(
|
||||
'There is an issue at server please try after some time',
|
||||
style: serverIssueTextStyle(),
|
||||
),
|
||||
],
|
||||
)
|
||||
: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
/*Image(
|
||||
image: AssetImage('images/resourceblue.pngs'),
|
||||
// height: MediaQuery.of(context).size.height * .10,
|
||||
),*/
|
||||
Icon(
|
||||
Icons.info,
|
||||
color: primaryColor,
|
||||
size: 40,
|
||||
),
|
||||
SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
Text(
|
||||
'No offers available',
|
||||
style: TextStyle(
|
||||
color: primaryColor,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
],
|
||||
)));
|
||||
}
|
||||
}
|
||||
|
||||
Widget _pharmacies() {
|
||||
return Container();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text('All Quotations'),
|
||||
backgroundColor: primaryColor,
|
||||
bottom: TabBar(
|
||||
controller: _controller,
|
||||
tabs: topTabs,
|
||||
indicatorColor: buttonColors,
|
||||
unselectedLabelColor: Colors.white60,
|
||||
indicatorWeight: 2,
|
||||
),
|
||||
),
|
||||
body: Container(
|
||||
child: TabBarView(controller: _controller, children: [
|
||||
Padding(
|
||||
padding: EdgeInsets.all(10),
|
||||
child: isDataLoading
|
||||
? Center(
|
||||
child: CircularProgressIndicator(
|
||||
color: primaryColor,
|
||||
strokeWidth: 5.0,
|
||||
),
|
||||
)
|
||||
: _pendingQuotations(),
|
||||
),
|
||||
Padding(
|
||||
padding: EdgeInsets.all(10),
|
||||
)
|
||||
]),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
@ -1,271 +0,0 @@
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:healthcare_user/common/settings.dart';
|
||||
import 'dart:async';
|
||||
import 'package:permission_handler/permission_handler.dart';
|
||||
|
||||
import 'package:agora_rtc_engine/rtc_engine.dart';
|
||||
import 'package:agora_rtc_engine/rtc_engine.dart' as rtc_engine;
|
||||
import 'package:agora_rtc_engine/rtc_local_view.dart' as rtc_local_view;
|
||||
import 'package:agora_rtc_engine/rtc_remote_view.dart' as rtc_remote_view;
|
||||
|
||||
class CallPage extends StatefulWidget {
|
||||
final String? channelName;
|
||||
final ClientRole? role;
|
||||
const CallPage({Key? key, this.channelName, this.role}) : super(key: key);
|
||||
|
||||
@override
|
||||
State<CallPage> createState() => _CallPageState();
|
||||
}
|
||||
|
||||
class _CallPageState extends State<CallPage> {
|
||||
final _users = <int>[];
|
||||
final _infoString = <String>[];
|
||||
late RtcEngine _engine;
|
||||
bool muted = false; // Define the muted variable
|
||||
bool viewPanel = true;
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
initialize();
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_users.clear();
|
||||
_engine.leaveChannel();
|
||||
_engine.destroy();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
Future<void> initialize() async {
|
||||
if (appId.isEmpty) {
|
||||
setState(() {
|
||||
_infoString.add('AppId is missing please provide AppId');
|
||||
_infoString.add('Agora Engine is not starting');
|
||||
});
|
||||
return;
|
||||
}
|
||||
_engine = await rtc_engine.RtcEngine.create(appId);
|
||||
await _engine.enableVideo();
|
||||
await _engine.setChannelProfile(ChannelProfile.LiveBroadcasting);
|
||||
await _engine.setClientRole(widget.role!);
|
||||
_addAgoraEventHandler();
|
||||
VideoEncoderConfiguration configuration = VideoEncoderConfiguration(
|
||||
dimensions: VideoDimensions(width: 1920, height: 1080),
|
||||
);
|
||||
await _engine.setVideoEncoderConfiguration(configuration);
|
||||
await _engine.joinChannel(token, widget.channelName!, null, 0);
|
||||
}
|
||||
|
||||
void _addAgoraEventHandler() {
|
||||
_engine.setEventHandler(
|
||||
rtc_engine.RtcEngineEventHandler(
|
||||
error: (code) {
|
||||
setState(() {
|
||||
final info = 'Error: $code';
|
||||
_infoString.add(info);
|
||||
});
|
||||
},
|
||||
joinChannelSuccess: (channel, uid, elapsed) {
|
||||
setState(() {
|
||||
final info = 'Join Channel: $channel, uid:$uid';
|
||||
_infoString.add(info);
|
||||
});
|
||||
},
|
||||
leaveChannel: (stats) {
|
||||
setState(() {
|
||||
_infoString.add('Leave Channel');
|
||||
_users.clear();
|
||||
});
|
||||
},
|
||||
userJoined: (uid, elapsed) {
|
||||
setState(() {
|
||||
final info = 'User joined: $uid';
|
||||
_infoString.add(info);
|
||||
_users.add(uid);
|
||||
});
|
||||
},
|
||||
userOffline: (uid, elapsed) {
|
||||
setState(() {
|
||||
final info = 'User Offline: $uid';
|
||||
_infoString.add(info);
|
||||
_users.remove(uid);
|
||||
});
|
||||
},
|
||||
firstRemoteVideoFrame: (uid, width, height, elapsed) {
|
||||
setState(() {
|
||||
final info = 'First Remote Video: $uid $width*$height';
|
||||
_infoString.add(info);
|
||||
_users.remove(uid);
|
||||
});
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Widget _viewRows() {
|
||||
final List<StatefulWidget> list = [];
|
||||
if (widget.role == ClientRole.Broadcaster) {
|
||||
list.add(const rtc_local_view.SurfaceView());
|
||||
}
|
||||
for (var uid in _users) {
|
||||
list.add(rtc_remote_view.SurfaceView(
|
||||
uid: uid,
|
||||
channelId: widget.channelName!,
|
||||
));
|
||||
}
|
||||
final views=list;
|
||||
return Column(
|
||||
children: List.generate(
|
||||
views.length,
|
||||
(index) => Expanded(
|
||||
child: views[index],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Widget _toolbar() {
|
||||
if (widget.role == ClientRole.Audience) return SizedBox();
|
||||
|
||||
return Container(
|
||||
alignment: Alignment.bottomCenter,
|
||||
padding: const EdgeInsets.symmetric(vertical: 48),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: <Widget>[
|
||||
RawMaterialButton(
|
||||
onPressed: () {
|
||||
setState(() {
|
||||
muted = !muted;
|
||||
});
|
||||
_engine.muteLocalAudioStream(muted);
|
||||
},
|
||||
child: Icon(
|
||||
muted ? Icons.mic_off : Icons.mic,
|
||||
color: muted ? Colors.white : Colors.blueAccent,
|
||||
size: 20.0,
|
||||
),
|
||||
shape: CircleBorder(),
|
||||
elevation: 2.0,
|
||||
fillColor: muted ? Colors.blueAccent : Colors.white,
|
||||
padding: EdgeInsets.all(12.0),
|
||||
),
|
||||
RawMaterialButton(
|
||||
onPressed: () => Navigator.pop(context),
|
||||
child: Icon(
|
||||
Icons.call_end,
|
||||
color: Colors.white,
|
||||
size: 35.0,
|
||||
),
|
||||
shape: CircleBorder(),
|
||||
elevation: 2.0,
|
||||
fillColor: Colors.redAccent,
|
||||
padding: EdgeInsets.all(15.0),
|
||||
),
|
||||
RawMaterialButton(
|
||||
onPressed: () {
|
||||
_engine.switchCamera();
|
||||
},
|
||||
child: Icon(
|
||||
Icons.switch_camera,
|
||||
color: Colors.blueAccent,
|
||||
size: 20.0,
|
||||
),
|
||||
shape: CircleBorder(),
|
||||
elevation: 2.0,
|
||||
fillColor: Colors.white,
|
||||
padding: EdgeInsets.all(12.0),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Widget _panel()
|
||||
{
|
||||
return Visibility(
|
||||
visible: viewPanel,
|
||||
child: Container(
|
||||
padding: const EdgeInsets.symmetric(vertical: 48),
|
||||
alignment: Alignment.bottomCenter,
|
||||
child: FractionallySizedBox(
|
||||
heightFactor: 0.5,
|
||||
child: Container(
|
||||
padding: EdgeInsets.symmetric(vertical: 48),
|
||||
child: ListView.builder(
|
||||
reverse: true,
|
||||
itemCount: _infoString.length,
|
||||
itemBuilder:(BuildContext context,int index)
|
||||
{
|
||||
if(_infoString.isEmpty)
|
||||
{
|
||||
return const Text("null");
|
||||
}
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 3,horizontal: 10),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Flexible(
|
||||
child: Container(
|
||||
padding: const EdgeInsets.symmetric(vertical: 2, horizontal: 5),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.circular(5)
|
||||
),
|
||||
child: Text(
|
||||
_infoString[index],
|
||||
style: const TextStyle(color:Colors.blueGrey),
|
||||
),
|
||||
),
|
||||
|
||||
)
|
||||
],
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: const Text("VideoCall"),
|
||||
centerTitle: true,
|
||||
actions: [
|
||||
IconButton(onPressed:()
|
||||
{
|
||||
setState(() {
|
||||
viewPanel=!viewPanel;
|
||||
});
|
||||
}, icon: const Icon(Icons.ice_skating))
|
||||
],
|
||||
),
|
||||
backgroundColor: Colors.black,
|
||||
body: Center(
|
||||
child: Stack(
|
||||
children: <Widget>[
|
||||
_viewRows(),
|
||||
_panel(),
|
||||
_toolbar(),
|
||||
]
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
@ -1,120 +0,0 @@
|
||||
import 'package:agora_rtc_engine/rtc_engine.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:async/async.dart';
|
||||
import 'dart:developer';
|
||||
import 'package:permission_handler/permission_handler.dart';
|
||||
import './call.dart';
|
||||
import 'package:flutter/material.dart' hide Size;
|
||||
import 'dart:ui' as ui;
|
||||
|
||||
class IndexPage extends StatefulWidget {
|
||||
const IndexPage({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
State<IndexPage> createState() => _IndexPageState();
|
||||
}
|
||||
|
||||
class _IndexPageState extends State<IndexPage> {
|
||||
|
||||
TextEditingController _channelController = TextEditingController(text: 'call');
|
||||
|
||||
bool _validateError=false;
|
||||
ClientRole? _role= ClientRole.Broadcaster;
|
||||
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_channelController.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: const Text("VideoCall"),
|
||||
centerTitle: true,
|
||||
),
|
||||
body: SingleChildScrollView(
|
||||
child: Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 20),
|
||||
child: Column(
|
||||
children:<Widget> [
|
||||
const SizedBox(height: 20),
|
||||
const SizedBox(height: 20),
|
||||
TextField(
|
||||
controller: _channelController,
|
||||
decoration: InputDecoration(
|
||||
errorText: _validateError ? 'Chanel Name is Mondatory' : null,
|
||||
border: UnderlineInputBorder(borderSide: BorderSide(width: 1),),
|
||||
hintText: 'channel name',
|
||||
),
|
||||
),
|
||||
RadioListTile(
|
||||
title: const Text('Broadcaster'),
|
||||
onChanged: (ClientRole? value)
|
||||
{
|
||||
setState(() {
|
||||
_role=value;
|
||||
});
|
||||
},
|
||||
value: ClientRole.Broadcaster,
|
||||
groupValue: _role,
|
||||
),
|
||||
RadioListTile(
|
||||
title: const Text('Audience'),
|
||||
onChanged: (ClientRole? value)
|
||||
{
|
||||
setState(() {
|
||||
_role=value;
|
||||
});
|
||||
},
|
||||
value: ClientRole.Audience,
|
||||
groupValue: _role,
|
||||
),
|
||||
ElevatedButton(
|
||||
onPressed: onjoin,
|
||||
child: const Text('Join'),
|
||||
style: ElevatedButton.styleFrom(
|
||||
minimumSize: const ui.Size(double.infinity, 40),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Future<void> onjoin() async {
|
||||
setState(() {
|
||||
_channelController.text.isEmpty
|
||||
? _validateError=true:
|
||||
_validateError=false; // This line doesn't actually update any state
|
||||
});
|
||||
|
||||
if(_channelController.text.isNotEmpty)
|
||||
{
|
||||
await _handlecameraAndMic(Permission.camera);
|
||||
await _handlecameraAndMic(Permission.microphone);
|
||||
await Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (__) => CallPage(
|
||||
channelName: _channelController.text, // Passes the text from _channelController as channelName
|
||||
role: _role, // Passes the value of _role as role
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Future <void> _handlecameraAndMic(Permission permission) async
|
||||
{
|
||||
final status=await permission.request();
|
||||
log(status.toString());
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in new issue