Merge branch 'development_new_design_2.0' of https://gitlab.com/Cloud_Solution/diplomatic-quarter into sultan_new_design
commit
160049973e
Binary file not shown.
|
After Width: | Height: | Size: 6.4 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 10 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 14 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 4.9 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 16 KiB |
@ -1,44 +1,56 @@
|
||||
class GetCMCServicesResponseModel {
|
||||
String description;
|
||||
String descriptionN;
|
||||
int iD;
|
||||
bool isActive;
|
||||
int id;
|
||||
String serviceID;
|
||||
int orderServiceID;
|
||||
String text;
|
||||
String textN;
|
||||
dynamic price;
|
||||
int serviceID;
|
||||
dynamic totalPrice;
|
||||
dynamic vAT;
|
||||
dynamic priceVAT;
|
||||
dynamic priceTotal;
|
||||
bool isEnabled;
|
||||
int orderId;
|
||||
int quantity;
|
||||
|
||||
GetCMCServicesResponseModel(
|
||||
{this.description,
|
||||
this.descriptionN,
|
||||
this.iD,
|
||||
this.isActive,
|
||||
this.price,
|
||||
{this.id,
|
||||
this.serviceID,
|
||||
this.totalPrice,
|
||||
this.vAT});
|
||||
this.orderServiceID,
|
||||
this.text,
|
||||
this.textN,
|
||||
this.price,
|
||||
this.priceVAT,
|
||||
this.priceTotal,
|
||||
this.isEnabled,
|
||||
this.orderId,
|
||||
this.quantity});
|
||||
|
||||
GetCMCServicesResponseModel.fromJson(Map<String, dynamic> json) {
|
||||
description = json['Description'];
|
||||
descriptionN = json['DescriptionN'];
|
||||
iD = json['ID'];
|
||||
isActive = json['IsActive'];
|
||||
price = json['Price'];
|
||||
serviceID = json['ServiceID'];
|
||||
totalPrice = json['TotalPrice'];
|
||||
vAT = json['VAT'];
|
||||
id = json['id'];
|
||||
serviceID = json['serviceID'];
|
||||
orderServiceID = json['orderServiceID'];
|
||||
text = json['text'];
|
||||
textN = json['textN'];
|
||||
price = json['price'];
|
||||
priceVAT = json['priceVAT'];
|
||||
priceTotal = json['priceTotal'];
|
||||
isEnabled = json['isEnabled'];
|
||||
orderId = json['orderId'];
|
||||
quantity = json['quantity'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['Description'] = this.description;
|
||||
data['DescriptionN'] = this.descriptionN;
|
||||
data['ID'] = this.iD;
|
||||
data['IsActive'] = this.isActive;
|
||||
data['Price'] = this.price;
|
||||
data['ServiceID'] = this.serviceID;
|
||||
data['TotalPrice'] = this.totalPrice;
|
||||
data['VAT'] = this.vAT;
|
||||
data['id'] = this.id;
|
||||
data['serviceID'] = this.serviceID;
|
||||
data['orderServiceID'] = this.orderServiceID;
|
||||
data['text'] = this.text;
|
||||
data['textN'] = this.textN;
|
||||
data['price'] = this.price;
|
||||
data['priceVAT'] = this.priceVAT;
|
||||
data['priceTotal'] = this.priceTotal;
|
||||
data['isEnabled'] = this.isEnabled;
|
||||
data['orderId'] = this.orderId;
|
||||
data['quantity'] = this.quantity;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,148 @@
|
||||
import 'dart:math' as math;
|
||||
|
||||
import 'package:fl_chart/fl_chart.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class LineChartModel {
|
||||
int value;
|
||||
String title;
|
||||
|
||||
LineChartModel(this.title, this.value);
|
||||
}
|
||||
|
||||
class CustomLineChart extends StatefulWidget {
|
||||
final List<LineChartModel> list;
|
||||
final bool isArabic;
|
||||
CustomLineChart(this.list, this.isArabic);
|
||||
|
||||
@override
|
||||
_CustomLineChartState createState() => _CustomLineChartState();
|
||||
}
|
||||
|
||||
class _CustomLineChartState extends State<CustomLineChart> {
|
||||
bool showAvg = false;
|
||||
|
||||
final List<LineChartModel> myList = [
|
||||
LineChartModel("", 0),
|
||||
LineChartModel("", 0),
|
||||
// LineChartModel("", 0),
|
||||
];
|
||||
|
||||
List<LineChartModel> list = [];
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
if (widget.list.isEmpty) {
|
||||
list = myList;
|
||||
} else {
|
||||
list = widget.list;
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Stack(
|
||||
children: <Widget>[
|
||||
AspectRatio(
|
||||
aspectRatio: 1.0,
|
||||
child: LineChart(
|
||||
mainData(),
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
width: 60,
|
||||
height: 34,
|
||||
child: TextButton(
|
||||
onPressed: () {
|
||||
setState(() {
|
||||
showAvg = !showAvg;
|
||||
});
|
||||
},
|
||||
child: Text(
|
||||
'',
|
||||
style: TextStyle(fontSize: 12, color: showAvg ? Colors.white.withOpacity(0.5) : Colors.white),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
LineChartData mainData() {
|
||||
SideTitles right = SideTitles(
|
||||
showTitles: true,
|
||||
margin: 0,
|
||||
reservedSize: 8,
|
||||
getTitles: (value) {
|
||||
return '';
|
||||
},
|
||||
);
|
||||
SideTitles left = SideTitles(
|
||||
showTitles: true,
|
||||
interval: 1,
|
||||
getTextStyles: (value) => const TextStyle(color: Color(0xff2E303A), fontWeight: FontWeight.w600, fontSize: 12, letterSpacing: 0),
|
||||
getTitles: (value) {
|
||||
if (widget.list.isEmpty) {
|
||||
return (value).toInt().toString();
|
||||
}
|
||||
return (value * 20).toInt().toString();
|
||||
},
|
||||
reservedSize: 22,
|
||||
margin: 12,
|
||||
);
|
||||
return LineChartData(
|
||||
lineTouchData: LineTouchData(enabled: false),
|
||||
gridData: FlGridData(
|
||||
show: true,
|
||||
drawVerticalLine: false,
|
||||
getDrawingHorizontalLine: (value) {
|
||||
return FlLine(
|
||||
color: const Color(0xffEFEFEF),
|
||||
strokeWidth: 1,
|
||||
);
|
||||
},
|
||||
),
|
||||
titlesData: FlTitlesData(
|
||||
show: true,
|
||||
topTitles: SideTitles(showTitles: false),
|
||||
bottomTitles: SideTitles(
|
||||
showTitles: true,
|
||||
reservedSize: 22,
|
||||
interval: 1,
|
||||
getTextStyles: (value) => const TextStyle(color: Color(0xff2E303A), fontWeight: FontWeight.w600, fontSize: 12, letterSpacing: 0),
|
||||
getTitles: (value) {
|
||||
String _title = list[value.toInt()].title;
|
||||
return (_title.length > 3 ? (widget.isArabic ? _title : _title.substring(0, 3)) : _title).toUpperCase();
|
||||
},
|
||||
margin: 12,
|
||||
),
|
||||
rightTitles: widget.isArabic ? left : right,
|
||||
leftTitles: widget.isArabic ? right : left),
|
||||
borderData: FlBorderData(
|
||||
show: true,
|
||||
border: Border.symmetric(
|
||||
horizontal: BorderSide(color: const Color(0xffEFEFEF), width: 1),
|
||||
),
|
||||
),
|
||||
minX: 0,
|
||||
maxX: widget.list.isEmpty ? 1 : widget.list.length - 1.0,
|
||||
minY: widget.list.isEmpty ? -1 : 0,
|
||||
maxY: widget.list.isEmpty ? 1 : 5,
|
||||
lineBarsData: [
|
||||
LineChartBarData(
|
||||
spots: [
|
||||
for (int i = 0; i < list.length; i++) FlSpot(i + 0.0, (list[i].value / 20) + 0.0),
|
||||
],
|
||||
isCurved: true,
|
||||
preventCurveOverShooting: true,
|
||||
barWidth: 2,
|
||||
isStrokeCapRound: true,
|
||||
dotData: FlDotData(
|
||||
show: false,
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,52 @@
|
||||
// import 'package:flutter/material.dart';
|
||||
// import 'package:syncfusion_flutter_charts/charts.dart';
|
||||
// import 'package:syncfusion_flutter_charts/sparkcharts.dart';
|
||||
//
|
||||
// class SyncFuChart extends StatelessWidget {
|
||||
// List<_SalesData> data = [
|
||||
// _SalesData('Jan', 35),
|
||||
// _SalesData('Feb', 28),
|
||||
// _SalesData('Mar', 34),
|
||||
// _SalesData('Apr', 32),
|
||||
// _SalesData('May', 40),
|
||||
// ];
|
||||
//
|
||||
// @override
|
||||
// Widget build(BuildContext context) {
|
||||
// return Scaffold(
|
||||
// body: Column(
|
||||
// children: [
|
||||
// //Initialize the chart widget
|
||||
// SfCartesianChart(
|
||||
//
|
||||
// primaryXAxis: CategoryAxis(),
|
||||
// primaryYAxis: CategoryAxis(minimum: 28),
|
||||
// // Chart title
|
||||
// title: ChartTitle(text: 'Half yearly sales analysis'),
|
||||
// // Enable legend
|
||||
// legend: Legend(isVisible: true),
|
||||
// // Enable tooltip
|
||||
// tooltipBehavior: TooltipBehavior(enable: true),
|
||||
// series: <ChartSeries<_SalesData, String>>[
|
||||
// LineSeries<_SalesData, String>(
|
||||
// dataSource: data,
|
||||
// xValueMapper: (_SalesData sales, _) => sales.year,
|
||||
// yValueMapper: (_SalesData sales, _) => sales.sales,
|
||||
// name: 'Sales',
|
||||
// // Enable data label
|
||||
// dataLabelSettings: DataLabelSettings(isVisible: true),
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// );
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// class _SalesData {
|
||||
// _SalesData(this.year, this.sales);
|
||||
//
|
||||
// final String year;
|
||||
// final double sales;
|
||||
// }
|
||||
Loading…
Reference in New Issue