|
|
|
|
@ -7,6 +7,7 @@ import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
|
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
import 'package:flutter_datetime_picker/flutter_datetime_picker.dart';
|
|
|
|
|
import 'package:intl/intl.dart';
|
|
|
|
|
import 'package:jiffy/jiffy.dart';
|
|
|
|
|
|
|
|
|
|
import 'ovulation_result_page.dart';
|
|
|
|
|
|
|
|
|
|
@ -22,6 +23,8 @@ class _OvulationPeriodState extends State<OvulationPeriod> {
|
|
|
|
|
int lutealPhaseLength = 0;
|
|
|
|
|
String selectedDate;
|
|
|
|
|
var dateFrom = DateTime.now();
|
|
|
|
|
var babyAgeWeeks;
|
|
|
|
|
var babyAgeDays;
|
|
|
|
|
var dateTo = DateTime.now();
|
|
|
|
|
var conceivedDate = DateTime.now();
|
|
|
|
|
var deliveryDue = DateTime.now();
|
|
|
|
|
@ -78,10 +81,15 @@ class _OvulationPeriodState extends State<OvulationPeriod> {
|
|
|
|
|
bloodSugarDate = date;
|
|
|
|
|
dateFrom = date.add(Duration(days: 10));
|
|
|
|
|
updatedDt = DateFormat.yMMMEd().format(dateFrom);
|
|
|
|
|
|
|
|
|
|
dateTo = date.add(Duration(days: 20));
|
|
|
|
|
conceivedDate = date.add(Duration(days: 14));
|
|
|
|
|
deliveryDue = date.add(Duration(days: 280));
|
|
|
|
|
|
|
|
|
|
// babyAge = Jiffy([DateTime.now()]).diff(Jiffy([date]), Units.WEEK);
|
|
|
|
|
babyAgeWeeks = Jiffy([DateTime.now().year, DateTime.now().month, DateTime.now().day])
|
|
|
|
|
.diff(Jiffy([date.year, date.month, dateTo.day]), Units.WEEK);
|
|
|
|
|
babyAgeDays = Jiffy([DateTime.now().year, DateTime.now().month, DateTime.now().day])
|
|
|
|
|
.diff(Jiffy([date.year, date.month, dateTo.day]), Units.DAY);
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
currentTime: DateTime.now(),
|
|
|
|
|
@ -91,9 +99,7 @@ class _OvulationPeriodState extends State<OvulationPeriod> {
|
|
|
|
|
padding: EdgeInsets.all(12),
|
|
|
|
|
width: double.infinity,
|
|
|
|
|
height: 65,
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
borderRadius: BorderRadius.circular(12),
|
|
|
|
|
color: Colors.white),
|
|
|
|
|
decoration: BoxDecoration(borderRadius: BorderRadius.circular(12), color: Colors.white),
|
|
|
|
|
child: Row(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
|
children: [
|
|
|
|
|
@ -124,8 +130,7 @@ class _OvulationPeriodState extends State<OvulationPeriod> {
|
|
|
|
|
child: Row(
|
|
|
|
|
children: [
|
|
|
|
|
Padding(
|
|
|
|
|
padding: EdgeInsets.symmetric(
|
|
|
|
|
vertical: 10.0, horizontal: 8.0),
|
|
|
|
|
padding: EdgeInsets.symmetric(vertical: 10.0, horizontal: 8.0),
|
|
|
|
|
child: Center(
|
|
|
|
|
child: Container(
|
|
|
|
|
width: 60.0,
|
|
|
|
|
@ -146,10 +151,8 @@ class _OvulationPeriodState extends State<OvulationPeriod> {
|
|
|
|
|
Container(
|
|
|
|
|
height: 38.0,
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment:
|
|
|
|
|
CrossAxisAlignment.center,
|
|
|
|
|
mainAxisAlignment:
|
|
|
|
|
MainAxisAlignment.center,
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
Container(
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
@ -166,8 +169,7 @@ class _OvulationPeriodState extends State<OvulationPeriod> {
|
|
|
|
|
),
|
|
|
|
|
onTap: () {
|
|
|
|
|
setState(() {
|
|
|
|
|
if (cycleLength < 45)
|
|
|
|
|
cycleLength++;
|
|
|
|
|
if (cycleLength < 45) cycleLength++;
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
@ -179,8 +181,7 @@ class _OvulationPeriodState extends State<OvulationPeriod> {
|
|
|
|
|
),
|
|
|
|
|
onTap: () {
|
|
|
|
|
setState(() {
|
|
|
|
|
if (cycleLength > 0)
|
|
|
|
|
cycleLength--;
|
|
|
|
|
if (cycleLength > 0) cycleLength--;
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
@ -229,8 +230,7 @@ class _OvulationPeriodState extends State<OvulationPeriod> {
|
|
|
|
|
child: Row(
|
|
|
|
|
children: [
|
|
|
|
|
Padding(
|
|
|
|
|
padding: EdgeInsets.symmetric(
|
|
|
|
|
vertical: 10.0, horizontal: 8.0),
|
|
|
|
|
padding: EdgeInsets.symmetric(vertical: 10.0, horizontal: 8.0),
|
|
|
|
|
child: Center(
|
|
|
|
|
child: Container(
|
|
|
|
|
width: 60.0,
|
|
|
|
|
@ -245,17 +245,14 @@ class _OvulationPeriodState extends State<OvulationPeriod> {
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
Expanded(
|
|
|
|
|
child: Center(
|
|
|
|
|
child:
|
|
|
|
|
Text(lutealPhaseLength.toString()),
|
|
|
|
|
child: Text(lutealPhaseLength.toString()),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
Container(
|
|
|
|
|
height: 38.0,
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment:
|
|
|
|
|
CrossAxisAlignment.center,
|
|
|
|
|
mainAxisAlignment:
|
|
|
|
|
MainAxisAlignment.center,
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
Container(
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
@ -272,8 +269,7 @@ class _OvulationPeriodState extends State<OvulationPeriod> {
|
|
|
|
|
),
|
|
|
|
|
onTap: () {
|
|
|
|
|
setState(() {
|
|
|
|
|
if (lutealPhaseLength < 15)
|
|
|
|
|
lutealPhaseLength++;
|
|
|
|
|
if (lutealPhaseLength < 15) lutealPhaseLength++;
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
@ -285,8 +281,7 @@ class _OvulationPeriodState extends State<OvulationPeriod> {
|
|
|
|
|
),
|
|
|
|
|
onTap: () {
|
|
|
|
|
setState(() {
|
|
|
|
|
if (lutealPhaseLength > 0)
|
|
|
|
|
lutealPhaseLength--;
|
|
|
|
|
if (lutealPhaseLength > 0) lutealPhaseLength--;
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
@ -332,11 +327,13 @@ class _OvulationPeriodState extends State<OvulationPeriod> {
|
|
|
|
|
context,
|
|
|
|
|
FadePage(
|
|
|
|
|
page: OvulationResult(
|
|
|
|
|
conceivedDate: conceivedDate,
|
|
|
|
|
dateFrom: dateFrom,
|
|
|
|
|
dateTo: dateTo,
|
|
|
|
|
deliveryDue: deliveryDue,
|
|
|
|
|
)),
|
|
|
|
|
conceivedDate: conceivedDate,
|
|
|
|
|
dateFrom: dateFrom,
|
|
|
|
|
dateTo: dateTo,
|
|
|
|
|
deliveryDue: deliveryDue,
|
|
|
|
|
babyAge: babyAgeWeeks,
|
|
|
|
|
babyAgeDays: babyAgeDays,
|
|
|
|
|
)),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|