Showing
2 changed files
with
116 additions
and
2 deletions
| @@ -6,10 +6,10 @@ import 'package:one_key/utils/dialog_util.dart'; | @@ -6,10 +6,10 @@ import 'package:one_key/utils/dialog_util.dart'; | ||
| 6 | import 'package:one_key/utils/utils.dart'; | 6 | import 'package:one_key/utils/utils.dart'; |
| 7 | import 'package:one_key/widgets/h_empty_view.dart'; | 7 | import 'package:one_key/widgets/h_empty_view.dart'; |
| 8 | import 'package:one_key/widgets/system_app_bar.dart'; | 8 | import 'package:one_key/widgets/system_app_bar.dart'; |
| 9 | -import 'package:video_compress/video_compress.dart'; | ||
| 10 | 9 | ||
| 11 | typedef ClickCallback = void Function(String value); | 10 | typedef ClickCallback = void Function(String value); |
| 12 | enum TimeType { TimeTypeStart, TimeTypeEnd, TimeTypeDefalt } | 11 | enum TimeType { TimeTypeStart, TimeTypeEnd, TimeTypeDefalt } |
| 12 | +enum TableItemType { TableItemTypeHeader, TableItemTypeBody } | ||
| 13 | 13 | ||
| 14 | class StatisticsPage extends StatefulWidget { | 14 | class StatisticsPage extends StatefulWidget { |
| 15 | StatisticsPage({Key key}) : super(key: key); | 15 | StatisticsPage({Key key}) : super(key: key); |
| @@ -24,15 +24,23 @@ class _StatisticsPageState extends State<StatisticsPage> { | @@ -24,15 +24,23 @@ class _StatisticsPageState extends State<StatisticsPage> { | ||
| 24 | DateTime datetimeS; //开始时间 | 24 | DateTime datetimeS; //开始时间 |
| 25 | DateTime datetimeE; //结束时间 | 25 | DateTime datetimeE; //结束时间 |
| 26 | DateTime dateNow; //当前日期 | 26 | DateTime dateNow; //当前日期 |
| 27 | - bool showWidget = false; | 27 | + bool showWidget = true; |
| 28 | List<String> selectList; | 28 | List<String> selectList; |
| 29 | int currentIndex = 0; | 29 | int currentIndex = 0; |
| 30 | TextEditingController controller = TextEditingController(); | 30 | TextEditingController controller = TextEditingController(); |
| 31 | + StaticsModel tableHeaderModel; | ||
| 31 | 32 | ||
| 32 | @override | 33 | @override |
| 33 | void initState() { | 34 | void initState() { |
| 34 | super.initState(); | 35 | super.initState(); |
| 35 | 36 | ||
| 37 | + tableHeaderModel = StaticsModel(); | ||
| 38 | + tableHeaderModel.select = true; | ||
| 39 | + tableHeaderModel.numstr = '序号'; | ||
| 40 | + tableHeaderModel.name = '顾客姓名'; | ||
| 41 | + tableHeaderModel.phone = '电话'; | ||
| 42 | + tableHeaderModel.count = '预订次数'; | ||
| 43 | + | ||
| 36 | datetimeS = DateTime.now(); | 44 | datetimeS = DateTime.now(); |
| 37 | datetimeE = datetimeS.add(Duration(days: 1)); | 45 | datetimeE = datetimeS.add(Duration(days: 1)); |
| 38 | // dateS = DateUtil.formatDate(datetimeS, format: DateFormats.y_mo_d); | 46 | // dateS = DateUtil.formatDate(datetimeS, format: DateFormats.y_mo_d); |
| @@ -306,8 +314,112 @@ class _StatisticsPageState extends State<StatisticsPage> { | @@ -306,8 +314,112 @@ class _StatisticsPageState extends State<StatisticsPage> { | ||
| 306 | ))) | 314 | ))) |
| 307 | ], | 315 | ], |
| 308 | )), | 316 | )), |
| 317 | + //表头 | ||
| 318 | + _tableItem(tableHeaderModel, 3, TableItemType.TableItemTypeHeader), | ||
| 319 | + Expanded( | ||
| 320 | + child: ListView.builder( | ||
| 321 | + itemCount: 100, | ||
| 322 | + itemBuilder: (BuildContext context, int index) { | ||
| 323 | + StaticsModel tableHeaderModel1 = StaticsModel(); | ||
| 324 | + tableHeaderModel1.select = true; | ||
| 325 | + tableHeaderModel1.numstr = '$index'; | ||
| 326 | + tableHeaderModel1.name = '某某'; | ||
| 327 | + tableHeaderModel1.phone = '1879097890'; | ||
| 328 | + tableHeaderModel1.count = '${index}次'; | ||
| 329 | + return _tableItem(tableHeaderModel1, index, | ||
| 330 | + TableItemType.TableItemTypeBody); | ||
| 331 | + })) | ||
| 309 | ], | 332 | ], |
| 310 | ), | 333 | ), |
| 311 | ); | 334 | ); |
| 312 | } | 335 | } |
| 336 | + | ||
| 337 | + ///表头 | ||
| 338 | + Widget _tableItem(StaticsModel model, int index, TableItemType type) { | ||
| 339 | + return Container( | ||
| 340 | + padding: EdgeInsets.only(left: ScreenUtil().setWidth(30)), | ||
| 341 | + height: ScreenUtil() | ||
| 342 | + .setWidth(type == TableItemType.TableItemTypeBody ? 100 : 80), | ||
| 343 | + color: index % 2 == 0 ? MyColours.color_f7fdfd : MyColours.color_fefefe, | ||
| 344 | + child: Row( | ||
| 345 | + children: [ | ||
| 346 | + Container( | ||
| 347 | + width: ScreenUtil().setWidth(85 * 2), | ||
| 348 | + height: double.infinity, | ||
| 349 | + decoration: BoxDecoration( | ||
| 350 | + border: Border( | ||
| 351 | + right: BorderSide( | ||
| 352 | + width: ScreenUtil().setWidth(2), | ||
| 353 | + color: MyColours.color_f5f5f5))), | ||
| 354 | + child: Row( | ||
| 355 | + children: [ | ||
| 356 | + Image.asset( | ||
| 357 | + Utils.getImgPath(model.select ? 'select' : 'unselect'), | ||
| 358 | + width: ScreenUtil().setWidth(34), | ||
| 359 | + height: ScreenUtil().setWidth(34), | ||
| 360 | + ), | ||
| 361 | + // HEmptyView(20), | ||
| 362 | + Expanded( | ||
| 363 | + child: Text( | ||
| 364 | + model.numstr, | ||
| 365 | + textAlign: TextAlign.center, | ||
| 366 | + style: TextStyle( | ||
| 367 | + fontSize: ScreenUtil().setSp(28), | ||
| 368 | + color: MyColours.color_333333), | ||
| 369 | + )), | ||
| 370 | + HEmptyView(30), | ||
| 371 | + ], | ||
| 372 | + ), | ||
| 373 | + ), | ||
| 374 | + Container( | ||
| 375 | + alignment: Alignment.center, | ||
| 376 | + width: ScreenUtil().setWidth(87 * 2), | ||
| 377 | + height: double.infinity, | ||
| 378 | + decoration: BoxDecoration( | ||
| 379 | + border: Border( | ||
| 380 | + right: BorderSide( | ||
| 381 | + width: ScreenUtil().setWidth(2), | ||
| 382 | + color: MyColours.color_f5f5f5))), | ||
| 383 | + child: Text( | ||
| 384 | + model.name, | ||
| 385 | + style: TextStyle( | ||
| 386 | + fontSize: ScreenUtil().setSp(28), | ||
| 387 | + color: MyColours.color_333333), | ||
| 388 | + )), | ||
| 389 | + Container( | ||
| 390 | + alignment: Alignment.center, | ||
| 391 | + width: ScreenUtil().setWidth(116 * 2), | ||
| 392 | + height: double.infinity, | ||
| 393 | + decoration: BoxDecoration( | ||
| 394 | + border: Border( | ||
| 395 | + right: BorderSide( | ||
| 396 | + width: ScreenUtil().setWidth(2), | ||
| 397 | + color: MyColours.color_f5f5f5))), | ||
| 398 | + child: Text( | ||
| 399 | + model.phone, | ||
| 400 | + style: TextStyle( | ||
| 401 | + fontSize: ScreenUtil().setSp(28), | ||
| 402 | + color: MyColours.color_333333), | ||
| 403 | + )), | ||
| 404 | + Expanded( | ||
| 405 | + child: Center( | ||
| 406 | + child: Text( | ||
| 407 | + model.count, | ||
| 408 | + style: TextStyle( | ||
| 409 | + fontSize: ScreenUtil().setSp(28), | ||
| 410 | + color: MyColours.color_333333), | ||
| 411 | + ), | ||
| 412 | + )) | ||
| 413 | + ], | ||
| 414 | + ), | ||
| 415 | + ); | ||
| 416 | + } | ||
| 417 | +} | ||
| 418 | + | ||
| 419 | +class StaticsModel extends Object { | ||
| 420 | + bool select; | ||
| 421 | + String numstr; | ||
| 422 | + String name; | ||
| 423 | + String phone; | ||
| 424 | + String count; | ||
| 313 | } | 425 | } |
-
Please register or login to post a comment