青岛有没有做网站的,网站3级营销是怎么做的,重庆做网站_重庆网站建设_重庆网络推广_重庆网络公司,邯郸市建设局网站政策在Flutter开发当中#xff0c;我们可能会遇到以下的需求#xff1a;实现页面组合使用#xff0c;比如说有悬浮按钮、顶部菜单栏、左右抽屉侧边栏、底部导航栏等等效果。Scaffold组件可以帮我们实现上面需求说的效果。这篇博客主要分享容器组件的Scaffold组件的使用#xff…在Flutter开发当中我们可能会遇到以下的需求实现页面组合使用比如说有悬浮按钮、顶部菜单栏、左右抽屉侧边栏、底部导航栏等等效果。Scaffold组件可以帮我们实现上面需求说的效果。这篇博客主要分享容器组件的Scaffold组件的使用希望对看文章的小伙伴有所帮助。简单示例代码Scaffold(appBar:AppBar(title:Text(widget.title),),body:Center(child:Column(mainAxisAlignment: MainAxisAlignment.center,children:Widget[constText(You have pushed the button this many times:,),Text($_counter,style: Theme.of(context).textTheme.headline4,),],),),backgroundColor: Colors.yellow,bottomNavigationBar:BottomAppBar(color: Colors.white,shape:constCircularNotchedRectangle(),child:Container(height:50,),),floatingActionButton:FloatingActionButton(onPressed: _incrementCounter,tooltip:Increment,child:constIcon(Icons.add),),floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked,)效果如下所示image.png组件源码组件属性说明这里针对源码做出相应的属性说明熟悉控件的属性方便大家的使用。属性名称属性说明backgroundColor设置容器的背景颜色appBar顶部状态栏body容器的主体bottomNavigationBar顶部导航栏floatingActionButton悬浮按钮floatingActionButtonLocation悬浮按钮的位置floatingActionButtonAnimator悬浮按钮相关的动画设置drawer侧边栏组件persistentFooterButtons固定在下方显示的按钮完整的源码以下的代码可以直接复制到编译器去运行方便小伙伴查看运行结果或者直接使用importpackage:flutter/material.dart;voidmain(){runApp(constMyApp());}classMyAppextendsStatelessWidget{constMyApp({Key? key}):super(key: key);// This widget is the root of your application.overrideWidgetbuild(BuildContext context){returnMaterialApp(title:Flutter Demo,theme:ThemeData(primarySwatch:Colors.blue,),home:constMyHomePage(title:Flutter Demo Home Page),);}}classMyHomePageextendsStatefulWidget{constMyHomePage({Key? key, required this.title}):super(key: key);finalString title;overrideStateMyHomePagecreateState()_MyHomePageState();}class _MyHomePageState extendsStateMyHomePage{int _counter 0;void_incrementCounter(){setState((){_counter;});}overrideWidgetbuild(BuildContext context){returnScaffold(appBar:AppBar(title:Text(widget.title),),body:Center(child:Column(mainAxisAlignment:MainAxisAlignment.center,children:Widget[constText(You have pushed the button this many times:,),Text($_counter,style:Theme.of(context).textTheme.headline4,),],),),backgroundColor:Colors.yellow,bottomNavigationBar:BottomAppBar(color:Colors.white,shape:constCircularNotchedRectangle(),child:Container(height:50,),),floatingActionButton:FloatingActionButton(onPressed: _incrementCounter,tooltip:Increment,child:constIcon(Icons.add),),floatingActionButtonLocation:FloatingActionButtonLocation.centerDocked,);}}