效果:

widget/JdButton.dart

import 'package:flutter/material.dart';
import '../services/ScreenAdaper.dart'; class JdButton extends StatelessWidget { final Color color;
final String text;
final Object cb;
JdButton({Key key,this.color=Colors.black,this.text='按钮',this.cb=null}) : super(key: key); @override
Widget build(BuildContext context) {
return InkWell(
onTap:this.cb,
child: Container(
margin: EdgeInsets.all(),
padding: EdgeInsets.all(),
height: ScreenAdaper.height(),
width: double.infinity,
decoration: BoxDecoration(
color: color,
borderRadius: BorderRadius.circular()),
child: Center(
child: Text(text, style: TextStyle(color: Colors.white)),
),
),
);
}
}

pages/ProductContent.dart

import 'package:flutter/material.dart';
import '../services/ScreenAdaper.dart';
import 'ProductContent/ProductContentFirst.dart';
import 'ProductContent/ProductContentSecond.dart';
import 'ProductContent/ProductContentThird.dart';
import '../widget/JdButton.dart';
class ProductContentPage extends StatefulWidget {
final Map arguments;
ProductContentPage({Key key, this.arguments}) : super(key: key); _ProductContentPageState createState() => _ProductContentPageState();
} class _ProductContentPageState extends State<ProductContentPage> {
@override
Widget build(BuildContext context) {
return DefaultTabController(
length: ,
child: Scaffold(
appBar: AppBar(
title: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Container(
width: ScreenAdaper.width(),
child: TabBar(
indicatorColor: Colors.red,
indicatorSize: TabBarIndicatorSize.label,
tabs: <Widget>[
Tab(
child: Text('商品'),
),
Tab(
child: Text('详情'),
),
Tab(
child: Text('评价'),
)
],
),
)
],
),
actions: <Widget>[
IconButton(
icon: Icon(Icons.more_horiz),
onPressed: () {
showMenu(
context: context,
position: RelativeRect.fromLTRB(
ScreenAdaper.width(), , , ),
items: [
PopupMenuItem(
child: Row(
children: <Widget>[Icon(Icons.home), Text('首页')],
),
),
PopupMenuItem(
child: Row(
children: <Widget>[Icon(Icons.search), Text('搜索')],
),
),
]);
},
)
],
),
body: Stack(
children: <Widget>[
TabBarView(
children: <Widget>[
ProductContentFirst(),
ProductContentSecond(),
ProductContentThird()
],
),
Positioned(
width: ScreenAdaper.width(),
height: ScreenAdaper.height(),
bottom: ,
child: Container(
decoration: BoxDecoration(
border: Border(
top: BorderSide(color: Colors.black54, width: )),
color: Colors.white),
child: Row(
children: <Widget>[
Container(
padding: EdgeInsets.only(top: ScreenAdaper.height()),
width: ,
height: ScreenAdaper.height(),
child: Column(
children: <Widget>[
Icon(
Icons.shopping_cart,
size: ,
),
Text('购物车')
],
),
),
Expanded(
flex: ,
child: JdButton(
color: Color.fromRGBO(, , , 0.9),
text: "加入购物车",
cb: (){
print('加入购物车');
},
),
),
Expanded(
flex: ,
child: JdButton(
color: Color.fromRGBO(, , , 0.9),
text: "立即购物",
cb: (){
print('立即购物');
},
),
)
],
),
),
)
],
),
),
);
}
}

pages/ProductContent/ProductContentFirst.dart

