Merge branch 'development' of https://gitlab.com/Cloud_Solution/doctor_app_flutter into in_patient_soap

merge-requests/796/head
hussam al-habibeh 5 years ago
commit 8d493f40fa

@ -5,8 +5,8 @@ const ONLY_NUMBERS = "[0-9]";
const ONLY_LETTERS = "[a-zA-Z &'\"]"; const ONLY_LETTERS = "[a-zA-Z &'\"]";
const ONLY_DATE = "[0-9/]"; const ONLY_DATE = "[0-9/]";
const BASE_URL_LIVE_CARE = 'https://livecare.hmg.com/'; const BASE_URL_LIVE_CARE = 'https://livecare.hmg.com/';
const BASE_URL = 'https://hmgwebservices.com/'; // const BASE_URL = 'https://hmgwebservices.com/';
// const BASE_URL = 'https://uat.hmgwebservices.com/'; const BASE_URL = 'https://uat.hmgwebservices.com/';
const PHARMACY_ITEMS_URL = "Services/Lists.svc/REST/GetPharmcyItems_Region_enh"; const PHARMACY_ITEMS_URL = "Services/Lists.svc/REST/GetPharmcyItems_Region_enh";
const PHARMACY_LIST_URL = "Services/Patients.svc/REST/GetPharmcyList"; const PHARMACY_LIST_URL = "Services/Patients.svc/REST/GetPharmcyList";
const PATIENT_PROGRESS_NOTE_URL = "Services/DoctorApplication.svc/REST/GetProgressNoteForInPatient"; const PATIENT_PROGRESS_NOTE_URL = "Services/DoctorApplication.svc/REST/GetProgressNoteForInPatient";

@ -665,7 +665,7 @@ const Map<String, Map<String, String>> localizedValues = {
'noteVerify': {'en': 'Verify', 'ar': 'تحقق'}, 'noteVerify': {'en': 'Verify', 'ar': 'تحقق'},
'noteConfirm': {'en': 'Confirm', 'ar': 'تاكيد'}, 'noteConfirm': {'en': 'Confirm', 'ar': 'تاكيد'},
'noteAdd': {'en': 'Add ', 'ar': 'اضف '}, 'noteAdd': {'en': 'Add ', 'ar': 'اضف '},
'noteUpdateْْ': {'en': 'Update ', 'ar': 'تحديت'}, 'noteUpdate': {'en': 'Update ', 'ar': 'تحديت'},
'orderSheet': {'en': 'Order Sheet', 'ar': 'ورقة الطلب'}, 'orderSheet': {'en': 'Order Sheet', 'ar': 'ورقة الطلب'},
'order': {'en': 'Order', 'ar': 'الطلب'}, 'order': {'en': 'Order', 'ar': 'الطلب'},
'sheet': {'en': 'Sheet', 'ar': 'ورقة'}, 'sheet': {'en': 'Sheet', 'ar': 'ورقة'},
@ -708,5 +708,6 @@ const Map<String, Map<String, String>> localizedValues = {
"inProgress": {"en": "inProgress", "ar": "تحت المعالجه"}, "inProgress": {"en": "inProgress", "ar": "تحت المعالجه"},
"Completed": {"en": "Completed", "ar": "مكتمل"}, "Completed": {"en": "Completed", "ar": "مكتمل"},
"Locked": {"en": "Locked", "ar": "مقفل"}, "Locked": {"en": "Locked", "ar": "مقفل"},
"textCopiedSuccessfully": {"en": "Text copied successfully", "ar": "تم نسخ النص بنجاح"},
}; };

