Merge branch 'mirza_home_page' into development_new_design_2.0

merge-update-with-lab-changes
Mirza.Shafique 4 years ago
commit 719cdbd2e4

@ -96,8 +96,8 @@ class _HomePageFragment2State extends State<HomePageFragment2> {
margin: EdgeInsets.only(left: 20, right: 20, top: 8, bottom: 6),
child: SliderView(
onLoginClick: () {
// widget.onLoginClick();
navigateTo(context, CallHomePage());
widget.onLoginClick();
// navigateTo(context, CallHomePage());
},
),
// height: MediaQuery.of(context).size.width / 2.6,

@ -17,6 +17,8 @@ class LineChartCurved extends StatelessWidget {
double minY = 0;
double maxY = 0;
double intialY = 0;
double lastY = 0;
double minX = 0;
double maxX = 0;
@ -26,6 +28,7 @@ class LineChartCurved extends StatelessWidget {
Widget build(BuildContext context) {
getXaxix();
getYaxix();
getInitialY();
calculateMaxAndMin();
return AspectRatio(
aspectRatio: 1.0,
@ -100,7 +103,7 @@ class LineChartCurved extends StatelessWidget {
touchCallback: (LineTouchResponse touchResponse) {},
handleBuiltInTouches: true,
),
gridData: FlGridData(show: true, drawVerticalLine: true, drawHorizontalLine: true,horizontalInterval: 14,verticalInterval: 14),
gridData: FlGridData(show: true, drawVerticalLine: true, drawHorizontalLine: true, horizontalInterval: 14, verticalInterval: 14),
titlesData: FlTitlesData(
bottomTitles: SideTitles(
showTitles: true,
@ -165,12 +168,14 @@ class LineChartCurved extends StatelessWidget {
),
minX: minX,
maxX: maxX,
maxY: maxY,
minY: 0,
maxY: lastY+50,
minY: intialY,
lineBarsData: getData(context),
);
}
calculateMaxAndMin() {
getMaxY();
getMaxX();
@ -185,12 +190,29 @@ class LineChartCurved extends StatelessWidget {
maxY = 0;
timeSeries.forEach((element) {
double resultValueDouble = element.sales;
if (resultValueDouble > maxY) maxY = resultValueDouble;
if (resultValueDouble > maxY) {
lastY = resultValueDouble;
maxY = resultValueDouble;
}
});
print("maxY " + lastY.toString());
return maxY.roundToDouble();
}
double getInitialY() {
try {
intialY = timeSeries.first.sales;
timeSeries.forEach((element) {
double resultValueDouble = element.sales;
if (resultValueDouble < intialY) intialY = resultValueDouble;
});
} catch (e) {
intialY = 0;
}
return intialY.roundToDouble();
}
getMaxX() {
maxX = (timeSeries.length - 1).toDouble();
}

Loading…
Cancel
Save