Merge branch 'home-refactoring' into 'development'

Home refactoring

See merge request Cloud_Solution/doctor_app_flutter!648
merge-requests/665/merge
Mohammad Aljammal 5 years ago
commit 2c43cfcdde

@ -48,6 +48,7 @@ const Map<String, Map<String, String>> localizedValues = {
'service': {'en': 'Service', 'ar': 'خدمة'}, 'service': {'en': 'Service', 'ar': 'خدمة'},
'referral': {'en': 'Referral', 'ar': 'الإحالة'}, 'referral': {'en': 'Referral', 'ar': 'الإحالة'},
'inPatient': {'en': 'InPatients', 'ar': 'مرضاي'}, 'inPatient': {'en': 'InPatients', 'ar': 'مرضاي'},
'myInPatient': {'en': 'My\nInPatients', 'ar': 'مرضاي'},
'inPatientLabel': {'en': 'InPatients', 'ar': 'المريض الداخلي'}, 'inPatientLabel': {'en': 'InPatients', 'ar': 'المريض الداخلي'},
'inPatientAll': {'en': 'All InPatients', 'ar': 'كل المرضى'}, 'inPatientAll': {'en': 'All InPatients', 'ar': 'كل المرضى'},
'operations': {'en': 'Operations', 'ar': 'عمليات'}, 'operations': {'en': 'Operations', 'ar': 'عمليات'},

@ -1,11 +1,44 @@
import 'package:doctor_app_flutter/config/config.dart';
import 'package:doctor_app_flutter/config/shared_pref_kay.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/service/home/dasboard_service.dart'; import 'package:doctor_app_flutter/core/service/home/dasboard_service.dart';import 'package:doctor_app_flutter/core/viewModel/auth_view_model.dart';
import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart';
import 'package:doctor_app_flutter/models/dashboard/dashboard_model.dart';
import 'package:doctor_app_flutter/models/doctor/profile_req_Model.dart';
import 'package:firebase_messaging/firebase_messaging.dart';
import '../../locator.dart'; import '../../locator.dart';
import 'base_view_model.dart'; import 'base_view_model.dart';
class DashboardViewModel extends BaseViewModel { class DashboardViewModel extends BaseViewModel {
final FirebaseMessaging _firebaseMessaging = FirebaseMessaging();
DashboardService _dashboardService = locator<DashboardService>(); DashboardService _dashboardService = locator<DashboardService>();
get dashboardItemsList => _dashboardService.dashboardItemsList;
List<DashboardModel> get dashboardItemsList =>
_dashboardService.dashboardItemsList;
Future setFirebaseNotification(ProjectViewModel projectsProvider, AuthViewModel authProvider) async{
setState(ViewState.Busy);
await projectsProvider.getDoctorClinicsList();
// _firebaseMessaging.setAutoInitEnabled(true);
_firebaseMessaging.requestNotificationPermissions(
const IosNotificationSettings(
sound: true, badge: true, alert: true, provisional: true));
_firebaseMessaging.onIosSettingsRegistered
.listen((IosNotificationSettings settings) {
print("Settings registered: $settings");
});
_firebaseMessaging.getToken().then((String token) async {
if (token != '') {
DEVICE_TOKEN = token;
var request = await sharedPref.getObj(DOCTOR_PROFILE);
authProvider.insertDeviceImei(request).then((value) {
});
}
});
}
Future getDashboard() async { Future getDashboard() async {
setState(ViewState.Busy); setState(ViewState.Busy);
@ -16,4 +49,31 @@ class DashboardViewModel extends BaseViewModel {
} else } else
setState(ViewState.Idle); setState(ViewState.Idle);
} }
Future changeClinic(int clinicId, AuthViewModel authProvider) async {
setState(ViewState.BusyLocal);
await getDoctorProfile();
ProfileReqModel docInfo = new ProfileReqModel(
doctorID: doctorProfile.doctorID,
clinicID: clinicId,
license: true,
projectID: doctorProfile.projectID,
tokenID: '',
languageID: 2);
await authProvider.getDocProfiles(docInfo.toJson()).then((res) async {
sharedPref.setObj(DOCTOR_PROFILE, res['DoctorProfileList'][0]);
setState(ViewState.Idle);
}).catchError((err) {
error = err;
setState(ViewState.ErrorLocal);
});
}
getPatientCount(DashboardModel inPatientCount) {
int value = 0;
inPatientCount.summaryoptions.forEach((result) => {value += result.value});
return value.toString();
}
} }

@ -0,0 +1,37 @@
import 'package:doctor_app_flutter/config/size_config.dart';
import 'package:doctor_app_flutter/models/dashboard/dashboard_model.dart';
import 'package:doctor_app_flutter/widgets/dashboard/activity_button.dart';
import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart';
import 'package:flutter/material.dart';
class DashboardSliderItemWidget extends StatelessWidget {
final DashboardModel item;
DashboardSliderItemWidget(this.item);
@override
Widget build(BuildContext context) {
return Column(
children: [
Row(
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
AppText(
item.kPIName,
fontSize: SizeConfig.textMultiplier * 2.2,
fontWeight: FontWeight.bold,
),
],
),
new Container(
height: 110,
child: ListView(
scrollDirection: Axis.horizontal,
children:
List.generate(item.summaryoptions.length, (int index) {
return GetActivityButton(item.summaryoptions[index]);
})))
],
);
}
}

