replace the TabBar in refer-patient-screen-in-patient with our custom TabBar in tab_utils

merge-requests/979/head
RoaaGhali98 4 years ago
parent e61d1e78f6
commit 4c7db58489

@ -3,11 +3,13 @@ import 'package:doctor_app_flutter/config/size_config.dart';
import 'package:doctor_app_flutter/core/enum/viewstate.dart'; import 'package:doctor_app_flutter/core/enum/viewstate.dart';
import 'package:doctor_app_flutter/core/provider/robot_provider.dart'; import 'package:doctor_app_flutter/core/provider/robot_provider.dart';
import 'package:doctor_app_flutter/core/viewModel/patient-referral-viewmodel.dart'; import 'package:doctor_app_flutter/core/viewModel/patient-referral-viewmodel.dart';
import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart';
import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart'; import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart';
import 'package:doctor_app_flutter/core/model/patient/patiant_info_model.dart'; import 'package:doctor_app_flutter/core/model/patient/patiant_info_model.dart';
import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart';
import 'package:doctor_app_flutter/screens/patients/profile/soap_update/shared_soap_widgets/bottom_sheet_dialog_button.dart'; import 'package:doctor_app_flutter/screens/patients/profile/soap_update/shared_soap_widgets/bottom_sheet_dialog_button.dart';
import 'package:doctor_app_flutter/utils/dr_app_toast_msg.dart'; import 'package:doctor_app_flutter/utils/dr_app_toast_msg.dart';
import 'package:doctor_app_flutter/utils/tab_utils.dart';
import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.dart'; import 'package:doctor_app_flutter/utils/translations_delegate_base_utils.dart';
import 'package:doctor_app_flutter/widgets/patients/profile/app_bar/patient-profile-app-bar.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/app_bar/patient-profile-app-bar.dart';
import 'package:doctor_app_flutter/widgets/patients/patient_service_title.dart'; import 'package:doctor_app_flutter/widgets/patients/patient_service_title.dart';
@ -22,6 +24,7 @@ import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:intl/intl.dart'; import 'package:intl/intl.dart';
import 'package:permission_handler/permission_handler.dart'; import 'package:permission_handler/permission_handler.dart';
import 'package:provider/provider.dart';
import 'package:speech_to_text/speech_recognition_error.dart'; import 'package:speech_to_text/speech_recognition_error.dart';
import 'package:speech_to_text/speech_to_text.dart' as stt; import 'package:speech_to_text/speech_to_text.dart' as stt;
@ -31,8 +34,9 @@ class PatientMakeInPatientReferralScreen extends StatefulWidget {
_PatientMakeInPatientReferralScreenState(); _PatientMakeInPatientReferralScreenState();
} }
class _PatientMakeInPatientReferralScreenState class _PatientMakeInPatientReferralScreenState extends State<PatientMakeInPatientReferralScreen> with SingleTickerProviderStateMixin{
extends State<PatientMakeInPatientReferralScreen> { TabController _tabController;
int index = 0;
PatiantInformtion patient; PatiantInformtion patient;
List<dynamic> referToList; List<dynamic> referToList;
dynamic _referTo; dynamic _referTo;
@ -54,6 +58,20 @@ class _PatientMakeInPatientReferralScreenState
var recognizedWord; var recognizedWord;
var event = RobotProvider(); var event = RobotProvider();
_handleTabSelection() {
setState(() {
index = _tabController.index;
});
}
@override
void dispose() {
super.dispose();
_tabController.dispose();
}
@override @override
void initState() { void initState() {
requestPermissions(); requestPermissions();
@ -65,6 +83,8 @@ class _PatientMakeInPatientReferralScreenState
} }
}); });
super.initState(); super.initState();
_tabController = TabController(length: 3, vsync: this);
_tabController.addListener(_handleTabSelection);
} }
onVoiceText() async { onVoiceText() async {
@ -489,6 +509,9 @@ class _PatientMakeInPatientReferralScreenState
), ),
], ],
), ),
SizedBox(
height: 100,
)
], ],
), ),
) )
@ -587,52 +610,110 @@ class _PatientMakeInPatientReferralScreenState
} }
Widget priorityBar(BuildContext _context, Size screenSize) { Widget priorityBar(BuildContext _context, Size screenSize) {
List<String> _priorities = [ ProjectViewModel projectsProvider = Provider.of<ProjectViewModel>(context);
TranslationBase.of(context).veryUrgent.toUpperCase(), return Center(
TranslationBase.of(context).urgent.toUpperCase(), child: Container(
TranslationBase.of(context).routine.toUpperCase(), width: SizeConfig.widthMultiplier * 120,
]; height: TabHelper.getTabHeight(context),
return Container( color: TabHelper.getBgTabColor(),
height: screenSize.height * 0.070, child: Center(
width: screenSize.width * 0.95, child: TabBar(
decoration: isScrollable: false,
containerBorderDecoration(Color(0Xffffffff), Color(0xFFCCCCCC)), controller: _tabController,
child: Row( indicatorColor: Colors.transparent,
mainAxisSize: MainAxisSize.max, indicatorWeight: 1.0,
crossAxisAlignment: CrossAxisAlignment.center, indicatorSize: TabBarIndicatorSize.tab,
children: _priorities.map((item) { labelColor: Theme.of(context).primaryColor,
bool _isActive = _priorities[_activePriority] == item ? true : false; labelPadding:
return Expanded( EdgeInsets.only(top: 0, left: 0, right: 0, bottom: 0),
child: InkWell( unselectedLabelColor: Colors.grey[800],
child: Center( tabs: [
Container(
decoration: TabHelper.getBoxTabsBoxDecoration(
isActive: index == 0,
isFirst: true,
projectViewModel: projectsProvider),
child: Center(
child: TabHelper.getTabText(
title: TranslationBase.of(context).veryUrgent.toUpperCase(),
isActive: index == 0)),
),
Center(
child: Container( child: Container(
height: screenSize.height * 0.070, decoration: TabHelper.getBoxTabsBoxDecoration(
decoration: containerBorderDecoration( isActive: index == 1,
_isActive ? Color(0XFFB8382B) : Colors.white, isMiddle: true,
_isActive ? Color(0XFFB8382B) : Colors.white), projectViewModel: projectsProvider),
child: Center( child: Center(
child: Text( child: TabHelper.getTabText(
item, title: TranslationBase.of(context).urgent.toUpperCase(),
style: TextStyle( isActive: index == 1)),
fontSize: 12, ),
color: _isActive ? Colors.white : Colors.black,
//Colors.black,
fontWeight: FontWeight.bold,
),
),
)),
), ),
onTap: () { Center(
print(_priorities.indexOf(item)); child: Container(
setState(() { decoration: TabHelper.getBoxTabsBoxDecoration(
_activePriority = _priorities.indexOf(item); isActive: index == 2,
}); isLast: true,
}, projectViewModel: projectsProvider),
), child: Center(
); child: TabHelper.getTabText(
}).toList(), title: TranslationBase.of(context).routine.toUpperCase(),
isActive: index == 2),
),
),
),
],
),
),
), ),
); );
// List<String> _priorities = [
// TranslationBase.of(context).veryUrgent.toUpperCase(),
// TranslationBase.of(context).urgent.toUpperCase(),
// TranslationBase.of(context).routine.toUpperCase(),
// ];
// return Container(
// height: screenSize.height * 0.070,
// width: screenSize.width * 0.95,
// decoration:
// containerBorderDecoration(Color(0Xffffffff), Color(0xFFCCCCCC)),
// child: Row(
// mainAxisSize: MainAxisSize.max,
// crossAxisAlignment: CrossAxisAlignment.center,
// children: _priorities.map((item) {
// bool _isActive = _priorities[_activePriority] == item ? true : false;
// return Expanded(
// child: InkWell(
// child: Center(
// child: Container(
// height: screenSize.height * 0.070,
// decoration: containerBorderDecoration(
// _isActive ? Color(0XFFB8382B) : Colors.white,
// _isActive ? Color(0XFFB8382B) : Colors.white),
// child: Center(
// child: Text(
// item,
// style: TextStyle(
// fontSize: 12,
// color: _isActive ? Colors.white : Colors.black,
// //Colors.black,
// fontWeight: FontWeight.bold,
// ),
// ),
// )),
// ),
// onTap: () {
// print(_priorities.indexOf(item));
// setState(() {
// _activePriority = _priorities.indexOf(item);
// });
// },
// ),
// );
// }).toList(),
// ),
// );
} }
String getPriority() { String getPriority() {

@ -1,7 +1,5 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart'; import 'package:flutter/widgets.dart';
import '../config/config.dart'; import '../config/config.dart';
import '../config/size_config.dart'; import '../config/size_config.dart';
import '../core/viewModel/project_view_model.dart'; import '../core/viewModel/project_view_model.dart';

Loading…
Cancel
Save