feast_item.dart 5.47 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/widgets/v_empty_view.dart';

class FeastItem extends StatefulWidget {
  FeastItem({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(
        RichText(
            textScaleFactor: 1,
            overflow: TextOverflow.ellipsis,
            // textDirection: TextDirection.ltr,
            // textAlign: TextAlign.left,

            text: TextSpan(
              children: [
                TextSpan(
                    text: "1299套餐:",
                    style: TextStyle(
                        color: MyColours.color_000000,
                        fontSize: ScreenUtil().setSp(28)),
                    recognizer: TapGestureRecognizer()..onTap = () {}),
                TextSpan(
                    text: "已调菜",
                    style: TextStyle(
                        color: MyColours.color_438E93,
                        fontSize: ScreenUtil().setSp(28)),
                    //点击事件
                    recognizer: TapGestureRecognizer()
                      ..onTap = () {
                        print("点击了安全协议");
                      }),
                TextSpan(
                    text: "保证30桌、备2桌",
                    style: TextStyle(
                        color: MyColours.color_000000,
                        fontSize: ScreenUtil().setSp(28)),
                    recognizer: TapGestureRecognizer()..onTap = () {}),
              ],
            )),
      );
    });
    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(
                    '8月1日  午餐  14:00-16:00',
                    style: TextStyle(
                        fontWeight: FontWeight.bold,
                        color: MyColours.color_F6F6F6,
                        fontSize: ScreenUtil().setSp(40)),
                  ),
                  Text(
                    '婚宴',
                    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,
              children: [
                Text(
                  '桌位:凤凰厅、包间1、包间2',
                  style: TextStyle(
                      color: MyColours.color_000000,
                      fontSize: ScreenUtil().setSp(28)),
                ),
                VEmptyView(8),
                Column(
                  children: taocanWidget(['ff', 'ff', 'ff', 'ff']),
                ),
                VEmptyView(36),
                Row(
                  mainAxisAlignment: MainAxisAlignment.spaceBetween,
                  children: [
                    Text(
                      '方先生  订32桌  备2桌',
                      style: TextStyle(
                          fontWeight: FontWeight.bold,
                          color: MyColours.color_000000,
                          fontSize: ScreenUtil().setSp(28)),
                    ),
                    Text(
                      '负责人:刘经理',
                      style: TextStyle(
                          fontWeight: FontWeight.bold,
                          color: MyColours.color_000000,
                          fontSize: ScreenUtil().setSp(28)),
                    ),
                  ],
                )
              ],
            ),
          )
        ],
      ),
    );
  }
}