效果:

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. 4.Hbase Shell 命令

    Hbase提供了一个shell的终端给用户交互:#$HBASE_HOME/bin/hbase shell,执行quit命令可以退出命令行 2.使用Hbase Shelll 命令操作: 名称 命令表达式 ...

  2. ping加上时间信息

    一.linux系统ping加时间戳信息 1.ping 加时间信息,然后还要实时保存到一个文件中,那么就与awk结合 ping 115.239.211.112 -c 10 | awk '{ print ...

  3. cookies, session, token

    Cookie 是由客户端(通常是浏览器)保存的小型文本信息,其内容是一系列的键值对,是由 HTTP 服务器设置并保存在浏览器上的信息. 在post请求的瞬间,cookie会被浏览器自动添加到请求头中. ...

  4. Java&Selenium自动化测试调用JS实现单击

    Java&Selenium自动化测试调用JS实现单击 /* * the method of invoking js to do something * * @author davieyang ...

  5. Mybatis 动态SQL注解 in操作符的用法

    在SQL语法中如果我们想使用in的话直接可以像如下一样使用: ,,) ; ,,) ; 但是如果在MyBatis中的使用 in 操作符,像下面这样写的话,肯定会报错: @Update("upd ...

  6. 解决selenium和FireFox版本不兼容问题

    相信很多同学刚接触selenium时,在Eclipse中打开fireFox浏览器时会报错:org.openqa.selenium.firefox.NotConnectedException: Unab ...

  7. Interleaving String (DP)

    Given s1, s2, s3, find whether s3 is formed by the interleaving of s1 and s2. For example, Given:s1 ...

  8. MVC路由规则进一步了解

    本周由于工作需要,接触了PetaPoco(一个小型的ORM-框架)和ExtJS,这个项目框架是别人写好的,用的是MVC,我写的MVC程序一般控制器和视图都是在一个类库下面的,但是作者是把MVC中的控制 ...

  9. FTPClient上传下载等

    package com.lct.conference.controller.MonitorManagement.cofer; import org.apache.commons.net.ftp.FTP ...

  10. vue+axios+elementUI文件上传与下载

    vue+axios+elementUI文件上传与下载 Simple_Learn 关注  0.5 2018.05.30 10:20 字数 209 阅读 15111评论 4喜欢 6 1.文件上传 这里主要 ...