1、界面分析

通过下图我们可以拆分成 4 部分,头部、订单标题区域、订单列表区域、ListTitle同用部分。

2、UI编写

2.1、头部

主要用到了圆形头像裁剪组件-ClipOval

顶部头像区域
Widget _topHeader(){
  return Container(
    width: ScreenUtil().setWidth(750),
    padding: EdgeInsets.all(20),
    color: Colors.white,
    child: Column(
      children: <Widget>[
        Container(
          margin: EdgeInsets.only(top: 30),
          width: ScreenUtil().setWidth(155),
          child: ClipOval(
              child:Image.network('https://profile.csdnimg.cn/6/4/0/1_niceyoo')
          ),
        ),
        Container(
          margin: EdgeInsets.only(top: 10),
          child: Text(
            'niceyoo',
            style: TextStyle(
              fontSize: ScreenUtil().setSp(36),
              color: Colors.white
            ),
          ),
        )
      ],
    ),
  );
}
2.2、订单标题区域

使用 ListTile 编写,如下是关于 ListTile 组件属性说明:

const ListTile({
    Key key,
    this.leading,左侧widget
    this.title,标题
    this.subtitle,副标题
    this.trailing,右侧widget
    this.isThreeLine = false,是否默认3行高度,subtitle不为空时才能使用
    this.dense,设置为true后字体变小
    this.contentPadding,
    this.enabled = true,能否被点击
    this.onTap,
    this.onLongPress,
    this.selected = false,展示是否默认显示选中
})

我的订单标题代码部分:

Widget _orderTitle(){
    return Container(
      margin: EdgeInsets.only(top: 10),
      decoration: BoxDecoration(
        color: Colors.white,
        border: Border(
          bottom: BorderSide(
            width: 1,
            color: Colors.black12
          )
        )
      ),
      child: ListTile(
        leading: Icon(Icons.list),
        title: Text('我的订单'),
        trailing: Icon(Icons.arrow_right),
      ),
    );
}
2.3、订单列表区域

同样使用 ListTile 组件堆起来的:

Widget _orderType(){
    return Container(
      margin: EdgeInsets.only(top: 5),
      width: ScreenUtil().setWidth(750),
      height: ScreenUtil().setHeight(150),
      padding: EdgeInsets.only(top: 20),
      color: Colors.white,
      child: Row(
        children: <Widget>[
          Container(
            width: ScreenUtil().setWidth(187),
            child: Column(
              children: <Widget>[
                Icon(
                  Icons.party_mode,
                  size: 30,
                ),
                Text('待付款')
              ],
            ),
          ),           Container(
            width: ScreenUtil().setWidth(187),
            child: Column(
              children: <Widget>[
                Icon(
                  Icons.query_builder,
                  size: 30,
                ),
                Text('待发货')
              ],
            ),
          ),           Container(
            width: ScreenUtil().setWidth(187),
            child: Column(
              children: <Widget>[
                Icon(
                  Icons.directions_car,
                  size: 30,
                ),
                Text('待收货')
              ],
            ),
          ),           Container(
            width: ScreenUtil().setWidth(187),
            child: Column(
              children: <Widget>[
                Icon(
                  Icons.content_paste,
                  size: 30,
                ),
                Text('待评价')
              ],
            ),
          )
        ],
      ),
    );
  }
2.4、ListTitle同用部分

由于这一块内容格式基本一致,组装一下 ListTile 的子项:

Widget _myListTile(Icon icon,String title){
    return Container(
      decoration: BoxDecoration(
        color: Colors.white,
        border: Border(
          bottom: BorderSide(width: 1,color: Colors.black12)
        )
      ),
      child: ListTile(
        leading: icon,
        title: Text(
            title,
            textAlign: TextAlign.left,
        ),
        trailing: Icon(Icons.arrow_right),
      ),
    );
}

组合 List 布局:

Widget _actionList(){
    return Container(
      margin: EdgeInsets.only(top: 10),
      child: Column(
        children: <Widget>[
          _myListTile(Icon(Icons.settings),'领取优惠卷'),
          _myListTile(Icon(Icons.blur_circular),'已领取优惠卷'),
          _myListTile(Icon(Icons.add_location),'地址管理'),
          _myListTile(Icon(Icons.phone_in_talk),'客服电话'),
          _myListTile(Icon(Icons.add_to_home_screen),'关于我们'),
        ],
      ),
    );
}

