Merge branch 'bug_fixing' into 'development'

Bug fixing

See merge request Cloud_Solution/diplomatic-quarter!319
merge-requests/321/merge
Sultan khan 3 years ago
commit 924f9bedc0

@ -39,6 +39,9 @@ class BloodSugarViewMode extends BaseViewModel {
element.dailyAverageResult.toDouble(),
));
});
if (bloodWeekTimeSeriesData.isEmpty) {
bloodWeekTimeSeriesData.add(TimeSeriesSales2(DateTime.now(), 0));
}
for (int index = 0;
index < bloodSugarService.monthDiabtectResultAverageList.length;

@ -14,6 +14,10 @@ class ReportsMonthlyViewModel extends BaseViewModel {
ReportsService _reportsService = locator<ReportsService>();
String get userAgreementContent => _reportsService.userAgreementContent;
bool get receiveHealthSummaryReport => _reportsService?.user?.receiveHealthSummaryReport ?? false;
set receiveHealthSummaryReport(bool val) {
_reportsService?.user?.receiveHealthSummaryReport = val;
}
getUserTermsAndConditions() async {
setState(ViewState.Busy);
@ -26,14 +30,9 @@ class ReportsMonthlyViewModel extends BaseViewModel {
}
}
updatePatientHealthSummaryReport(
{String message,
bool isSummary,
bool isUpdateEmail = false,
String email}) async {
updatePatientHealthSummaryReport({String message, bool isSummary, bool isUpdateEmail = false, String email}) async {
setState(ViewState.BusyLocal);
await _reportsService.updatePatientHealthSummaryReport(
isSummary: isSummary);
await _reportsService.updatePatientHealthSummaryReport(isSummary: isSummary);
if (_reportsService.hasError) {
error = _reportsService.error;
AppToast.showErrorToast(message: error);

@ -1,12 +1,18 @@
import 'dart:ui';
import 'package:diplomaticquarterapp/config/config.dart';
import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/H2O_view_model.dart';
import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/h2o/h20_setting.dart';
import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/h2o/month_page.dart';
import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/h2o/today_page.dart';
import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/h2o/week_page.dart';
import 'package:diplomaticquarterapp/pages/DrawerPages/family/my-family.dart';
import 'package:diplomaticquarterapp/pages/ToDoList/ToDo.dart';
import 'package:diplomaticquarterapp/pages/base/base_view.dart';
import 'package:diplomaticquarterapp/pages/medical/medical_profile_page.dart';
import 'package:diplomaticquarterapp/routes.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/widgets/bottom_navigation/bottom_nav_bar.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
@ -18,14 +24,16 @@ class H2OPage extends StatefulWidget {
_H2OPageState createState() => _H2OPageState();
}
class _H2OPageState extends State<H2OPage>
with SingleTickerProviderStateMixin {
class _H2OPageState extends State<H2OPage> with SingleTickerProviderStateMixin {
TabController _tabController;
@override
void initState() {
super.initState();
_tabController = TabController(length: 3, vsync: this,);
_tabController = TabController(
length: 3,
vsync: this,
);
}
@override
@ -43,6 +51,7 @@ class _H2OPageState extends State<H2OPage>
appBarTitle: TranslationBase.of(context).waterTracker,
showHomeAppBarIcon: false,
baseViewModel: model,
isHelp: true,
appBarIcons: [
IconButton(
icon: Image.asset("assets/images/new-design/setting_gear_icon.png"),
@ -129,6 +138,39 @@ class _H2OPageState extends State<H2OPage>
)
],
),
bottomNavigationBar: BottomNavBar(
changeIndex: (index) {
if (index == 0) {
IS_VOICE_COMMAND_CLOSED = false;
} else if (index == 1) {
Navigator.push(
context,
FadePage(
page: AppScaffold(
appBarTitle: TranslationBase.of(context).medicalProfile,
isShowAppBar: true,
showHomeAppBarIcon: false,
appBarIcons: [
IconButton(
icon: Image.asset("assets/images/new-design/setting_gear_icon.png"),
color: Colors.white,
onPressed: () => Navigator.of(context).pushNamed(
SETTINGS,
),
),
],
body: MedicalProfilePage())));
} else if (index == 2) {
Navigator.of(context).pushNamedAndRemoveUntil(HOME, (Route<dynamic> route) => false);
} else if (index == 3) {
Navigator.of(context).pushNamed(MY_FAMILIY);
} else if (index == 4) {
Navigator.push(context, FadePage(page: ToDo(isShowAppBar: false)));
}
},
showHomeIcon: true,
index: 0,
),
),
),
);

@ -31,42 +31,47 @@ class BloodSugarWeeklyPage extends StatelessWidget {
Widget build(BuildContext context) {
ProjectViewModel projectViewModel = Provider.of(context);
return AppScaffold(
body:timeSeriesData.isEmpty?Container(child: Center(child: Texts(TranslationBase.of(context).noDataAvailable),),): ListView(
children: [
Container(
margin: EdgeInsets.only(top: 12, left: 8, right: 8),
color: Colors.white,
child: LineChartCurved(
title: 'Sugar',
timeSeries: timeSeriesData,
indexes: timeSeriesData.length ~/ 5.5,
),
),
SizedBox(
height: 12,
),
Padding(
padding: const EdgeInsets.all(8.0),
child: Texts(TranslationBase.of(context).details),
),
Container(
padding: EdgeInsets.all(10),
color: Colors.transparent,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Table(
border: TableBorder.symmetric(
inside: BorderSide(width: 2.0, color: Colors.grey[300]),
body: timeSeriesData.isEmpty
? Container(
child: Center(
child: Texts(TranslationBase.of(context).noDataAvailable),
),
)
: ListView(
children: [
Container(
margin: EdgeInsets.only(top: 12, left: 8, right: 8),
color: Colors.white,
child: LineChartCurved(
title: 'Sugar',
timeSeries: timeSeriesData,
indexes: timeSeriesData.length ~/ 5.5,
),
children:
fullData(context, projectViewModel, bloodSugarViewMode),
),
SizedBox(
height: 12,
),
Padding(
padding: const EdgeInsets.all(8.0),
child: Texts(TranslationBase.of(context).details),
),
Container(
padding: EdgeInsets.all(10),
color: Colors.transparent,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Table(
border: TableBorder.symmetric(
inside: BorderSide(width: 2.0, color: Colors.grey[300]),
),
children: fullData(context, projectViewModel, bloodSugarViewMode),
),
],
),
)
],
),
)
],
),
);
}

@ -184,7 +184,7 @@ class LineChartCurved extends StatelessWidget {
}
double getMinY() {
double min = timeSeries[0].sales;
double min = timeSeries.isEmpty ? 0 : timeSeries.first.sales;
timeSeries.forEach((element) {
double resultValueDouble = element.sales;
if (resultValueDouble < min) min = resultValueDouble;

@ -19,15 +19,24 @@ class MonthlyReportsPage extends StatefulWidget {
}
class _MonthlyReportsPageState extends State<MonthlyReportsPage> {
bool isAgree = false;
bool isSummary = false;
String email = "";
bool isAgree;
bool isSummary;
String email;
final formKey = GlobalKey<FormState>();
@override
Widget build(BuildContext context) {
return BaseView<ReportsMonthlyViewModel>(
builder: (_, model, w) => AppScaffold(
return BaseView<ReportsMonthlyViewModel>(builder: (_, model, w) {
if (isSummary == null) {
isSummary = model.receiveHealthSummaryReport;
}
if (isAgree == null) {
isAgree = model.receiveHealthSummaryReport;
}
if (email == null) {
email = model?.user?.emailAddress ?? "";
}
return AppScaffold(
isShowAppBar: true,
appBarTitle: TranslationBase.of(context).monthlyReports,
body: SingleChildScrollView(
@ -41,15 +50,10 @@ class _MonthlyReportsPageState extends State<MonthlyReportsPage> {
Container(
padding: EdgeInsets.all(9),
height: 55,
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.all(Radius.circular(8)),
shape: BoxShape.rectangle,
border: Border.all(color: Colors.grey)),
decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.all(Radius.circular(8)), shape: BoxShape.rectangle, border: Border.all(color: Colors.grey)),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Texts(
TranslationBase.of(context).patientHealthSummaryReport,
bold: true,
@ -62,12 +66,12 @@ class _MonthlyReportsPageState extends State<MonthlyReportsPage> {
setState(() {
isSummary = !isSummary;
});
if(!isSummary) {
if (!isSummary) {
GifLoaderDialogUtils.showMyDialog(context);
await model.updatePatientHealthSummaryReport(
message: TranslationBase
.of(context)
.updateSuccessfully, isSummary: isSummary);
await model.updatePatientHealthSummaryReport(message: TranslationBase.of(context).updateSuccessfully, isSummary: isSummary);
model.receiveHealthSummaryReport = isSummary;
isAgree = isSummary;
model.user.emailAddress = "";
GifLoaderDialogUtils.hideDialog(context);
}
},
@ -80,11 +84,11 @@ class _MonthlyReportsPageState extends State<MonthlyReportsPage> {
),
Container(
margin: EdgeInsets.all(8),
child: TextFields(
child: TextFields(
fillColor: Colors.red,
hintText: 'email@email.com',
fontSize: 20,
initialValue: model.user.emailAddress,
initialValue: email,
fontWeight: FontWeight.w600,
onChanged: (text) {
email = text;
@ -111,8 +115,7 @@ class _MonthlyReportsPageState extends State<MonthlyReportsPage> {
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Expanded(
child: Texts(TranslationBase.of(context)
.toViewTheTermsAndConditions),
child: Texts(TranslationBase.of(context).toViewTheTermsAndConditions),
),
InkWell(
onTap: () {
@ -156,19 +159,15 @@ class _MonthlyReportsPageState extends State<MonthlyReportsPage> {
child: SecondaryButton(
textColor: Colors.white,
label: TranslationBase.of(context).save,
disabled: (!isAgree || !isSummary ),
disabled: (!isAgree || !isSummary),
onTap: () async {
final form = formKey.currentState;
if (form.validate()) {
GifLoaderDialogUtils.showMyDialog(context);
await model.updatePatientHealthSummaryReport(
message: TranslationBase
.of(context)
.updateSuccessfully,
isSummary: isSummary,
isUpdateEmail: true,
email: email.isNotEmpty ? email : model.user
.emailAddress);
message: TranslationBase.of(context).updateSuccessfully, isSummary: isSummary, isUpdateEmail: true, email: email.isNotEmpty ? email : model.user.emailAddress);
model.receiveHealthSummaryReport = isSummary;
model.user.emailAddress = email.isNotEmpty ? email : model.user.emailAddress;
GifLoaderDialogUtils.hideDialog(context);
}
},
@ -177,8 +176,7 @@ class _MonthlyReportsPageState extends State<MonthlyReportsPage> {
Padding(
padding: const EdgeInsets.all(5.0),
child: Texts(
TranslationBase.of(context)
.instructionAgree,
TranslationBase.of(context).instructionAgree,
fontWeight: FontWeight.normal,
),
),
@ -191,7 +189,7 @@ class _MonthlyReportsPageState extends State<MonthlyReportsPage> {
),
),
),
),
);
);
});
}
}

@ -21,7 +21,8 @@ import 'package:diplomaticquarterapp/config/shared_pref_kay.dart';
class BottomNavBar extends StatefulWidget {
final ValueChanged<int> changeIndex;
final int index;
BottomNavBar({Key key, this.changeIndex, this.index}) : super(key: key);
final bool showHomeIcon;
BottomNavBar({Key key, this.changeIndex, this.index, this.showHomeIcon = false}) : super(key: key);
@override
_BottomNavBarState createState() => _BottomNavBarState();
@ -33,7 +34,7 @@ class _BottomNavBarState extends State<BottomNavBar> {
var event = RobotProvider();
_changeIndex(int index) async {
widget.changeIndex(index);
if (_index == 0) {
if (index == 0) {
event.setValue({'isRobotVisible': 'true'});
}
}
@ -72,16 +73,27 @@ class _BottomNavBarState extends State<BottomNavBar> {
),
if (widget.index == 0)
Expanded(
child: SizedBox(
height: 50,
child: Column(
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
SizedBox(height: 22),
],
),
),
child: (widget.showHomeIcon)
? SizedBox(
child: BottomNavigationItem(
icon: Icons.home_outlined,
activeIcon: Icons.home_outlined,
changeIndex: _changeIndex,
index: widget.index,
currentIndex: 2,
name: TranslationBase.of(context).home,
),
)
: SizedBox(
height: 50,
child: Column(
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
SizedBox(height: 22),
],
),
),
),
if (widget.index != 0 && projectViewModel.havePrivilege(34))
BottomNavigationItem(

Loading…
Cancel
Save