@ -1,15 +1,16 @@
final TOKEN = 'token'; const TOKEN = 'token';
final PROJECT_ID = 'projectID'; const PROJECT_ID = 'projectID';
final VIDA_AUTH_TOKEN_ID = 'VidaAuthTokenID'; const VIDA_AUTH_TOKEN_ID = 'VidaAuthTokenID';
final VIDA_REFRESH_TOKEN_ID = 'VidaRefreshTokenID'; const VIDA_REFRESH_TOKEN_ID = 'VidaRefreshTokenID';
final LOGIN_TOKEN_ID = 'LogInToken'; const LOGIN_TOKEN_ID = 'LogInToken';
final DOCTOR_ID = 'doctorID'; const DOCTOR_ID = 'doctorID';
final SLECTED_PATIENT_TYPE = 'slectedPatientType'; const SLECTED_PATIENT_TYPE = 'slectedPatientType';
final APP_Language = 'language'; const APP_Language = 'language';
final DOCTOR_PROFILE = 'doctorProfile'; const DOCTOR_PROFILE = 'doctorProfile';
final LIVE_CARE_PATIENT = 'livecare-patient-profile'; const LIVE_CARE_PATIENT = 'livecare-patient-profile';
final LOGGED_IN_USER = 'loggedUser'; const LOGGED_IN_USER = 'loggedUser';
final DASHBOARD_DATA = 'dashboard-data'; const EMPLOYEE_ID = 'EmployeeID';
final OTP_TYPE = 'otp-type'; const DASHBOARD_DATA = 'dashboard-data';
final LAST_LOGIN_USER = 'last-login-user'; const OTP_TYPE = 'otp-type';
final CLINIC_NAME = 'clinic-name'; const LAST_LOGIN_USER = 'last-login-user';
const CLINIC_NAME = 'clinic-name';

@ -1,6 +1,7 @@
class ActivationCodeModel { class ActivationCodeModel {
int channel; int channel;
int languageID; int languageID;
int loginDoctorID;
double versionID; double versionID;
int memberID; int memberID;
int facilityId; int facilityId;
@ -14,7 +15,7 @@ class ActivationCodeModel {
this.memberID, this.memberID,
this.facilityId, this.facilityId,
this.otpSendType, this.otpSendType,
this.generalid}); this.generalid,this.loginDoctorID});
ActivationCodeModel.fromJson(Map<String, dynamic> json) { ActivationCodeModel.fromJson(Map<String, dynamic> json) {
channel = json['Channel']; channel = json['Channel'];
@ -24,6 +25,7 @@ class ActivationCodeModel {
facilityId = json['facilityId']; facilityId = json['facilityId'];
otpSendType = json['OTP_SendType']; otpSendType = json['OTP_SendType'];
generalid = json['generalid']; generalid = json['generalid'];
loginDoctorID = json['LoginDoctorID'];
} }
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
@ -35,6 +37,7 @@ class ActivationCodeModel {
data['facilityId'] = this.facilityId; data['facilityId'] = this.facilityId;
data['OTP_SendType'] = otpSendType; data['OTP_SendType'] = otpSendType;
data['generalid'] = this.generalid; data['generalid'] = this.generalid;
data['LoginDoctorID'] = this.loginDoctorID;
return data; return data;
} }
} }

@ -3,6 +3,7 @@ class ActivationCodeForVerificationScreenModel {
String mobileNumber; String mobileNumber;
String zipCode; String zipCode;
int channel; int channel;
int loginDoctorID;
int languageID; int languageID;
double versionID; double versionID;
int memberID; int memberID;
@ -25,7 +26,7 @@ class ActivationCodeForVerificationScreenModel {
this.isMobileFingerPrint, this.isMobileFingerPrint,
this.vidaAuthTokenID, this.vidaAuthTokenID,
this.vidaRefreshTokenID, this.vidaRefreshTokenID,
this.iMEI}); this.iMEI,this.loginDoctorID});
ActivationCodeForVerificationScreenModel.fromJson(Map<String, dynamic> json) { ActivationCodeForVerificationScreenModel.fromJson(Map<String, dynamic> json) {
oTPSendType = json['OTP_SendType']; oTPSendType = json['OTP_SendType'];
@ -41,6 +42,7 @@ class ActivationCodeForVerificationScreenModel {
vidaAuthTokenID = json['VidaAuthTokenID']; vidaAuthTokenID = json['VidaAuthTokenID'];
vidaRefreshTokenID = json['VidaRefreshTokenID']; vidaRefreshTokenID = json['VidaRefreshTokenID'];
iMEI = json['IMEI']; iMEI = json['IMEI'];
loginDoctorID = json['LoginDoctorID'];
} }
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
@ -56,6 +58,7 @@ class ActivationCodeForVerificationScreenModel {
data['generalid'] = this.generalid; data['generalid'] = this.generalid;
data['IsMobileFingerPrint'] = this.isMobileFingerPrint; data['IsMobileFingerPrint'] = this.isMobileFingerPrint;
data['IMEI'] = this.iMEI; data['IMEI'] = this.iMEI;
data['LoginDoctorID'] = this.loginDoctorID;
return data; return data;
} }
} }