import 'package:flutter/material.dart';
import '../../services/ScreenAdaper.dart';
class ProductContentFirst extends StatefulWidget {
ProductContentFirst({Key key}) : super(key: key); _ProductContentFirstState createState() => _ProductContentFirstState();
} class _ProductContentFirstState extends State<ProductContentFirst> {
@override
Widget build(BuildContext context) {
return Container(
padding: EdgeInsets.all(),
child:ListView(
children: <Widget>[
AspectRatio(
aspectRatio: /,
child: Image.network("https://www.itying.com/images/flutter/p1.jpg",fit: BoxFit.cover,)
),
Container(
padding: EdgeInsets.only(top: ),
child: Text("联想ThinkPad联想ThinkPad联想ThinkPad联想ThinkPad联想ThinkPad联想ThinkPad联想ThinkPad",style: TextStyle(
color: Colors.black87,
fontSize: ScreenAdaper.size()
)),
),
Container(
padding: EdgeInsets.only(top: ),
child: Text("联想ThinkPad联想ThinkPad联想ThinkPad联想ThinkPad联想ThinkPad联想ThinkPad联想ThinkPad",style: TextStyle(
color: Colors.black54,
fontSize: ScreenAdaper.size()
)),
),
Container(
padding: EdgeInsets.only(top:),
child: Row(
children: <Widget>[ Expanded(
flex: ,
child: Row(
children: <Widget>[
Text('特价'),
Text('¥28',style: TextStyle(
color: Colors.red,
fontSize: ScreenAdaper.size()
))
],
),
), Expanded(
flex: ,
child: Row(
mainAxisAlignment: MainAxisAlignment.end,
children: <Widget>[
Text('原价'),
Text('¥50',style: TextStyle(
color: Colors.black38,
fontSize: ScreenAdaper.size(),
decoration: TextDecoration.lineThrough
))
],
),
) ],
),
),
//筛选:
Container(
margin: EdgeInsets.only(top:),
height: ScreenAdaper.height(),
child: Row(
children: <Widget>[
Text('已选',style: TextStyle(
fontWeight: FontWeight.bold
)),
Text('115,黑色')
],
),
),
Divider(),
Container(
height: ScreenAdaper.height(),
child: Row(
children: <Widget>[
Text('运费',style: TextStyle(
fontWeight: FontWeight.bold
)),
Text('免运费')
],
),
),
Divider()
],
)
);
}
}

pages/ProductContent/ProductContentSecond.dart

import 'package:flutter/material.dart';
class ProductContentSecond extends StatefulWidget {
ProductContentSecond({Key key}) : super(key: key); _ProductContentSecondState createState() => _ProductContentSecondState();
} class _ProductContentSecondState extends State<ProductContentSecond> {
@override
Widget build(BuildContext context) {
return Container(
child: Text('商品详情'),
);
}
}

pages/ProductContent/ProductContentThird.dart

import 'package:flutter/material.dart';
class ProductContentThird extends StatefulWidget {
ProductContentThird({Key key}) : super(key: key); _ProductContentThirdState createState() => _ProductContentThirdState();
} class _ProductContentThirdState extends State<ProductContentThird> {
@override
Widget build(BuildContext context) {
return Container(
child: Text('商品评论'),
);
}
}

