stack嵌套 一般情况下 stack是无法嵌套,出现stack嵌套,布局就会出乱 解决方式:就是第二个stack需要确定宽高

appbar透明

AppBar(
backgroundColor: Colors.transparent,
elevation: 0,
}

container设置背景

Container(
decoration: BoxDecoration(
image: DecorationImage(
image: AssetImage('assets/icon_login_bg.png'),
fit: BoxFit.cover,
),
),
),

背景图在appBar之下

return new Scaffold(
body: new Stack(
children: <Widget>[
new Container(
color: Colors.blue.shade200,
),
new AppBar(
title: new Text("App bar"),
backgroundColor: Colors.transparent,
elevation: 0.0,
),
new Positioned(
top: 80.0,
left: 0.0,
bottom: 0.0,
right: 0.0,
//here the body
child: new Column(
children: <Widget>[
new Expanded(
child: Container(
color: Colors.grey,
),
)
],
),
),
],
),
);

登陆页面

import 'dart:async';
import 'package:flutte_xms/util/func_util.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; class LoginPage extends StatefulWidget {
@override
_LoginPageState createState() => _LoginPageState();
} class _LoginPageState extends State<LoginPage> {
static const defaultText = '点击获取验证码';
Timer countDownTimer;
String vefifyCountText = defaultText; TextEditingController _mobileController;
TextEditingController _verifyCodeController;
Focus mobileFocus;
@override
Widget build(BuildContext context) {
double screenWidth = FuntionUtil.screenwidth(context);
double screenHeight = FuntionUtil.screenHeight(context);
return Stack(
children: <Widget>[
Container(
alignment: Alignment.center,
decoration: BoxDecoration(
color: Colors.blue,
image: DecorationImage(
image: AssetImage('assets/icon_login_bg.png'),
fit: BoxFit.cover,
repeat: ImageRepeat.noRepeat,
),
),
),
Scaffold(
backgroundColor: Colors.transparent,
appBar: AppBar(
backgroundColor: Colors.transparent,
elevation: 0,
iconTheme: IconThemeData(
color: Colors.white,
),
),
body: GestureDetector(
onTap: () {
FocusScope.of(context).unfocus();
},
child: Container(
height: screenHeight,
width: screenWidth,
alignment: FractionalOffset(0.5, 0.7),
child: Padding(
padding: EdgeInsets.zero,
child: Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Stack(
alignment: FractionalOffset(0.5, 0.95),
children: <Widget>[
Container(
color: Colors.transparent,
padding: EdgeInsets.only(top: 15, bottom: 30),
child: Container(
margin: EdgeInsets.only(left: 20, right: 20), // height: 200,
child: Card(
child: Column(
children: <Widget>[
//请输入手机号
Container(
margin: EdgeInsets.only(
top: 15, left: 12, right: 12),
child: Row(
children: <Widget>[
Container(
height: 54,
width: 30,
alignment: Alignment.center,
padding: EdgeInsets.only(
left: 0, right: 5),
child: Image.asset(
'assets/icon_login_verifycode.png'),
),
Expanded(
child: Container(
margin: EdgeInsets.only(right: 14),
height: 54,
alignment: Alignment.center,
child: Theme(
data: Theme.of(context).copyWith(
splashColor:
Colors.transparent),
child: TextField(
controller: _mobileController,
keyboardType:
TextInputType.number,
textInputAction:
TextInputAction.next,
cursorColor: Colors.orange,
decoration: InputDecoration(
hintText: '请输入手机号',
border: InputBorder.none,
),
inputFormatters: [
LengthLimitingTextInputFormatter(
11)
],
),
),
),
),
],
),
decoration: BoxDecoration(
border: Border(
bottom: BorderSide(
width: 2, color: Colors.orange),
),
),
),
//请输入验证码
Padding(
padding: EdgeInsets.only(
top: 15,
bottom: 80,
left: 12,
right: 12),
child: Container(
child: Row(
children: <Widget>[
Container(
height: 54,
width: 30,
alignment: Alignment.center,
padding: EdgeInsets.only(
left: 0, right: 5),
child: Image.asset(
'assets/icon_login_verifycode.png'),
),
Expanded(
child: Container(
margin:
EdgeInsets.only(right: 14),
height: 54,
alignment: Alignment.center,
child: Theme(
data: Theme.of(context)
.copyWith(
splashColor:
Colors.transparent),
child: TextField(
controller:
_verifyCodeController,
keyboardType:
TextInputType.number,
textInputAction:
TextInputAction.done,
cursorColor: Colors.orange,
decoration: InputDecoration(
hintText: '请输入验证码',
border: InputBorder.none,
),
inputFormatters: [
LengthLimitingTextInputFormatter(
11)
],
),
),
),
),
FlatButton(
splashColor: Colors.transparent,
highlightColor: Colors.transparent,
// disabledColor: Colors.grey,
disabledTextColor: Colors.grey[300],
child: Text(vefifyCountText),
onPressed:
vefifyCountText != defaultText
? null
: () {
//开启倒计时
_startTime();
},
)
],
),
decoration: BoxDecoration(
border: Border(
bottom: BorderSide(
color: Colors.orange, width: 2),
),
),
),
),
],
),
),
),
),
GestureDetector(
child: FuntionUtil.button(context, '登陆'),
onTap: () {
FocusScope.of(context).unfocus();
},
),
],
),
Padding(
padding: EdgeInsets.only(top: 10),
child: Row(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Image.asset('assets/icon_login_agreed.png'),
SizedBox(
width: 5,
),
Text('用户同意协议和隐私策略'),
],
),
),
Padding(
padding: EdgeInsets.only(top: 20),
child: Text('本产品不对未成年人开放'),
)
],
),
),
),
),
),
],
);
} //开启定时器
void _startTime() {
//置空
_cancelTime();
countDownTimer = Timer.periodic(Duration(seconds: 1), (t) {
int second = 60 - t.tick;
setState(() {
//60-t.tick代表剩余秒数,如果大于0,设置text为剩余秒数
if (second > 0) {
vefifyCountText = '$second秒后重新获取';
} else {
vefifyCountText = '点击获取验证码';
_cancelTime();
}
});
});
} //取消定时器
void _cancelTime() {
countDownTimer?.cancel();
countDownTimer = null;
} @override
void dispose() {
_cancelTime();
super.dispose();
}
}