@ -3,6 +3,7 @@ class CheckActivationCodeRequestModel {
String zipCode; String zipCode;
int doctorID; int doctorID;
int memberID; int memberID;
int loginDoctorID;
String password; String password;
String facilityId; String facilityId;
String iPAdress; String iPAdress;
@ -32,7 +33,7 @@ class CheckActivationCodeRequestModel {
this.activationCode, this.activationCode,
this.vidaAuthTokenID, this.vidaAuthTokenID,
this.vidaRefreshTokenID, this.vidaRefreshTokenID,
this.oTPSendType,this.password,this.facilityId,this.memberID,this.isForSilentLogin=false,this.iMEI}); this.oTPSendType,this.password,this.facilityId,this.memberID,this.isForSilentLogin=false,this.iMEI,this.loginDoctorID});
CheckActivationCodeRequestModel.fromJson(Map<String, dynamic> json) { CheckActivationCodeRequestModel.fromJson(Map<String, dynamic> json) {
mobileNumber = json['MobileNumber']; mobileNumber = json['MobileNumber'];
@ -49,6 +50,7 @@ class CheckActivationCodeRequestModel {
vidaAuthTokenID = json['VidaAuthTokenID']; vidaAuthTokenID = json['VidaAuthTokenID'];
vidaRefreshTokenID = json['VidaRefreshTokenID']; vidaRefreshTokenID = json['VidaRefreshTokenID'];
oTPSendType = json['OTP_SendType']; oTPSendType = json['OTP_SendType'];
loginDoctorID = json['LoginDoctorID'];
} }
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
@ -72,6 +74,7 @@ class CheckActivationCodeRequestModel {
data['Password'] = this.password; data['Password'] = this.password;
data['IMEI'] = this.iMEI; data['IMEI'] = this.iMEI;
data['IsForSilentLogin'] = this.isForSilentLogin; data['IsForSilentLogin'] = this.isForSilentLogin;
data['LoginDoctorID'] = this.loginDoctorID;
return data; return data;
} }
} }

