fix on history design

merge-requests/444/head
Elham Rababah 5 years ago
parent ee6288e26a
commit c8b44936f8

@ -0,0 +1,93 @@
import 'package:doctor_app_flutter/config/config.dart';
import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart';
import 'package:flutter/material.dart';
import 'package:hexcolor/hexcolor.dart';
import 'package:provider/provider.dart';
class PriorityBar extends StatefulWidget {
final Function onTap;
const PriorityBar({Key key, this.onTap}) : super(key: key);
@override
_PriorityBarState createState() => _PriorityBarState();
}
class _PriorityBarState extends State<PriorityBar> {
int _activePriority = 0;
int index = -1;
List<String> _priorities = [
"Family",
"Surgical/Sports",
"Medical",
];
List<String> _prioritiesAr = [
"أسرة",
"جراحي / رياضي",
"طبي",
];
BoxDecoration containerBorderDecoration(
Color containerColor, Color borderColor) {
return BoxDecoration();
}
@override
Widget build(BuildContext context) {
final screenSize = MediaQuery.of(context).size;
ProjectViewModel projectViewModel = Provider.of(context);
return Container(
height: screenSize.height * 0.080,
child: Row(
mainAxisSize: MainAxisSize.max,
crossAxisAlignment: CrossAxisAlignment.center,
children: _priorities.map((
item,
) {
bool _isActive = _priorities[_activePriority] == item ? true : false;
if (index < 2) {
index++;
}
return Expanded(
child: InkWell(
child: Center(
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Container(
height: screenSize.height * 0.070,
decoration: containerBorderDecoration(
_isActive ? HexColor("#B8382B") : Colors.white,
_isActive ? HexColor("#B8382B") : Colors.white),
child: Center(
child: Text(
(projectViewModel.isArabic)
? _prioritiesAr[index]
: item,
style: TextStyle(
fontSize: 15,
color: Colors.black, //Colors.black,
fontWeight: FontWeight.bold,
),
),
),
),
if(_isActive)
Container(width: 120,height: 4,color: AppGlobal.appPrimaryColor,)
],
),
),
onTap: () {
widget.onTap(_priorities.indexOf(item));
setState(() {
_activePriority = _priorities.indexOf(item);
});
}),
);
}).toList(),
),
);
}
}

