Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/sql-server-2005/2.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 切换到其他屏幕时抖动黑屏_Flutter_Dart - Fatal编程技术网

Flutter 切换到其他屏幕时抖动黑屏

Flutter 切换到其他屏幕时抖动黑屏,flutter,dart,Flutter,Dart,我在《颤栗》中制作了第二个屏幕。我有我的主飞镖,我的一月飞镖和我的年鉴,飞镖。 我想从一月份的屏幕切换到一年的屏幕 但是当我想切换到YearScreen屏幕时,屏幕会变成黑色 一小时前,它使用相同的代码工作。 有没有人有这方面的经验 主飞镖 import 'package:flutter/material.dart'; import 'package:flutter_calendar/January.dart'; void main() { runApp(Calendar()); }

我在《颤栗》中制作了第二个屏幕。我有我的主飞镖,我的一月飞镖和我的年鉴,飞镖。 我想从一月份的屏幕切换到一年的屏幕

但是当我想切换到YearScreen屏幕时,屏幕会变成黑色

一小时前,它使用相同的代码工作。 有没有人有这方面的经验

主飞镖


import 'package:flutter/material.dart';
import 'package:flutter_calendar/January.dart';

void main() {
  runApp(Calendar());
}

class Calendar extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(debugShowCheckedModeBanner: false,
        home: JanuaryScreen());
  }
}

一月,达特


import 'package:flutter/material.dart';
import 'package:flutter_calendar/YearScreen.dart';

