feast_item.dart 6.39 KB
import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:one_key/res/colors.dart';
import 'package:one_key/utils/utils.dart';
import 'package:one_key/widgets/round_button.dart';
import 'package:one_key/widgets/v_empty_view.dart';

import '../../models/GetBanquetByTimeModel.dart';
import '../../utils/screen_util.dart';

class FeastItem extends StatefulWidget {
  final ScrollController controller;
  final GetBanquetByTimeSunModel sunModel;
  FeastItem(this.controller, this.sunModel, {Key key}) : super(key: key);

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

class _FeastItemState extends State<FeastItem> {
  List<Widget> taocanWidget(List data) {
    List<Widget> list = [];
    data.forEach((element) {
      list.add(Container(
        padding: EdgeInsets.symmetric(horizontal: w(4), vertical: h(4)),
        decoration: BoxDecoration(
            color: MyColours.color_438E93,
            borderRadius: BorderRadius.circular(w(5))),
        child: Text(
          element,
          style: TextStyle(fontSize: font(14), color: MyColours.color_F6F6F6),
        ),
      ));
    });
    return list;
  }

  @override
  Widget build(BuildContext context) {
    return Container(
      margin: EdgeInsets.only(bottom: ScreenUtil().setWidth(36)),
      decoration: BoxDecoration(
          border: Border.all(
              color: MyColours.color_f3f3f3, width: ScreenUtil().setWidth(2)),
          boxShadow: [
            BoxShadow(
                color: MyColours.color_1F000000,
                offset: Offset(0, ScreenUtil().setWidth(8)),
                blurRadius: ScreenUtil().setWidth(8))
          ],
          borderRadius: BorderRadius.circular(ScreenUtil().radius(10))),
      child: Column(
        children: [
          Container(
              padding: EdgeInsets.symmetric(
                  horizontal: ScreenUtil().setWidth(16),
                  vertical: ScreenUtil().setWidth(8)),
              decoration: BoxDecoration(
                color: MyColours.color_438E93,
                borderRadius: BorderRadius.only(
                  topLeft: Radius.circular(ScreenUtil().radius(10)),
                  topRight: Radius.circular(ScreenUtil().radius(10)),
                ),
              ),
              child: Row(
                mainAxisAlignment: MainAxisAlignment.spaceBetween,
                children: [
                  Text(
                    widget.sunModel.ddateStr,
                    style: TextStyle(
                        fontWeight: FontWeight.bold,
                        color: MyColours.color_F6F6F6,
                        fontSize: ScreenUtil().setSp(40)),
                  ),
                  Text(
                    widget.sunModel.className,
                    style: TextStyle(
                        fontWeight: FontWeight.bold,
                        color: MyColours.color_F6F6F6,
                        fontSize: ScreenUtil().setSp(40)),
                  )
                ],
              )),
          Container(
            padding: EdgeInsets.symmetric(
                horizontal: ScreenUtil().setWidth(16),
                vertical: ScreenUtil().setWidth(14)),
            decoration: BoxDecoration(
              color: MyColours.color_ffffff,
              borderRadius: BorderRadius.only(
                bottomLeft: Radius.circular(ScreenUtil().radius(10)),
                bottomRight: Radius.circular(ScreenUtil().radius(10)),
              ),
            ),
            child: Column(
              crossAxisAlignment: CrossAxisAlignment.start,
              mainAxisAlignment: MainAxisAlignment.start,
              children: [
                Wrap(
                    // mainAxisAlignment: MainAxisAlignment.spaceBetween,
                    children: [
                      Text(
                        '${widget.sunModel.rname} ${Utils.starPhone(widget.sunModel.phone)}',
                        style: TextStyle(
                            color: MyColours.color_515151,
                            fontSize: ScreenUtil().setSp(28)),
                      ),
                      Text(
                        '跟单经理:${widget.sunModel.nickName ?? widget.sunModel.account}',
                        style: TextStyle(
                            color: MyColours.color_515151,
                            fontSize: ScreenUtil().setSp(28)),
                      )
                    ]),
                VEmptyView(16),
                ListView.builder(
                    shrinkWrap: true,
                    controller: widget.controller,
                    padding: EdgeInsets.zero,
                    // padding: EdgeInsets.symmetric(
                    //     horizontal: ScreenUtil().setWidth(24)),
                    itemBuilder: (context, index) {
                      SessionByTime sessionByTime = widget.sunModel.list[index];
                      return Column(
                          crossAxisAlignment: CrossAxisAlignment.start,
                          children: [
                            Row(
                              children: [
                                Text(
                                  sessionByTime.reserveOrder,
                                  style: TextStyle(
                                      color: MyColours.color_000000,
                                      fontWeight: FontWeight.bold,
                                      fontSize: ScreenUtil().setSp(30)),
                                ),
                                Text(
                                  '  ${sessionByTime.ddateStr}',
                                  style: TextStyle(
                                      color: MyColours.color_000000,
                                      fontSize: ScreenUtil().setSp(30)),
                                )
                              ],
                            ),
                            VEmptyView(20),
                            Wrap(
                              spacing: ScreenUtil().setWidth(14),
                              runSpacing: ScreenUtil().setWidth(20),
                              children: taocanWidget(sessionByTime.tableName),
                            ),
                            VEmptyView(26)
                          ]);
                    },
                    itemCount: widget.sunModel.list.length),
              ],
            ),
          )
        ],
      ),
    );
  }
}