feast_board.dart 35.6 KB
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712
/**
 * 宴会看板
 */

import 'package:common_utils/common_utils.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:one_key/models/get_board_model.dart';
import 'package:one_key/res/colors.dart';
import 'package:one_key/widgets/system_app_bar.dart';
import 'package:provider/provider.dart';
import 'package:table_calendar/table_calendar.dart';

import '../../provider/feast_model.dart';
import '../../provider/user_model.dart';
import '../../route/navigator_util.dart';
import '../../utils/screen_util.dart';
import '../../utils/utils.dart';
import '../../widgets/v_empty_view.dart';
import 'feast_board_item.dart';

class FeastBoardPage extends StatefulWidget {
  FeastBoardPage({Key? key}) : super(key: key);

  @override
  _FeastBoardPageState createState() => _FeastBoardPageState();
}

class _FeastBoardPageState extends State<FeastBoardPage> {
  // CalendarController _calendarController = CalendarController();
  DateTime? dateTimeNow; //当前日期
  bool calendarShow = true; //日历展开
  late FeastModel feastModel;
  ScrollController controller = ScrollController();
  DateTime? _focusedDay;

  @override
  void initState() {
    // TODO: implement initState
    super.initState();
    dateTimeNow = DateTime.now();
    _focusedDay = dateTimeNow;
    Utils.changeStatusColor(color: MyColours.color_438E93);
    WidgetsBinding.instance.addPostFrameCallback((_) {
      _getExitsBanquetByDate();
      _getBanquetByDate();
    });
  }

  @override
  void dispose() {
    super.dispose();
    Utils.changeStatusColor(color: MyColours.color_ffffff);
  }

  ///指定日期、时段宴会预定
  _getBanquetByDate() async {
    UserModel userModel = Provider.of<UserModel>(context, listen: false);
    String timeStrStart = dateTimeNow!.year.toString() +
        "-" +
        Utils.addZeroNumber(dateTimeNow!.month) +
        "-" +
        Utils.addZeroNumber(dateTimeNow!.day) +
        " 00:00:00";
    String timeStrEnd = dateTimeNow!.year.toString() +
        "-" +
        Utils.addZeroNumber(dateTimeNow!.month) +
        "-" +
        Utils.addZeroNumber(dateTimeNow!.day) +
        " 23:59:59";

    String start =
        (DateUtil.getDateMsByTimeStr(timeStrStart)! / 1000).floor().toString();
    String end =
        (DateUtil.getDateMsByTimeStr(timeStrEnd)! / 1000).floor().toString();
    Map<String, String?> pramas = {
      'sid': userModel.user!.sellerid,
      'rdate': '${start}',
      'edate': '${end}'
    };
    bool success =
        await feastModel.getBanquetByDate(context, pramas, showLoading: true);
    if (success) {}
  }

  //解析返回显示的日期
  static String _parseDateDay(DateTime dateTime) {
    DateTime now = DateTime.now();
    if (Utils.isOneDay(dateTime, now)) {
      return "今";
    }
    //  else if (Utils.isOneDay(dateTime, now.add(Duration(days: 1)))) {
    //   return "明";
    // } else if (Utils.isOneDay(dateTime, now.add(Duration(days: 2)))) {
    //   return "后";
    // }
    else {
      return '${Utils.lunarCalendarHolidaysShow(dateTime)}';
    }
  }

