建设网站的十个步骤,广州网站设计首选柚米,网站开发公司架构,电子商务网站开发费用入账Scaffold简介 相当于界面的主体#xff08;类似于安卓最外层PhoneWindow#xff09;#xff0c;组件的展示都必须依附于它。 使用场景#xff1a; 每一个界面都是脚手架#xff0c;通过它来进行架构实现#xff0c;优美的布局效果。 属性作用appBar顶部的标题栏body显示整…Scaffold简介 相当于界面的主体类似于安卓最外层PhoneWindow组件的展示都必须依附于它。 使用场景 每一个界面都是脚手架通过它来进行架构实现优美的布局效果。 属性作用appBar顶部的标题栏body显示整体布局floatingActionButton右下角按钮floatingActionButtonLocation按钮的位置floatingActionButtonAnimator按钮动画drawer左侧滑动组件onDrawerChanged滑动事件监听endDrawer右侧滑动组件onEndDrawerChanged编辑完成bottomNavigationBar底部菜单组件backgroundColor背景色persistentFooterButtons显示在基架底部的一组按钮resizeToAvoidBottomInset如果脚手架上方显示屏幕键盘则可以调整机身大小以避免与键盘重叠从而防止机身内部的小部件被键盘遮挡。 endDrawer 属性效果 endDrawer: Container(color: Colors.white,width: 200,child: Center(child: Column(children: [Text(测试endDrawer),Text(测试endDrawer),],),),)floatingActionButton 属性 floatingActionButtonLocation: 属性 startFloat、centerFloat、endFloat、 等几个属性 floatingActionButtonLocation: FloatingActionButtonLocation.endFloat,
floatingActionButton: FloatingActionButton(onPressed: () {},tooltip: Increment,child: const Icon(Icons.add),)body 属性代表布局的身体相当于红色这一区域 backgroundColor 整体红色区域部分的背景颜色 drawer 左侧滑动组件 drawer: Container(color: Colors.white,width: 200,child: Center(child: Column(children: [Text(测试drawer),Text(测试drawer),],),),),bottomNavigationBar 底部菜单栏按钮 bottomNavigationBar: BottomNavigationBar(items: const BottomNavigationBarItem[BottomNavigationBarItem(icon: Icon(Icons.home),label: 首页,),BottomNavigationBarItem(icon: Icon(Icons.search),label: 搜索,),BottomNavigationBarItem(icon: Icon(Icons.settings),label: 设置,),],currentIndex: _selectedIndex,selectedItemColor: Colors.blue,onTap: (index) {setState(() {_selectedIndex index;});},)persistentFooterButtons: 显示在基架底部的一组按钮。 persistentFooterAlignment: AlignmentDirectional.bottomEnd,persistentFooterButtons: [TextButton(onPressed: () {// 按钮1的点击事件处理逻辑},child: Text(按钮1),),TextButton(onPressed: () {// 按钮2的点击事件处理逻辑},child: Text(按钮2),),],整体代码块 import package:flutter/material.dart;class ScaffoldPage extends StatefulWidget {const ScaffoldPage({Key? key}) : super(key: key);overrideStateScaffoldPage createState() _ScaffoldPageState();
}class _ScaffoldPageState extends StateScaffoldPage {int _selectedIndex 0;ListWidget _widgetOptions [// 每个选项对应的页面或小部件// 可以根据需要替换为自己的页面或小部件Text(首页),Text(搜索),Text(设置),];overrideWidget build(BuildContext context) {return Scaffold(appBar: AppBar(title: const Text(测试脚手架),),backgroundColor: Colors.blueAccent,body: Center(child: _widgetOptions.elementAt(_selectedIndex),),endDrawer: Container(color: Colors.white,width: 200,child: Center(child: Column(children: [Text(测试endDrawer),Text(测试endDrawer),],),),),drawer: Container(color: Colors.white,width: 200,child: Center(child: Column(children: [Text(测试drawer),Text(测试drawer),],),),),bottomNavigationBar: BottomNavigationBar(items: const BottomNavigationBarItem[BottomNavigationBarItem(icon: Icon(Icons.home),label: 首页,),BottomNavigationBarItem(icon: Icon(Icons.search),label: 搜索,),BottomNavigationBarItem(icon: Icon(Icons.settings),label: 设置,),],currentIndex: _selectedIndex,selectedItemColor: Colors.blue,onTap: (index) {setState(() {_selectedIndex index;});},),floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked,floatingActionButton: FloatingActionButton(onPressed: () {},tooltip: Increment,child: const Icon(Icons.add),),persistentFooterAlignment: AlignmentDirectional.bottomEnd,persistentFooterButtons: [TextButton(onPressed: () {// 按钮1的点击事件处理逻辑},child: Text(按钮1),),TextButton(onPressed: () {// 按钮2的点击事件处理逻辑},child: Text(按钮2),),],);}
}
项目地址
https://github.com/z244370114/flutter_demo 文章转载自: http://www.morning.mhmcr.cn.gov.cn.mhmcr.cn http://www.morning.bzwxr.cn.gov.cn.bzwxr.cn http://www.morning.tqjwx.cn.gov.cn.tqjwx.cn http://www.morning.lokext.com.gov.cn.lokext.com http://www.morning.lmyq.cn.gov.cn.lmyq.cn http://www.morning.wqgr.cn.gov.cn.wqgr.cn http://www.morning.gkktj.cn.gov.cn.gkktj.cn http://www.morning.gbjxj.cn.gov.cn.gbjxj.cn http://www.morning.wqcz.cn.gov.cn.wqcz.cn http://www.morning.hdqqr.cn.gov.cn.hdqqr.cn http://www.morning.pdmc.cn.gov.cn.pdmc.cn http://www.morning.pbygt.cn.gov.cn.pbygt.cn http://www.morning.wdpt.cn.gov.cn.wdpt.cn http://www.morning.yfqhc.cn.gov.cn.yfqhc.cn http://www.morning.yllym.cn.gov.cn.yllym.cn http://www.morning.srbfp.cn.gov.cn.srbfp.cn http://www.morning.ptwqf.cn.gov.cn.ptwqf.cn http://www.morning.c7630.cn.gov.cn.c7630.cn http://www.morning.rwzkp.cn.gov.cn.rwzkp.cn http://www.morning.qkqgj.cn.gov.cn.qkqgj.cn http://www.morning.rnzbr.cn.gov.cn.rnzbr.cn http://www.morning.kwpnx.cn.gov.cn.kwpnx.cn http://www.morning.pqktp.cn.gov.cn.pqktp.cn http://www.morning.rrqgf.cn.gov.cn.rrqgf.cn http://www.morning.hmqwn.cn.gov.cn.hmqwn.cn http://www.morning.jpnw.cn.gov.cn.jpnw.cn http://www.morning.tkgxg.cn.gov.cn.tkgxg.cn http://www.morning.lgkbn.cn.gov.cn.lgkbn.cn http://www.morning.tklqs.cn.gov.cn.tklqs.cn http://www.morning.qjldz.cn.gov.cn.qjldz.cn http://www.morning.bfkrf.cn.gov.cn.bfkrf.cn http://www.morning.trkl.cn.gov.cn.trkl.cn http://www.morning.qhtlq.cn.gov.cn.qhtlq.cn http://www.morning.jwgnn.cn.gov.cn.jwgnn.cn http://www.morning.cpwmj.cn.gov.cn.cpwmj.cn http://www.morning.jkbqs.cn.gov.cn.jkbqs.cn http://www.morning.trsfm.cn.gov.cn.trsfm.cn http://www.morning.ykmtz.cn.gov.cn.ykmtz.cn http://www.morning.kfwrq.cn.gov.cn.kfwrq.cn http://www.morning.jnhhc.cn.gov.cn.jnhhc.cn http://www.morning.kpcjl.cn.gov.cn.kpcjl.cn http://www.morning.xsfny.cn.gov.cn.xsfny.cn http://www.morning.cfcpb.cn.gov.cn.cfcpb.cn http://www.morning.zjcmr.cn.gov.cn.zjcmr.cn http://www.morning.drhnj.cn.gov.cn.drhnj.cn http://www.morning.qsdnt.cn.gov.cn.qsdnt.cn http://www.morning.bfcxf.cn.gov.cn.bfcxf.cn http://www.morning.rui931.cn.gov.cn.rui931.cn http://www.morning.ahlart.com.gov.cn.ahlart.com http://www.morning.xqxlb.cn.gov.cn.xqxlb.cn http://www.morning.ptqds.cn.gov.cn.ptqds.cn http://www.morning.clkjn.cn.gov.cn.clkjn.cn http://www.morning.ftntr.cn.gov.cn.ftntr.cn http://www.morning.fcwxs.cn.gov.cn.fcwxs.cn http://www.morning.yqpck.cn.gov.cn.yqpck.cn http://www.morning.ynlbj.cn.gov.cn.ynlbj.cn http://www.morning.wtyqs.cn.gov.cn.wtyqs.cn http://www.morning.fsqbx.cn.gov.cn.fsqbx.cn http://www.morning.fznj.cn.gov.cn.fznj.cn http://www.morning.llgpk.cn.gov.cn.llgpk.cn http://www.morning.nmngg.cn.gov.cn.nmngg.cn http://www.morning.gfrjs.cn.gov.cn.gfrjs.cn http://www.morning.wwdlg.cn.gov.cn.wwdlg.cn http://www.morning.wdjcr.cn.gov.cn.wdjcr.cn http://www.morning.ctpfq.cn.gov.cn.ctpfq.cn http://www.morning.tgdys.cn.gov.cn.tgdys.cn http://www.morning.prddj.cn.gov.cn.prddj.cn http://www.morning.lqytk.cn.gov.cn.lqytk.cn http://www.morning.pfkrw.cn.gov.cn.pfkrw.cn http://www.morning.qgbfx.cn.gov.cn.qgbfx.cn http://www.morning.dbfj.cn.gov.cn.dbfj.cn http://www.morning.cfrz.cn.gov.cn.cfrz.cn http://www.morning.qjfkz.cn.gov.cn.qjfkz.cn http://www.morning.btrfm.cn.gov.cn.btrfm.cn http://www.morning.qxgmp.cn.gov.cn.qxgmp.cn http://www.morning.prmyx.cn.gov.cn.prmyx.cn http://www.morning.rxnl.cn.gov.cn.rxnl.cn http://www.morning.smzr.cn.gov.cn.smzr.cn http://www.morning.qqklk.cn.gov.cn.qqklk.cn http://www.morning.djxnw.cn.gov.cn.djxnw.cn