@ -0,0 +1,260 @@
import 'package:doctor_app_flutter/core/viewModel/dashboard_view_model.dart';
import 'package:doctor_app_flutter/models/dashboard/dashboard_model.dart';
import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
import 'package:doctor_app_flutter/widgets/dashboard/guage_chart.dart';
import 'package:doctor_app_flutter/widgets/dashboard/out_patient_stack.dart';
import 'package:doctor_app_flutter/widgets/dashboard/row_count.dart';
import 'package:doctor_app_flutter/widgets/dashboard/swiper_rounded_pagination.dart';
import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/rounded_container_widget.dart';
import 'package:flutter/material.dart';
import 'package:flutter_swiper/flutter_swiper.dart';
import 'package:charts_flutter/flutter.dart' as charts;
class DashboardSwipeWidget extends StatefulWidget {
final List<DashboardModel> dashboardItemList;
final DashboardViewModel model;
final Function(int) sliderChange;
DashboardSwipeWidget(this.dashboardItemList, this.model, this.sliderChange);
@override
_DashboardSwipeWidgetState createState() => _DashboardSwipeWidgetState();
}
class _DashboardSwipeWidgetState extends State<DashboardSwipeWidget> {
int sliderActiveIndex = 0;
@override
Widget build(BuildContext context) {
return Container(
// height: MediaQuery.of(context).size.height * 0.35,
height: 230,
child: Swiper(
onIndexChanged: (index) {
if (mounted) {
setState(() {
sliderActiveIndex = index;
widget.sliderChange(index);
});
}
},
itemBuilder: (BuildContext context, int index) {
return getSwipeWidget(widget.dashboardItemList, index);
},
itemCount: 3,
// itemHeight: 300,
pagination: new SwiperCustomPagination(
builder: (BuildContext context, SwiperPluginConfig config) {
return new Stack(
alignment: Alignment.bottomCenter,
children: [
Positioned(
bottom: 0,
child: Center(
child: InkWell(
onTap: () {},
child: Container(
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
config.activeIndex == 0
? SwiperRoundedPagination(true)
: SwiperRoundedPagination(false),
config.activeIndex == 1
? SwiperRoundedPagination(true)
: SwiperRoundedPagination(false),
config.activeIndex == 2
? SwiperRoundedPagination(true)
: SwiperRoundedPagination(false),
],
),
),
),
),
)
],
);
}),
viewportFraction: 0.9,
// scale: 0.9,
// control: new SwiperControl(),
),
);
}
Widget getSwipeWidget(List<DashboardModel> dashboardItemList, int index) {
if (index == 1)
return RoundedContainer(
raduis: 16,
showBorder: true,
borderColor: Colors.white,
shadowWidth: 0.2,
shadowSpreadRadius: 3,
shadowDy: 1,
margin: EdgeInsets.only(top: 15, bottom: 15, left: 10, right: 10),
child: Padding(
padding: const EdgeInsets.all(5.0),
child: GetOutPatientStack(dashboardItemList[1])));
if (index == 0)
return RoundedContainer(
raduis: 16,
showBorder: true,
borderColor: Colors.white,
shadowWidth: 0.2,
shadowSpreadRadius: 3,
shadowDy: 1,
margin: EdgeInsets.only(top: 15, bottom: 15, left: 10, right: 10),
child: Padding(
padding: const EdgeInsets.all(5.0),
child: GetOutPatientStack(dashboardItemList[0])));
if (index == 2)
return RoundedContainer(
raduis: 16,
showBorder: true,
borderColor: Colors.white,
shadowWidth: 0.2,
shadowSpreadRadius: 3,
shadowDy: 1,
margin: EdgeInsets.only(top: 15, bottom: 15, left: 10, right: 10),
child:
Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
Expanded(
flex: 1,
child: Row(
children: [
Expanded(
flex: 4,
child: Padding(
padding: const EdgeInsets.all(5.0),
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Padding(
padding: EdgeInsets.all(8),
child: Column(
mainAxisAlignment:
MainAxisAlignment.center,
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
AppText(
TranslationBase.of(context)
.patients,
fontSize: 12,
fontWeight: FontWeight.bold,
fontHeight: 0.5,
),
AppText(
TranslationBase.of(context)
.referral,
fontSize: 22,
fontWeight: FontWeight.bold,
),
],
)),
Expanded(
flex: 1,
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Expanded(
child: RowCounts(
dashboardItemList[2]
.summaryoptions[0]
.kPIParameter,
dashboardItemList[2]
.summaryoptions[0]
.value,
Colors.black),
),
Expanded(
child: RowCounts(
dashboardItemList[2]
.summaryoptions[1]
.kPIParameter,
dashboardItemList[2]
.summaryoptions[1]
.value,
Colors.grey),
),
Expanded(
child: RowCounts(
dashboardItemList[2]
.summaryoptions[2]
.kPIParameter,
dashboardItemList[2]
.summaryoptions[2]
.value,
Colors.red),
),
],
),
)
],
)),
),
Expanded(
flex: 3,
child: Stack(children: [
Container(
child: GaugeChart(
_createReferralData(widget.dashboardItemList))),
Positioned(
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
AppText(
widget.model
.getPatientCount(dashboardItemList[2])
.toString(),
fontSize: 28,
fontWeight: FontWeight.bold,
)
],
),
top: MediaQuery.of(context).size.height * 0.12,
left: 0,
right: 0)
]),
),
],
)),
]));
return Container();
}
static List<charts.Series<GaugeSegment, String>> _createReferralData(
List<DashboardModel> dashboardItemList) {
final data = [
new GaugeSegment(
dashboardItemList[2].summaryoptions[0].kPIParameter,
getValue(dashboardItemList[1].summaryoptions[0].value),
charts.MaterialPalette.black),
new GaugeSegment(
dashboardItemList[2].summaryoptions[1].kPIParameter,
getValue(dashboardItemList[1].summaryoptions[1].value),
charts.MaterialPalette.gray.shadeDefault),
new GaugeSegment(
dashboardItemList[2].summaryoptions[2].kPIParameter,
getValue(dashboardItemList[1].summaryoptions[2].value),
charts.MaterialPalette.red.shadeDefault),
];
return [
new charts.Series<GaugeSegment, String>(
id: 'Segments',
domainFn: (GaugeSegment segment, _) => segment.segment,
measureFn: (GaugeSegment segment, _) => segment.size,
data: data,
colorFn: (GaugeSegment segment, _) => segment.color,
)
];
}
static int getValue(value) {
return value == 0 ? 1 : value;
}
}

@ -26,8 +26,8 @@ class HomePageCard extends StatelessWidget {
child: Container( child: Container(
width: 120, width: 120,
height: MediaQuery.of(context).orientation == Orientation.portrait height: MediaQuery.of(context).orientation == Orientation.portrait
? 130 ? 100
: 250, : 200,
margin: this.margin, margin: this.margin,
decoration: BoxDecoration( decoration: BoxDecoration(
color: !hasBorder color: !hasBorder
@ -41,17 +41,15 @@ class HomePageCard extends StatelessWidget {
: Border.all(width: 0.0, color: Colors.transparent), : Border.all(width: 0.0, color: Colors.transparent),
image: imageName != null image: imageName != null
? DecorationImage( ? DecorationImage(
image: AssetImage('assets/images/dashboard/${imageName}'), image: AssetImage('assets/images/dashboard/$imageName'),
fit: BoxFit.cover, fit: BoxFit.cover,
colorFilter: new ColorFilter.mode( colorFilter: new ColorFilter.mode(
Colors.black.withOpacity(0.2), BlendMode.dstIn), Colors.black.withOpacity(0.2), BlendMode.dstIn),
) )
: null, : null,
), ),
child: Center(
child: child, child: child,
), ),
),
); );
} }
} }

