Null Safety

update_flutter_3.16.0_voipcall
Aamir Muhammad 2 years ago
parent c3ff456645
commit cb01308f96

@ -398,10 +398,10 @@ class AuthenticationViewModel extends BaseViewModel {
/// logout function /// logout function
logout({bool isFromLogin = false}) async { logout({bool isFromLogin = false}) async {
localToken = ""; localToken = "";
String lang = await sharedPref.getString(APP_Language); String? lang = await sharedPref.getString(APP_Language);
await Utils.clearSharedPref(); await Utils.clearSharedPref();
doctorProfile = null; doctorProfile = null;
sharedPref.setString(APP_Language, lang); sharedPref.setString(APP_Language, lang ?? 'en');
deleteUser(); deleteUser();
await getDeviceInfoFromFirebase(); await getDeviceInfoFromFirebase();
this.isFromLogin = isFromLogin; this.isFromLogin = isFromLogin;

@ -27,28 +27,20 @@ class PatientsSearchResultScreen extends StatefulWidget {
final String? searchKey; final String? searchKey;
PatientsSearchResultScreen( PatientsSearchResultScreen(
{this.selectedPatientType, {this.selectedPatientType, this.patientSearchRequestModel, this.isSearchWithKeyInfo = true, this.isSearch = false, this.isInpatient = false, this.searchKey, this.isSearchAndOut = false});
this.patientSearchRequestModel,
this.isSearchWithKeyInfo = true,
this.isSearch = false,
this.isInpatient = false,
this.searchKey,
this.isSearchAndOut = false});
@override @override
_PatientsSearchResultScreenState createState() => _PatientsSearchResultScreenState createState() => _PatientsSearchResultScreenState();
_PatientsSearchResultScreenState();
} }
class _PatientsSearchResultScreenState class _PatientsSearchResultScreenState extends State<PatientsSearchResultScreen> {
extends State<PatientsSearchResultScreen> {
int? clinicId; int? clinicId;
AuthenticationViewModel authenticationViewModel = AuthenticationViewModel(); AuthenticationViewModel authenticationViewModel = AuthenticationViewModel();
String? patientType; String patientType = '';
String? patientTypeTitle; String? patientTypeTitle;
var selectedFilter = 1; var selectedFilter = 1;
String? arrivalType; String arrivalType = '';
late ProjectViewModel projectsProvider; late ProjectViewModel projectsProvider;
var isView; var isView;
final _controller = TextEditingController(); final _controller = TextEditingController();
@ -60,12 +52,10 @@ class _PatientsSearchResultScreenState
authenticationViewModel = Provider.of(context); authenticationViewModel = Provider.of(context);
return BaseView<PatientSearchViewModel>( return BaseView<PatientSearchViewModel>(
onModelReady: (model) async { onModelReady: (model) async {
if (!widget.isSearchWithKeyInfo && if (!widget.isSearchWithKeyInfo && widget.selectedPatientType == PatientType.OutPatient) {
widget.selectedPatientType == PatientType.OutPatient) {
await model.getOutPatient(widget.patientSearchRequestModel!); await model.getOutPatient(widget.patientSearchRequestModel!);
} else { } else {
await model await model.getPatientFileInformation(widget.patientSearchRequestModel!);
.getPatientFileInformation(widget.patientSearchRequestModel!);
} }
}, },
builder: (_, model, w) => AppScaffold( builder: (_, model, w) => AppScaffold(
@ -89,9 +79,10 @@ class _PatientsSearchResultScreenState
DoctorApp.filter_1, DoctorApp.filter_1,
color: Colors.black, color: Colors.black,
), ),
iconSize: 20, onPressed: () { }, iconSize: 20, onPressed: () {},
// padding: EdgeInsets.only(bottom: 30), // padding: EdgeInsets.only(bottom: 30),
), onFieldSubmitted: (){}, ),
onFieldSubmitted: () {},
), ),
SizedBox( SizedBox(
height: 10.0, height: 10.0,
@ -101,8 +92,7 @@ class _PatientsSearchResultScreenState
child: model.filterData.isEmpty child: model.filterData.isEmpty
? Center( ? Center(
child: ErrorMessage( child: ErrorMessage(
error: TranslationBase.of(context) error: TranslationBase.of(context).youDontHaveAnyPatient,
.youDontHaveAnyPatient,
), ),
) )
: ListView.builder( : ListView.builder(
@ -114,27 +104,27 @@ class _PatientsSearchResultScreenState
padding: EdgeInsets.all(8.0), padding: EdgeInsets.all(8.0),
child: PatientCard( child: PatientCard(
patientInfo: model.filterData[index], patientInfo: model.filterData[index],
patientType: patientType!, patientType: patientType,
arrivalType: arrivalType!, arrivalType: arrivalType,
isFromSearch: widget.isSearchAndOut, isFromSearch: widget.isSearchAndOut,
isInpatient: widget.isInpatient, isInpatient: widget.isInpatient,
onTap: () { onTap: () {
print("TODO change the parameter to daynamic");
print("TODO change the parameter to daynamic");
print("TODO change the parameter to daynamic");
print("TODO change the parameter to daynamic");
print("TODO change the parameter to daynamic");
// TODO change the parameter to daynamic // TODO change the parameter to daynamic
Navigator.of(context).pushNamed( Navigator.of(context).pushNamed(PATIENTS_PROFILE, arguments: {
PATIENTS_PROFILE, "patient": model.filterData[index],
arguments: { "patientType": "1",
"patient": model.filterData[index], "from": widget.patientSearchRequestModel!.from,
"patientType": "1", "to": widget.patientSearchRequestModel!.from,
"from": widget "isSearch": widget.isSearch,
.patientSearchRequestModel!.from, "isInpatient": widget.isInpatient,
"to": widget "arrivalType": "7",
.patientSearchRequestModel!.from, "isSearchAndOut": widget.isSearchAndOut,
"isSearch": widget.isSearch, });
"isInpatient": widget.isInpatient,
"arrivalType": "7",
"isSearchAndOut":
widget.isSearchAndOut,
});
}, },
// isFromSearch: widget.isSearch, // isFromSearch: widget.isSearch,
), ),

@ -18,7 +18,7 @@ import 'ShowTimer.dart';
class PatientCard extends StatelessWidget { class PatientCard extends StatelessWidget {
final PatiantInformtion? patientInfo; final PatiantInformtion? patientInfo;
final Function()? onTap; final Function() onTap;
final String patientType; final String patientType;
final String arrivalType; final String arrivalType;
final bool isInpatient; final bool isInpatient;
@ -451,7 +451,7 @@ class PatientCard extends StatelessWidget {
: SizedBox() : SizedBox()
], ],
), ),
onTap: onTap!(), onTap: onTap,
)), )),
)); ));
} }

@ -63,7 +63,7 @@ class AppTextFieldCustomSearch extends StatelessWidget {
onChangeFun(val!); onChangeFun(val!);
}, },
onFieldSubmitted: () { onFieldSubmitted: () {
onFieldSubmitted(); onFieldSubmitted;
}, },
validationError: validationError, validationError: validationError,
onClick: () {}, onClick: () {},

Loading…
Cancel
Save