19 Flutter仿京东商城项目 商品详情 底部浮动导航布局 商品页面布局的更多相关文章

  1. 01-02 Flutter仿京东商城项目 功能分析、底部导航Tab切换以及路由配置、架构搭建:(Flutter仿京东商城项目 首页布局以及不同终端屏幕适配方案)

    Flutter和Dart交流学习群:交流群:452892873 01Flutter仿京东商城项目 功能分析.底部导航Tab切换以及路由配置.架构搭建 02Flutter仿京东商城项目 首页布局以及不同 ...

  2. 18 Flutter仿京东商城项目 商品详情顶部tab切换 顶部下拉菜单 底部浮动导航

    ProductContent.dart import 'package:flutter/material.dart'; import '../services/ScreenAdaper.dart'; ...

  3. 42 Flutter仿京东商城项目 修改默认收货地址 显示默认收货地址

    CheckOut.dart import 'package:flutter/material.dart'; import '../services/ScreenAdapter.dart'; impor ...

  4. 41 Flutter 仿京东商城项目签名验证 增加收货地址、显示收货地址 事件广播

    加群452892873 下载对应41课文件,运行方法,建好项目,直接替换lib目录 AddressAdd.dart import 'package:dio/dio.dart'; import 'pac ...

  5. 36 Flutter仿京东商城项目 用户登录 退出登录 事件广播更新状态

    Login.dart import 'dart:convert'; import 'package:dio/dio.dart'; import 'package:flutter/material.da ...

  6. 20 Flutter仿京东商城项目 商品详情 底部弹出筛选属性 以及筛选属性页面布局

    ProductContentFirst.dart import 'package:flutter/material.dart'; import '../../widget/JdButton.dart' ...

  7. 22 Flutter仿京东商城项目 inappbrowser 加载商品详情、保持页面状态、以及实现属性筛选业务逻辑

    加群452892873 下载对应21可文件,运行方法,建好项目,直接替换lib目录,在往pubspec.yaml添加上一下扩展. cupertino_icons: ^0.1.2 flutter_swi ...

  8. 21 Flutter仿京东商城项目 商品详情 请求接口渲染数据 商品属性数据渲染

    加群452892873 下载对应21可文件,运行方法,建好项目,直接替换lib目录,在往pubspec.yaml添加上一下扩展.   cupertino_icons: ^0.1.2   flutter ...

  9. 13 Flutter仿京东商城项目 商品列表筛选以及上拉分页加载更多

    ProductList.dart import 'package:flutter/material.dart'; import '../services/ScreenAdaper.dart'; imp ...

随机推荐

  1. adb使用时出现unanthorized问题

    adb使用时出现unanthorized问题 ADB 启动时,adb devices出现unanthorized问题. 检查USB调试是否开启. 重新拔插USB数据线是否有授权提示 重启adb :ad ...

  2. Tensorflow ARM交叉编译错误集锦

    版权声明:本文为博主(Jimchen)原创文章,未经博主允许不得转载. ttps://www.cnblogs.com/jimchen1218/p/11611975.html 前言: Tensorflo ...

  3. 《python解释器源码剖析》第12章--python虚拟机中的函数机制

    12.0 序 函数是任何一门编程语言都具备的基本元素,它可以将多个动作组合起来,一个函数代表了一系列的动作.当然在调用函数时,会干什么来着.对,要在运行时栈中创建栈帧,用于函数的执行. 在python ...

  4. 【问题】bzip2 --version 2>&1 < /dev/null

    https://unix.stackexchange.com/questions/230887/what-does-dev-null-mean https://stackoverflow.com/qu ...

  5. Liunx-tail命令

    1. 实时刷新tail -f /var/log/messages 2. 实时刷新最新500条log tail -500f  /var/log/messages 3. tail -n 20 catali ...

  6. 0009SpringBoot静态资源访问路径

    访问静态资源: 静态资源需要放在哪些路径下才能被访问呢: 通过WebMvcAutoConfiguration.java中 addResourceHandlers()方法查找绑定的路径,一个是通过web ...

  7. confluent_kafka消费时内存泄漏

    confluent_kafka测试的内存泄漏的条件 多线程消费 centos6 预测和centos6底层库存在关系. 换用centos7(我是换了7.3)就行了. (起初以为是代码问题,定位问题位置后 ...

  8. swoole,http\server 跨域---记一次php网站跨域访问上机实验

    缘由:为了更好的体验swoole组件优良的协程Mysql客户端,实现更好的并发设计:写了一个小程序. 环境准备: 没有采用任何框架,只是使用了smarty模版,来渲染后端php响应的数据,在一个htm ...

  9. django -过滤器的使用

    前情提要: 最近工作中用到django 中的  自定制过滤器的内容, 再此 复习一波过滤器和自定制 过滤器的内容 自定制过滤器   1.在settings中的INSTALLED_APPS配置当前app ...

  10. Driver对 (一对两对的对):specific/mini VS general

    老是听说miniport,port,在这里算是搞清楚了.mini就是specific(特殊)的意思.在微软的驱动层次里面,最底层的一般都是比较特殊的,但是为了满足系统的可拓展.可维护.通用等要求,微软 ...