@ -0,0 +1,84 @@
import 'package:doctor_app_flutter/config/size_config.dart';
import 'package:doctor_app_flutter/screens/home/home_page_card.dart';
import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart';
import 'package:flutter/material.dart';
class HomePatientCard extends StatelessWidget {
final Color backgroundColor;
final IconData cardIcon;
final Color backgroundIconColor;
final String text;
final Color textColor;
final Function onTap;
HomePatientCard({
@required this.backgroundColor,
@required this.backgroundIconColor,
@required this.cardIcon,
@required this.text,
@required this.textColor,
@required this.onTap,
});
@override
Widget build(BuildContext context) {
return HomePageCard(
color: backgroundColor,
margin: EdgeInsets.all(4),
child: Container(
padding: EdgeInsets.all(8),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Expanded(
child: Stack(
children: [
Positioned(
bottom: 0.1,
right: 0.5,
width: 23.0,
height: 25.0,
child: Icon(
cardIcon,
size: 60,
color: backgroundIconColor,
),
),
Container(
child: Column(
mainAxisAlignment: MainAxisAlignment.end,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Icon(
cardIcon,
size: 30,
color: textColor,
),
SizedBox(
height: 4,
),
],
),
),
],
),
),
Expanded(
child: Container(
child: AppText(
text,
color: textColor,
textAlign: TextAlign.start,
fontSize: SizeConfig.textMultiplier * 1.6,
),
),
),
],
),
),
hasBorder: false,
onTap: onTap,
);
}
}

