Discuz!NT|BBS|论坛

注册

 

发新话题 回复该主题

购物车类的排版 [复制链接]

1#
import 'packagelutter/material.dart';
import 'package:khapp/util/toast_util.dart';
import 'package:khapp/routers/routers.dart';
import 'package:khapp/widgets/menu_item.dart';
import 'package:khapp/util/sp_util.dart';
import 'package:khapp/public/logininfo.dart';
import 'package:khapp/http/khapp_sockbas.dart';
import 'dart:convert';
import 'package:khapp/widgets/loading_widget.dart';
import 'package:khapp/models/rmbindmodel.dart';

class feehispage extends StatefulWidget {
  @override
  _feehispageState createState() => _feehispageState();
}

class _feehispageState extends State<feehispage> {

  String sdefalutrmid = logininfo.bind_list[0].RM_ID;

  @override
  void initState() {
    super.initState();
  }

  @override
  void dispose() {
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    // TODO: implement build
    return new Scaffold(
      appBar: AppBar(
        title: Text("历史缴费"),
        centerTitle: false
      ),
      backgroundColor: new Color.fromARGB(255, 242, 242, 245),
      body: new Column(
        children: <Widget>[

          Row(
            children: <Widget>[
              new Checkbox(
                  value: false,
                  activeColor: Color.fromARGB(255, 255, 67, 78),
                  onChanged: (bool) {

                    setState(() {});
                  }),
              Text("全选"),
              Expanded(
                child: Row(
                  mainAxisAlignment: MainAxisAlignment.end,
                  children: <Widget>[
                    Text(
                      "不含运费 ",
                      style: TextStyle(color: Colors.grey, fontSize: 10),
                    ),
                    Text(
                      "合计:",
                      style: TextStyle(color: Colors.black, fontSize: 12),
                    ),
                    Text(
                      "¥",
                      style: TextStyle(color: Colors.red, fontSize: 12),
                    ),
                    Text(
                      "123456",
                      style: TextStyle(
                        color: Colors.red,
                        fontSize: 16,
                      ),
                    ),
                    Container(
                      alignment: Alignment.center,
                      child: new Text(
                        "结算123456",
                        style: TextStyle(color: Colors.white),
                      ),
                      width: 130,
                      height: 50,
                      color: Colors.red,
                    )
                  ],
                ),
              )
            ],
          ),

          new Expanded(
              child: Container(
                child: new ListView.separated(
                    itemBuilder: (context, item) {
                      return buildListData(context, titleItems[item], iconItems[item], subTitleItems[item]);
                    },
                    separatorBuilder: (BuildContext context, int index) => new Divider(),  // 分割线
                    itemCount: iconItems.length
                ),
                width: double.infinity,
                color: Colors.grey,
              )),
          Row(
            children: <Widget>[
              new Checkbox(
                  value: false,
                  activeColor: Color.fromARGB(255, 255, 67, 78),
                  onChanged: (bool) {

                    setState(() {});
                  }),
              Text("全选"),
              Expanded(
                child: Row(
                  mainAxisAlignment: MainAxisAlignment.end,
                  children: <Widget>[
                    Text(
                      "不含运费 ",
                      style: TextStyle(color: Colors.grey, fontSize: 10),
                    ),
                    Text(
                      "合计:",
                      style: TextStyle(color: Colors.black, fontSize: 12),
                    ),
                    Text(
                      "¥",
                      style: TextStyle(color: Colors.red, fontSize: 12),
                    ),
                    Text(
                      "123456",
                      style: TextStyle(
                        color: Colors.red,
                        fontSize: 16,
                      ),
                    ),
                    Container(
                      alignment: Alignment.center,
                      child: new Text(
                        "结算123456",
                        style: TextStyle(color: Colors.white),
                      ),
                      width: 130,
                      height: 50,
                      color: Colors.red,
                    )
                  ],
                ),
              )
            ],
          )
        ],
      ),
    );
  }

  Widget buildListData(BuildContext context, String titleItem, Icon iconItem, String subTitleItem) {
    return new ListTile(
      leading: iconItem,
      title: new Text(
        titleItem,
        style: TextStyle(fontSize: 18),
      ),
      subtitle: new Text(
        subTitleItem,
      ),
      trailing: new Icon(Icons.keyboard_arrow_right),
      // 创建点击事件
      onTap: () {
        showDialog(
          context: context,
          builder: (BuildContext context) {
            return new AlertDialog(
              title: new Text(
                'ListViewAlert',
                style: new TextStyle(
                  color: Colors.black54,
                  fontSize: 18.0,
                ),
              ),
              content: new Text('您选择的item内容为titleItem'),
            );
          },
        );
      },
    );
  }

  List<String> titleItems = <String>[
    'keyboard', 'print',
    'router', 'pages',
    'zoom_out_map', 'zoom_out',
    'youtube_searched_for', 'wifi_tethering',
    'wifi_lock', 'widgets',
    'weekend', 'web',
    '图accessible', 'ac_unit',
  ];

  List<Icon> iconItems = <Icon>[
    new Icon(Icons.keyboard), new Icon(Icons.print),
    new Icon(Icons.router), new Icon(Icons.pages),
    new Icon(Icons.zoom_out_map), new Icon(Icons.zoom_out),
    new Icon(Icons.youtube_searched_for), new Icon(Icons.wifi_tethering),
    new Icon(Icons.wifi_lock), new Icon(Icons.widgets),
    new Icon(Icons.weekend), new Icon(Icons.web),
    new Icon(Icons.accessible), new Icon(Icons.ac_unit),
  ];

  List<String> subTitleItems = <String>[
    'subTitle: keyboard', 'subTitle: print',
    'subTitle: router', 'subTitle: pages',
    'subTitle: zoom_out_map', 'subTitle: zoom_out',
    'subTitle: youtube_searched_for', 'subTitle: wifi_tethering',
    'subTitle: wifi_lock', 'subTitle: widgets',
    'subTitle: weekend', 'subTitle: web',
    'subTitle: accessible', 'subTitle: ac_unit',
  ];

  Widget buildselrm(IconData icon, String title, String subtitle){
    return new GestureDetector(
      onTap: (){

      },
      child:  new Column(
        children: <Widget>[
          new Padding(
              padding: EdgeInsets.only(
                left: 20.0,
                top: 12.0,
                right: 20.0,
                bottom: 10.0,
              ),
              child: new Row(
                children: <Widget>[
                  new Padding(padding: const EdgeInsets.only(
                    right: 8.0,
                  ),
                    child:new Icon(
                      icon,
                      color: Colors.black54,
                    ),
                  ),
                  new Expanded(
                      child: new Text(
                        title,
                        style: new TextStyle(color: Colors.black54,fontSize: 16.0),
                      )
                  ),
                  new Expanded(
                      child: new Text(
                        subtitle,
                        textAlign: TextAlign.right,
                        style: new TextStyle(color: Colors.black54,fontSize: 16.0),
                      )
                  ),
                  new Icon(
                    Icons.chevron_right,
                    color: Colors.grey,
                  )
                ],

              )
          ),
          new Padding(padding: const EdgeInsets.only(left: 20.0,right: 20.0),
            child: new Divider(
              height: 2.0,
              color: Colors.black54,
            ),
          )
        ],
      ),
    );
  }

}
分享 转发
TOP
发新话题 回复该主题