@ -142,6 +142,7 @@ class AuthenticationViewModel extends BaseViewModel {
iMEI: user.iMEI, iMEI: user.iMEI,
facilityId: user.projectID, facilityId: user.projectID,
memberID: user.doctorID, memberID: user.doctorID,
loginDoctorID: user.doctorID,
zipCode: user.outSA == true ? '971' : '966', zipCode: user.outSA == true ? '971' : '966',
mobileNumber: user.mobile, mobileNumber: user.mobile,
oTPSendType: authMethodType.getTypeIdService(), oTPSendType: authMethodType.getTypeIdService(),
@ -163,6 +164,7 @@ class AuthenticationViewModel extends BaseViewModel {
ActivationCodeModel activationCodeModel = ActivationCodeModel( ActivationCodeModel activationCodeModel = ActivationCodeModel(
facilityId: projectID, facilityId: projectID,
memberID: loggedUser.listMemberInformation[0].memberID, memberID: loggedUser.listMemberInformation[0].memberID,
loginDoctorID: loggedUser.listMemberInformation[0].employeeID,
otpSendType: authMethodType.getTypeIdService().toString(), otpSendType: authMethodType.getTypeIdService().toString(),
); );
await _authService.sendActivationCodeForDoctorApp(activationCodeModel); await _authService.sendActivationCodeForDoctorApp(activationCodeModel);
@ -196,6 +198,7 @@ class AuthenticationViewModel extends BaseViewModel {
facilityId:userInfo.projectID!=null? userInfo.projectID.toString():user.projectID.toString(), facilityId:userInfo.projectID!=null? userInfo.projectID.toString():user.projectID.toString(),
oTPSendType: await sharedPref.getInt(OTP_TYPE), oTPSendType: await sharedPref.getInt(OTP_TYPE),
iMEI: localToken, iMEI: localToken,
loginDoctorID:userInfo.userID!=null? int.parse(userInfo.userID):user.doctorID,// loggedUser.listMemberInformation[0].employeeID,
isForSilentLogin:isSilentLogin, isForSilentLogin:isSilentLogin,
generalid: "Cs2020@2016\$2958"); generalid: "Cs2020@2016\$2958");
await _authService.checkActivationCodeForDoctorApp(checkActivationCodeForDoctorApp); await _authService.checkActivationCodeForDoctorApp(checkActivationCodeForDoctorApp);

@ -148,7 +148,7 @@ class DoctorReplayChat extends StatelessWidget {
child: AppText( child: AppText(
reply.patientName reply.patientName
.toString(), .toString(),
fontSize: 14, fontSize: SizeConfig.getTextMultiplierBasedOnWidth() *3,
fontFamily: 'Poppins', fontFamily: 'Poppins',
color: Colors.white, color: Colors.white,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
@ -170,7 +170,7 @@ class DoctorReplayChat extends StatelessWidget {
], ],
), ),
Column( Column(
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.end,
children: [ children: [
AppText( AppText(
@ -178,11 +178,11 @@ class DoctorReplayChat extends StatelessWidget {
fontWeight: FontWeight fontWeight: FontWeight
.w500, .w500,
color: Colors.white, color: Colors.white,
fontSize: 14, fontSize: SizeConfig.getTextMultiplierBasedOnWidth() *2.8,
), ),
AppText( AppText(
reply.createdOn !=null?AppDateUtils.getHour(AppDateUtils.getDateTimeFromServerFormat(reply.createdOn)):AppDateUtils.getHour(DateTime.now()), reply.createdOn !=null?AppDateUtils.getHour(AppDateUtils.getDateTimeFromServerFormat(reply.createdOn)):AppDateUtils.getHour(DateTime.now()),
fontSize: 14, fontSize: SizeConfig.getTextMultiplierBasedOnWidth() *2.8,
fontFamily: 'Poppins', fontFamily: 'Poppins',
color: Colors.white, color: Colors.white,
// fontSize: 18 // fontSize: 18
@ -223,6 +223,7 @@ class DoctorReplayChat extends StatelessWidget {
SizedBox(height: 30,), SizedBox(height: 30,),
SizedBox(height: 30,), SizedBox(height: 30,),
if(reply.doctorResponse != null && reply.doctorResponse.isNotEmpty)
Align( Align(
alignment: Alignment.centerRight, alignment: Alignment.centerRight,
child: Container( child: Container(
@ -267,7 +268,7 @@ class DoctorReplayChat extends StatelessWidget {
width: MediaQuery.of(context).size.width * 0.35, width: MediaQuery.of(context).size.width * 0.35,
child: AppText( child: AppText(
previousModel.doctorProfile.doctorName, previousModel.doctorProfile.doctorName,
fontSize: 14, fontSize: SizeConfig.getTextMultiplierBasedOnWidth() *3,
fontFamily: 'Poppins', fontFamily: 'Poppins',
color: Color(0xFF2B353E), color: Color(0xFF2B353E),
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
@ -278,18 +279,18 @@ class DoctorReplayChat extends StatelessWidget {
], ],
), ),
Column( Column(
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.end,
children: [ children: [
AppText( AppText(
reply.createdOn !=null?AppDateUtils.getDayMonthYearDateFormatted(AppDateUtils.getDateTimeFromServerFormat(reply.createdOn)):AppDateUtils.getDayMonthYearDateFormatted(DateTime.now()), reply.createdOn !=null?AppDateUtils.getDayMonthYearDateFormatted(AppDateUtils.getDateTimeFromServerFormat(reply.createdOn)):AppDateUtils.getDayMonthYearDateFormatted(DateTime.now()),
fontWeight: FontWeight fontWeight: FontWeight
.w500, .w500,
color: Color(0xFF2B353E), color: Color(0xFF2B353E),
fontSize: 14, fontSize: SizeConfig.getTextMultiplierBasedOnWidth() *2.8,
), ),
AppText( AppText(
reply.createdOn !=null?AppDateUtils.getHour(AppDateUtils.getDateTimeFromServerFormat(reply.createdOn)):AppDateUtils.getHour(DateTime.now()), reply.createdOn !=null?AppDateUtils.getHour(AppDateUtils.getDateTimeFromServerFormat(reply.createdOn)):AppDateUtils.getHour(DateTime.now()),
fontSize: 14, fontSize: SizeConfig.getTextMultiplierBasedOnWidth() *2.8,
fontFamily: 'Poppins', fontFamily: 'Poppins',
color: Color(0xFF2B353E), color: Color(0xFF2B353E),
// fontSize: 18 // fontSize: 18
@ -358,6 +359,11 @@ class DoctorReplayChat extends StatelessWidget {
suffixIcon: FontAwesomeIcons.arrowRight, suffixIcon: FontAwesomeIcons.arrowRight,
suffixIconColor: Colors.green, suffixIconColor: Colors.green,
onSuffixTap: ()async { onSuffixTap: ()async {
if(msgController.text.isEmpty){
Helpers.showErrorToast("Please Add Doctor Reply");
return;
} else {
GifLoaderDialogUtils.showMyDialog(context); GifLoaderDialogUtils.showMyDialog(context);
await previousModel.createDoctorResponse(msgController.text, reply); await previousModel.createDoctorResponse(msgController.text, reply);
if(previousModel.state == ViewState.ErrorLocal) { if(previousModel.state == ViewState.ErrorLocal) {
@ -368,6 +374,8 @@ class DoctorReplayChat extends StatelessWidget {
Navigator.pop(context); Navigator.pop(context);
} }
GifLoaderDialogUtils.hideDialog(context); GifLoaderDialogUtils.hideDialog(context);
}

@ -161,6 +161,9 @@ class _InPatientPageState extends State<InPatientPage> {
"isSearch": false, "isSearch": false,
"isInpatient": true, "isInpatient": true,
"arrivalType": "1", "arrivalType": "1",
"isMyPatient":widget.patientSearchViewModel.filteredInPatientItems[index]
.doctorId ==
widget.patientSearchViewModel.doctorProfile.doctorID,
}); });
}, },
); );

@ -39,6 +39,7 @@ class _PatientProfileScreenState extends State<PatientProfileScreen> with Single
bool isFromLiveCare = false; bool isFromLiveCare = false;
bool isInpatient = false; bool isInpatient = false;
bool isMyPatient = false;
bool isCallFinished = false; bool isCallFinished = false;
bool isDischargedPatient = false; bool isDischargedPatient = false;
bool isSearchAndOut = false; bool isSearchAndOut = false;
@ -97,6 +98,9 @@ class _PatientProfileScreenState extends State<PatientProfileScreen> with Single
if (routeArgs.containsKey("isCallFinished")) { if (routeArgs.containsKey("isCallFinished")) {
isCallFinished = routeArgs['isCallFinished']; isCallFinished = routeArgs['isCallFinished'];
} }
if (routeArgs.containsKey("isMyPatient")) {
isMyPatient = routeArgs['isMyPatient'];
}
if (isInpatient) if (isInpatient)
_activeTab = 0; _activeTab = 0;
else else
@ -132,7 +136,9 @@ class _PatientProfileScreenState extends State<PatientProfileScreen> with Single
if (isFromLiveCare && patient.patientStatus == 1) await model.addPatientToDoctorList(patient.vcId); if (isFromLiveCare && patient.patientStatus == 1) await model.addPatientToDoctorList(patient.vcId);
}, },
builder: (_, model, w) => AppScaffold( builder: (_, model, w) => AppScaffold(
baseViewModel: model, baseViewModel: model,
appBarTitle: TranslationBase.of(context).patientProfile, appBarTitle: TranslationBase.of(context).patientProfile,
isShowAppBar: false, isShowAppBar: false,
body: Column( body: Column(
@ -198,11 +204,13 @@ class _PatientProfileScreenState extends State<PatientProfileScreen> with Single
), ),
], ],
), ),
if ( isInpatient? true:isFromLiveCare if ( (isInpatient && isMyPatient )? true:isFromLiveCare
? patient.episodeNo != null ? patient.episodeNo != null
: patient.patientStatusType != null && patient.patientStatusType == 43) : patient.patientStatusType != null && patient.patientStatusType == 43)
BaseView<SOAPViewModel>( BaseView<SOAPViewModel>(
onModelReady: (model) async {}, onModelReady: (model) async {
model.getDoctorProfile();
},
builder: (_, model, w) => Positioned( builder: (_, model, w) => Positioned(
top: 180, top: 180,
left: 20, left: 20,
@ -253,7 +261,7 @@ class _PatientProfileScreenState extends State<PatientProfileScreen> with Single
AppButton( AppButton(
title: title:
"${TranslationBase.of(context).update}\n${TranslationBase.of(context).episode}", "${TranslationBase.of(context).update}\n${TranslationBase.of(context).episode}",
color: isInpatient || isFromLiveCare color: (isInpatient &&isMyPatient ) || isFromLiveCare
? Colors.red.shade700 ? Colors.red.shade700
: patient.patientStatusType == 43 : patient.patientStatusType == 43
? Colors.red.shade700 ? Colors.red.shade700

@ -1370,6 +1370,7 @@ class TranslationBase {
String get edit => localizedValues['edit'][locale.languageCode]; String get edit => localizedValues['edit'][locale.languageCode];
String get summeryReply => localizedValues['summeryReply'][locale.languageCode]; String get summeryReply => localizedValues['summeryReply'][locale.languageCode];
String get severityValidationError => localizedValues['severityValidationError'][locale.languageCode]; String get severityValidationError => localizedValues['severityValidationError'][locale.languageCode];
String get textCopiedSuccessfully => localizedValues['textCopiedSuccessfully'][locale.languageCode];
} }
class TranslationBaseDelegate extends LocalizationsDelegate<TranslationBase> { class TranslationBaseDelegate extends LocalizationsDelegate<TranslationBase> {

@ -191,32 +191,25 @@ class PatientProfileAppBar extends StatelessWidget
Row( Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
RichText( Row(
text: TextSpan( children: [
style: TextStyle( AppText(
fontSize: 1.6 * SizeConfig.textMultiplier, TranslationBase
color: Colors.black),
children: <TextSpan>[
new TextSpan(
text: TranslationBase
.of(context) .of(context)
.fileNumber, .fileNumber,
style: TextStyle(
fontSize: SizeConfig.getTextMultiplierBasedOnWidth() *3, fontSize: SizeConfig.getTextMultiplierBasedOnWidth() *3,
fontFamily: 'Poppins',
color: Color(0xFF575757), color: Color(0xFF575757),
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
),
),), SizedBox(width: 1,),
new TextSpan( AppText(
text: patient.patientId.toString(), patient.patientId.toString(),
style: TextStyle( fontSize: SizeConfig.getTextMultiplierBasedOnWidth() *3.5,
color: Color(0xFF2E303A),
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
fontFamily: 'Poppins', isCopyable: true,
fontSize: SizeConfig.getTextMultiplierBasedOnWidth() *3.5, color: Color(0xFF2E303A),)),
],
), ),
],
), ),
Row( Row(
children: [ children: [

@ -1,6 +1,9 @@
import 'package:doctor_app_flutter/config/size_config.dart'; import 'package:doctor_app_flutter/config/size_config.dart';
import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart';
import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:hexcolor/hexcolor.dart'; import 'package:hexcolor/hexcolor.dart';
class AppText extends StatefulWidget { class AppText extends StatefulWidget {
@ -30,6 +33,7 @@ class AppText extends StatefulWidget {
final bool visibility; final bool visibility;
final TextOverflow textOverflow; final TextOverflow textOverflow;
final TextDecoration textDecoration; final TextDecoration textDecoration;
final bool isCopyable;
AppText( AppText(
this.text, { this.text, {
@ -56,7 +60,9 @@ class AppText extends StatefulWidget {
this.allowExpand = true, this.allowExpand = true,
this.visibility = true, this.visibility = true,
this.textOverflow, this.textOverflow,
this.textDecoration, this.letterSpacing, this.textDecoration,
this.letterSpacing,
this.isCopyable = true,
}); });
@override @override
@ -92,7 +98,8 @@ class _AppTextState extends State<AppText> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Container( return GestureDetector(
child: Container(
margin: widget.margin != null margin: widget.margin != null
? EdgeInsets.all(widget.margin) ? EdgeInsets.all(widget.margin)
: EdgeInsets.only( : EdgeInsets.only(
@ -106,39 +113,7 @@ class _AppTextState extends State<AppText> {
children: [ children: [
Stack( Stack(
children: [ children: [
Text( _textWidget(),
!hidden
? text
: (text.substring(
0,
text.length > widget.maxLength
? widget.maxLength
: text.length)),
textAlign: widget.textAlign,
overflow: widget.maxLines != null
? ((widget.maxLines > 1)
? TextOverflow.fade
: TextOverflow.ellipsis)
: null,
maxLines: widget.maxLines ?? null,
style: widget.style != null
? _getFontStyle().copyWith(
fontStyle: widget.italic ? FontStyle.italic : null,
color: widget.color,
fontWeight: widget.fontWeight ?? _getFontWeight(),
height: widget.fontHeight)
: TextStyle(
fontStyle: widget.italic ? FontStyle.italic : null,
color:
widget.color != null ? widget.color : Colors.black,
fontSize: widget.fontSize ?? _getFontSize(),
letterSpacing:
widget.letterSpacing??(widget.variant == "overline" ? 1.5 : null),
fontWeight: widget.fontWeight ?? _getFontWeight(),
fontFamily: widget.fontFamily ?? 'Poppins',
decoration: widget.textDecoration,
height: widget.fontHeight),
),
if (widget.readMore && text.length > widget.maxLength && hidden) if (widget.readMore && text.length > widget.maxLength && hidden)
Positioned( Positioned(
bottom: 0, bottom: 0,
@ -179,9 +154,93 @@ class _AppTextState extends State<AppText> {
), ),
], ],
), ),
),
// onLongPress: (){
// if(widget.isCopyable){
// DrAppToastMsg.showShortToast(TranslationBase.of(context).textCopiedSuccessfully);
// Clipboard.setData(new ClipboardData(text: widget.text));
// }
// },
); );
} }
Widget _textWidget() {
if (widget.isCopyable) {
return Theme(
data: ThemeData(
textSelectionColor: Colors.lightBlueAccent,
),
child: Container(
child: SelectableText(
!hidden
? text
: (text.substring(
0,
text.length > widget.maxLength
? widget.maxLength
: text.length)),
textAlign: widget.textAlign,
// overflow: widget.maxLines != null
// ? ((widget.maxLines > 1)
// ? TextOverflow.fade
// : TextOverflow.ellipsis)
// : null,
maxLines: widget.maxLines ?? null,
style: widget.style != null
? _getFontStyle().copyWith(
fontStyle: widget.italic ? FontStyle.italic : null,
color: widget.color,
fontWeight: widget.fontWeight ?? _getFontWeight(),
height: widget.fontHeight)
: TextStyle(
fontStyle: widget.italic ? FontStyle.italic : null,
color: widget.color != null ? widget.color : Colors.black,
fontSize: widget.fontSize ?? _getFontSize(),
letterSpacing: widget.letterSpacing ??
(widget.variant == "overline" ? 1.5 : null),
fontWeight: widget.fontWeight ?? _getFontWeight(),
fontFamily: widget.fontFamily ?? 'Poppins',
decoration: widget.textDecoration,
height: widget.fontHeight),
),
),
);
} else {
return Text(
!hidden
? text
: (text.substring(
0,
text.length > widget.maxLength
? widget.maxLength
: text.length)),
textAlign: widget.textAlign,
overflow: widget.maxLines != null
? ((widget.maxLines > 1)
? TextOverflow.fade
: TextOverflow.ellipsis)
: null,
maxLines: widget.maxLines ?? null,
style: widget.style != null
? _getFontStyle().copyWith(
fontStyle: widget.italic ? FontStyle.italic : null,
color: widget.color,
fontWeight: widget.fontWeight ?? _getFontWeight(),
height: widget.fontHeight)
: TextStyle(
fontStyle: widget.italic ? FontStyle.italic : null,
color: widget.color != null ? widget.color : Colors.black,
fontSize: widget.fontSize ?? _getFontSize(),
letterSpacing: widget.letterSpacing ??
(widget.variant == "overline" ? 1.5 : null),
fontWeight: widget.fontWeight ?? _getFontWeight(),
fontFamily: widget.fontFamily ?? 'Poppins',
decoration: widget.textDecoration,
height: widget.fontHeight),
);
}
}
TextStyle _getFontStyle() { TextStyle _getFontStyle() {
switch (widget.style) { switch (widget.style) {
case "headline2": case "headline2":

Loading…
Cancel
Save