|
|
|
|
@ -1,11 +1,10 @@
|
|
|
|
|
import 'package:diplomaticquarterapp/core/enum/viewstate.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/core/viewModels/medical/blood_sugar_view_model.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/pages/base/base_view.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/pages/medical/my_trackers/widget/TabBarWidget.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/uitl/app_toast.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/widgets/buttons/button.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/widgets/dialogs/confirm_send_email_dialog.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
|
|
|
|
|
@ -13,10 +12,10 @@ import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
|
|
|
|
|
import 'package:flutter/cupertino.dart';
|
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
import 'package:provider/provider.dart';
|
|
|
|
|
|
|
|
|
|
import 'AddBloodSugarPage.dart';
|
|
|
|
|
import 'BloodMonthly.dart';
|
|
|
|
|
import 'BloodYeaPage.dart';
|
|
|
|
|
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
|
|
|
|
|
import 'blood_sugar_weekly_page.dart';
|
|
|
|
|
|
|
|
|
|
class BloodSugarHomePage extends StatefulWidget {
|
|
|
|
|
@ -51,98 +50,113 @@ class _BloodSugarHomePageState extends State<BloodSugarHomePage> with SingleTick
|
|
|
|
|
baseViewModel: model,
|
|
|
|
|
appBarTitle: TranslationBase.of(context).bloodSugar,
|
|
|
|
|
// baseViewModel: model,
|
|
|
|
|
body: Scaffold(
|
|
|
|
|
extendBodyBehindAppBar: true,
|
|
|
|
|
appBar: TabBarWidget(
|
|
|
|
|
tabController: _tabController,
|
|
|
|
|
),
|
|
|
|
|
body: Column(
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
Expanded(
|
|
|
|
|
child: TabBarView(
|
|
|
|
|
physics: BouncingScrollPhysics(),
|
|
|
|
|
controller: _tabController,
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
BloodSugarWeeklyPage(
|
|
|
|
|
timeSeriesData: model.bloodWeekTimeSeriesData,
|
|
|
|
|
diabtecPatientResult: model.weekDiabtecPatientResult,
|
|
|
|
|
bloodSugarViewMode: model,
|
|
|
|
|
),
|
|
|
|
|
BloodMonthlyPage(
|
|
|
|
|
timeSeriesData: model.monthTimeSeriesData,
|
|
|
|
|
diabtecPatientResult: model.monthDiabtecPatientResult,
|
|
|
|
|
bloodSugarViewMode: model,
|
|
|
|
|
),
|
|
|
|
|
BloodYearPage(
|
|
|
|
|
timeSeriesData: model.yearTimeSeriesData,
|
|
|
|
|
diabtecPatientResult: model.yearDiabtecPatientResult,
|
|
|
|
|
bloodSugarViewMode: model,
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
floatingActionButton: Stack(
|
|
|
|
|
children: [
|
|
|
|
|
Positioned(
|
|
|
|
|
bottom: 60,
|
|
|
|
|
right: projectViewModel.isArabic ? MediaQuery.of(context).size.width * .85 : 0,
|
|
|
|
|
child: InkWell(
|
|
|
|
|
onTap: () {
|
|
|
|
|
Navigator.push(
|
|
|
|
|
context,
|
|
|
|
|
FadePage(
|
|
|
|
|
page: AddBloodSugarPage(
|
|
|
|
|
bloodSugarViewMode: model,
|
|
|
|
|
)));
|
|
|
|
|
},
|
|
|
|
|
child: Container(
|
|
|
|
|
width: 50,
|
|
|
|
|
height: 50,
|
|
|
|
|
decoration: BoxDecoration(shape: BoxShape.circle, color: Theme.of(context).primaryColor),
|
|
|
|
|
child: Center(
|
|
|
|
|
child: Icon(
|
|
|
|
|
Icons.add,
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
),
|
|
|
|
|
)),
|
|
|
|
|
),
|
|
|
|
|
body: Column(
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
TabBar(
|
|
|
|
|
controller: _tabController,
|
|
|
|
|
indicatorWeight: 3.0,
|
|
|
|
|
indicatorSize: TabBarIndicatorSize.tab,
|
|
|
|
|
labelColor: Color(0xff2B353E),
|
|
|
|
|
unselectedLabelColor: Color(0xff575757),
|
|
|
|
|
labelPadding: EdgeInsets.only(top: 15, bottom: 13, left: 20, right: 20),
|
|
|
|
|
labelStyle: TextStyle(
|
|
|
|
|
fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins',
|
|
|
|
|
fontSize: 16,
|
|
|
|
|
fontWeight: FontWeight.w600,
|
|
|
|
|
letterSpacing: -0.48,
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
bottomSheet: Container(
|
|
|
|
|
color: Theme.of(context).scaffoldBackgroundColor,
|
|
|
|
|
child: Padding(
|
|
|
|
|
padding: const EdgeInsets.all(12.0),
|
|
|
|
|
child: DefaultButton(
|
|
|
|
|
TranslationBase.of(context).sendEmail,
|
|
|
|
|
() {
|
|
|
|
|
showDialog(
|
|
|
|
|
context: context,
|
|
|
|
|
child: ConfirmSendEmailDialog(
|
|
|
|
|
email: model.user.emailAddress,
|
|
|
|
|
onTapSendEmail: () async {
|
|
|
|
|
GifLoaderDialogUtils.showMyDialog(context);
|
|
|
|
|
model.sendReportByEmail().then((value) {
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
if (model.state == ViewState.ErrorLocal) {
|
|
|
|
|
AppToast.showErrorToast(message: model.error);
|
|
|
|
|
} else {
|
|
|
|
|
AppToast.showSuccessToast(
|
|
|
|
|
message: TranslationBase.of(context).emailSentSuccessfully,
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}).catchError((e) {
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
AppToast.showErrorToast(message: model.error);
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
unselectedLabelStyle: TextStyle(
|
|
|
|
|
fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins',
|
|
|
|
|
fontSize: 16,
|
|
|
|
|
fontWeight: FontWeight.w600,
|
|
|
|
|
letterSpacing: -0.48,
|
|
|
|
|
),
|
|
|
|
|
tabs: [Text(TranslationBase.of(context).weekly), Text(TranslationBase.of(context).monthlyT), Text(TranslationBase.of(context).yearly)],
|
|
|
|
|
),
|
|
|
|
|
Expanded(
|
|
|
|
|
child: TabBarView(
|
|
|
|
|
physics: BouncingScrollPhysics(),
|
|
|
|
|
controller: _tabController,
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
BloodSugarWeeklyPage(
|
|
|
|
|
timeSeriesData: model.bloodWeekTimeSeriesData,
|
|
|
|
|
diabtecPatientResult: model.weekDiabtecPatientResult,
|
|
|
|
|
bloodSugarViewMode: model,
|
|
|
|
|
),
|
|
|
|
|
BloodMonthlyPage(
|
|
|
|
|
timeSeriesData: model.monthTimeSeriesData,
|
|
|
|
|
diabtecPatientResult: model.monthDiabtecPatientResult,
|
|
|
|
|
bloodSugarViewMode: model,
|
|
|
|
|
),
|
|
|
|
|
BloodYearPage(
|
|
|
|
|
timeSeriesData: model.yearTimeSeriesData,
|
|
|
|
|
diabtecPatientResult: model.yearDiabtecPatientResult,
|
|
|
|
|
bloodSugarViewMode: model,
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
floatingActionButton: Stack(
|
|
|
|
|
children: [
|
|
|
|
|
Positioned(
|
|
|
|
|
bottom: 60,
|
|
|
|
|
right: projectViewModel.isArabic ? MediaQuery.of(context).size.width * .85 : 0,
|
|
|
|
|
child: InkWell(
|
|
|
|
|
onTap: () {
|
|
|
|
|
Navigator.push(
|
|
|
|
|
context,
|
|
|
|
|
FadePage(
|
|
|
|
|
page: AddBloodSugarPage(
|
|
|
|
|
bloodSugarViewMode: model,
|
|
|
|
|
)));
|
|
|
|
|
},
|
|
|
|
|
child: Container(
|
|
|
|
|
width: 50,
|
|
|
|
|
height: 50,
|
|
|
|
|
decoration: BoxDecoration(shape: BoxShape.circle, color: Theme.of(context).primaryColor),
|
|
|
|
|
child: Center(
|
|
|
|
|
child: Icon(
|
|
|
|
|
Icons.add,
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
),
|
|
|
|
|
)),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
bottomSheet: Container(
|
|
|
|
|
color: Theme.of(context).scaffoldBackgroundColor,
|
|
|
|
|
child: Padding(
|
|
|
|
|
padding: const EdgeInsets.all(12.0),
|
|
|
|
|
child: DefaultButton(
|
|
|
|
|
TranslationBase.of(context).sendEmail,
|
|
|
|
|
() {
|
|
|
|
|
showDialog(
|
|
|
|
|
context: context,
|
|
|
|
|
child: ConfirmSendEmailDialog(
|
|
|
|
|
email: model.user.emailAddress,
|
|
|
|
|
onTapSendEmail: () async {
|
|
|
|
|
GifLoaderDialogUtils.showMyDialog(context);
|
|
|
|
|
model.sendReportByEmail().then((value) {
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
if (model.state == ViewState.ErrorLocal) {
|
|
|
|
|
AppToast.showErrorToast(message: model.error);
|
|
|
|
|
} else {
|
|
|
|
|
AppToast.showSuccessToast(
|
|
|
|
|
message: TranslationBase.of(context).emailSentSuccessfully,
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}).catchError((e) {
|
|
|
|
|
GifLoaderDialogUtils.hideDialog(context);
|
|
|
|
|
AppToast.showErrorToast(message: model.error);
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
|