flutter stack嵌套,appbar透明,Container设置背景图片并且图片在appbar之下的更多相关文章

  1. WebView设置透明和设置背景图片的方法

    http://blog.csdn.net/Vincent20111024/article/details/8478219 1. WebView若要设置背景图,直接设置web .setBackgroun ...

  2. VC 对话框设置背景颜色和图片

    改变背景颜色,有两种方法: 1.在app的初始化函数中调用:void SetDialogBkColor( COLORREF clrCtlBk = RGB(192, 192, 192), COLORRE ...

  3. 解决 UIView 设置背景为UIImage图片变型问题[XXX setBackgroundColor:[UIColor colorWithPatternImage:XXX]];

    [self.drawingViewsetBackgroundColor:[UIColorcolorWithPatternImage:[selfthumbnailWithImageWithoutScal ...

  4. android 设置背景为空(透明)

    在给控件设置背景时像ps那样的背景透明 在3.0以下可以使用 imageView.setBackgroundResource(android.R.id.empty); 但是这个方法在3.0以上会出现 ...

  5. android设置背景图片透明

    设置Activiyt为透明可以在Activity中引用系统透明主题android:theme="@android:style/Theme.Translucent" 设置背景图片透明 ...

  6. 解决css设置背景透明,文字不透明

    设置元素的透明度:  -moz-opacity:0.8; /*在Firefox中设置元素透明度  filter: alpha(opacity=80); /*ie使用滤镜设置透明   但是当我们对一个标 ...

  7. Activity设置背景透明之开发坑

    Activity设置背景透明的常规方法 方法一.在Manifest.xml中,直接在需要设置的Activity中添加主题样式: Android:theme="@android:style/T ...

  8. Sublime如何设置背景透明

    Sublime如何设置背景透明 下载sublime 透明背景插件 我用的是git下载插件: git clone https://github.com/vhanla/SublimeTextTrans.g ...

  9. ie6背景透明的设置方法 ie6背景颜色透明和png图像透明解决方法

    IE6浏览器,让我们又爱又恨.爱它的是,可以让我们写的代码的时候,可以更标准,恨的是,它有太多无厘头的IE6常见bug(详情点击),让我们焦头烂额.现在现在用百度浏览器调查,国内占有率不到6%了,但是 ...

随机推荐

  1. mysql的auto-rehash简介

    今天在看mysql的配置文件的时候,发现有"auto-rehash"不明白什么意思,在此记录一下,auto-rehash是自动补全的意思,就像我们在linux命令行里输入命令的时候 ...

  2. Delphi 无类型文件

  3. Linux部署java和tomcat的运行环境

    Linux部署java和tomcat的运行环境 1.上传下载的jdk的rpm包和tomcat的tar包,我是放到/opt目录了,文件直接去官网下载即可. 2.如果之前安装过其他版本的jdk,最好先现在 ...

  4. 牛客练习赛46 A 华华教奕奕写几何 (简单数学)

    链接:https://ac.nowcoder.com/acm/contest/894/A 来源:牛客网 华华教奕奕写几何 时间限制:C/C++ 1秒,其他语言2秒 空间限制:C/C++ 524288K ...

  5. js最简单焦点图片轮播代码

    将下面代码保存为banner.js,在需要显示焦点图的地方调用该js即可. <script type="text/javascript" src="banner.j ...

  6. 【NOI 2019】同步赛 / 题解 / 感想

    非常颓写不动题怎么办…… 写下这篇博客警示自己吧…… 游记 7.16 我并不在广二参加 NOI,而是在距离广二体育馆一公里远的包间打同步赛(其实就是给写不动题找个理由) 上午身体不舒服,鸽了半天才看题 ...

  7. Gym - 101630G The Great Wall (前缀和+树状数组+二分)

    题意:有一个序列,一开始所有的元素都是ai,你可以选择两个长度相等的区间,如果某个元素被一个区间覆盖,那么变为bi,如果被两个区间都覆盖,那么变为ci.问所有区间的选择方法中产生的第k小的元素总和. ...

  8. HTTP缓存剖析

    web浏览器会自动缓存访问过的页面,当访问同一个页面的请求时,浏览器不再从服务器中重新下载页面而是优先使用本地缓存中的页面 为什么要进行web缓存 从用户的角度来看web缓存加快了上网速度,当然这是用 ...

  9. Kendo UI for jQuery使用教程:使用MVVM初始化(二)

    [Kendo UI for jQuery最新试用版下载] Kendo UI目前最新提供Kendo UI for jQuery.Kendo UI for Angular.Kendo UI Support ...

  10. 利用rand7() 产生rand10()(腾讯)

    题目1:已知rand7() 可以产生 1~7 的7个数(均匀概率),利用rand7()  产生rand10()   1~10(均匀概率) int rand10() { int temp; int te ...