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
2.2 KiB
Dart
65 lines
2.2 KiB
Dart
|
6 years ago
|
import 'package:doctor_app_flutter/models/pharmacies_List_request_model.dart';
|
||
|
|
import 'package:doctor_app_flutter/providers/medicine_provider.dart';
|
||
|
|
import 'package:doctor_app_flutter/util/dr_app_shared_pref.dart';
|
||
|
|
import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart';
|
||
|
|
import 'package:flutter/material.dart';
|
||
|
|
import 'package:provider/provider.dart';
|
||
|
|
|
||
|
|
DrAppSharedPreferances sharedPref = DrAppSharedPreferances();
|
||
|
|
|
||
|
|
class PharmaciesListScreen extends StatefulWidget {
|
||
|
|
@override
|
||
|
|
_PharmaciesListState createState() => _PharmaciesListState();
|
||
|
|
}
|
||
|
|
|
||
|
|
class _PharmaciesListState extends State<PharmaciesListScreen> {
|
||
|
|
var _pharmaciesModel = PharmaciesListRequestModel(
|
||
|
|
ItemID: 90417,
|
||
|
|
IsLoginForDoctorApp: true,
|
||
|
|
PatientOutSA: false,
|
||
|
|
PatientTypeID: 1,
|
||
|
|
LanguageID: 2,
|
||
|
|
IPAdress: "11.11.11.11",
|
||
|
|
VersionID: 1.2,
|
||
|
|
TokenID: "2Fi7HoIHB0eDyekVa6tCJg==",
|
||
|
|
stamp: "2020-04-23T21:01:21.492Z",
|
||
|
|
Channel: 9,
|
||
|
|
SessionID: "e29zoooEJ4");
|
||
|
|
|
||
|
|
@override
|
||
|
|
Widget build(BuildContext context) {
|
||
|
|
return ChangeNotifierProvider(
|
||
|
|
create: (context) => MedicineProvider(), //change builder to create
|
||
|
|
child: Consumer<MedicineProvider>(
|
||
|
|
builder: (context, provider, child) => AppScaffold(
|
||
|
|
appBarTitle: "Pharmacies List",
|
||
|
|
body: RaisedButton(
|
||
|
|
onPressed: () {
|
||
|
|
MedicineProvider medicineProvider =
|
||
|
|
Provider.of<MedicineProvider>(context);
|
||
|
|
pharmaciesList(context, medicineProvider);
|
||
|
|
},
|
||
|
|
))));
|
||
|
|
}
|
||
|
|
|
||
|
|
pharmaciesList(context, MedicineProvider medicineProvider) {
|
||
|
|
medicineProvider.getPharmaciesList(_pharmaciesModel).then((res) {
|
||
|
|
print(res.toString());
|
||
|
|
if (res['MessageStatus'] == 1) {
|
||
|
|
print("ListPharmcy " + res['PharmList'].toString());
|
||
|
|
|
||
|
|
//Navigator.of(context).pushNamed();
|
||
|
|
} else {
|
||
|
|
// handel error
|
||
|
|
// widget.showCenterShortLoadingToast("watting");
|
||
|
|
//helpers.showErrorToast(res['ErrorEndUserMessage']);
|
||
|
|
print(res['MessageStatus'].toString());
|
||
|
|
}
|
||
|
|
// Navigator.of(context).pushNamed(HOME);
|
||
|
|
}).catchError((err) {
|
||
|
|
print('$err');
|
||
|
|
//helpers.showErrorToast();
|
||
|
|
});
|
||
|
|
}
|
||
|
|
}
|