|
1 |
| -// ignore_for_file: import_of_legacy_library_into_null_safe |
| 1 | +// // ignore_for_file: import_of_legacy_library_into_null_safe |
2 | 2 |
|
3 |
| -import 'package:flutter/material.dart'; |
4 |
| -import 'package:tutor_me/src/colorpallete.dart'; |
5 |
| -import 'package:fl_chart/fl_chart.dart'; |
| 3 | +// import 'package:flutter/material.dart'; |
| 4 | +// import 'package:tutor_me/src/colorpallete.dart'; |
| 5 | +// import 'package:fl_chart/fl_chart.dart'; |
| 6 | +// import 'package:app_usage/app_usage.dart'; |
6 | 7 |
|
7 |
| -// ignore: must_be_immutable |
| 8 | +// class DailyUsage extends StatefulWidget { |
| 9 | +// DailyUsage({Key? key}) : super(key: key); |
8 | 10 |
|
9 |
| -class DailyUsage extends StatelessWidget { |
10 |
| - DailyUsage({Key? key}) : super(key: key); |
| 11 | +// @override |
| 12 | +// State<DailyUsage> createState() => _DailyUsageState(); |
| 13 | +// } |
11 | 14 |
|
12 |
| - final List<Color> colorList = [ |
13 |
| - colorBlueTeal, |
14 |
| - colorLightBlueTeal, |
15 |
| - ]; |
16 |
| - @override |
17 |
| - Widget build(BuildContext context) { |
18 |
| - return LineChart( |
| 15 | +// // ignore: must_be_immutable |
19 | 16 |
|
20 |
| - LineChartData( |
21 |
| - minX: 1, |
22 |
| - maxX: 7, |
23 |
| - minY: 0, |
24 |
| - maxY: 6, |
25 |
| - titlesData: LineTitles.getTitleData(), |
26 |
| - gridData: FlGridData( |
27 |
| - show: true, |
28 |
| - getDrawingHorizontalLine: (value) { |
29 |
| - return FlLine( |
30 |
| - color: colorOrange, |
31 |
| - strokeWidth: 1, |
32 |
| - ); |
33 |
| - }, |
34 |
| - drawVerticalLine: false, |
35 |
| - ), |
36 |
| - borderData: FlBorderData( |
37 |
| - show: true, border: Border.all(color: colorOrange, width: 1)), |
38 |
| - lineBarsData: [ |
39 |
| - LineChartBarData( |
40 |
| - spots: [ |
41 |
| - const FlSpot(1, 2), |
42 |
| - const FlSpot(2, 2), |
43 |
| - const FlSpot(3, 3), |
44 |
| - const FlSpot(4, 5), |
45 |
| - const FlSpot(5, 3), |
46 |
| - const FlSpot(6, 2), |
47 |
| - const FlSpot(7, 2), |
48 |
| - ], |
49 |
| - isCurved: true, |
50 |
| - barWidth: 5, |
51 |
| - gradient: const LinearGradient( |
52 |
| - colors: [ |
53 |
| - colorBlueTeal, |
54 |
| - colorLightBlueTeal, |
55 |
| - ], |
56 |
| - ), |
57 |
| - belowBarData: BarAreaData( |
58 |
| - show: true, |
59 |
| - gradient: LinearGradient( |
60 |
| - colors: [ |
61 |
| - colorBlueTeal.withOpacity(0.5), |
62 |
| - colorOrange.withOpacity(0.2), |
63 |
| - ], |
64 |
| - ), |
65 |
| - ), |
66 |
| - ), |
67 |
| - ], |
68 |
| - ), |
69 |
| - ); |
70 |
| - } |
71 |
| -} |
| 17 | +// class _DailyUsageState extends State<DailyUsage> { |
| 18 | +// final List<AppUsageInfo> _usage = <AppUsageInfo>[]; |
72 | 19 |
|
73 |
| -class LineTitles { |
74 |
| - static getTitleData() { |
75 |
| - return FlTitlesData( |
| 20 | +// final List<Color> colorList = [ |
| 21 | +// colorBlueTeal, |
| 22 | +// colorLightBlueTeal, |
| 23 | +// ]; |
76 | 24 |
|
77 |
| - show: true, |
78 |
| - leftTitles: AxisTitles( |
79 |
| - |
80 |
| - sideTitles: SideTitles( |
81 |
| - showTitles: false, |
82 |
| - ) |
83 |
| - ), |
84 |
| - rightTitles: AxisTitles( |
85 |
| - sideTitles: SideTitles( |
86 |
| - showTitles: false |
87 |
| - ) |
88 |
| - ), |
89 |
| - topTitles: AxisTitles( |
90 |
| - sideTitles: SideTitles( |
91 |
| - showTitles: false, |
92 |
| - ) |
93 |
| - ), |
94 |
| - bottomTitles: AxisTitles( |
| 25 | +// getStats() async { |
| 26 | +// final DateTime _now = DateTime.now(); |
| 27 | +// final DateTime _from = DateTime(_now.year, _now.month, _now.day - 7); |
| 28 | +// final List<AppUsageInfo> _info = await AppUsage.getAppUsage(_from, _now); |
| 29 | +// setState(() { |
| 30 | +// _usage.addAll(_info); |
| 31 | +// }); |
| 32 | +// } |
95 | 33 |
|
96 |
| - sideTitles: SideTitles( |
97 |
| - showTitles: true, |
98 |
| - |
99 |
| - reservedSize: 25, |
100 |
| - getTitlesWidget: (value, context) { |
101 |
| - switch (value.toInt()) { |
102 |
| - case 1: |
103 |
| - return const Text( |
104 |
| - 'Sun', |
105 |
| - style: TextStyle( |
106 |
| - color: colorOrange, |
107 |
| - fontWeight: FontWeight.bold, |
108 |
| - fontSize: 16, |
109 |
| - ), |
110 |
| - ); |
111 |
| - case 2: |
112 |
| - return const Text( |
113 |
| - 'Mon', |
114 |
| - style: TextStyle( |
115 |
| - color: colorOrange, |
116 |
| - fontWeight: FontWeight.bold, |
117 |
| - fontSize: 16, |
118 |
| - ), |
119 |
| - ); |
120 |
| - case 3: |
121 |
| - return const Text( |
122 |
| - 'Tue', |
123 |
| - style: TextStyle( |
124 |
| - color: colorOrange, |
125 |
| - fontWeight: FontWeight.bold, |
126 |
| - fontSize: 16, |
127 |
| - ), |
128 |
| - ); |
129 |
| - case 4: |
130 |
| - return const Text( |
131 |
| - 'Wed', |
132 |
| - style: TextStyle( |
133 |
| - color: colorOrange, |
134 |
| - fontWeight: FontWeight.bold, |
135 |
| - fontSize: 16, |
136 |
| - ), |
137 |
| - ); |
138 |
| - case 5: |
139 |
| - return const Text( |
140 |
| - 'Thurs', |
141 |
| - style: TextStyle( |
142 |
| - color: colorOrange, |
143 |
| - fontWeight: FontWeight.bold, |
144 |
| - fontSize: 16, |
145 |
| - ), |
146 |
| - ); |
147 |
| - case 6: |
148 |
| - return const Text( |
149 |
| - 'Fri', |
150 |
| - style: TextStyle( |
151 |
| - color: colorOrange, |
152 |
| - fontWeight: FontWeight.bold, |
153 |
| - fontSize: 16, |
154 |
| - ), |
155 |
| - ); |
156 |
| - default: |
157 |
| - return const Text( |
158 |
| - 'Sat', |
159 |
| - style: TextStyle( |
160 |
| - color: colorOrange, |
161 |
| - fontWeight: FontWeight.bold, |
162 |
| - fontSize: 16, |
163 |
| - ), |
164 |
| - ); |
165 |
| - } |
166 |
| - }, |
167 |
| - ), |
168 |
| - )); |
169 |
| - |
170 |
| - } |
171 |
| -} |
| 34 | +// @override |
| 35 | +// void initState() { |
| 36 | +// super.initState(); |
| 37 | +// } |
| 38 | + |
| 39 | +// @override |
| 40 | +// Widget build(BuildContext context) { |
| 41 | +// return LineChart( |
| 42 | +// LineChartData( |
| 43 | +// minX: 1, |
| 44 | +// maxX: 7, |
| 45 | +// minY: 0, |
| 46 | +// maxY: 6, |
| 47 | +// titlesData: LineTitles.getTitleData(), |
| 48 | +// gridData: FlGridData( |
| 49 | +// show: true, |
| 50 | +// getDrawingHorizontalLine: (value) { |
| 51 | +// return FlLine( |
| 52 | +// color: colorOrange, |
| 53 | +// strokeWidth: 1, |
| 54 | +// ); |
| 55 | +// }, |
| 56 | +// drawVerticalLine: false, |
| 57 | +// ), |
| 58 | +// borderData: FlBorderData( |
| 59 | +// show: true, border: Border.all(color: colorOrange, width: 1)), |
| 60 | +// lineBarsData: [ |
| 61 | +// LineChartBarData( |
| 62 | +// spots: [ |
| 63 | +// FlSpot(1, _usage[0].usage.inMinutes.toDouble()), |
| 64 | +// FlSpot(2, _usage[1].usage.inMinutes.toDouble()), |
| 65 | +// FlSpot(3, _usage[2].usage.inMinutes.toDouble()), |
| 66 | +// FlSpot(4, _usage[3].usage.inMinutes.toDouble()), |
| 67 | +// FlSpot(5, _usage[4].usage.inMinutes.toDouble()), |
| 68 | +// FlSpot(6, _usage[5].usage.inMinutes.toDouble()), |
| 69 | +// FlSpot(7, _usage[6].usage.inMinutes.toDouble()), |
| 70 | +// ], |
| 71 | +// isCurved: true, |
| 72 | +// barWidth: 5, |
| 73 | +// gradient: const LinearGradient( |
| 74 | +// colors: [ |
| 75 | +// colorBlueTeal, |
| 76 | +// colorLightBlueTeal, |
| 77 | +// ], |
| 78 | +// ), |
| 79 | +// belowBarData: BarAreaData( |
| 80 | +// show: true, |
| 81 | +// gradient: LinearGradient( |
| 82 | +// colors: [ |
| 83 | +// colorBlueTeal.withOpacity(0.5), |
| 84 | +// colorOrange.withOpacity(0.2), |
| 85 | +// ], |
| 86 | +// ), |
| 87 | +// ), |
| 88 | +// ), |
| 89 | +// ], |
| 90 | +// ), |
| 91 | +// ); |
| 92 | +// } |
| 93 | +// } |
| 94 | + |
| 95 | +// class LineTitles { |
| 96 | +// static getTitleData() { |
| 97 | +// return FlTitlesData( |
| 98 | +// show: true, |
| 99 | +// leftTitles: AxisTitles( |
| 100 | +// sideTitles: SideTitles( |
| 101 | +// showTitles: false, |
| 102 | +// )), |
| 103 | +// rightTitles: AxisTitles(sideTitles: SideTitles(showTitles: false)), |
| 104 | +// topTitles: AxisTitles( |
| 105 | +// sideTitles: SideTitles( |
| 106 | +// showTitles: false, |
| 107 | +// )), |
| 108 | +// bottomTitles: AxisTitles( |
| 109 | +// sideTitles: SideTitles( |
| 110 | +// showTitles: true, |
| 111 | +// reservedSize: 25, |
| 112 | +// getTitlesWidget: (value, context) { |
| 113 | +// switch (value.toInt()) { |
| 114 | +// case 1: |
| 115 | +// return const Text( |
| 116 | +// 'Sun', |
| 117 | +// style: TextStyle( |
| 118 | +// color: colorOrange, |
| 119 | +// fontWeight: FontWeight.bold, |
| 120 | +// fontSize: 16, |
| 121 | +// ), |
| 122 | +// ); |
| 123 | +// case 2: |
| 124 | +// return const Text( |
| 125 | +// 'Mon', |
| 126 | +// style: TextStyle( |
| 127 | +// color: colorOrange, |
| 128 | +// fontWeight: FontWeight.bold, |
| 129 | +// fontSize: 16, |
| 130 | +// ), |
| 131 | +// ); |
| 132 | +// case 3: |
| 133 | +// return const Text( |
| 134 | +// 'Tue', |
| 135 | +// style: TextStyle( |
| 136 | +// color: colorOrange, |
| 137 | +// fontWeight: FontWeight.bold, |
| 138 | +// fontSize: 16, |
| 139 | +// ), |
| 140 | +// ); |
| 141 | +// case 4: |
| 142 | +// return const Text( |
| 143 | +// 'Wed', |
| 144 | +// style: TextStyle( |
| 145 | +// color: colorOrange, |
| 146 | +// fontWeight: FontWeight.bold, |
| 147 | +// fontSize: 16, |
| 148 | +// ), |
| 149 | +// ); |
| 150 | +// case 5: |
| 151 | +// return const Text( |
| 152 | +// 'Thurs', |
| 153 | +// style: TextStyle( |
| 154 | +// color: colorOrange, |
| 155 | +// fontWeight: FontWeight.bold, |
| 156 | +// fontSize: 16, |
| 157 | +// ), |
| 158 | +// ); |
| 159 | +// case 6: |
| 160 | +// return const Text( |
| 161 | +// 'Fri', |
| 162 | +// style: TextStyle( |
| 163 | +// color: colorOrange, |
| 164 | +// fontWeight: FontWeight.bold, |
| 165 | +// fontSize: 16, |
| 166 | +// ), |
| 167 | +// ); |
| 168 | +// default: |
| 169 | +// return const Text( |
| 170 | +// 'Sat', |
| 171 | +// style: TextStyle( |
| 172 | +// color: colorOrange, |
| 173 | +// fontWeight: FontWeight.bold, |
| 174 | +// fontSize: 16, |
| 175 | +// ), |
| 176 | +// ); |
| 177 | +// } |
| 178 | +// }, |
| 179 | +// ), |
| 180 | +// )); |
| 181 | +// } |
| 182 | +// } |
0 commit comments