Skip to main content

moregeek program

flutter开发之scaffold组件快速开发app_亦可追寻的博客-多极客编程

Scaffold包括的属性


const Scaffold(
{Key? key,
PreferredSizeWidget? appBar,
Widget? body,
Widget? floatingActionButton,
FloatingActionButtonLocation? floatingActionButtonLocation,
FloatingActionButtonAnimator? floatingActionButtonAnimator,
List<Widget>? persistentFooterButtons,
AlignmentDirectional persistentFooterAlignment = AlignmentDirectional.centerEnd,
Widget? drawer,
DrawerCallback? onDrawerChanged,
Widget? endDrawer,
DrawerCallback? onEndDrawerChanged,
Widget? bottomNavigationBar,
Widget? bottomSheet,
Color? backgroundColor,
bool? resizeToAvoidBottomInset,
bool primary = true,
DragStartBehavior drawerDragStartBehavior = DragStartBehavior.start,
bool extendBody = false,
bool extendBodyBehindAppBar = false,
Color? drawerScrimColor,
double? drawerEdgeDragWidth,
bool drawerEnableOpenDragGesture = true,
bool endDrawerEnableOpenDragGesture = true,
String? restorationId}
)

属性的解释


appBar → PreferredSizeWidget?
An app bar to display at the top of the scaffold.
final
backgroundColor → Color?
The color of the Material widget that underlies the entire Scaffold.
final
body → Widget?
The primary content of the scaffold.
final
bottomNavigationBar → Widget?
A bottom navigation bar to display at the bottom of the scaffold.
final
bottomSheet → Widget?
The persistent bottom sheet to display.
final
drawer → Widget?
A panel displayed to the side of the body, often hidden on mobile devices. Swipes in from either left-to-right (TextDirection.ltr) or right-to-left (TextDirection.rtl)
final
drawerDragStartBehavior → DragStartBehavior
Determines the way that drag start behavior is handled.
final
drawerEdgeDragWidth → double?
The width of the area within which a horizontal swipe will open the drawer.
final
drawerEnableOpenDragGesture → bool
Determines if the Scaffold.drawer can be opened with a drag gesture on mobile.
final
drawerScrimColor → Color?
The color to use for the scrim that obscures primary content while a drawer is open.
final
endDrawer → Widget?
A panel displayed to the side of the body, often hidden on mobile devices. Swipes in from right-to-left (TextDirection.ltr) or left-to-right (TextDirection.rtl)
final
endDrawerEnableOpenDragGesture → bool
Determines if the Scaffold.endDrawer can be opened with a gesture on mobile.
final
extendBody → bool
If true, and bottomNavigationBar or persistentFooterButtons is specified, then the body extends to the bottom of the Scaffold, instead of only extending to the top of the bottomNavigationBar or the persistentFooterButtons.
final
extendBodyBehindAppBar → bool
If true, and an appBar is specified, then the height of the body is extended to include the height of the app bar and the top of the body is aligned with the top of the app bar.
final
floatingActionButton → Widget?
A button displayed floating above body, in the bottom right corner.
final
floatingActionButtonAnimator → FloatingActionButtonAnimator?
Animator to move the floatingActionButton to a new floatingActionButtonLocation.
final
floatingActionButtonLocation → FloatingActionButtonLocation?
Responsible for determining where the floatingActionButton should go.
final
hashCode → int
The hash code for this object.
@nonVirtual, read-only, inherited
key → Key?
Controls how one widget replaces another widget in the tree.
final, inherited
onDrawerChanged → DrawerCallback?
Optional callback that is called when the Scaffold.drawer is opened or closed.
final
onEndDrawerChanged → DrawerCallback?
Optional callback that is called when the Scaffold.endDrawer is opened or closed.
final
persistentFooterAlignment → AlignmentDirectional
The alignment of the persistentFooterButtons inside the OverflowBar.
final
persistentFooterButtons → List<Widget>?
A set of buttons that are displayed at the bottom of the scaffold.
final
primary → bool
Whether this scaffold is being displayed at the top of the screen.
final
resizeToAvoidBottomInset → bool?
If true the body and the scaffold's floating widgets should size themselves to avoid the onscreen keyboard whose height is defined by the ambient MediaQuery's MediaQueryData.viewInsets bottom property.
final
restorationId → String?
Restoration ID to save and restore the state of the Scaffold.
final
runtimeType → Type
A representation of the runtime type of the object.
read-only, inherited


