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.
doctor_app_flutter/lib/screens/patients/PatientsInPatientScreen.dart

192 lines
6.9 KiB
Dart

import 'package:doctor_app_flutter/config/size_config.dart';
import 'file:///C:/Users/admin/AndroidStudioProjects/doctor_app_flutter/lib/core/model/patient_muse/PatientSearchRequestModel.dart';
import 'package:doctor_app_flutter/core/viewModel/PatientSearchViewModel.dart';
import 'package:doctor_app_flutter/screens/base/base_view.dart';
import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/text_fields/text_fields_utils.dart';
import 'package:flutter/material.dart';
import 'DischargedPatientPage.dart';
import 'InPatientPage.dart';
class PatientInPatientScreen extends StatefulWidget {
@override
_PatientInPatientScreenState createState() => _PatientInPatientScreenState();
}
class _PatientInPatientScreenState extends State<PatientInPatientScreen>
with SingleTickerProviderStateMixin {
TabController _tabController;
int _activeTab = 0;
@override
void initState() {
super.initState();
_tabController = TabController(length: 3, vsync: this);
_tabController.addListener(_handleTabSelection);
}
@override
void dispose() {
super.dispose();
_tabController.dispose();
}
_handleTabSelection() {
setState(() {
_activeTab = _tabController.index;
});
}
@override
Widget build(BuildContext context) {
final screenSize = MediaQuery.of(context).size;
5 years ago
PatientSearchRequestModel requestModel = PatientSearchRequestModel();
return BaseView<PatientSearchViewModel>(
5 years ago
onModelReady: (model) async {
model.clearPatientList();
model.getInPatientList(requestModel);
},
builder: (_, model, w) => AppScaffold(
baseViewModel: model,
isShowAppBar: false,
body: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
padding: EdgeInsets.only(left: 0, right: 5, bottom: 5, top: 5),
decoration: BoxDecoration(
color: Colors.white,
),
child: Container(
padding: EdgeInsets.only(left: 10, right: 10, bottom: 10),
margin: EdgeInsets.only(top: 50),
child: Row(children: [
IconButton(
icon: Icon(Icons.arrow_back_ios),
color: Colors.black, //Colors.black,
onPressed: () => Navigator.pop(context),
),
Expanded(
child: AppText(
TranslationBase.of(context).inPatient,
fontSize: SizeConfig.textMultiplier * 2.8,
fontWeight: FontWeight.bold,
color: Color(0xFF2B353E),
),
),
]),
),
),
Expanded(
child: Scaffold(
extendBodyBehindAppBar: true,
appBar: PreferredSize(
preferredSize: Size.fromHeight(
MediaQuery.of(context).size.height * 0.070),
child: Container(
height: MediaQuery.of(context).size.height * 0.070,
decoration: BoxDecoration(
border: Border(
bottom: BorderSide(
color: Theme.of(context).dividerColor,
width: 0.5), //width: 0.7
),
color: Colors.white),
child: Center(
child: TabBar(
isScrollable: false,
controller: _tabController,
indicatorColor: Colors.transparent,
indicatorWeight: 1.0,
indicatorSize: TabBarIndicatorSize.tab,
labelColor: Theme.of(context).primaryColor,
labelPadding: EdgeInsets.only(
top: 0, left: 0, right: 0, bottom: 0),
unselectedLabelColor: Colors.grey[800],
tabs: [
tabWidget(screenSize, _activeTab == 0,
TranslationBase.of(context).inPatientAll,
counter: model.inPatientList.length),
tabWidget(
screenSize, _activeTab == 1, "My InPatients",
counter: model.myIinPatientList.length),
tabWidget(screenSize, _activeTab == 2,
TranslationBase.of(context).discharged),
],
),
),
),
),
body: Column(
children: [
Expanded(
child: TabBarView(
physics: BouncingScrollPhysics(),
controller: _tabController,
children: [
InPatientPage(false),
InPatientPage(true),
DischargedPatient(),
],
),
),
],
),
),
),
],
),
),
);
}
Widget tabWidget(Size screenSize, bool isActive, String title,
{int counter = -1}) {
return Center(
child: Container(
height: screenSize.height * 0.070,
decoration: TextFieldsUtils.containerBorderDecoration(
isActive ? Color(0xFFD02127 /*B8382B*/) : Color(0xFFEAEAEA),
isActive ? Color(0xFFD02127) : Color(0xFFEAEAEA),
borderRadius: 4,
borderWidth: 0),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
AppText(
title,
5 years ago
fontSize: SizeConfig.textMultiplier * 1.5,
color: isActive ? Colors.white : Color(0xFF2B353E),
fontWeight: FontWeight.w700,
),
if (counter != -1)
Container(
margin: EdgeInsets.all(4),
width: 15,
height: 15,
decoration: BoxDecoration(
color: isActive ? Colors.white : Color(0xFFD02127),
shape: BoxShape.circle,
),
child: Center(
child: FittedBox(
child: AppText(
"$counter",
fontSize: SizeConfig.textMultiplier * 1.5,
color: !isActive ? Colors.white : Color(0xFFD02127),
fontWeight: FontWeight.w700,
),
),
),
),
],
),
),
);
}
}