class JanuaryScreen extends StatefulWidget {
  @override
  _JanuaryScreenState createState() => _JanuaryScreenState();
}
class _JanuaryScreenState extends State<JanuaryScreen> {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
        debugShowCheckedModeBanner: false,
        home: Scaffold(
          floatingActionButton: Stack(children: [
            Positioned(
                top: 300,
                left: 285,
                child: SizedBox(
                    height: 60,
                    width: 101,
                    child: FloatingActionButton.extended(
                      onPressed: () {
                        Navigator.push(context,
                            MaterialPageRoute(builder: (context) {
                              return YearScreen();
                            }));
                      },
                      elevation: 0,
                      isExtended: true,
                      backgroundColor: Colors.black,
                      splashColor: Colors.blueGrey,
                      highlightElevation: 0,
                      label: Text("J"),
                    ))),
        Positioned(
        top: 600,
            right: 285,
            child: SizedBox(
                height: 60,
                width: 101,
                child: FloatingActionButton.extended(
                  onPressed: () {
                    Navigator.push(context,
                        MaterialPageRoute(builder: (context) {
                          return YearScreen();
                        }));
                  },
                  elevation: 0,
                  isExtended: true,
                  backgroundColor: Colors.black,
                  splashColor: Colors.blueGrey,
                  highlightElevation: 0,
                  label: Text("2020"),
                )))
          ]),
          backgroundColor: Colors.blueGrey,
          appBar: PreferredSize(
            preferredSize: Size.fromHeight(65.0),
            child: AppBar(
              backgroundColor: Colors.blueGrey,
              elevation: 0.0,
              title: Transform(
                transform: Matrix4.translationValues(-85.0, 0.0, 0.0),
                child: Text(
                  "January",
                  style: TextStyle(fontSize: 50),
                ),
              ),
            ),),
            body: ListView(
              children: [
                RaisedButton(
                  child: Text(
                    "1",
                    style: TextStyle(fontSize: 130),
                  ),
                  color: Colors.blueGrey,
                  splashColor: Colors.transparent,
                  elevation: 0,
                  onPressed: () {
                    print("j");
                  },
                ),
                RaisedButton(
                  child: Text(
                    "2",
                    style: TextStyle(fontSize: 130),
                  ),
                  color: Colors.blueGrey,
                  splashColor: Colors.transparent,
                  elevation: 0,
                  onPressed: () {
                    print("2021");
                  },
                ),
                RaisedButton(
                  child: Text(
                    "3",
                    style: TextStyle(fontSize: 130),
                  ),
                  color: Colors.blueGrey,
                  splashColor: Colors.transparent,
                  elevation: 0,
                  onPressed: () {
                    print("j");
                  },
                ),
                RaisedButton(
                  child: Text(
                    "4",
                    style: TextStyle(fontSize: 130),
                  ),
                  color: Colors.blueGrey,
                  splashColor: Colors.transparent,
                  elevation: 0,
                  onPressed: () {
                    print("2021");
                  },
                ),
                RaisedButton(
                  child: Text(
                    "5",
                    style: TextStyle(fontSize: 130),
                  ),
                  color: Colors.blueGrey,
                  splashColor: Colors.transparent,
                  elevation: 0,
                  onPressed: () {
                    print("j");
                  },
                ),
                RaisedButton(
                  child: Text(
                    "6",
                    style: TextStyle(fontSize: 130),
                  ),
                  color: Colors.blueGrey,
                  splashColor: Colors.transparent,
                  elevation: 0,
                  onPressed: () {
                    print("2021");
                  },
                ),
                RaisedButton(
                  child: Text(
                    "7",
                    style: TextStyle(fontSize: 130),
                  ),
                  color: Colors.blueGrey,
                  splashColor: Colors.transparent,
                  elevation: 0,
                  onPressed: () {
                    print("j");
                  },
                ),
                RaisedButton(
                  child: Text(
                    "8",
                    style: TextStyle(fontSize: 130),
                  ),
                  color: Colors.blueGrey,
                  splashColor: Colors.transparent,
                  elevation: 0,
                  onPressed: () {
                    print("2021");
                  },
                ),
                RaisedButton(
                  child: Text(
                    "9",
                    style: TextStyle(fontSize: 130),
                  ),
                  color: Colors.blueGrey,
                  splashColor: Colors.transparent,
                  elevation: 0,
                  onPressed: () {
                    print("j");
                  },
                ),
                RaisedButton(
                  child: Text(
                    "10",
                    style: TextStyle(fontSize: 130),
                  ),
                  color: Colors.blueGrey,
                  splashColor: Colors.transparent,
                  elevation: 0,
                  onPressed: () {
                    print("2021");
                  },
                ),
                RaisedButton(
                  child: Text(
                    "11",
                    style: TextStyle(fontSize: 130),
                  ),
                  color: Colors.blueGrey,
                  splashColor: Colors.transparent,
                  elevation: 0,
                  onPressed: () {
                    print("j");
                  },
                ),
                RaisedButton(
                  child: Text(
                    "12",
                    style: TextStyle(fontSize: 130),
                  ),
                  color: Colors.blueGrey,
                  splashColor: Colors.transparent,
                  elevation: 0,
                  onPressed: () {
                    print("2021");
                  },
                ),
                RaisedButton(
                  child: Text(
                    "13",
                    style: TextStyle(fontSize: 130),
                  ),
                  color: Colors.blueGrey,
                  splashColor: Colors.transparent,
                  elevation: 0,
                  onPressed: () {
                    print("j");
                  },
                ),
                RaisedButton(
                  child: Text(
                    "14",
                    style: TextStyle(fontSize: 130),
                  ),
                  color: Colors.blueGrey,
                  splashColor: Colors.transparent,
                  elevation: 0,
                  onPressed: () {
                    print("2021");
                  },
                ),
                RaisedButton(
                  child: Text(
                    "15",
                    style: TextStyle(fontSize: 130),
                  ),
                  color: Colors.blueGrey,
                  splashColor: Colors.transparent,
                  elevation: 0,
                  onPressed: () {
                    print("j");
                  },
                ),
                RaisedButton(
                  child: Text(
                    "16",
                    style: TextStyle(fontSize: 130),
                  ),
                  color: Colors.blueGrey,
                  splashColor: Colors.transparent,
                  elevation: 0,
                  onPressed: () {
                    print("2021");
                  },
                ),
                RaisedButton(
                  child: Text(
                    "17",
                    style: TextStyle(fontSize: 130),
                  ),
                  color: Colors.blueGrey,
                  splashColor: Colors.transparent,
                  elevation: 0,
                  onPressed: () {
                    print("j");
                  },
                ),
                RaisedButton(
                  child: Text(
                    "18",
                    style: TextStyle(fontSize: 130),
                  ),
                  color: Colors.blueGrey,
                  splashColor: Colors.transparent,
                  elevation: 0,
                  onPressed: () {
                    print("2021");
                  },
                ),
                RaisedButton(
                  child: Text(
                    "19",
                    style: TextStyle(fontSize: 130),
                  ),
                  color: Colors.blueGrey,
                  splashColor: Colors.transparent,
                  elevation: 0,
                  onPressed: () {
                    print("j");
                  },
                ),
                RaisedButton(
                  child: Text(
                    "20",
                    style: TextStyle(fontSize: 130),
                  ),
                  color: Colors.blueGrey,
                  splashColor: Colors.transparent,
                  elevation: 0,
                  onPressed: () {
                    print("2021");
                  },
                ),
                RaisedButton(
                  child: Text(
                    "21",
                    style: TextStyle(fontSize: 130),
                  ),
                  color: Colors.blueGrey,
                  splashColor: Colors.transparent,
                  elevation: 0,
                  onPressed: () {
                    print("j");
                  },
                ),
                RaisedButton(
                  child: Text(
                    "22",
                    style: TextStyle(fontSize: 130),
                  ),
                  color: Colors.blueGrey,
                  splashColor: Colors.transparent,
                  elevation: 0,
                  onPressed: () {
                    print("2021");
                  },
                ),
                RaisedButton(
                  child: Text(
                    "23",
                    style: TextStyle(fontSize: 130),
                  ),
                  color: Colors.blueGrey,
                  splashColor: Colors.transparent,
                  elevation: 0,
                  onPressed: () {
                    print("j");
                  },
                ),
                RaisedButton(
                  child: Text(
                    "24",
                    style: TextStyle(fontSize: 130),
                  ),
                  color: Colors.blueGrey,
                  splashColor: Colors.transparent,
                  elevation: 0,
                  onPressed: () {
                    print("2021");
                  },
                ),
                RaisedButton(
                  child: Text(
                    "25",
                    style: TextStyle(fontSize: 130),
                  ),
                  color: Colors.blueGrey,
                  splashColor: Colors.transparent,
                  elevation: 0,
                  onPressed: () {
                    print("j");
                  },
                ),
                RaisedButton(
                  child: Text(
                    "26",
                    style: TextStyle(fontSize: 130),
                  ),
                  color: Colors.blueGrey,
                  splashColor: Colors.transparent,
                  elevation: 0,
                  onPressed: () {
                    print("2021");
                  },
                ),
                RaisedButton(
                  child: Text(
                    "27",
                    style: TextStyle(fontSize: 130),
                  ),
                  color: Colors.blueGrey,
                  splashColor: Colors.transparent,
                  elevation: 0,
                  onPressed: () {
                    print("j");
                  },
                ),
                RaisedButton(
                  child: Text(
                    "28",
                    style: TextStyle(fontSize: 130),
                  ),
                  color: Colors.blueGrey,
                  splashColor: Colors.transparent,
                  elevation: 0,
                  onPressed: () {
                    print("2021");
                  },
                ),
                RaisedButton(
                  child: Text(
                    "29",
                    style: TextStyle(fontSize: 130),
                  ),
                  color: Colors.blueGrey,
                  splashColor: Colors.transparent,
                  elevation: 0,
                  onPressed: () {
                    print("j");
                  },
                ),
                RaisedButton(
                  child: Text(
                    "30",
                    style: TextStyle(fontSize: 130),
                  ),
                  color: Colors.blueGrey,
                  splashColor: Colors.transparent,
                  elevation: 0,
                  onPressed: () {
                    print("2021");
                  },
                ),
                RaisedButton(
                  child: Text(
                    "31",
                    style: TextStyle(fontSize: 130),
                  ),
                  color: Colors.blueGrey,
                  splashColor: Colors.transparent,
                  elevation: 0,
                  onPressed: () {
                    print("j");
                  },
                ),
              ],
              itemExtent: 211.89,
            ),
          ),
        );
  }
}