@ -1,55 +1,34 @@
import 'package:charts_flutter/flutter.dart' as charts; import 'package:doctor_app_flutter/core/enum/viewstate.dart';
import 'package:doctor_app_flutter/config/config.dart';
import 'package:doctor_app_flutter/config/shared_pref_kay.dart';
import 'package:doctor_app_flutter/config/size_config.dart';
import 'package:doctor_app_flutter/core/enum/patient_type.dart';
import 'package:doctor_app_flutter/core/model/patient_muse/PatientSearchRequestModel.dart'; import 'package:doctor_app_flutter/core/model/patient_muse/PatientSearchRequestModel.dart';
import 'package:doctor_app_flutter/core/viewModel/auth_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/auth_view_model.dart';
import 'package:doctor_app_flutter/core/viewModel/dashboard_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/dashboard_view_model.dart';
import 'package:doctor_app_flutter/core/viewModel/hospital_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';
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/models/dashboard/dashboard_model.dart';
import 'package:doctor_app_flutter/models/doctor/doctor_profile_model.dart';
import 'package:doctor_app_flutter/models/doctor/profile_req_Model.dart';
import 'package:doctor_app_flutter/models/patient/patient_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/home/dashboard_slider-item-widget.dart';
import 'package:doctor_app_flutter/screens/home/dashboard_swipe_widget.dart';
import 'package:doctor_app_flutter/screens/home/home_patient_card.dart';
import 'package:doctor_app_flutter/screens/medicine/medicine_search_screen.dart'; import 'package:doctor_app_flutter/screens/medicine/medicine_search_screen.dart';
import 'package:doctor_app_flutter/screens/patients/DischargedPatientPage.dart';
import 'package:doctor_app_flutter/screens/patients/PatientsInPatientScreen.dart'; import 'package:doctor_app_flutter/screens/patients/PatientsInPatientScreen.dart';
import 'package:doctor_app_flutter/screens/patients/ReferralDischargedPatientPage.dart';
import 'package:doctor_app_flutter/screens/patients/out_patient/out_patient_screen.dart'; import 'package:doctor_app_flutter/screens/patients/out_patient/out_patient_screen.dart';
import 'package:doctor_app_flutter/screens/patients/patient_search/patient_search_screen.dart'; import 'package:doctor_app_flutter/screens/patients/patient_search/patient_search_screen.dart';
import 'package:doctor_app_flutter/screens/patients/patient_search/patient_search_result_screen.dart';
import 'package:doctor_app_flutter/screens/patients/profile/referral/patient_referral_screen.dart'; import 'package:doctor_app_flutter/screens/patients/profile/referral/patient_referral_screen.dart';
import 'package:doctor_app_flutter/util/date-utils.dart'; import 'package:doctor_app_flutter/util/date-utils.dart';
import 'package:doctor_app_flutter/util/dr_app_shared_pref.dart'; import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart';
import 'package:doctor_app_flutter/util/helpers.dart';
import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
import 'package:doctor_app_flutter/widgets/dashboard/activity_button.dart';
import 'package:doctor_app_flutter/widgets/dashboard/guage_chart.dart';
import 'package:doctor_app_flutter/widgets/dashboard/out_patient_stack.dart';
import 'package:doctor_app_flutter/widgets/dashboard/row_count.dart';
import 'package:doctor_app_flutter/widgets/dashboard/swiper_rounded_pagination.dart';
import 'package:doctor_app_flutter/widgets/patients/profile/profile-welcome-widget.dart'; import 'package:doctor_app_flutter/widgets/patients/profile/profile-welcome-widget.dart';
import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.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/app_texts_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_dialog_utils.dart';
import 'package:doctor_app_flutter/widgets/transitions/fade_page.dart'; import 'package:doctor_app_flutter/widgets/transitions/fade_page.dart';
import 'package:firebase_messaging/firebase_messaging.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_swiper/flutter_swiper.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'package:sticky_headers/sticky_headers/widget.dart'; import 'package:sticky_headers/sticky_headers/widget.dart';
import '../../widgets/shared/app_texts_widget.dart'; import '../../widgets/shared/app_texts_widget.dart';
import '../../widgets/shared/rounded_container_widget.dart';
import 'home_page_card.dart'; import 'home_page_card.dart';
DrAppSharedPreferances sharedPref = new DrAppSharedPreferances();
Helpers helpers = Helpers();
class HomeScreen extends StatefulWidget { class HomeScreen extends StatefulWidget {
HomeScreen({Key key, this.title}) : super(key: key); HomeScreen({Key key, this.title}) : super(key: key);
@ -61,65 +40,25 @@ class HomeScreen extends StatefulWidget {
} }
class _HomeScreenState extends State<HomeScreen> { class _HomeScreenState extends State<HomeScreen> {
final FirebaseMessaging _firebaseMessaging = FirebaseMessaging();
HospitalViewModel hospitalProvider;
AuthViewModel authProvider;
bool isLoading = false;
ProjectViewModel projectsProvider;
var _isInit = true;
DoctorProfileModel profile;
bool isExpanded = false; bool isExpanded = false;
bool isInpatient = false; bool isInpatient = false;
var clinicName = [];
int sliderActiveIndex = 0; int sliderActiveIndex = 0;
var clinicId; var clinicId;
var _patientSearchFormValues;
void didChangeDependencies() async {
super.didChangeDependencies();
if (_isInit) {
projectsProvider = Provider.of<ProjectViewModel>(context);
projectsProvider.getDoctorClinicsList();
// _firebaseMessaging.setAutoInitEnabled(true);
_firebaseMessaging.requestNotificationPermissions(
const IosNotificationSettings(
sound: true, badge: true, alert: true, provisional: true));
_firebaseMessaging.onIosSettingsRegistered
.listen((IosNotificationSettings settings) {
print("Settings registered: $settings");
});
clinicName = await sharedPref.getObj(CLINIC_NAME);
print(clinicName);
_firebaseMessaging.getToken().then((String token) async {
if (token != '') {
DEVICE_TOKEN = token;
var request = await sharedPref.getObj(DOCTOR_PROFILE);
authProvider.insertDeviceImei(request).then((value) {
// print(value);
changeIsLoading(false);
});
}
});
}
_isInit = false;
}
BuildContext myContext;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
myContext = context; ProjectViewModel projectsProvider = Provider.of<ProjectViewModel>(context);
hospitalProvider = Provider.of(context); AuthViewModel authProvider = Provider.of<AuthViewModel>(context);
authProvider = Provider.of(context);
projectsProvider = Provider.of(context);
FocusScopeNode currentFocus = FocusScope.of(context); FocusScopeNode currentFocus = FocusScope.of(context);
if (!currentFocus.hasPrimaryFocus) { if (!currentFocus.hasPrimaryFocus) {
currentFocus.unfocus(); currentFocus.unfocus();
} }
return BaseView<DashboardViewModel>( return BaseView<DashboardViewModel>(
onModelReady: (model) => model.getDashboard(), onModelReady: (model) async {
await model.setFirebaseNotification(projectsProvider, authProvider);
await model.getDashboard();
},
builder: (_, model, w) => AppScaffold( builder: (_, model, w) => AppScaffold(
baseViewModel: model, baseViewModel: model,
isShowAppBar: false, isShowAppBar: false,
@ -144,7 +83,6 @@ class _HomeScreenState extends State<HomeScreen> {
children: [ children: [
Container( Container(
width: MediaQuery.of(context).size.width * .6, width: MediaQuery.of(context).size.width * .6,
// // height: 100,
child: projectsProvider.doctorClinicsList.length > child: projectsProvider.doctorClinicsList.length >
0 0
? Stack( ? Stack(
@ -170,36 +108,49 @@ class _HomeScreenState extends State<HomeScreen> {
mainAxisAlignment: mainAxisAlignment:
MainAxisAlignment.end, MainAxisAlignment.end,
children: <Widget>[ children: <Widget>[
Column(
mainAxisAlignment:
MainAxisAlignment
.center,
children: [
Container( Container(
padding: EdgeInsets.all(2), padding:
margin: EdgeInsets.all(2), EdgeInsets.all(2),
margin:
EdgeInsets.all(2),
decoration: decoration:
new BoxDecoration( new BoxDecoration(
color: Colors.red[800], color:
Colors.red[800],
borderRadius: borderRadius:
BorderRadius.circular( BorderRadius
.circular(
20), 20),
), ),
constraints: BoxConstraints( constraints:
BoxConstraints(
minWidth: 20, minWidth: 20,
minHeight: 20, minHeight: 20,
), ),
child: new Text( child: Center(
child: AppText(
projectsProvider projectsProvider
.doctorClinicsList .doctorClinicsList
.length .length
.toString(), .toString(),
style: new TextStyle( color:
color: Colors.white, Colors.white,
fontSize: fontSize:
projectsProvider projectsProvider
.isArabic .isArabic
? 10 ? 10
: 11, : 11,
),
textAlign: textAlign:
TextAlign.center, TextAlign
.center,
), ),
)),
],
), ),
AppText(item.clinicName, AppText(item.clinicName,
fontSize: 12, fontSize: 12,
@ -211,10 +162,19 @@ class _HomeScreenState extends State<HomeScreen> {
); );
}).toList(); }).toList();
}, },
onChanged: (newValue) { onChanged: (newValue) async {
clinicId = newValue; clinicId = newValue;
changeClinic( GifLoaderDialogUtils.showMyDialog(
newValue, context, model); context);
await model.changeClinic(
newValue, authProvider);
GifLoaderDialogUtils.hideDialog(
context);
if (model.state ==
ViewState.ErrorLocal) {
DrAppToastMsg.showErrorToast(
model.error);
}
}, },
items: projectsProvider items: projectsProvider
.doctorClinicsList .doctorClinicsList
@ -242,63 +202,17 @@ class _HomeScreenState extends State<HomeScreen> {
])), ])),
content: Column( content: Column(
children: [ children: [
Container( model.dashboardItemsList.length > 0
height: MediaQuery.of(context).size.height * 0.35, ? DashboardSwipeWidget(
child: model.dashboardItemsList.length > 0 model.dashboardItemsList,
? new Swiper( model,
onIndexChanged: (index) { (sliderIndex) {
if (mounted) {
setState(() { setState(() {
sliderActiveIndex = index; sliderActiveIndex = sliderIndex;
}); });
}
},
itemBuilder: (BuildContext context, int index) {
return getSwipeWidget(model)[index];
}, },
itemCount: 3,
itemHeight: 300,
pagination: new SwiperCustomPagination(builder:
(BuildContext context,
SwiperPluginConfig config) {
return new Stack(
alignment: Alignment.bottomCenter,
children: [
Positioned(
bottom: 0,
child: Center(
child: InkWell(
onTap: () {},
child: Container(
child: Row(
mainAxisAlignment:
MainAxisAlignment
.spaceBetween,
children: [
config.activeIndex == 0
? SwiperRoundedPagination(
true)
: SwiperRoundedPagination(
false),
config.activeIndex == 1
? SwiperRoundedPagination(
true)
: SwiperRoundedPagination(
false),
config.activeIndex == 2
? SwiperRoundedPagination(
true)
: SwiperRoundedPagination(
false),
],
)))))
]);
}),
viewportFraction: 0.9,
// scale: 0.9,
// control: new SwiperControl(),
) )
: SizedBox()), : SizedBox(),
model.dashboardItemsList.length > 0 model.dashboardItemsList.length > 0
? FractionallySizedBox( ? FractionallySizedBox(
widthFactor: 0.90, widthFactor: 0.90,
@ -310,111 +224,13 @@ class _HomeScreenState extends State<HomeScreen> {
height: 10, height: 10,
), ),
sliderActiveIndex == 1 sliderActiveIndex == 1
? Column( ? DashboardSliderItemWidget(
children: [ model.dashboardItemsList[3])
Row(
mainAxisAlignment:
MainAxisAlignment.start,
children: <Widget>[
AppText(
model.dashboardItemsList[3]
.kPIName,
fontSize:
SizeConfig.textMultiplier *
2.2,
fontWeight: FontWeight.bold,
),
],
),
new Container(
height: 130,
child: new ListView(
scrollDirection:
Axis.horizontal,
children: new List.generate(
model
.dashboardItemsList[3]
.summaryoptions
.length, (int index) {
return GetActivityButton(model
.dashboardItemsList[3]
.summaryoptions[index]);
})))
],
)
: sliderActiveIndex == 0 : sliderActiveIndex == 0
? Column( ? DashboardSliderItemWidget(
children: [ model.dashboardItemsList[6])
Row( : DashboardSliderItemWidget(
mainAxisAlignment: model.dashboardItemsList[4]),
MainAxisAlignment.start,
children: <Widget>[
AppText(
model.dashboardItemsList[6]
.kPIName,
fontSize: SizeConfig
.textMultiplier *
2.2,
fontWeight: FontWeight.bold,
),
],
),
new Container(
height: 130,
child: new ListView(
scrollDirection: Axis
.horizontal,
children: new List
.generate(
model
.dashboardItemsList[
6]
.summaryoptions
.length,
(int index) {
return GetActivityButton(model
.dashboardItemsList[
6]
.summaryoptions[index]);
})))
],
)
: Column(
children: [
Row(
mainAxisAlignment:
MainAxisAlignment.start,
children: <Widget>[
AppText(
model.dashboardItemsList[4]
.kPIName,
fontSize: SizeConfig
.textMultiplier *
2.2,
fontWeight: FontWeight.bold,
),
],
),
new Container(
height: 130,
child: new ListView(
scrollDirection: Axis
.horizontal,
children: new List
.generate(
model
.dashboardItemsList[
4]
.summaryoptions
.length,
(int index) {
return GetActivityButton(model
.dashboardItemsList[
4]
.summaryoptions[index]);
})))
],
),
]))) ])))
: SizedBox(), : SizedBox(),
FractionallySizedBox( FractionallySizedBox(
@ -429,91 +245,46 @@ class _HomeScreenState extends State<HomeScreen> {
margin: EdgeInsets.only(top: 10), margin: EdgeInsets.only(top: 10),
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[ children: <Widget>[
SizedBox( SizedBox(
height: 10, height: 10,
), ),
Row(
children: <Widget>[
Container( Container(
width: 150,
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: crossAxisAlignment: CrossAxisAlignment.start,
CrossAxisAlignment.start,
children: [ children: [
Text( AppText(
TranslationBase.of(context).patients, TranslationBase.of(context).patients,
style: TextStyle(
fontSize: 12, fontSize: 12,
height: .5,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
fontFamily: 'Poppins'), fontHeight: .5,
), ),
Text( AppText(
TranslationBase.of(context).services, TranslationBase.of(context).services,
style: TextStyle(
fontSize: 22, fontSize: 22,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
fontFamily: 'Poppins'),
), ),
], ],
)), )),
],
),
SizedBox( SizedBox(
height: 10, height: 10,
), ),
new Container( Container(
height: 130, height: 120,
child: new ListView( child: ListView(
scrollDirection: Axis.horizontal, scrollDirection: Axis.horizontal,
children: [ children: [
HomePageCard( HomePatientCard(
color: Color(0xffD02127), backgroundColor: Color(0xffD02127),
margin: EdgeInsets.all(5), backgroundIconColor: Colors.white12,
child: Column( cardIcon: DoctorApp.inpatient,
mainAxisAlignment: textColor: Colors.white,
MainAxisAlignment.center, text:
crossAxisAlignment:
CrossAxisAlignment.start,
children: <Widget>[
Padding(
padding: EdgeInsets.only(
top: 10, left: 10, right: 0),
child: Stack(
children: [
Positioned(
bottom: 0.1,
right: 0.5,
width: 23.0,
height: 25.0,
child: Icon(
DoctorApp.inpatient,
size: 65,
color: Colors.white12,
),
),
Icon(
DoctorApp.inpatient,
size: 32,
color: Colors.white,
),
],
)),
Container(
padding: EdgeInsets.all(10),
child: AppText(
"My\n" +
TranslationBase.of(context) TranslationBase.of(context)
.inPatient, .myInPatient,
color: Colors.white,
textAlign: TextAlign.start,
fontSize: 15,
))
],
),
hasBorder: false,
onTap: () { onTap: () {
Navigator.push( Navigator.push(
context, context,
@ -523,51 +294,13 @@ class _HomeScreenState extends State<HomeScreen> {
); );
}, },
), ),
HomePageCard( HomePatientCard(
color: Colors.grey[300], backgroundColor: Colors.grey[300],
margin: EdgeInsets.all(5), backgroundIconColor: Colors.white38,
child: Column( cardIcon: DoctorApp.arrival_patients,
mainAxisAlignment: textColor: Colors.black,
MainAxisAlignment.center, text: TranslationBase.of(context)
crossAxisAlignment:
CrossAxisAlignment.start,
children: <Widget>[
Padding(
padding: EdgeInsets.only(
top: 10, left: 10, right: 0),
child: Stack(
children: [
Positioned(
bottom: 0.1,
right: 0.5,
width: 23.0,
height: 25.0,
child: Icon(
DoctorApp
.arrival_patients,
size: 65,
color: Colors.white38,
),
),
Icon(
DoctorApp.arrival_patients,
size: 35,
color: Colors.black,
),
],
)),
Container(
padding: EdgeInsets.all(10),
child: AppText(
TranslationBase.of(context)
.myOutPatient, .myOutPatient,
color: Colors.black,
textAlign: TextAlign.start,
fontSize: 15,
))
],
),
hasBorder: false,
onTap: () { onTap: () {
String date = String date =
AppDateUtils.convertDateToFormat( AppDateUtils.convertDateToFormat(
@ -591,106 +324,30 @@ class _HomeScreenState extends State<HomeScreen> {
)); ));
}, },
), ),
HomePageCard( HomePatientCard(
color: Color(0xff2B353E), backgroundColor: Color(0xff2B353E),
margin: EdgeInsets.all(5), backgroundIconColor: Colors.white10,
child: Column( cardIcon: DoctorApp.referral_1,
mainAxisAlignment: textColor: Colors.white,
MainAxisAlignment.center, text: TranslationBase.of(context)
crossAxisAlignment:
CrossAxisAlignment.start,
children: <Widget>[
Padding(
padding: EdgeInsets.only(
top: 10, left: 10, right: 0),
child: Stack(
children: [
Positioned(
bottom: 0.1,
right: 0.5,
width: 23.0,
height: 25.0,
child: Icon(
DoctorApp.referral_1,
size: 65,
color: Colors.white10
.withOpacity(0.1),
),
),
Icon(
DoctorApp.referral_1,
size: 35,
color: Colors.white,
),
],
)),
Container(
padding: EdgeInsets.all(10),
child: AppText(
TranslationBase.of(context)
.patientsreferral, .patientsreferral,
color: Colors.white,
textAlign: TextAlign.start,
fontSize: 15,
))
],
),
hasBorder: false,
onTap: () { onTap: () {
Navigator.push( Navigator.push(
context, context,
MaterialPageRoute( MaterialPageRoute(
builder: (context) => builder: (context) =>
PatientReferralScreen(), PatientReferralScreen(),
// MyReferredPatient(),
), ),
); );
}, },
), ),
HomePageCard( HomePatientCard(
color: Color(0xffD02127), backgroundColor: Color(0xffD02127),
margin: EdgeInsets.all(5), backgroundIconColor: Colors.white10,
child: Column( cardIcon: DoctorApp.search,
mainAxisAlignment: textColor: Colors.white,
MainAxisAlignment.center, text: TranslationBase.of(context)
crossAxisAlignment:
CrossAxisAlignment.start,
children: <Widget>[
Padding(
padding: EdgeInsets.only(
top: 10, left: 10, right: 0),
child: Stack(
children: [
Positioned(
bottom: 0.1,
right: 0.5,
width: 23.0,
height: 25.0,
child: Icon(
DoctorApp.search,
size: 65,
color: Colors.white10,
),
),
Icon(
DoctorApp.search,
size: 35,
color: Colors.white,
),
],
)),
Container(
padding: EdgeInsets.all(10),
child: AppText(
TranslationBase.of(context)
.searchPatient, .searchPatient,
color: Colors.white,
textAlign: TextAlign.start,
fontSize: 13,
))
],
),
hasBorder: false,
onTap: () { onTap: () {
Navigator.push( Navigator.push(
context, context,
@ -700,51 +357,13 @@ class _HomeScreenState extends State<HomeScreen> {
)); ));
}, },
), ),
HomePageCard( HomePatientCard(
color: Color(0xffC9C9C9), backgroundColor: Color(0xffC9C9C9),
margin: EdgeInsets.all(5), backgroundIconColor: Colors.black12,
child: Column( cardIcon: DoctorApp.search_medicines,
mainAxisAlignment: textColor: Color(0xff2B353E),
MainAxisAlignment.center, text: TranslationBase.of(context)
crossAxisAlignment:
CrossAxisAlignment.start,
children: <Widget>[
Padding(
padding: EdgeInsets.only(
top: 10, left: 10, right: 0),
child: Stack(
children: [
Positioned(
bottom: 0.1,
right: 0.5,
width: 23.0,
height: 25.0,
child: Icon(
DoctorApp
.search_medicines,
color: Colors.black12,
size: 65,
),
),
Icon(
DoctorApp.search_medicines,
size: 40,
color: Color(0xff2B353E),
),
],
)),
Container(
padding: EdgeInsets.all(10),
child: AppText(
TranslationBase.of(context)
.searchMedicine, .searchMedicine,
color: Color(0xff2B353E),
textAlign: TextAlign.start,
fontSize: 13,
))
],
),
hasBorder: false,
onTap: () { onTap: () {
Navigator.push( Navigator.push(
context, context,
@ -753,17 +372,8 @@ class _HomeScreenState extends State<HomeScreen> {
MedicineSearchScreen(), MedicineSearchScreen(),
)); ));
}, },
)
])),
Row(
// mainAxisAlignment: MainAxisAlignment.spaceAround,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
SizedBox(
width: 8,
),
],
), ),
])),
SizedBox( SizedBox(
height: 20, height: 20,
), ),
@ -779,214 +389,4 @@ class _HomeScreenState extends State<HomeScreen> {
), ),
); );
} }
static List<charts.Series<GaugeSegment, String>> _createReferralData(model) {
final data = [
new GaugeSegment(
model.dashboardItemsList[2].summaryoptions[0].kPIParameter,
getValue(model.dashboardItemsList[1].summaryoptions[0].value),
charts.MaterialPalette.black),
new GaugeSegment(
model.dashboardItemsList[2].summaryoptions[1].kPIParameter,
getValue(model.dashboardItemsList[1].summaryoptions[1].value),
charts.MaterialPalette.gray.shadeDefault),
new GaugeSegment(
model.dashboardItemsList[2].summaryoptions[2].kPIParameter,
getValue(model.dashboardItemsList[1].summaryoptions[2].value),
charts.MaterialPalette.red.shadeDefault),
];
return [
new charts.Series<GaugeSegment, String>(
id: 'Segments',
domainFn: (GaugeSegment segment, _) => segment.segment,
measureFn: (GaugeSegment segment, _) => segment.size,
data: data,
colorFn: (GaugeSegment segment, _) => segment.color,
)
];
}
static int getValue(value) {
return value == 0 ? 1 : value;
}
changeClinic(clinicId, BuildContext context, model) async {
// Navigator.pop(context);
changeIsLoading(true);
Map profile = await sharedPref.getObj(DOCTOR_PROFILE);
DoctorProfileModel doctorProfile = new DoctorProfileModel.fromJson(profile);
ProfileReqModel docInfo = new ProfileReqModel(
doctorID: doctorProfile.doctorID,
clinicID: clinicId,
license: true,
projectID: doctorProfile.projectID,
tokenID: '',
languageID: 2);
authProvider.getDocProfiles(docInfo.toJson()).then((res) async {
changeIsLoading(false);
sharedPref.setObj(DOCTOR_PROFILE, res['DoctorProfileList'][0]);
}).catchError((err) {
changeIsLoading(false);
Helpers.showErrorToast(err);
});
}
changeIsLoading(bool val) {
setState(() {
this.isLoading = val;
});
}
getPatientCount(DashboardModel inPatientCount) {
int value = 0;
inPatientCount.summaryoptions.forEach((result) => {value += result.value});
return value.toString();
}
List<Widget> getSwipeWidget(model) {
return [
RoundedContainer(
height: MediaQuery.of(context).size.height * 0.35,
margin: EdgeInsets.only(top: 15, bottom: 15, left: 10, right: 10),
child: Padding(
padding: const EdgeInsets.all(5.0),
child: GetOutPatientStack(model.dashboardItemsList[1]))),
RoundedContainer(
height: MediaQuery.of(context).size.height * 0.35,
margin: EdgeInsets.only(top: 15, bottom: 15, left: 10, right: 10),
child: Padding(
padding: const EdgeInsets.all(5.0),
child: GetOutPatientStack(model.dashboardItemsList[0]))),
RoundedContainer(
height: MediaQuery.of(context).size.height * 0.35,
margin: EdgeInsets.only(top: 15, bottom: 15, left: 10, right: 10),
child:
Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
Expanded(
flex: 1,
child: Row(
children: [
Expanded(
flex: 4,
child: Padding(
padding: const EdgeInsets.all(5.0),
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Expanded(
flex: 1,
child: Padding(
padding: EdgeInsets.all(8),
child: Column(
mainAxisAlignment:
MainAxisAlignment.center,
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Text(
TranslationBase.of(context)
.patients,
style: TextStyle(
fontSize: 12,
height: .5,
fontWeight: FontWeight.bold,
fontFamily: 'Poppins'),
),
Text(
TranslationBase.of(context)
.referral,
style: TextStyle(
fontSize: 22,
fontWeight: FontWeight.bold,
fontFamily: 'Poppins'),
),
],
))),
Expanded(
flex: 2,
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
RowCounts(
model.dashboardItemsList[2]
.summaryoptions[0].kPIParameter,
model.dashboardItemsList[2]
.summaryoptions[0].value,
Colors.black),
RowCounts(
model.dashboardItemsList[2]
.summaryoptions[1].kPIParameter,
model.dashboardItemsList[2]
.summaryoptions[1].value,
Colors.grey),
RowCounts(
model.dashboardItemsList[2]
.summaryoptions[2].kPIParameter,
model.dashboardItemsList[2]
.summaryoptions[2].value,
Colors.red),
],
),
)
],
))),
Expanded(
flex: 3,
child: Stack(children: [
Container(
child: GaugeChart(_createReferralData(model))),
Positioned(
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
AppText(
getPatientCount(model.dashboardItemsList[2])
.toString(),
fontSize: 30,
fontWeight: FontWeight.bold,
)
],
),
top: MediaQuery.of(context).size.height * 0.12,
left: 0,
right: 0)
]),
),
],
)),
])),
];
}
getRequestHeader(isInpatient) {
_patientSearchFormValues = PatientModel(
FirstName: "0",
MiddleName: "0",
LastName: "0",
PatientMobileNumber: "0",
PatientIdentificationID: "0",
PatientID: 0,
From: isInpatient == true
? '0'
: AppDateUtils.convertDateToFormat(DateTime.now(), 'yyyy-MM-dd')
.toString(),
To: isInpatient == true
? '0'
: AppDateUtils.convertDateToFormat(DateTime.now(), 'yyyy-MM-dd')
.toString(),
LanguageID: 2,
stamp: "2020-03-02T13:56:39.170Z",
IPAdress: "11.11.11.11",
VersionID: 1.2,
Channel: 9,
TokenID: "2Fi7HoIHB0eDyekVa6tCJg==",
SessionID: "5G0yXn0Jnq",
IsLoginForDoctorApp: true,
PatientOutSA: false);
}
} }