@ -1,3 +1,4 @@
import 'package:doctor_app_flutter/config/size_config.dart';
import 'package:doctor_app_flutter/core/enum/master_lookup_key.dart'; import 'package:doctor_app_flutter/core/enum/master_lookup_key.dart';
import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/SOAP_view_model.dart';
import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart';
@ -16,6 +17,8 @@ import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:hexcolor/hexcolor.dart'; import 'package:hexcolor/hexcolor.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'PriorityBar.dart';
class UpdateHistoryWidget extends StatefulWidget { class UpdateHistoryWidget extends StatefulWidget {
final List<MySelectedHistory> myHistoryList; final List<MySelectedHistory> myHistoryList;
@ -184,93 +187,7 @@ class _UpdateHistoryWidgetState extends State<UpdateHistoryWidget>
} }
} }
class PriorityBar extends StatefulWidget {
final Function onTap;
const PriorityBar({Key key, this.onTap}) : super(key: key);
@override
_PriorityBarState createState() => _PriorityBarState();
}
class _PriorityBarState extends State<PriorityBar> {
int _activePriority = 0;
int index =-1;
List<String> _priorities = [
"Family",
"Surgical/Sports",
"Medical",
];
List<String> _prioritiesAr = [
"أسرة",
"جراحي / رياضي" ,
"طبي",
];
BoxDecoration containerBorderDecoration(
Color containerColor, Color borderColor) {
return BoxDecoration(
color: containerColor,
shape: BoxShape.rectangle,
borderRadius: BorderRadius.all(Radius.circular(6)),
border: Border.fromBorderSide(BorderSide(
color: borderColor,
width: 2.0,
)),
);
}
@override
Widget build(BuildContext context) {
final screenSize = MediaQuery.of(context).size;
ProjectViewModel projectViewModel = Provider.of(context);
return Container(
height: screenSize.height * 0.070,
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;
if(index <2){
index++;
}
return Expanded(
child: InkWell(
child: Center(
child: Container(
height: screenSize.height * 0.070,
decoration: containerBorderDecoration(
_isActive ? HexColor("#B8382B") : Colors.white,
_isActive ? HexColor("#B8382B") : Colors.white),
child: Center(
child: Text(
(projectViewModel.isArabic)?_prioritiesAr[index]: item,
style: TextStyle(
fontSize: 12,
color: _isActive
? Colors.white
: Colors.black, //Colors.black,
fontWeight: FontWeight.bold,
),
),
)),
),
onTap: () {
widget.onTap(_priorities.indexOf(item));
setState(() {
_activePriority = _priorities.indexOf(item);
});
}),
);
}).toList(),
),
);
}
}
class AddHistoryDialog extends StatefulWidget { class AddHistoryDialog extends StatefulWidget {
final Function changePageViewIndex; final Function changePageViewIndex;
@ -291,7 +208,7 @@ class _AddHistoryDialogState extends State<AddHistoryDialog> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return FractionallySizedBox( return FractionallySizedBox(
heightFactor: 0.7, heightFactor: 1,
child: BaseView<SOAPViewModel>( child: BaseView<SOAPViewModel>(
onModelReady: (model) async { onModelReady: (model) async {
if (model.historyFamilyList.length == 0) { if (model.historyFamilyList.length == 0) {
@ -312,20 +229,66 @@ class _AddHistoryDialogState extends State<AddHistoryDialog> {
isShowAppBar: false, isShowAppBar: false,
body: Center( body: Center(
child: Container( child: Container(
child: FractionallySizedBox( child: Column(
widthFactor: 0.9, children: [
child: Column( Container(
children: [ padding: EdgeInsets.only(
SizedBox( left: 0, right: 5, bottom: 5, top: 5),
height: 10, decoration: BoxDecoration(
color: Colors.white,
), ),
PriorityBar(onTap: (activePriority) async { height: 115,
widget.changePageViewIndex(activePriority); child: Container(
}), padding: EdgeInsets.only(
SizedBox( left: 10, right: 10),
height: 20, margin: EdgeInsets.only(top: 40),
), child: Column(
Expanded( children: [
Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
RichText(
text: TextSpan(
style: TextStyle(
fontSize:20,
color: Colors.black),
children: <TextSpan>[
new TextSpan(
text: TranslationBase.of(context).addHistory,
style: TextStyle(
color: Color(0xFF2B353E),
fontWeight: FontWeight.bold,
fontFamily: 'Poppins',
fontSize: 20)),
],
),
),
InkWell(
onTap: () {
Navigator.pop(context);
},
child: Icon(FontAwesomeIcons.times,
size: 30,
color: Color(0xFF2B353E)))
],
),
],
),
),
),
SizedBox(
height: 10,
),
PriorityBar(onTap: (activePriority) async {
widget.changePageViewIndex(activePriority);
}),
SizedBox(
height: 20,
),
Expanded(
child: FractionallySizedBox(
widthFactor: 0.9,
child: PageView( child: PageView(
physics: NeverScrollableScrollPhysics(), physics: NeverScrollableScrollPhysics(),
controller: widget.controller, controller: widget.controller,
@ -405,9 +368,9 @@ class _AddHistoryDialogState extends State<AddHistoryDialog> {
], ],
), ),
), ),
),
], ],
), )),
)),
), ),
), ),
)); ));

@ -13,6 +13,8 @@ import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'app_texts_widget.dart';
class MasterKeyCheckboxSearchWidget extends StatefulWidget { class MasterKeyCheckboxSearchWidget extends StatefulWidget {
final SOAPViewModel model; final SOAPViewModel model;
final Function addSelectedHistories; final Function addSelectedHistories;
@ -49,15 +51,14 @@ class _MasterKeyCheckboxSearchWidgetState extends State<MasterKeyCheckboxSearchW
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
ProjectViewModel projectViewModel = Provider.of(context); ProjectViewModel projectViewModel = Provider.of(context);
return Container( return Container(
child: Column( child: Column(
children: [ children: [
Container( Container(
height: MediaQuery.of(context).size.height * 0.5, height: MediaQuery.of(context).size.height * 0.62,
child: Center( child: Center(
child: Container( child: Container(
margin: EdgeInsets.only(top: 15), padding:EdgeInsets.all(20),
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.circular(12), borderRadius: BorderRadius.circular(12),
color: Colors.white), color: Colors.white),
@ -97,17 +98,18 @@ class _MasterKeyCheckboxSearchWidgetState extends State<MasterKeyCheckboxSearchW
child: Padding( child: Padding(
padding: const EdgeInsets.symmetric( padding: const EdgeInsets.symmetric(
horizontal: 10, vertical: 0), horizontal: 10, vertical: 0),
child: Texts(projectViewModel.isArabic child: AppText(projectViewModel.isArabic
? historyInfo.nameAr!=""?historyInfo.nameAr:historyInfo.nameEn ? historyInfo.nameAr!=""?historyInfo.nameAr:historyInfo.nameEn
: historyInfo.nameEn, : historyInfo.nameEn,
variant: "bodyText", color: Color(0xFF575757),
bold: true, fontSize: 16,
color: Colors.black), fontWeight:FontWeight.w600,
),
), ),
), ),
], ],
), ),
DividerWithSpacesAround(), // DividerWithSpacesAround(),
], ],
); );
}).toList(), }).toList(),

Loading…
Cancel
Save