feast_board.item.dart 3.52 KB
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:one_key/res/colors.dart';
import 'package:one_key/widgets/MyDivider.dart';
import 'package:one_key/widgets/h_empty_view.dart';
import 'package:one_key/widgets/v_empty_view.dart';

import '../../widgets/round_button.dart';

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

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

class _FeastBoardItemState extends State<FeastBoardItem> {
  Widget numWidget(String title, bool select, {bool needMargin = true}) {
    return Container(
      width: ScreenUtil().setWidth(32),
      height: ScreenUtil().setWidth(32),
      alignment: Alignment.center,
      margin: needMargin
          ? EdgeInsets.only(right: ScreenUtil().setWidth(50))
          : EdgeInsets.zero,
      decoration: BoxDecoration(
          color: select ? MyColours.color_438E93 : MyColours.color_BFC4D4,
          borderRadius: BorderRadius.circular(ScreenUtil().radius(4))),
      child: Text(
        title,
        style: TextStyle(
            color: select ? MyColours.color_ffffff : MyColours.color_515151,
            fontSize: ScreenUtil().setSp(16)),
      ),
    );
  }

  Widget canduanWidget(String title) {
    return Column(
      children: [
        VEmptyView(16),
        Row(
          children: [
            Text(
              title,
              style: TextStyle(
                  fontSize: ScreenUtil().setSp(28),
                  color: MyColours.color_000000,
                  fontWeight: FontWeight.bold),
            ),
            HEmptyView(56),
            RoundButton(
              onPressed: () async {},
              text: '刘经理 30桌',
              fontSize: 20,
              isBold: false,
              height: ScreenUtil().setWidth(36),
              width: ScreenUtil().setWidth(64 * 2),
              gradientStart: MyColours.color_438E93,
              gradientEnd: MyColours.color_438E93,
              radius: ScreenUtil().radius(10),
              textColor: MyColours.color_F6F6F6,
            ),
          ],
        ),
        VEmptyView(16),
        MyDivider(
          double.infinity,
          ScreenUtil().setWidth(2),
          color: MyColours.color_DBDBDB,
        )
      ],
    );
  }

  @override
  Widget build(BuildContext context) {
    return Container(
      margin: EdgeInsets.only(bottom: ScreenUtil().setWidth(40)),
      padding: EdgeInsets.symmetric(
          horizontal: ScreenUtil().setWidth(24),
          vertical: ScreenUtil().setWidth(16)),
      decoration: BoxDecoration(
          borderRadius: BorderRadius.circular(ScreenUtil().radius(10)),
          border: Border.all(
              color: MyColours.color_438E93, width: ScreenUtil().setWidth(2))),
      child: Column(
        children: [
          Row(
            children: [
              Text(
                '凤凰厅',
                style: TextStyle(
                    color: MyColours.color_438E93,
                    fontSize: ScreenUtil().setSp(40),
                    fontWeight: FontWeight.bold),
              ),
              Spacer(),
              numWidget('空', false),
              numWidget('1', true),
              numWidget('空', false),
              numWidget('空', false, needMargin: false),
            ],
          ),
          VEmptyView(24),
          canduanWidget('早餐'),
          canduanWidget('午餐'),
          canduanWidget('晚餐'),
          canduanWidget('其他'),
        ],
      ),
    );
  }
}