@ -100,6 +100,7 @@ class TranslationBase {
String get referral => localizedValues['referral'][locale.languageCode]; String get referral => localizedValues['referral'][locale.languageCode];
String get inPatient => localizedValues['inPatient'][locale.languageCode]; String get inPatient => localizedValues['inPatient'][locale.languageCode];
String get myInPatient => localizedValues['myInPatient'][locale.languageCode];
String get inPatientLabel => String get inPatientLabel =>
localizedValues['inPatientLabel'][locale.languageCode]; localizedValues['inPatientLabel'][locale.languageCode];

@ -3,37 +3,42 @@ import 'package:flutter/material.dart';
class GetActivityButton extends StatelessWidget { class GetActivityButton extends StatelessWidget {
final value; final value;
GetActivityButton(this.value); GetActivityButton(this.value);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Container( return Container(
width: 120, width: 110,
padding: EdgeInsets.all(5), padding: EdgeInsets.all(5),
margin: EdgeInsets.all(5), margin: EdgeInsets.all(5),
height: 120,
decoration: BoxDecoration( decoration: BoxDecoration(
color: Colors.white, color: Colors.white,
borderRadius: BorderRadius.circular(20), borderRadius: BorderRadius.circular(20),
), ),
child: Padding(
padding: const EdgeInsets.fromLTRB(8, 0, 8, 0),
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [
Padding( AppText(
padding: EdgeInsets.all(10), value.value.toString(),
child: AppText(value.value.toString(), fontSize: 27,
fontSize: 32, fontWeight: FontWeight.bold)), fontWeight: FontWeight.bold,
Expanded( color: Color(0xFF2B353E),
child: AppText( ),
AppText(
value.kPIParameter, value.kPIParameter,
textOverflow: TextOverflow.clip, textOverflow: TextOverflow.clip,
fontSize: 12, fontSize: 10,
textAlign: TextAlign.center, color: Color(0xFF2B353E),
fontWeight: FontWeight.w600, textAlign: TextAlign.start,
), fontWeight: FontWeight.w700,
), ),
], ],
), ),
),
); );
} }
} }