使用


见下面的例子


 Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text("WhatsApp"),
elevation: 0.7,
bottom: TabBar(
controller: _tabController,
indicatorColor: Colors.blue,
tabs: <Widget>[
Tab(icon: Icon(Icons.camera_alt)),
Tab(text: "CHATS"),
Tab(text: "STATUS"),
Tab(text: "CALLS"),
],
),
actions: <Widget>[
Icon(Icons.search),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 5.0),
),
Icon(Icons.more_vert)
],
),
body: TabBarView(
controller: _tabController,
children: <Widget>[
CameraScreen(widget.cameras),
ChatScreen(),
StatusScreen(),
CallsScreen(),
],
),
floatingActionButton: showFab
? FloatingActionButton(
backgroundColor: Theme.of(context).accentColor,
child: Icon(
Icons.add,
color: Colors.white,
),
onPressed: () => debugDumpApp(),
)
: null,
bottomNavigationBar: BottomNavigationBar(
items: const <BottomNavigationBarItem>[
BottomNavigationBarItem(
icon: Icon(Icons.home),
label: 'Home',
),
BottomNavigationBarItem(
icon: Icon(Icons.business),
label: 'Business',
),
BottomNavigationBarItem(
icon: Icon(Icons.school),
label: 'School',
),
],
// currentIndex: _selectedIndex,
selectedItemColor: Colors.amber[800],
onTap: _onItemTapped,
),
);
}

上述代码运行起来的效果如下:
image.png


©著作权归作者所有:来自51CTO博客作者亦可追寻的原创作品,请联系作者获取转载授权,否则将追究法律责任

重构 flask 服务端项目对于 sql 的配置使用和延迟的请求回调巧妙设计运用_上进小菜猪的博客-多极客编程

一. Flask-SQLAlchemy SQLAlchemy的声明扩展是使用SQLAlchemy的最新方法,可以像Django一样在一个位置定义表和模型,然后在任何地方使用。 from sqlalchemy import create_engine from sqlalchemy.orm import scoped_session, sessionmaker from sqlalchemy.ext

linux入门-结构与命令【长期更新】_上进小菜猪的博客-多极客编程

一.Linux入门简单介绍 内蒙古科技大学计算机科学与技术20级-企业课(Linux操作系统)听课知识点记录。 Linux是一个免费的、类似UNIX的开源操作系统。该操作系统的内核于1991年10月5日由Linus Torvalds首次发布。通过用户空间应用程序,它成为了Linux操作系统。Linux也是自由软件和开源软件开发中最著名的例子。只要遵循GNU通用公共许可证(GPL),任何个人和组织都

在重构flask项目的时候对于wsgi中间件和好密钥的规划实战_上进小菜猪的博客-多极客编程

##手动推入一个上下文 如果尝试访问应用程序上下文之外的当前内容_应用程序或此对象的任何使用都将收到此错误消息: RuntimeError: Working outside of application context. ​ This typically means that you attempted to use functionality that needed to interface w

unity il2cpp 游戏分析入门_奋飞安全的博客-多极客编程

一、目标 很多时候App加密本身并不难,难得是他用了一套新玩意,天生自带加密光环。例如PC时代的VB,直接ida的话,汇编代码能把你看懵。 但是要是搞明白了他的玩法,VB Decompiler一上,那妥妥的就是源码。 Unity 和 Flutter 也是如此。 最近迷上了一个小游戏 Dream Blast,今天就拿他解剖吧。 com.rovio.dream 二、步骤 侦测敌情 从apk包里面发现l

使用低代码平台快速开发阅读app_ffapi的博客-多极客编程

