feast_setmeal_manage_page.dart 4.75 KB
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:one_key/route/navigator_util.dart';
import 'package:one_key/widgets/v_empty_view.dart';

import '../../../res/colors.dart';
import '../../../utils/dialog_util.dart';
import '../../../utils/screen_util.dart';
import '../../../utils/utils.dart';
import '../../../widgets/h_empty_view.dart';
import '../../../widgets/round_button.dart';
import '../../../widgets/system_app_bar.dart';

/**
 * 套餐管理
 */

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

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

class _FeastSetmealManagePageState extends State<FeastSetmealManagePage> {
  @override
  void initState() {
    super.initState();
    Utils.changeStatusColor(color: MyColours.color_438E93);
  }

  Widget buildFeastTypeHeader() {
    return RoundButton(
      onPressed: () async {
        NavigatorUtil.goFeastSetmealManageEditPage(context);
      },
      text: '添加一项',
      fontSize: 32,
      isBold: false,
      height: h(32),
      width: w(80),
      margin: EdgeInsets.only(top: w(18), bottom: w(4)),
      textColor: MyColours.color_438E93,
      gradientStart: MyColours.color_ffffff,
      gradientEnd: MyColours.color_ffffff,
      borderColor: MyColours.color_438E93,
      radius: r(6),
    );
  }

  Widget buildFeastTypeItem(String title, String subTitle) {
    return Container(
      height: h(48),
      margin: EdgeInsets.only(top: w(12)),
      decoration: BoxDecoration(
          border: Border(
              bottom: BorderSide(width:w(0.5), color: MyColours.color_E7E7E7))),
      child: Row(
        children: [
          Column(
            crossAxisAlignment: CrossAxisAlignment.start,
            children: [
              Text(
                title,
                style: TextStyle(
                    fontSize: font(16), color: MyColours.color_E6000000),
              ),
              VEmptyView(12),
              Text(
                subTitle,
                style: TextStyle(
                    fontSize: font(12), color: MyColours.color_999999),
              )
            ],
          ),
          Spacer(),
          InkWell(
              onTap: () {
                NavigatorUtil.goFeastSetmealManageEditPage(context);
              },
              child: Text(
                '修改',
                style: TextStyle(
                    decoration: TextDecoration.underline,
                    fontSize: font(16),
                    color: MyColours.color_438E93),
              )),
          HEmptyView(32),
          InkWell(
              onTap: () {
                //已经传到服务器,弹提醒窗口,是否删除
                //修改之前有内容,则弹框
                DialogUtil.cupertinoAlertDialogFeast(context,
                    rTitle: '删除',
                    title: "是否确认删除",
                    content: "1299套餐", lCallback: () {
                  print("取消");
                }, rCallback: () {
                  print("确定");
                  // widget.deleteCallback(index);
                });
              },
              child: Image.asset(
                Utils.getImgPath(true ? 'f_delete_red_un' : 'f_delete_red'),
                width: w(32),
                height: w(32),
              )),
          HEmptyView(32),
        ],
      ),
    );
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: MyColours.color_ffffff,
      appBar: SystemAppBar(
        '套餐管理',
        needWhite: true,
        bgColor: MyColours.color_438E93,
        titleColor: MyColours.color_F6F6F6,
        onTap: () {
          Navigator.pop(context);
        },
      ),
      body: NestedScrollView(
        // controller: _scrollViewController,
        headerSliverBuilder: (BuildContext context, bool innerBoxIsScrolled) {
          return <Widget>[
            SliverAppBar(
              pinned: true,
              floating: false,
              leading: null,
              backgroundColor: MyColours.color_ffffff,
              expandedHeight: ScreenUtil().setWidth(56 * 2),
              automaticallyImplyLeading: false,
              title: buildFeastTypeHeader(),
              // flexibleSpace: FlexibleSpaceBar(
              //     collapseMode: CollapseMode.pin,
              //     title: buildFeastTypeHeader())
            )
          ];
        },
        body: ListView.builder(
            itemCount: 100,
            padding: EdgeInsets.only(left: w(16)),
            itemBuilder: (BuildContext context, int index) {
              return buildFeastTypeItem('1299套餐', '1499元  不可议价');
            }),
      ),
    );
  }
}