@ -4,7 +4,9 @@ import 'package:flutter/material.dart';
class GetOutPatientStack extends StatelessWidget { class GetOutPatientStack extends StatelessWidget {
final value; final value;
GetOutPatientStack(this.value); GetOutPatientStack(this.value);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
value.summaryoptions value.summaryoptions
@ -17,9 +19,13 @@ class GetOutPatientStack extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.spaceEvenly, mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [ children: [
AppText( Container(
height: 30,
child: AppText(
value.kPIName, value.kPIName,
medium: true, medium: true,
fontSize: 14,
),
), ),
Row(mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: list) Row(mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: list)
], ],
@ -27,42 +33,67 @@ class GetOutPatientStack extends StatelessWidget {
} }
getStack(Summaryoptions value, max) { getStack(Summaryoptions value, max) {
return Stack(children: [ return Expanded(
Container( child: Container(
height: 150, margin: EdgeInsets.symmetric(horizontal: 2),
margin: EdgeInsets.all(5),
width: 40,
child: SizedBox(),
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10), color: Colors.red[50]), gradient: LinearGradient(
begin: Alignment.topLeft,
end: Alignment(
0.0, 1.0), // 10% of the width, so there are ten blinds.
colors: <Color>[Color(0x8FF5F6FA), Colors.red[50]], // red to yellow
tileMode: TileMode.mirror, // repeats the gradient over the canvas
), ),
borderRadius: BorderRadius.circular(8),
// color: Colors.red[50],
),
child: Stack(children: [
Positioned( Positioned(
bottom: 0, bottom: 0,
left: 0,
right: 0,
child: Container( child: Container(
child: SizedBox(), child: SizedBox(),
margin: EdgeInsets.all(5),
padding: EdgeInsets.all(10), padding: EdgeInsets.all(10),
height: max != 0 ? (150 * value.value) / max : 0, height: max != 0 ? (150 * value.value) / max : 0,
width: 40,
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10), borderRadius: BorderRadius.circular(8),
color: Colors.red[300]))), color: Color(0x63D02127),
),
),
),
Container( Container(
height: 150, height: 150,
margin: EdgeInsets.only(left: 5, top: 5), margin: EdgeInsets.only(left: 5, top: 5),
padding: EdgeInsets.all(10), padding: EdgeInsets.all(10),
child: RotatedBox( child: RotatedBox(
quarterTurns: 1, quarterTurns: 3,
child: Center( child: Center(
child: Align( child: Align(
child: AppText( child: FittedBox(
value.kPIParameter + ' (' + value.value.toString() + ') ', child: Row(
children: [
AppText(
value.kPIParameter,
fontSize: 10, fontSize: 10,
textAlign: TextAlign.center, textAlign: TextAlign.center,
color: Color(0xFF2B353E),
fontWeight: FontWeight.w700,
),
AppText(
' (' + value.value.toString() + ') ',
fontSize: 12,
textAlign: TextAlign.center,
color: Color(0xFF2B353E),
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
),
],
),
)), )),
), ),
)) ))
]); ]),
),
);
} }
} }