设计实现效果如下图:主要包括书架,阅读,收藏功能。经过分析,我们可以先实现底部导航功能,和书架列表页面。1\. 使用 tabLayout 高级窗口实现底部导航 。 使用tabLayout 有两种方式,一种是使用 api.openTabLayout 接口打开,如果在app首页使用 tabLayout 布局,则可以使用配置json 文件的方式:{ "name": "root", "prel

百度 android 直播秒开体验优化_百度geek说的博客-多极客编程

作者 | 任雪龙导读网络直播功能作为一项互联网基本能力已经越来越重要,手机中的直播功能也越来越完善,电商直播、新闻直播、娱乐直播等多种直播类型为用户提供了丰富的直播内容。随着直播的普及,为用户提供极速、流畅的直播观看体验也越来越重要。全文6657字,预计阅读时间17分钟。01 背景百度 APP 作为百度的航母级应用为用户提供了完善的移动端服务,直播也作为其中一个必要功能为用户提供内容。随着直播间架

重构 flask 服务端项目对于 sql 的配置使用和延迟的请求回调巧妙设计运用_上进小菜猪的博客-多极客编程

一. Flask-SQLAlchemy SQLAlchemy的声明扩展是使用SQLAlchemy的最新方法,可以像Django一样在一个位置定义表和模型,然后在任何地方使用。 from sqlalchemy import create_engine from sqlalchemy.orm import scoped_session, sessionmaker from sqlalchemy.ext

#yyds干货盘点#【愚公系列】2022年10月 微信小程序-数据绑定_qq61972345e36b7的博客-多极客编程

前言 1.小程序页面结构 微信小程序的页面结构主要是分别由四个文件组成: js(逻辑处理文件):负责页面逻辑内容的处理,遵循js语言框架。 json(配置文件):用来设置页面的窗口内容,遵循JSON语法规范。 wxml(页面结构文件或视图文件):用于页面可视化组件的组织和描述,语法结构类似于xml,与html格式差别较大。 wxss(样式文件):兼容CSS语法规范。 2.数据绑定的定义 数据绑

#yyds干货盘点#【愚公系列】2022年10月 微信小程序-循环的使用_qq61972345e36b7的博客-多极客编程

一、列表渲染 1.wx:for 的item和index 在组件上使用 wx:for 控制属性绑定一个数组,即可使用数组中各项的数据重复渲染该组件。 默认数组的当前项的下标变量名默认为 index,数组当前项的变量名默认为 item <view wx:for="{{array}}"> {{index}}: {{item.message}} </view> 使用 wx:f

appstore 打包上传后提示“二进制文件无效” 的解决方法_mb6359e7ae95f15的博客-多极客编程

昨天提交打包提交App,将包上传到iTunes Connect之后,以为就能发布了,便点击构建版本,发现没有刚刚上传的包,于是就点击"预发行"看一下,会看到"已上传",过不久再刷新一次再看,就变成了二进制无效,无比的郁闷,上传了五六次都是二进制文件无效。在检查了app是否支持64位以后,我以为是传错了版本,把debug版本传上去了,排查了后发现不是。查了很多的资料都说是使用了私有API或者是iDF

#yyds干货盘点#【愚公系列】2022年11月 微信小程序-引用_qq61972345e36b7的博客-多极客编程

前言 1.模板的引入方式 WXML 提供两种文件引用方式import和include import:导入模板并没有真正的使用 include:直接引入页面元素,已经使用了 2.模板和组件的比较 template(模板):是可以在wxml中引用的代码,就是在wxml中引用公用的wxml类型的代码,它的作用类似于组件,因此这里简单的说明下template与Component (组件)的区别。 te

#yyds干货盘点#【愚公系列】2022年11月 微信小程序-template的使用_qq61972345e36b7的博客-多极客编程

一、template的概念 template模板顾名思义就是页面的复用,前端可以理解成组件中通用页面的封装,后端可以理解成时函数的封装,主要的作用就是服用减少代码冗余 比如下面几个场景: 首页需要显示轮播,分类页面也需要显示轮播,详情页面也需要显示轮播。三个地方都是需要使用轮播,并且是同一个轮播。这时就可以使用template 了 把轮播的代码提取出来放入模板标签中 在多个页面引用这个模板 ,把重