Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/flutter/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/dart/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Flutter 在这种情况下,使appbar透明_Flutter_Dart_Flutter Layout_Transparent_Appbar - Fatal编程技术网

Flutter 在这种情况下,使appbar透明

Flutter 在这种情况下,使appbar透明,flutter,dart,flutter-layout,transparent,appbar,Flutter,Dart,Flutter Layout,Transparent,Appbar,伙计们! 我正在尝试使此AppBar透明。因为它背后会有一个背景,但到目前为止我还没有成功。谢谢大家,谢谢大家 class _HomePageState extends State<HomePage> { int index = 0; Widget build(BuildContext context) { return Scaffold( body: show(index), appBar: AppBar( backgroun

伙计们! 我正在尝试使此AppBar透明。因为它背后会有一个背景,但到目前为止我还没有成功。谢谢大家,谢谢大家

class _HomePageState extends State<HomePage> {
  int index = 0;
  Widget build(BuildContext context) {
    return Scaffold(
      body: show(index),
      appBar: AppBar(
        backgroundColor: Colors.transparent,
        actions: <Widget>[
          IconButton(
            icon: Icon(Icons.settings),
            onPressed: (){},
          )
        ],
      ),
      bottomNavigationBar: Theme(
        data: Theme.of(context).copyWith(
          canvasColor: Colors.grey[900],
        ),
        child: BottomNavigationBar(
          type: BottomNavigationBarType.fixed,
          currentIndex: index,
          showUnselectedLabels: true,
          unselectedItemColor: Colors.white54,
          selectedItemColor: Colors.white,
          onTap: ((int x) {
            setState(() {
              index = x;
            });
          }),
          items: [
            new BottomNavigationBarItem(
                icon: Icon(Icons.home), title: Text("Home")),
            new BottomNavigationBarItem(
                icon: Icon(Icons.search), title: Text("Search")),
            new BottomNavigationBarItem(
                icon: Icon(Icons.library_music), title: Text("Library")),
          ],
        ),
      ),
    );
  }
}
class\u HomePageState扩展状态{
int指数=0;
小部件构建(构建上下文){
返回脚手架(
正文:显示(索引),
appBar:appBar(
背景颜色:颜色。透明,
行动:[
图标按钮(
图标:图标(图标.设置),
按下:(){},
)
],
),
底部导航栏:主题(
数据:Theme.of(context).copyWith(
画布颜色:颜色。灰色[900],
),
子项:底部导航栏(
类型:BottomNavigationBarType.fixed,
当前索引:索引,
showUnselectedLabels:true,
unselectedItemColor:Colors.white54,
选择编辑颜色:Colors.white,
onTap:((int x){
设置状态(){
指数=x;
});
}),
项目:[
新海底导航气压计(
图标:图标(Icons.home),标题:文本(“home”),
新海底导航气压计(
图标:图标(Icons.search),标题:文本(“search”),
新海底导航气压计(
图标:图标(Icons.library_music),标题:文本(“library”),
],
),
),
);
}
}

从以下代码(源代码)获取提示

@覆盖
小部件构建(构建上下文){
返回脚手架(
主体:堆栈(
儿童:[
容器(
装饰:盒子装饰(
图像:装饰图像(
图片:NetworkImage(
'https://images.unsplash.com/photo-1517030330234-94c4fb948ebc?ixlib=rb-1.2.1&ixid=eyjhcbfawqiojeymdd9&auto=format&fit=crop&w=1275&q=80’,
适合:BoxFit.cover,
),
),
儿童:中心(
子:文本(
“mrflatter.com”,
样式:TextStyle(
颜色:颜色,白色,
尺寸:30,
),
),
),
),
定位(
孩子:AppBar(
标题:文本(“透明AppBar”),
背景颜色:颜色。透明,
海拔:0,
行动:[
图标按钮(
图标:图标(Icons.share),
按下:(){},
工具提示:“共享”,
),
],
),
)
],
),
);
}

从以下代码(源代码)获取提示

@覆盖
小部件构建(构建上下文){
返回脚手架(
主体:堆栈(
儿童:[
容器(
装饰:盒子装饰(
图像:装饰图像(
图片:NetworkImage(
'https://images.unsplash.com/photo-1517030330234-94c4fb948ebc?ixlib=rb-1.2.1&ixid=eyjhcbfawqiojeymdd9&auto=format&fit=crop&w=1275&q=80’,
适合:BoxFit.cover,
),
),
儿童:中心(
子:文本(
“mrflatter.com”,
样式:TextStyle(
颜色:颜色,白色,
尺寸:30,
),
),
),
),
定位(
孩子:AppBar(
标题:文本(“透明AppBar”),
背景颜色:颜色。透明,
海拔:0,
行动:[
图标按钮(
图标:图标(Icons.share),
按下:(){},
工具提示:“共享”,
),
],
),
)
],
),
);
}

尝试将AppBar和您的Body部分包装在堆栈中,并将AppBar转换为Trasparent,以便获得所需的输出

class _HomePageState extends State<HomePage> {
  int index = 0;

  Widget build(BuildContext context) {
    return Scaffold(
      body: Stack(
        children: <Widget>[
          show(index),
          Wrap(
            children: <Widget>[
              AppBar(
                backgroundColor: Colors.transparent,
                actions: <Widget>[
                  IconButton(
                    icon: Icon(Icons.settings),
                    onPressed: () {},
                  )
                ],
              ),
            ],
          ),
        ],
      ),
      bottomNavigationBar: Theme(
        data: Theme.of(context).copyWith(
          canvasColor: Colors.grey[900],
        ),
        child: BottomNavigationBar(
          type: BottomNavigationBarType.fixed,
          currentIndex: index,
          showUnselectedLabels: true,
          unselectedItemColor: Colors.white54,
          selectedItemColor: Colors.white,
          onTap: ((int x) {
            setState(() {
              index = x;
            });
          }),
          items: [
            new BottomNavigationBarItem(
                icon: Icon(Icons.home), title: Text("Home")),
            new BottomNavigationBarItem(
                icon: Icon(Icons.search), title: Text("Search")),
            new BottomNavigationBarItem(
                icon: Icon(Icons.library_music), title: Text("Library")),
          ],
        ),
      ),
    );
  }
} 
class\u HomePageState扩展状态{
int指数=0;
小部件构建(构建上下文){
返回脚手架(
主体:堆栈(
儿童:[
显示(索引),
包裹(
儿童:[
AppBar(
背景颜色:颜色。透明,
行动:[
图标按钮(
图标:图标(图标.设置),
按下:(){},
)
],
),
],
),
],
),
底部导航栏:主题(
数据:Theme.of(context).copyWith(
画布颜色:颜色。灰色[900],
),
子项:底部导航栏(
类型:BottomNavigationBarType.fixed,
当前索引:索引,
showUnselectedLabels:true,
unselectedItemColor:Colors.white54,
选择编辑颜色:Colors.white,
onTap:((int x){
设置状态(){
指数=x;
});
}),
项目:[
新海底导航气压计(
图标:图标(Icons.home),标题:文本(“home”),
新海底导航气压计(
图标:图标(Icons.search),标题:文本(“search”),
新海底导航气压计(
图标:图标(Icons.library_music),标题:文本(“library”),
],
),
),
);
}
} 

尝试将AppBar和您的Body部分包装在堆栈中,并将AppBar转换为Trasparent,以便获得所需的输出

class _HomePageState extends State<HomePage> {
  int index = 0;

  Widget build(BuildContext context) {
    return Scaffold(
      body: Stack(
        children: <Widget>[
          show(index),
          Wrap(
            children: <Widget>[
              AppBar(
                backgroundColor: Colors.transparent,
                actions: <Widget>[
                  IconButton(
                    icon: Icon(Icons.settings),
                    onPressed: () {},
                  )
                ],
              ),
            ],
          ),
        ],
      ),
      bottomNavigationBar: Theme(
        data: Theme.of(context).copyWith(
          canvasColor: Colors.grey[900],
        ),
        child: BottomNavigationBar(
          type: BottomNavigationBarType.fixed,
          currentIndex: index,
          showUnselectedLabels: true,
          unselectedItemColor: Colors.white54,
          selectedItemColor: Colors.white,
          onTap: ((int x) {
            setState(() {
              index = x;
            });
          }),
          items: [
            new BottomNavigationBarItem(
                icon: Icon(Icons.home), title: Text("Home")),
            new BottomNavigationBarItem(
                icon: Icon(Icons.search), title: Text("Search")),
            new BottomNavigationBarItem(
                icon: Icon(Icons.library_music), title: Text("Library")),
          ],
        ),
      ),
    );
  }
} 
class\u HomePageState扩展状态{
int指数=0;
小部件构建(构建上下文){
返回脚手架(
主体:堆栈(
儿童:[
显示(索引),
包裹(
儿童:[
AppBar(
背景颜色:颜色。透明,
行动:[
偶像