@ -8,31 +8,38 @@ class RowCounts extends StatelessWidget {
RowCounts(this.name, this.count, this.c); RowCounts(this.name, this.count, this.c);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Row( return Container(
padding: EdgeInsets.only(top: 5, bottom: 5),
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
dot(c), dot(c),
Padding( Expanded(
padding: EdgeInsets.only(top: 5, bottom: 5),
child: Row( child: Row(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start,
children: [ children: [
AppText( Expanded(
child: AppText(
name, name,
color: Colors.black, color: Colors.black,
textAlign: TextAlign.center, textAlign: TextAlign.start, // from TextAlign.center
fontSize: 12, fontSize: 11,
textOverflow: TextOverflow.ellipsis, textOverflow: TextOverflow.ellipsis,
), ),
),
AppText( AppText(
' (' + count.toString() + ')', ' (' + count.toString() + ')',
color: Colors.black, color: Colors.black,
textAlign: TextAlign.center, textAlign: TextAlign.center,
fontSize: 14, fontSize: 12,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
) )
], ],
)), ),
),
], ],
),
); );
} }

@ -9,6 +9,7 @@ class AppText extends StatefulWidget {
final Color color; final Color color;
final FontWeight fontWeight; final FontWeight fontWeight;
final double fontSize; final double fontSize;
final double fontHeight;
final String fontFamily; final String fontFamily;
final int maxLength; final int maxLength;
final bool italic; final bool italic;
@ -35,6 +36,7 @@ class AppText extends StatefulWidget {
this.fontWeight, this.fontWeight,
this.variant, this.variant,
this.fontSize, this.fontSize,
this.fontHeight,
this.fontFamily = 'Poppins', this.fontFamily = 'Poppins',
this.italic = false, this.italic = false,
this.maxLength = 60, this.maxLength = 60,
@ -121,20 +123,20 @@ class _AppTextState extends State<AppText> {
style: widget.style != null style: widget.style != null
? _getFontStyle().copyWith( ? _getFontStyle().copyWith(
fontStyle: widget.italic ? FontStyle.italic : null, fontStyle: widget.italic ? FontStyle.italic : null,
color: widget.color , color: widget.color,
fontWeight: widget.fontWeight ?? _getFontWeight(), fontWeight: widget.fontWeight ?? _getFontWeight(),
) height: widget.fontHeight)
: TextStyle( : TextStyle(
fontStyle: widget.italic ? FontStyle.italic : null, fontStyle: widget.italic ? FontStyle.italic : null,
color: widget.color != null color:
? widget.color widget.color != null ? widget.color : Colors.black,
: Colors.black,
fontSize: widget.fontSize ?? _getFontSize(), fontSize: widget.fontSize ?? _getFontSize(),
letterSpacing: letterSpacing:
widget.variant == "overline" ? 1.5 : null, widget.variant == "overline" ? 1.5 : null,
fontWeight: widget.fontWeight ?? _getFontWeight(), fontWeight: widget.fontWeight ?? _getFontWeight(),
fontFamily: widget.fontFamily ?? 'Poppins', fontFamily: widget.fontFamily ?? 'Poppins',
decoration: widget.textDecoration), decoration: widget.textDecoration,
height: widget.fontHeight),
), ),
if (widget.readMore && text.length > widget.maxLength && hidden) if (widget.readMore && text.length > widget.maxLength && hidden)
Positioned( Positioned(

@ -1,9 +1,5 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
// OWNER : Ibrahim albitar
// DATE : 05-04-2020
// DESCRIPTION : Custom widget for rounded container and custom decoration
class RoundedContainer extends StatefulWidget { class RoundedContainer extends StatefulWidget {
final double width; final double width;
final double height; final double height;
@ -13,6 +9,9 @@ class RoundedContainer extends StatefulWidget {
final double elevation; final double elevation;
final bool showBorder; final bool showBorder;
final Color borderColor; final Color borderColor;
final double shadowWidth;
final double shadowSpreadRadius;
final double shadowDy;
final bool customCornerRaduis; final bool customCornerRaduis;
final double topLeft; final double topLeft;
final double bottomRight; final double bottomRight;
@ -31,6 +30,9 @@ class RoundedContainer extends StatefulWidget {
this.elevation = 1, this.elevation = 1,
this.showBorder = false, this.showBorder = false,
this.borderColor = Colors.red, this.borderColor = Colors.red,
this.shadowWidth = 0.1,
this.shadowSpreadRadius = 10,
this.shadowDy = 5,
this.customCornerRaduis = false, this.customCornerRaduis = false,
this.topLeft = 0, this.topLeft = 0,
this.topRight = 0, this.topRight = 0,
@ -63,10 +65,10 @@ class _RoundedContainerState extends State<RoundedContainer> {
: BorderRadius.circular(widget.raduis), : BorderRadius.circular(widget.raduis),
boxShadow: [ boxShadow: [
BoxShadow( BoxShadow(
color: Colors.grey.withOpacity(0.1), color: Colors.grey.withOpacity(widget.shadowWidth),
spreadRadius: 10, spreadRadius: widget.shadowSpreadRadius,
blurRadius: 5, blurRadius: 5,
offset: Offset(0, 5), // changes position of shadow offset: Offset(0, widget.shadowDy), // changes position of shadow
), ),
]) ])
: null, : null,

Loading…
Cancel
Save