  Widget _callButton(
      {GestureTapCallback? onPress,
      required content,
      hasLeftBorder = true,
      isSelect = false}) {
    bool canDo = true;
    if (content == '创建宴会') {
      canDo = Utils.getAuthority(context, '创建宴会');
    }

    return InkWell(
      onTap: onPress,
      child: Container(
        height: h(48),
        decoration: BoxDecoration(
            color: isSelect
                ? canDo
                    ? MyColours.color_438E93
                    : MyColours.color_999999
                : MyColours.color_ffffff,
            border: Border(
                bottom: BorderSide(
                    color:
                        canDo ? MyColours.color_438E93 : MyColours.color_999999,
                    width: ScreenUtil().setWidth(2)),
                top: BorderSide(
                    color:
                        canDo ? MyColours.color_438E93 : MyColours.color_999999,
                    width: ScreenUtil().setWidth(2)),
                left: hasLeftBorder
                    ? BorderSide(
                        color: canDo
                            ? MyColours.color_438E93
                            : MyColours.color_999999,
                        width: ScreenUtil().setWidth(2))
                    : BorderSide.none,
                right: BorderSide(
                    color:
                        canDo ? MyColours.color_438E93 : MyColours.color_999999,
                    width: ScreenUtil().setWidth(2)))),
        child: Align(
          alignment: Alignment.center,
          child: Text(
            content,
            style: TextStyle(
                color:
                    isSelect ? MyColours.color_F6F6F6 : MyColours.color_438E93,
                fontSize: ScreenUtil().setSp(36)),
          ),
        ),
      ),
    );
  }

  ///查看指定时间内是否有宴会预定
  _getExitsBanquetByDate() async {
    UserModel userModel = Provider.of<UserModel>(context, listen: false);
    DateTime firstDay = DateTime(dateTimeNow!.year, dateTimeNow!.month);
    String startDay =
        (firstDay.millisecondsSinceEpoch / 1000).floor().toString();
    //下个月的第一天
    DateTime lastDateTime = DateTime(dateTimeNow!.year, dateTimeNow!.month + 1);
//再减一天
    DateTime lastDay = lastDateTime.subtract(Duration(days: 1));
    String endDay = (lastDay.millisecondsSinceEpoch / 1000).floor().toString();

    Map<String, String?> pramas = {
      'sid': userModel.user!.sellerid,
      'rdate': '${startDay}',
      'edate': '${endDay}'
    };
    await feastModel.getExitsBanquetByDate(context, pramas, showLoading: true);
  }