66-Flutter移动电商实战-会员中心_编写ListTile的通用方法的更多相关文章

  1. Flutter实战视频-移动电商-66.会员中心_编写ListTile通用方法

    66.会员中心_编写ListTile通用方法 布局List里面嵌套一个ListTile的布局效果 里面有很多条记录,以后可能还会增加,所以这里我们做一个通用的组件 通用组件方法 这里使用Column布 ...

  2. Flutter实战视频-移动电商-64.会员中心_顶部头像UI布局

    64.会员中心_顶部头像UI布局 会员中心的样式 member.dart 清除原来的代码生成一个基本的结构 默认返回一个scaffold脚手架工具,body里面布局使用ListView,这样不会出现纵 ...

  3. Flutter实战视频-移动电商-65.会员中心_订单区域UI布局

    65.会员中心_订单区域UI布局 我的订单区域 member.dart写我的标题的方法 布局使用瓦片布局 先做修饰,decoration颜色的背景,下边线的样式 //我的订单标题 Widget _or ...

  4. Flutter移动电商实战 --(1)项目学习记录

    1.项目相关截图 2.项目知识点梳理图 Dio2.0: Dio是一个强大的 Dart Http 请求库,支持 Restful API.FormData.拦截器.请求取消等操作. Swiper: Swi ...

  5. Flutter移动电商实战 --(24)Provide状态管理基础

    Flutter | 状态管理特别篇 —— Provide:https://juejin.im/post/5c6d4b52f265da2dc675b407?tdsourcetag=s_pcqq_aiom ...

  6. Flutter移动电商实战 --(16)切换后页面状态的保持AutomaticKeepAliveClientMixin

    底栏切换每次都重新请求是一件非常恶心的事,flutter 中提供了AutomaticKeepAliveClientMixin 帮我们完成页面状态保存效果. 1.AutomaticKeepAliveCl ...

  7. Flutter移动电商实战 --(4)打通底部导航栏

    关于界面切换以及底栏的实现可参考之前写的一篇文章:Flutter实 ViewPager.bottomNavigationBar界面切换 1.新建4个基本dart文件 在pages目录下,我们新建下面四 ...

  8. Flutter移动电商实战 --(3)底部导航栏制作

    1.cupertino_IOS风格介绍 在Flutter里是有两种内置风格的: material风格: Material Design 是由 Google 推出的全新设计语言,这种设计语言是为手机.平 ...

  9. Flutter移动电商实战 --(30)列表页_商品列表UI界面布局

    小程序里面的布局方式 小程序的图片上这里使用的是warp布局,因为首页里面火爆专区,已经用过了warp来布局了. 所以这里我们没有必要再讲一遍,这里我们使用ListView,我们把它布局成下图这种形式 ...

随机推荐

  1. 数据库权限优化,权限设计BigInteger

    最近看到了一个项目的权限是根据bigineger来进行计算的菜单权限,觉得还是不错,存储上只需要存储在一个字段里就可以了,通过计算算出该角色的菜单权限即可,效率也非常的快,放在session中也非常的 ...

  2. JWT与RBAC权限模型

    JWT JWT是什么? Json web token (JWT)是为了网络应用环境间传递声明而执行的一种基于JSON的开发标准(RFC7519),该token被设计为紧凑且安全的,特别适用于分布式站点 ...

  3. .NET中的异步编程——常见的错误和最佳实践

    在这篇文章中,我们将通过使用异步编程的一些最常见的错误来给你们一些参考. 背景 在之前的文章<.NET中的异步编程——动机和单元测试>中,我们开始分析.NET世界中的异步编程.在那篇文章中 ...

  4. gitblit服务器:用户、团队、权限管理

    在日常开发工作中,我们通常使用版本控制软件管理团队的源代码,常用的SVN.Git.与SVN相比,Git有分支的概念,可以从主分支创建开发分支,在开发分支测试没有问题之后,再合并到主分支上去,从而避免了 ...

  5. 2019 贝壳找房java面试笔试题 (含面试题解析)

      本人5年开发经验.18年年底开始跑路找工作,在互联网寒冬下成功拿到阿里巴巴.今日头条.贝壳找房等公司offer,岗位是Java后端开发,因为发展原因最终选择去了贝壳找房,入职一年时间了,也成为了面 ...

  6. CDN: trunk Repo update failed - CocoaPods

    解决方案: 1.podfile文件中添加source源:  source 'https://github.com/CocoaPods/Specs.git' 2.执行 pod repo remove t ...

  7. js 递归遍历对象 插入属性 遍历树结构

    // 向 info下面 每一项 插入 isShow test() { const _this = this; _this.info.isShow = false; let iteration = fu ...

  8. VUE组件2数据传递

    传递数据 prop验证 除了传递数组,也可以传递对象 Vue.component('test',{ props:{ price:Number, unit: String } }) 如果price不是数 ...

  9. Tomcat 8.5版本文件上传后无权限访问的问题

    之前在tomcat 7下文件上传后访问一直没问题,现在tomcat版本升到8.5,在测试文件http上传时,发现所传文件无法通过nginx访问了. (Tomcat具体版本为8.5.11) PS:tom ...

  10. RPC相关知识

    为什么要进行系统拆分,为什么要用dubbo RPC的由来,基本架构,实现原理,整个调用过程经历了哪几步 Java动态代理及 RPC框架介绍 一篇文章了解RPC框架原理 dubbo详解及demo实例 d ...