企业网站建设的建议,二手房中介网站模板,网易企业邮箱后缀怎么设置,福州公司网站设计AppBar 是 Flutter 中用于创建应用程序顶部栏的组件#xff0c;它遵循 Material Design 规范。
参数#xff1a;
参数名称类型描述titleWidget设置 AppBar 中的标题文本或自定义标题小部件。automaticallyImplyLeadingbool决定是否自动添加返回按钮#xff08;如果页面不是…AppBar 是 Flutter 中用于创建应用程序顶部栏的组件它遵循 Material Design 规范。
参数
参数名称类型描述titleWidget设置 AppBar 中的标题文本或自定义标题小部件。automaticallyImplyLeadingbool决定是否自动添加返回按钮如果页面不是首页。leadingWidget设置 AppBar 左侧的控件如菜单图标或自定义小部件。actionsListWidget设置 AppBar 右侧的操作按钮列表。elevationdouble定义 AppBar 下方阴影的高度。centerTitlebool决定 title 是否居中显示默认值根据平台而异。backgroundColorColor设置 AppBar 的背景颜色。foregroundColorColor设置 AppBar 内部元素的颜色例如标题和操作按钮的颜色。shadowColorColor设置 AppBar 阴影的颜色。surfaceTintColorColor设置 AppBar 表面高光的颜色。toolbarHeightdouble设置 AppBar 的总高度。bottomPreferredSizeWidget设置 AppBar 底部的小部件如 TabBar。shapeShapeBorder定义 AppBar 的形状例如圆角矩形等。iconThemeIconThemeData用于定义 AppBar 内部图标的样式。primarybool指示此 AppBar 是否是屏幕的主要工具栏。titleSpacingdouble定义 title 周围的间距。
代码示例
class MyHomePage extends StatefulWidget {const MyHomePage({super.key});overrideStateMyHomePage createState() _MyHomePageState();
}class _MyHomePageState extends StateMyHomePage {//所有右侧行为按钮ListWidget actionList const [Icon(Icons.social_distance),SizedBox(width: 30,),Icon(Icons.cyclone),SizedBox(width: 30,),Icon(Icons.manage_accounts),SizedBox(width: 40,)];overrideWidget build(BuildContext context) {return Scaffold(appBar: AppBar(backgroundColor: Theme.of(context).colorScheme.inversePrimary, //背景颜色foregroundColor: const Color.fromARGB(135, 226, 5, 255),leading: const Icon(Icons.accessibility_new_rounded), //左侧按钮title: const Text(Flutter 示例), //标题actions: actionList, //右侧按钮elevation: 10, //下方阴影shadowColor: const Color.fromARGB(136, 0, 225, 255), //阴影颜色centerTitle: true, // 标题是否居中ios默认居中Android默认居左surfaceTintColor: const Color.fromARGB(172, 249, 128, 0), //表面颜色toolbarHeight: 45, //顶部栏高度iconTheme: const IconThemeData(size: 30, color: Color.fromARGB(207, 255, 251, 0)), //控制内部元素样式primary: true, // 是否显示主要按钮titleSpacing: 100, //标题内边距bottom: const TabBar(tabs: [Tab(icon: Icon(Icons.directions_car)),Tab(icon: Icon(Icons.directions_transit)),Tab(icon: Icon(Icons.directions_bike)),]), //顶部栏底部按钮shape:const RoundedRectangleBorder(borderRadius: BorderRadius.vertical(bottom: Radius.circular(15)) //顶部栏底部按钮样式),), //顶部栏body: Center(child: ListView(children: [],),),);}
}效果