  @override
  Widget build(BuildContext context) {
    feastModel = Provider.of<FeastModel>(context, listen: true);
    return Scaffold(
      backgroundColor: MyColours.color_ffffff,
      appBar: SystemAppBar(
        '宴会看板',
        needWhite: true,
        bgColor: MyColours.color_438E93,
        titleColor: MyColours.color_F6F6F6,
        onTap: () {
          if (Navigator.canPop(context)) {
            Navigator.pop(context);
          }
        },
      ),
      body: Column(
        children: <Widget>[
          Expanded(
              child: SingleChildScrollView(
                  controller: controller,
                  child: Column(children: <Widget>[
                    Container(
                        decoration: BoxDecoration(
                            color: MyColours.color_ffffff,
                            boxShadow: [
                              BoxShadow(
                                  offset: Offset(
                                    0,
                                    ScreenUtil().setWidth(8),
                                  ),
                                  blurRadius: ScreenUtil().setWidth(8),
                                  color: MyColours.color_26000000)
                            ]),
                        child: Column(
                          children: [
                            TableCalendar(
                              firstDay: DateTime(1987),
                              lastDay: DateTime(2050),
                              focusedDay: _focusedDay!,
                              currentDay: DateTime.now(),

                              // rowHeight: ScreenUtil().setWidth(100),
                              rowHeight: ScreenUtil().setWidth(114),
                              daysOfWeekHeight: w(36),
                              // calendarController: _calendarController,
                              // initialSelectedDay: dateTimeNow,
                              selectedDayPredicate: (day) =>
                                  isSameDay(dateTimeNow!, day),
                              onDaySelected: (
                                selectedDay,
                                focusedDay,
                              ) {
                                if (!isSameDay(selectedDay, dateTimeNow!)) {
                                  //不是一天
                                  dateTimeNow = selectedDay;
                                  _focusedDay = focusedDay;
                                  _getBanquetByDate();
                                }
                              },
                              // holidays: _holidays,
                              availableGestures: AvailableGestures.none,

                              locale: "zh_CN",

                              onPageChanged: (focusedDay) async {
                                _focusedDay = focusedDay;
                                feastModel.fullStatusByTime = {};
                                print('r');
                                UserModel userModel = Provider.of<UserModel>(
                                    context,
                                    listen: false);
                                DateTime monthStart = DateTime(
                                    focusedDay.year, focusedDay.month, 1);
                                DateTime monthEnd = DateTime(focusedDay.year,
                                    focusedDay.month + 1, 0, 23, 59, 59);
                                String startDay =
                                    (monthStart.millisecondsSinceEpoch / 1000)
                                        .floor()
                                        .toString();
                                String endDay =
                                    (monthEnd.millisecondsSinceEpoch / 1000)
                                        .floor()
                                        .toString();

                                Map<String, String?> pramas = {
                                  'sid': userModel.user!.sellerid,
                                  'rdate': '${startDay}',
                                  'edate': '${endDay}'
                                };
                                await feastModel.getExitsBanquetByDate(
                                    context, pramas,
                                    showLoading: true);
                                setState(() {});
                              },
                              calendarFormat: calendarShow
                                  ? CalendarFormat.month
                                  : CalendarFormat.week,
                              headerStyle: HeaderStyle(
                                decoration: BoxDecoration(
                                    color: MyColours.color_ffffff),
                                headerPadding: EdgeInsets.symmetric(
                                    // vertical: ScreenUtil().setWidth(24),
                                    horizontal: ScreenUtil().setWidth(66)),
                                formatButtonVisible: false,
                                titleCentered: true,
                                // centerHeaderTitle: true,
                                titleTextFormatter: (dateTime, _) {
                                  return dateTime.year.toString() +
                                      ' ' +
                                      "年" +
                                      ' ' +
                                      dateTime.month.toString() +
                                      ' ' +
                                      "月";
                                },
                                titleTextStyle: TextStyle(
                                    fontWeight: FontWeight.bold,
                                    color: MyColours.color_515151,
                                    fontSize: ScreenUtil().setSp(44)),
                                leftChevronIcon: Icon(Icons.chevron_left,
                                    color: MyColours.color_000000,
                                    size: ScreenUtil().setWidth(48)),
                                rightChevronIcon: Icon(Icons.chevron_right,
                                    color: MyColours.color_000000,
                                    size: ScreenUtil().setWidth(48)),
                              ),
                              calendarStyle: CalendarStyle(
                                // rowDecoration: BoxDecoration(
                                //     shape: BoxShape.rectangle,
                                //     color: Colors.red),
                                // tablePadding: EdgeInsets.only(top: w(20)),
                                cellPadding:
                                    EdgeInsets.all(ScreenUtil().setWidth(8)),
                                // defaultTextStyle: TextStyle(
                                //     color: MyColours.color_515151,
                                //     fontSize: ScreenUtil().setSp(32)),
                                // weekendTextStyle: TextStyle(
                                //     color: MyColours.color_515151,
                                //     fontSize: ScreenUtil().setSp(32)),
                                // selectedDecoration: BoxDecoration(
                                //     shape: BoxShape.rectangle,
                                //     color: MyColours.color_438E93),
                                outsideDaysVisible: false,
                              ),

                              calendarBuilders: CalendarBuilders(
                                // weekNumberBuilder: (context, weekday) {
                                //   return Container(
                                //     alignment: Alignment.center,
                                //     margin: EdgeInsets.only(
                                //         bottom: ScreenUtil().setWidth(20)),
                                //     padding: EdgeInsets.symmetric(
                                //         vertical: ScreenUtil().setWidth(15)),
                                //     child: Text(
                                //       weekday.toString(),
                                //       style: TextStyle(
                                //           color: MyColours.color_999999,
                                //           fontSize: ScreenUtil().setSp(32)),
                                //     ),
                                //   );
                                // },
                                defaultBuilder: (context, date, date2) {
                                  String keytemp = '${date.year}' +
                                      '-' +
                                      '${Utils.addZeroNumber(date.month)}' +
                                      '-' +
                                      '${Utils.addZeroNumber(date.day)}';
                                  return Container(
                                    // height: ScreenUtil().setWidth(210),
                                    decoration: BoxDecoration(
                                        // shape: BoxShape.circle,
                                        // color: Colors.blue,
                                        ),
                                    // alignment: Alignment.center,
                                    // margin: EdgeInsets.fromLTRB(
                                    //     ScreenUtil().setWidth(12),
                                    //     ScreenUtil().setWidth(12),
                                    //     ScreenUtil().setWidth(12),
                                    //     ScreenUtil().setWidth(10)),
                                    // padding: EdgeInsets.symmetric(
                                    //   // horizontal: ScreenUtil().setWidth(12),
                                    //   vertical: ScreenUtil().setWidth(8),
                                    // ),
                                    child: Column(
                                      mainAxisAlignment:
                                          MainAxisAlignment.center,
                                      children: [
                                        Text(
                                            // "${_parseDateDay(date)}",
                                            // '${Utils.addZeroNumber(date.day)}',
                                            '${date.day}',
                                            style: TextStyle().copyWith(
                                                fontSize:
                                                    ScreenUtil().setSp(32),
                                                color: MyColours.color_515151,
                                                fontWeight: FontWeight.bold)),
                                        VEmptyView(4),
                                        // Text(
                                        //   // "${_parseDateDay(date)}",
                                        //   '${Utils.getLunarSpecialDate(date)}',
                                        //   style: TextStyle().copyWith(
                                        //       fontSize: ScreenUtil().setSp(22),
                                        //       color: MyColours.color_353535),
                                        // ),
                                        Text(
                                          "${_parseDateDay(date)}",
                                          style: TextStyle().copyWith(
                                              fontSize: ScreenUtil().setSp(20),
                                              color: MyColours.color_515151),
                                        ),
                                        feastModel.fullStatusByTime.keys
                                                    .contains(keytemp) &&
                                                feastModel.fullStatusByTime[
                                                        keytemp] ==
                                                    '1'
                                            ? Container(
                                                margin: EdgeInsets.symmetric(
                                                    vertical: ScreenUtil()
                                                        .setWidth(4)),
                                                width:
                                                    ScreenUtil().setWidth(16),
                                                height:
                                                    ScreenUtil().setWidth(16),
                                                decoration: BoxDecoration(
                                                    color:
                                                        MyColours.color_E34D59,
                                                    borderRadius:
                                                        BorderRadius.circular(
                                                            ScreenUtil()
                                                                .radius(8))),
                                              )
                                            : SizedBox()
                                      ],
                                    ),
                                  );
                                },
                                selectedBuilder: (context, date, _) {
                                  String keytemp = '${date.year}' +
                                      '-' +
                                      '${Utils.addZeroNumber(date.month)}' +
                                      '-' +
                                      '${Utils.addZeroNumber(date.day)}';
                                  return Container(
                                    width: w(60),

                                    // alignment: Alignment.center,
                                    // margin: EdgeInsets.fromLTRB(
                                    //     ScreenUtil().setWidth(12),
                                    //     ScreenUtil().setWidth(12),
                                    //     ScreenUtil().setWidth(12),
                                    //     ScreenUtil().setWidth(32)),
                                    padding: EdgeInsets.only(
                                        bottom: ScreenUtil().setWidth(0),
                                        left: ScreenUtil().setWidth(5),
                                        right: ScreenUtil().setWidth(5),
                                        top: ScreenUtil().setWidth(0)),
                                    child: Container(
                                      // width: w(40),
                                      decoration: BoxDecoration(
                                          shape: BoxShape.rectangle,
                                          borderRadius: BorderRadius.circular(
                                              ScreenUtil().setWidth(10)),
                                          color: MyColours.color_438E93),
                                      child: Column(
                                        mainAxisAlignment:
                                            MainAxisAlignment.center,
                                        children: [
                                          Text(
                                            // "${_parseDateDay(date)}",
                                            // '${Utils.addZeroNumber(date.day)}',
                                            '${date.day}',
                                            style: TextStyle().copyWith(
                                                color: MyColours.color_F6F6F6,
                                                fontSize:
                                                    ScreenUtil().setSp(32),
                                                fontWeight: FontWeight.bold),
                                          ),
                                          Text(
                                            "${_parseDateDay(date)}",
                                            // '${Utils.lunarCalendarHolidaysShow(date)}',
                                            style: TextStyle().copyWith(
                                                fontSize:
                                                    ScreenUtil().setSp(22),
                                                color: MyColours.color_F6F6F6),
                                          ),
                                          feastModel.fullStatusByTime.keys
                                                      .contains(keytemp) &&
                                                  feastModel.fullStatusByTime[
                                                          keytemp] ==
                                                      '1'
                                              ? Container(
                                                  margin: EdgeInsets.symmetric(
                                                      vertical: ScreenUtil()
                                                          .setWidth(4)),
                                                  width:
                                                      ScreenUtil().setWidth(16),
                                                  height:
                                                      ScreenUtil().setWidth(16),
                                                  decoration: BoxDecoration(
                                                      color: MyColours
                                                          .color_E34D59,
                                                      borderRadius:
                                                          BorderRadius.circular(
                                                              ScreenUtil()
                                                                  .radius(8))),
                                                )
                                              : SizedBox()
                                        ],
                                      ),
                                    ),
                                  );
                                },
                                todayBuilder: (context, date, _) {
                                  String keytemp = '${date.year}' +
                                      '-' +
                                      '${Utils.addZeroNumber(date.month)}' +
                                      '-' +
                                      '${Utils.addZeroNumber(date.day)}';
                                  return Container(
                                    width: w(60),
                                    // alignment: Alignment.center,
                                    // margin: EdgeInsets.fromLTRB(
                                    //     ScreenUtil().setWidth(12),
                                    //     ScreenUtil().setWidth(12),
                                    //     ScreenUtil().setWidth(12),
                                    //     ScreenUtil().setWidth(32)),
                                    padding: EdgeInsets.only(
                                        bottom: ScreenUtil().setWidth(0),
                                        left: ScreenUtil().setWidth(5),
                                        right: ScreenUtil().setWidth(5),
                                        top: ScreenUtil().setWidth(0)),
                                    child: Container(
                                      decoration: BoxDecoration(
                                          borderRadius: BorderRadius.circular(
                                              ScreenUtil().setWidth(10)),
                                          color: MyColours.color_2bb5b7),
                                      child: Column(
                                        mainAxisAlignment:
                                            MainAxisAlignment.center,
                                        children: [
                                          Text(
                                            // "${_parseDateDay(date)}",
                                            // '${Utils.addZeroNumber(date.day)}',
                                            '${date.day}',
                                            style: TextStyle().copyWith(
                                                color: MyColours.color_F6F6F6,
                                                fontSize:
                                                    ScreenUtil().setSp(32),
                                                fontWeight: FontWeight.bold),
                                          ),
                                          Text(
                                            "${_parseDateDay(date)}",
                                            // '${Utils.lunarCalendarHolidaysShow(date)}',
                                            style: TextStyle().copyWith(
                                                fontSize:
                                                    ScreenUtil().setSp(22),
                                                color: MyColours.color_F6F6F6),
                                          ),
                                          feastModel.fullStatusByTime.keys
                                                      .contains(keytemp) &&
                                                  feastModel.fullStatusByTime[
                                                          keytemp] ==
                                                      '1'
                                              ? Container(
                                                  margin: EdgeInsets.symmetric(
                                                      vertical: ScreenUtil()
                                                          .setWidth(4)),
                                                  width:
                                                      ScreenUtil().setWidth(16),
                                                  height:
                                                      ScreenUtil().setWidth(16),
                                                  decoration: BoxDecoration(
                                                      color: MyColours
                                                          .color_E34D59,
                                                      borderRadius:
                                                          BorderRadius.circular(
                                                              ScreenUtil()
                                                                  .radius(8))),
                                                )
                                              : SizedBox()
                                        ],
                                      ),
                                    ),
                                  );
                                  // return Container(
                                  //   decoration: BoxDecoration(
                                  //       shape: BoxShape.circle,
                                  //       border: Border.all(
                                  //           color: MyColours.color_2bb5b7,
                                  //           width: ScreenUtil().setWidth(2))),
                                  //   alignment: Alignment.center,
                                  //   margin: EdgeInsets.fromLTRB(
                                  //       ScreenUtil().setWidth(12),
                                  //       ScreenUtil().setWidth(12),
                                  //       ScreenUtil().setWidth(12),
                                  //       ScreenUtil().setWidth(32)),
                                  //   padding: EdgeInsets.only(
                                  //       bottom: ScreenUtil().setWidth(8),
                                  //       left: ScreenUtil().setWidth(16),
                                  //       right: ScreenUtil().setWidth(16),
                                  //       top: ScreenUtil().setWidth(8)),
                                  //   child: Text(
                                  //     // '今',
                                  //     '${Utils.addZeroNumber(date.day)}',
                                  //     style: TextStyle().copyWith(
                                  //         fontSize: ScreenUtil().setSp(32),
                                  //         color: MyColours.color_2bb5b7),
                                  //   ),
                                  // );
                                },
                                markerBuilder: (context, date, events) {
                                  final children = <Widget>[];

                                  // if (events.isNotEmpty) {
                                  //   children.add(
                                  //     Positioned(
                                  //       right: 1,
                                  //       bottom: 1,
                                  //       child: _buildEventsMarker(date, events),
                                  //     ),
                                  //   );
                                  // }

                                  // if (holidays.isNotEmpty) {
                                  // children.add(
                                  //   Positioned(
                                  //       right: ScreenUtil().setWidth(27),
                                  //       bottom: 0,
                                  //       top: ScreenUtil().setWidth(30),
                                  //       child: buildMarker(date)),
                                  // Align(
                                  //   alignment: Alignment.bottomCenter,
                                  //   child: buildMarker(date),
                                  // )
                                  // );
                                  // }

                                  // return [];
                                },
                                // singleMarkerBuilder: (context, dateTime, event) {
                                //   return Container(
                                //     width: ScreenUtil().setWidth(6),
                                //     height: ScreenUtil().setWidth(6),
                                //     margin:
                                //         const EdgeInsets.symmetric(horizontal: 0.3),
                                //     decoration: BoxDecoration(
                                //       shape: BoxShape.circle,
                                //       color: MyColours.color_ff0000,
                                //     ),
                                //   );
                                // },
                              ),
                            ),
                            InkWell(
                                onTap: () {
                                  calendarShow = !calendarShow;

                                  if (calendarShow) {
                                    // _calendarController.setCalendarFormat(
                                    //     CalendarFormat.month);
                                  } else {
                                    // _calendarController
                                    //     .setCalendarFormat(CalendarFormat.week);
                                  }
                                  setState(() {});
                                },
                                child: Container(
                                  width: double.infinity,
                                  color: Colors.white,
                                  child: Column(
                                    children: [
                                      VEmptyView(4),
                                      Image.asset(
                                          Utils.getImgPath(calendarShow
                                              ? 'y_chevron_up_circle'
                                              : 'y_chevron_down_circle'),
                                          width: ScreenUtil().setWidth(32)),
                                      VEmptyView(32),
                                    ],
                                  ),
                                ))
                          ],
                        )),
                    VEmptyView(48),
                    ListView.builder(
                        shrinkWrap: true,
                        padding: EdgeInsets.symmetric(
                            horizontal: ScreenUtil().setWidth(8)),
                        controller: controller,
                        itemBuilder: (context, index) {
                          FeastBoardModel boardModel =
                              feastModel.banquetByDateData[index];
                          return FeastBoardItem(
                            boardModel: boardModel,
                            controller: controller,
                            isOpen: !calendarShow,
                          );
                        },
                        itemCount: feastModel.banquetByDateData.length)
                  ]))),
          Row(
            children: [
              Expanded(
                  child: _callButton(
                      onPress: () async {
                        // _calendarController.setSelectedDay(DateTime.now());
                        dateTimeNow = DateTime.now();
                        _focusedDay = dateTimeNow;

                        setState(() {});
                        _getBanquetByDate();
                      },
                      content: '回到今天',
                      hasLeftBorder: true,
                      isSelect: false)),
              Expanded(
                  child: _callButton(
                      onPress: () async {
                        if (Provider.of<UserModel>(context, listen: false)
                                .user!
                                .role_name !=
                            '迎宾') {
                          NavigatorUtil.goFeastCreatePage(context,
                              isCreate: true);
                        }
                      },
                      content: '创建宴会',
                      hasLeftBorder: true,
                      isSelect: true))
            ],
          )
        ],
      ),
    );
  }
}