You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
65 lines
1.9 KiB
Dart
65 lines
1.9 KiB
Dart
import '../../models/patient_model.dart';
|
|
import '../../providers/patients_provider.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:provider/provider.dart';
|
|
|
|
class PatientsListScreen extends StatefulWidget {
|
|
@override
|
|
_PatientsListScreenState createState() => _PatientsListScreenState();
|
|
}
|
|
|
|
class _PatientsListScreenState extends State<PatientsListScreen> {
|
|
var _isInit = true;
|
|
var _isLoading = true;
|
|
var _hasError;
|
|
@override
|
|
void didChangeDependencies() {
|
|
final routeArgs = ModalRoute.of(context).settings.arguments as Map;
|
|
PatientModel patient = routeArgs['patientSearchForm'];
|
|
print(patient.TokenID+"EEEEEE");
|
|
String patientType = routeArgs['selectedType'];
|
|
print(patientType);
|
|
if (_isInit) {
|
|
// setState(() {});
|
|
PatientsProvider patientsProv = Provider.of<PatientsProvider>(context);
|
|
patientsProv.getPatientList(patient, patientType).then((res) {
|
|
// print('MessageStatus${res['MessageStatus']}');
|
|
print('List_MyInPatient${(res['List_MyInPatient'][0])}');
|
|
setState(() {
|
|
_isLoading = false;
|
|
_hasError = res['ErrorEndUserMessage'];
|
|
|
|
});
|
|
print(res);
|
|
}).catchError((error) {
|
|
print(error);
|
|
});
|
|
}
|
|
_isInit = false;
|
|
super.didChangeDependencies();
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Scaffold(
|
|
appBar: AppBar(
|
|
title: Text('PatientsListScreen'),
|
|
),
|
|
body: _isLoading
|
|
? Center(
|
|
child: CircularProgressIndicator(),
|
|
)
|
|
: Container(
|
|
child: _hasError != null
|
|
? Center(
|
|
child: Text(
|
|
_hasError,
|
|
style: TextStyle(color: Theme.of(context).errorColor),
|
|
),
|
|
)
|
|
: Text('EEEEEEEEEEEEEE'),
|
|
),
|
|
);
|
|
}
|
|
}
|