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.
72 lines
2.5 KiB
Dart
72 lines
2.5 KiB
Dart
import 'package:diplomaticquarterapp/core/model/hospitals/hospitals_model.dart';
|
|
import 'package:diplomaticquarterapp/core/viewModels/hospital_view_model.dart';
|
|
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
|
|
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
|
|
import 'package:flutter/cupertino.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:diplomaticquarterapp/core/model/pharmacies/pharmacies_model.dart';
|
|
import 'package:diplomaticquarterapp/core/viewModels/pharmacies_view_model.dart';
|
|
import 'package:diplomaticquarterapp/core/model/pharmacies/pharmacies_list_model.dart';
|
|
|
|
import '../base/base_view.dart';
|
|
|
|
class HomePage extends StatefulWidget {
|
|
@override
|
|
_HomePageState createState() => _HomePageState();
|
|
}
|
|
|
|
class _HomePageState extends State<HomePage> {
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return BaseView<PharmacyViewModel>(
|
|
onModelReady: (model) => model.getMedicine(),
|
|
builder: (BuildContext context, PharmacyViewModel model, Widget child) =>
|
|
AppScaffold(
|
|
baseViewModel: model,
|
|
body: Column(
|
|
children: <Widget>[
|
|
InkWell(
|
|
onTap: () {
|
|
model.getMedicine();
|
|
},
|
|
child: Container(
|
|
child: Texts('call api'),
|
|
),
|
|
),
|
|
Expanded(
|
|
child: _getHospitals(model.pharmacy),
|
|
)
|
|
// BaseView<DoctorViewModel>(
|
|
// onModelReady: (dctorViewModel) => dctorViewModel.getHospitals(),
|
|
// builder: (BuildContext context, DoctorViewModel dctorViewModel,
|
|
// Widget child) =>
|
|
// InkWell(
|
|
// onTap: () {
|
|
// dctorViewModel.getHospitals();
|
|
// },
|
|
// child: Container(
|
|
// width: double.infinity,
|
|
// height: 150,
|
|
// child: NetworkBaseView(
|
|
// baseViewModel: dctorViewModel,
|
|
// child: Container(
|
|
// child: Texts('The API 2'),
|
|
// ),
|
|
// ),
|
|
// ),
|
|
// ),
|
|
// ),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
|
|
Widget _getHospitals(List<PharmaciesModel> hospitals) => ListView.builder(
|
|
itemCount: hospitals.length,
|
|
itemBuilder: (BuildContext context, int index) => Container(
|
|
child: Texts(hospitals[index].itemDes),
|
|
),
|
|
);
|
|
}
|