进口“包装:颤振/材料.省道”;
导入“包:flift_日历/年屏幕.dart”;
类JanuaryScreen扩展StatefulWidget{
@凌驾
_JanuaryScreenState createState()=>\u JanuaryScreenState();
}
类别(1月份州扩展){
@凌驾
小部件构建(构建上下文){
返回材料PP(
debugShowCheckedModeBanner:false,
家:脚手架(
floatingActionButton:堆栈(子项:[
定位(
排名:300,
左:285,
孩子:大小盒子(
身高:60,
宽度:101,
子级:FloatingActionButton.extended(
已按下:(){
Navigator.push(上下文,
MaterialPage路线(生成器:(上下文){
返回屏幕();
}));
},
海拔:0,
扩展:是的,
背景颜色:Colors.black,
颜色:颜色。蓝灰色,
Highlight标高:0,
标签:文本(“J”),
))),
定位(
排名:600,
右:285,
孩子:大小盒子(
身高:60,
宽度:101,
子级:FloatingActionButton.extended(
已按下:(){
Navigator.push(上下文,
MaterialPage路线(生成器:(上下文){
返回屏幕();
}));
},
海拔:0,
扩展:是的,
背景颜色:Colors.black,
颜色:颜色。蓝灰色,
Highlight标高:0,
标签:文本(“2020”),
)))
]),
背景颜色:颜色。蓝灰色,
appBar:首选大小(
首选尺寸:从高度开始的尺寸(65.0),
孩子:AppBar(
背景颜色:颜色。蓝灰色,
标高:0.0,
标题:转变(
变换:矩阵4.translationValue(-85.0,0.0,0.0),
子:文本(
“一月”,
样式:TextStyle(字体大小:50),
),
),
),),
正文:ListView(
儿童:[
升起的按钮(
子:文本(
"1",
样式:TextStyle(字体大小:130),
),
颜色:颜色。蓝灰色,
splashColor:Colors.transparent,
海拔:0,
已按下:(){
印刷品(“j”);
},
),
升起的按钮(
子:文本(
"2",
样式:TextStyle(字体大小:130),
),
颜色:颜色。蓝灰色,
splashColor:Colors.transparent,
海拔:0,
已按下:(){
印刷品(“2021”);
},
),
升起的按钮(
子:文本(
"3",
样式:TextStyle(字体大小:130),
),
颜色:颜色。蓝灰色,
splashColor:Colors.transparent,
海拔:0,
已按下:(){
印刷品(“j”);
},
),
升起的按钮(
子:文本(
"4",
样式:TextStyle(字体大小:130),
),
颜色:颜色。蓝灰色,
splashColor:Colors.transparent,
海拔:0,
已按下:(){
印刷品(“2021”);
},
),
升起的按钮(
子:文本(
"5",
样式:TextStyle(字体大小:130),
),
颜色:颜色。蓝灰色,
splashColor:Colors.transparent,
海拔:0,
已按下:(){
印刷品(“j”);
},
),
升起的按钮(
子:文本(
"6",
样式:TextStyle(字体大小:130),
),
颜色:颜色。蓝灰色,
splashColor:Colors.transparent,
海拔:0,
已按下:(){
印刷品(“2021”);
},
),
升起的按钮(
子:文本(
"7",
样式:TextStyle(字体大小:130),
),
颜色:颜色。蓝灰色,
splashColor:Colors.transparent,
海拔:0,
已按下:(){
印刷品(“j”);
},
),
升起的按钮(
子:文本(
"8",
样式:TextStyle(字体大小:130),
),
颜色:颜色。蓝灰色,
splashColor:Colors.transparent,
海拔:0,
已按下:(){

import 'package:flutter/material.dart';
import 'package:flutter_calendar/January.dart';






class YearScreen extends StatefulWidget {
  @override
  _YearScreenState createState() => _YearScreenState();
}










class _YearScreenState extends State<YearScreen> {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      home: Scaffold(
        backgroundColor: Colors.blueGrey,
        body: ListView(
            children: [
              RaisedButton(
                child: Text(
                  "2020",
                  style: TextStyle(fontSize: 130),
                ),
                color: Colors.blueGrey,
                elevation: 0,
                splashColor: Colors.transparent,
                onPressed: () {
                  Navigator.push(context,
                      MaterialPageRoute(builder: (context) {
                        return JanuaryScreen();
                      }));
                },
              ),
              RaisedButton(
                child: Text(
                  "2021",
                  style: TextStyle(fontSize: 130),
                ),
                color: Colors.blueGrey,
                elevation: 0,
                splashColor: Colors.transparent,
                onPressed: () {
                  print("2021");
                },
              ),
              RaisedButton(
                child: Text(
                  "2022",
                  style: TextStyle(fontSize: 130),
                ),
                color: Colors.blueGrey,
                elevation: 0,
                splashColor: Colors.transparent,
                onPressed: () {
                  print("2022");
                },
              ),
              RaisedButton(
                child: Text(
                  "2023",
                  style: TextStyle(fontSize: 130),
                ),
                color: Colors.blueGrey,
                elevation: 0,
                splashColor: Colors.transparent,
                onPressed: () {
                  print("2023");
                },
              ),
              RaisedButton(
                child: Text(
                  "2024",
                  style: TextStyle(fontSize: 130),
                ),
                color: Colors.blueGrey,
                elevation: 0,
                splashColor: Colors.transparent,
                onPressed: () {
                  print("2024");
                },
              ),
              RaisedButton(
                child: Text(
                  "2025",
                  style: TextStyle(fontSize: 130),
                ),
                color: Colors.blueGrey,
                elevation: 0,
                splashColor: Colors.transparent,
                onPressed: () {
                  print("2025");
                },
              ),
              RaisedButton(
                child: Text(
                  "2026",
                  style: TextStyle(fontSize: 130),
                ),
                onPressed: () {
                  print("2026");
                },
                color: Colors.blueGrey,
                elevation: 0,
                splashColor: Colors.transparent,
              ),
              RaisedButton(
                child: Text(
                  "2027",
                  style: TextStyle(fontSize: 130),
                ),
                onPressed: () {
                  print("2027");
                },
                color: Colors.blueGrey,
                elevation: 0,
                splashColor: Colors.transparent,
              ),
              RaisedButton(
                child: Text(
                  "2028",
                  style: TextStyle(fontSize: 130),
                ),
                onPressed: () {
                  print("2028");
                },
                color: Colors.blueGrey,
                elevation: 0,
                splashColor: Colors.transparent,
              ),
              RaisedButton(
                child: Text(
                  "2029",
                  style: TextStyle(fontSize: 130),
                ),
                onPressed: () {
                  print("2029");
                },
                color: Colors.blueGrey,
                elevation: 0,
                splashColor: Colors.transparent,
              ),
              RaisedButton(
                child: Text(
                  "2030",
                  style: TextStyle(fontSize: 130),
                ),
                color: Colors.blueGrey,
                elevation: 0,
                splashColor: Colors.transparent,
                onPressed: () {
                  print("2030");
                },
              ),
            ],
            itemExtent: 300,
      ),
    ),);
  }
  }