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 抖动底部溢出99469像素的RenderFlex_Flutter_Dart - Fatal编程技术网

Flutter 抖动底部溢出99469像素的RenderFlex

Flutter 抖动底部溢出99469像素的RenderFlex,flutter,dart,Flutter,Dart,我是一个新手,尝试解决以下问题,在第一个屏幕截图中,我将labelStart line 127的值设置为1.21,当我使用变量传递该值时,我得到renderflex error,如果我使用硬编码,我不会得到任何错误。不知道我做错了什么。我在网上读了几篇帖子后,试着添加了Expanded,但没用。有人能告诉我我在这里犯了什么错误吗 class _ListPageState extends State<ListPage> with SingleTickerProviderStateMix

我是一个新手,尝试解决以下问题,在第一个屏幕截图中,我将labelStart line 127的值设置为1.21,当我使用变量传递该值时,我得到renderflex error,如果我使用硬编码,我不会得到任何错误。不知道我做错了什么。我在网上读了几篇帖子后,试着添加了Expanded,但没用。有人能告诉我我在这里犯了什么错误吗

class _ListPageState extends State<ListPage> with SingleTickerProviderStateMixin {
  List<MusicModel> _list;
  var _value;
  int _playId;
  String _playURL;
  bool isPlaying = false;
  String _startTime;
  String _endTime;
  AnimationController _controller;
  AudioPlayer _audioPlayer = AudioPlayer();
  @override
  void initState() {
    _playId = 0;    
    _list = MusicModel.list;   
    _controller = AnimationController(vsync: this,duration: Duration(microseconds: 250));
    _value = 0.0; 
    _startTime="0.0";
    _endTime="0.0";
    super.initState();   
    _audioPlayer.onAudioPositionChanged.listen((Duration duration) {
      setState(() {
        _startTime = duration.toString().split(".")[0];
      });
    });
    _audioPlayer.onDurationChanged.listen((Duration duration) {
      setState(() {
        _endTime = duration.toString().split(".")[0];
      });
    });


  }  


  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        elevation: 0,
        backgroundColor: AppColors.mainColor,
        centerTitle: true,
        title: Text("Skin - Flume", 
        style: TextStyle(color: AppColors.styleColor),),
      ),

      backgroundColor: AppColors.mainColor,
      body: Stack(
          children: <Widget>[
            Column(
            children: <Widget>[
              Padding(
                padding: const EdgeInsets.all(24.0),
                child: Row(
                  mainAxisAlignment: MainAxisAlignment.spaceBetween,
                  children: <Widget>[
                    CustomButtonWidget(
                      child: Icon(
                        Icons.favorite,
                        color: AppColors.styleColor,                        
                      ),
                      size: 50,
                      onTap: (){

                      },
                    ),
                    CustomButtonWidget(                      
                      image: 'assets/logo.jpg',
                      size: 100,
                      borderWidth: 5,
                      onTap: (){
                        Navigator.of(context).push(
                            MaterialPageRoute(builder: (_) => DetailPage(),
                          ),
                        );
                      },
                    ),
                    CustomButtonWidget(
                      child: Icon(
                        Icons.menu,
                        color: AppColors.styleColor,                        
                      ),
                      size: 50,
                      onTap: (){
                        Navigator.of(context).push(
                            MaterialPageRoute(builder: (_) => HomePage(),
                          ),
                        );
                      },
                    )  
                  ],
                ),
              ),
              //Progress bar section
              // Expanded(child: SizedBox()),

              Padding(
                padding: const EdgeInsets.symmetric(horizontal: 24),
                child: CustomProgressWidget(
                  value: _value,
                  labelStart: "1.21",
                  labelend: "2.34",
                ),
              ),
              // Expanded(child: SizedBox()),


              Expanded( //This is added so we can see overlay else this will be over button

                  child: ListView.builder(
                    physics: BouncingScrollPhysics(),//This line removes the dark flash when you are at the begining or end of list menu. Just uncomment for
                    itemCount: _list.length,
                    padding: EdgeInsets.all(12),
                    itemBuilder: (context,index){
                      return GestureDetector(
                          onTap: (){
                            Navigator.of(context).push(
                                MaterialPageRoute(builder: (_) => DetailPage(),
                              ),
                            );
                          },
                          child: AnimatedContainer(
                          duration: Duration(milliseconds: 500),
                          //This below code will change the color of sected area or song being played.
                          decoration: BoxDecoration(
                            color: _list[index].id ==  _playId
                                  ? AppColors.activeColor
                                  : AppColors.mainColor,
                                  borderRadius: BorderRadius.all(
                                    Radius.circular(20),
                                  ),
                          ),
                          //End of row color change
                          child: Padding(
                            padding: const EdgeInsets.all(16), //This will all padding around all size
                            child: Row(
                              mainAxisAlignment: MainAxisAlignment.spaceBetween, //This will allign button to left, else button will be infront of name
                              children: <Widget>[
                                Column(
                                  crossAxisAlignment: CrossAxisAlignment.start,
                                  children: <Widget>[
                                    Text(
                                        _list[index].title,
                                        style: TextStyle(
                                          color: AppColors.styleColor,
                                          fontSize: 16,
                                        ),
                                      ),
                                    Text(
                                        _list[index].album,
                                        style: TextStyle(
                                          color: AppColors.styleColor.withAlpha(90),
                                          fontSize: 16,
                                        ),
                                      ),
                                  ],
                                ),
                                CustomButtonWidget( //This is Play button functionality on list page. 
                                  child: Icon(
                                    _list[index].id == _playId
                                      ? Icons.pause
                                      : Icons.play_arrow,
                                    color: _list[index].id == _playId
                                      ? Colors.white
                                      : AppColors.styleColor,
                                    ),
                                  size: 50,
                                  isActive: _list[index].id == _playId,
                                  onTap: () async {                                       
                                    if (isPlaying){                                       
                                      if (_playId == _list[index].id){                                        
                                        int status = await _audioPlayer.pause();
                                        if (status == 1){
                                          setState(() {
                                            isPlaying = false;
                                          }); 
                                        }
                                      } else {
                                        _playId = _list[index].id;
                                        _playURL = _list[index].songURL;
                                        _audioPlayer.stop();  
                                        int status = await _audioPlayer.play(_playURL);
                                        if (status == 1){
                                          setState(() {
                                            isPlaying = true;
                                          }); 
                                        } 
                                      }
                                      //  int status = await _audioPlayer.pause();
                                      //   if (status == 1){
                                      //     setState(() {
                                      //       isPlaying = false;
                                      //     }); 
                                      //   } 
                                    }  else {
                                      _playId = _list[index].id;
                                      _playURL = _list[index].songURL;
                                       int status = await _audioPlayer.play(_playURL);
                                        if (status == 1){
                                          setState(() {
                                            isPlaying = true;
                                          }); 
                                        } 
                                    } // String filePath = await FilePicker.getFilePath();            

                                  },
                                  // onTap: (){
                                  //   setState(() {
                                  //     _playId = _list[index].id;                                      
                                  //   });
                                  // },
                                )
                              ],
                            ),
                          ),  
                        ),
                      );
                    },
                  ),
              )
            ],        
          ),
          Align(
            alignment: Alignment.bottomCenter,
              child: Container(
              height: 50,
              decoration: BoxDecoration(
                gradient: LinearGradient(
                  colors: [
                    AppColors.mainColor.withAlpha(0),
                    AppColors.mainColor,
                  ],
                  begin: Alignment.topCenter,
                  end: Alignment.bottomCenter,
                )
              ),
            ),
          )
        ],

      ),

    );
  }
}
class\u ListPageState使用SingleTickerProviderStateMixin扩展状态{
列表(u List),;
var_值;
int_playId;
字符串playURL;
布尔显示=假;
字符串开始时间;
字符串_endTime;
动画控制器_控制器;
AudioPlayer_AudioPlayer=AudioPlayer();
@凌驾
void initState(){
_playId=0;
_list=MusicModel.list;
_controller=AnimationController(vsync:this,duration:duration(微秒:250));
_数值=0.0;
_startTime=“0.0”;
_endTime=“0.0”;
super.initState();
_audioPlayer.onAudioPositionChanged.listen((持续时间){
设置状态(){
_startTime=duration.toString().split(“.”[0];
});
});
_audioPlayer.onDurationChanged.listen((持续时间){
设置状态(){
_endTime=duration.toString().split(“.”[0];
});
});
}  
@凌驾
小部件构建(构建上下文){
返回脚手架(
appBar:appBar(
海拔:0,
背景颜色:AppColors.mainColor,
标题:对,
标题:文本(“皮肤-水槽”,
样式:TextStyle(颜色:AppColors.styleColor),),
),
背景颜色:AppColors.mainColor,
主体:堆栈(
儿童:[
纵队(
儿童:[
填充物(
填充:常数边集全部(24.0),
孩子:排(
mainAxisAlignment:mainAxisAlignment.spaceBetween,
儿童:[
自定义按钮隐藏(
子:图标(
我的最爱,
颜色:AppColors.styleColor,
),
尺码:50,
onTap:(){
},
),
自定义按钮Widget(
图片:“assets/logo.jpg”,
尺码:100,
边框宽度:5,
onTap:(){
导航器.of(上下文).push(
MaterialPage路线(生成器:()=>DetailPage(),
),
);
},
),
自定义按钮隐藏(
子:图标(
图标菜单,
颜色:AppColors.styleColor,
),
尺码:50,
onTap:(){
导航器.of(上下文).push(
MaterialPackageRoute(生成器:()=>HomePage(),
),
);
},
)  
],
),
),
//进度条部分
//已展开(子项:SizedBox()),
填充物(
填充:常量边集。对称(水平:24),
子组件:CustomProgressWidget(
值:_值,
labelStart:“1.21”,
标签:“2.34”,
),
),
//已展开(子项:SizedBox()),
Expanded(//这是添加的,以便我们可以看到覆盖,否则这将结束按钮
子项:ListView.builder(
physics:BouncingScrollPhysics(),//当您处于列表的开始或结束菜单时,此行将删除暗闪光。只需取消注释即可
itemCount:_list.length,
填充:边缘设置。全部(12),
itemBuilder:(上下文,索引){
返回手势检测器(
onTap:(){
导航器.of(上下文).push(
MaterialPage路线(生成器:()=>DetailPage(),
),
);
},
子:动画容器(
持续时间:持续时间(毫秒:500),
//下面的代码将更改正在播放的分区区域或歌曲的颜色。
装饰:盒子装饰(
颜色:_列表[索引].id=\u播放id
?AppColors.activeColor
:AppColors.mainColor,
borderRadius:borderRadius.all(
圆形半径(20),
),
),
//行结束颜色更改
孩子:填充(
padding:const-EdgeInsets.all(16),//这将在所有大小上填充所有内容
孩子:排(
mainAxisAlignment:mainAxisAlignment.spaceBetween,//这将向左对齐按钮,否则按钮将位于名称前面
儿童:[
纵队(
crossAxisAlignment:crossAxisAlignment.start,
儿童:[
正文(
_列表[索引]。标题,
样式:TextStyle(
颜色:AppColors.styleColor,
尺寸:16,
GetX<UserController>(
          builder: (_){
               
              return Text(_.user.name);

            }
          },
        ),
GetX<UserController>(
          builder: (_){
            
            if(_.user.email != null){
              return Text(_.user.name);

            }else{
              return Text('Loading....');
            }
          },
        ),