working on procedure refactoring
parent
4b6263ca1a
commit
9454e9d8af
@ -0,0 +1,5 @@
|
||||
enum ProcedureType {
|
||||
PROCEDURE,
|
||||
LAB_RESULT,
|
||||
RADIOLOGY,
|
||||
}
|
||||
@ -1,218 +0,0 @@
|
||||
import 'package:doctor_app_flutter/config/size_config.dart';
|
||||
import 'package:doctor_app_flutter/core/viewModel/procedure_View_model.dart';
|
||||
import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart';
|
||||
import 'package:doctor_app_flutter/screens/base/base_view.dart';
|
||||
import 'package:doctor_app_flutter/screens/procedures/add-favourite-procedure.dart';
|
||||
import 'package:doctor_app_flutter/screens/procedures/add-procedure-form.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/network_base_view.dart';
|
||||
import 'package:doctor_app_flutter/widgets/shared/text_fields/text_fields_utils.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'add_lab_orders.dart';
|
||||
|
||||
class AddLabHomeScreen extends StatefulWidget {
|
||||
final ProcedureViewModel model;
|
||||
final PatiantInformtion patient;
|
||||
const AddLabHomeScreen({Key key, this.model, this.patient}) : super(key: key);
|
||||
@override
|
||||
_AddLabHomeScreenState createState() =>
|
||||
_AddLabHomeScreenState(patient: patient, model: model);
|
||||
}
|
||||
|
||||
class _AddLabHomeScreenState extends State<AddLabHomeScreen>
|
||||
with SingleTickerProviderStateMixin {
|
||||
_AddLabHomeScreenState({this.patient, this.model});
|
||||
ProcedureViewModel model;
|
||||
PatiantInformtion patient;
|
||||
TabController _tabController;
|
||||
int _activeTab = 0;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_tabController = TabController(length: 2, 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;
|
||||
return BaseView<ProcedureViewModel>(
|
||||
builder: (BuildContext context, ProcedureViewModel model, Widget child) =>
|
||||
AppScaffold(
|
||||
isShowAppBar: false,
|
||||
body: NetworkBaseView(
|
||||
baseViewModel: model,
|
||||
child: DraggableScrollableSheet(
|
||||
minChildSize: 0.90,
|
||||
initialChildSize: 0.95,
|
||||
maxChildSize: 1.0,
|
||||
builder:
|
||||
(BuildContext context, ScrollController scrollController) {
|
||||
return Container(
|
||||
height: MediaQuery.of(context).size.height * 1.20,
|
||||
child: Padding(
|
||||
padding: EdgeInsets.all(12.0),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
AppText(
|
||||
'Add Procedure',
|
||||
fontWeight: FontWeight.w700,
|
||||
fontSize: 20,
|
||||
),
|
||||
InkWell(
|
||||
child: Icon(
|
||||
Icons.close,
|
||||
size: 24.0,
|
||||
),
|
||||
onTap: () {
|
||||
Navigator.pop(context);
|
||||
},
|
||||
)
|
||||
]),
|
||||
SizedBox(
|
||||
height: MediaQuery.of(context).size.height * 0.04,
|
||||
),
|
||||
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,
|
||||
"Favorite Templates",
|
||||
),
|
||||
tabWidget(
|
||||
screenSize,
|
||||
_activeTab == 1,
|
||||
'All Lab',
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
body: Column(
|
||||
children: [
|
||||
Expanded(
|
||||
child: TabBarView(
|
||||
physics: BouncingScrollPhysics(),
|
||||
controller: _tabController,
|
||||
children: [
|
||||
AddFavouriteProcedure(
|
||||
patient: patient,
|
||||
model: model,
|
||||
addButtonTitle: TranslationBase.of(context).addLabOrder,
|
||||
toolbarTitle: TranslationBase.of(context).applyForNewLabOrder,
|
||||
categoryID: "02",
|
||||
),
|
||||
AddSelectedLabOrder(
|
||||
model: model,
|
||||
patient: patient,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
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,
|
||||
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,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -1,219 +0,0 @@
|
||||
import 'package:doctor_app_flutter/config/size_config.dart';
|
||||
import 'package:doctor_app_flutter/core/viewModel/procedure_View_model.dart';
|
||||
import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart';
|
||||
import 'package:doctor_app_flutter/screens/base/base_view.dart';
|
||||
import 'package:doctor_app_flutter/screens/procedures/add-favourite-procedure.dart';
|
||||
import 'package:doctor_app_flutter/screens/procedures/add-procedure-form.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/network_base_view.dart';
|
||||
import 'package:doctor_app_flutter/widgets/shared/text_fields/text_fields_utils.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'add_lab_orders.dart';
|
||||
import 'add_radiology_order.dart';
|
||||
|
||||
class AddRadiologyScreen extends StatefulWidget {
|
||||
final ProcedureViewModel model;
|
||||
final PatiantInformtion patient;
|
||||
const AddRadiologyScreen({Key key, this.model, this.patient}) : super(key: key);
|
||||
@override
|
||||
_AddRadiologyScreenState createState() =>
|
||||
_AddRadiologyScreenState(patient: patient, model: model);
|
||||
}
|
||||
|
||||
class _AddRadiologyScreenState extends State<AddRadiologyScreen>
|
||||
with SingleTickerProviderStateMixin {
|
||||
_AddRadiologyScreenState({this.patient, this.model});
|
||||
ProcedureViewModel model;
|
||||
PatiantInformtion patient;
|
||||
TabController _tabController;
|
||||
int _activeTab = 0;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_tabController = TabController(length: 2, 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;
|
||||
return BaseView<ProcedureViewModel>(
|
||||
builder: (BuildContext context, ProcedureViewModel model, Widget child) =>
|
||||
AppScaffold(
|
||||
isShowAppBar: false,
|
||||
body: NetworkBaseView(
|
||||
baseViewModel: model,
|
||||
child: DraggableScrollableSheet(
|
||||
minChildSize: 0.90,
|
||||
initialChildSize: 0.95,
|
||||
maxChildSize: 1.0,
|
||||
builder:
|
||||
(BuildContext context, ScrollController scrollController) {
|
||||
return Container(
|
||||
height: MediaQuery.of(context).size.height * 1.20,
|
||||
child: Padding(
|
||||
padding: EdgeInsets.all(12.0),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
AppText(
|
||||
TranslationBase.of(context).addRadiologyOrder,
|
||||
fontWeight: FontWeight.w700,
|
||||
fontSize: 20,
|
||||
),
|
||||
InkWell(
|
||||
child: Icon(
|
||||
Icons.close,
|
||||
size: 24.0,
|
||||
),
|
||||
onTap: () {
|
||||
Navigator.pop(context);
|
||||
},
|
||||
)
|
||||
]),
|
||||
SizedBox(
|
||||
height: MediaQuery.of(context).size.height * 0.04,
|
||||
),
|
||||
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,
|
||||
"Favorite Templates",
|
||||
),
|
||||
tabWidget(
|
||||
screenSize,
|
||||
_activeTab == 1,
|
||||
'All Radiology',
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
body: Column(
|
||||
children: [
|
||||
Expanded(
|
||||
child: TabBarView(
|
||||
physics: BouncingScrollPhysics(),
|
||||
controller: _tabController,
|
||||
children: [
|
||||
AddFavouriteProcedure(
|
||||
patient: patient,
|
||||
model: model,
|
||||
addButtonTitle: TranslationBase.of(context).addRadiologyOrder,
|
||||
toolbarTitle: TranslationBase.of(context).addRadiologyOrder,
|
||||
categoryID: "03",
|
||||
),
|
||||
AddSelectedRadiologyOrder(
|
||||
model: model,
|
||||
patient: patient,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
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,
|
||||
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,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue