Flutter 使用安全区域时,颤振无法固定底部溢出

Flutter 使用安全区域时,颤振无法固定底部溢出,flutter,dart,flutter-layout,Flutter,Dart,Flutter Layout,我试图用我的代码使用SafeArea,但当我旋转屏幕时,底部溢出的问题发生了。我试图通过使用SingleChildScrollView和ListView来修复它,但它不起作用。只有在使用其他代码时,我才不使用SafeArea。你能帮我解决这个问题吗 这就是问题所在 这是人像屏幕的图片 这是我在屏幕上显示细节的代码 class _DiaryDetailState extends State<DiaryDetail> { double xOffset = 0; //set X

我试图用我的代码使用SafeArea,但当我旋转屏幕时,底部溢出的问题发生了。我试图通过使用SingleChildScrollView和ListView来修复它,但它不起作用。只有在使用其他代码时,我才不使用SafeArea。你能帮我解决这个问题吗

这就是问题所在

这是人像屏幕的图片

这是我在屏幕上显示细节的代码

  class _DiaryDetailState extends State<DiaryDetail> {
  double xOffset = 0; //set X axis and Y axis
  double yOffset = 0;
  double scaleFactor = 1;
  bool isDrawerOpen = false;

  @override
  Widget build(BuildContext context) {
    var screenSize = MediaQuery.of(context).size;
    var width = screenSize.width;
    var height = screenSize.height;
    return 
    AnimatedContainer(
      decoration: BoxDecoration(
        color: Color(0xff1a3c5a),
        borderRadius: BorderRadius.circular(isDrawerOpen ? 40 : 0.0),
      ),
      transform: Matrix4.translationValues(xOffset, yOffset, 0)
        ..scale(scaleFactor),
      duration: Duration(milliseconds: 250),
      child: SafeArea(
        child: Column(
          children: <Widget>[
            Row(
              mainAxisAlignment: MainAxisAlignment.spaceBetween,
              children: [
                Row(
                  children: <Widget>[
                    isDrawerOpen
                        ? IconButton(
                            icon: Icon(
                              Icons.arrow_back_ios,
                              color: Color(0xffdac6a3),
                            ),
                            onPressed: () {
                              setState(
                                () {
                                  xOffset = 0;
                                  yOffset = 0;
                                  scaleFactor = 1;
                                  isDrawerOpen = false;
                                },
                              );
                            },
                          )
                        : IconButton(
                            icon: Icon(
                              Icons.menu,
                              color: Color(0xffdac6a3),
                            ),
                            onPressed: () {
                              setState(
                                () {
                                  xOffset = 230;
                                  yOffset = 150;
                                  scaleFactor = 0.6;
                                  isDrawerOpen = true;
                                },
                              );
                            },
                          ),
                    SizedBox(
                      width: 10,
                    ),
                    Text(
                      'My Diary',
                      style: TextStyle(
                        color: Colors.white,
                        fontSize: 25.0,
                        letterSpacing: 1.0,
                        fontWeight: FontWeight.bold,
                      ),
                    ),
                  ],
                ),
              ],
            ),
            SizedBox(
              height: 5,
            ),
            Expanded(
              child: Padding(
                padding: const EdgeInsets.only(left: 3, right: 3,),
                child: Container(
                  decoration: BoxDecoration(
                    color: Colors.white,
                    borderRadius: isDrawerOpen
                        ? BorderRadius.circular(40)
                        : BorderRadius.only(
                            topLeft: Radius.circular(60),
                            topRight: Radius.circular(60),
                          ),
                  ),
                  child: Container(
                    child: DiaryCalenda(),
                  ),
                ),
              ),
            ),
          ],
        ),
      ),
);
  }
}
class\u DiaryDetailState扩展状态{
double xOffset=0;//设置X轴和Y轴
双yOffset=0;
双尺度因子=1;
bool isDrawerOpen=false;
@凌驾
小部件构建(构建上下文){
var screenSize=MediaQuery.of(context).size;
var width=屏幕大小.width;
var height=屏幕大小.height;
返回
动画容器(
装饰:盒子装饰(
颜色:颜色(0xff1a3c5a),
边界半径:边界半径。圆形(isDrawerOpen?40:0.0),
),
转换:Matrix4.translationValues(xOffset,yOffset,0)
…比例(比例因子),
持续时间:持续时间(毫秒:250),
儿童:安全区(
子:列(
儿童:[
划船(
mainAxisAlignment:mainAxisAlignment.spaceBetween,
儿童:[
划船(
儿童:[
isDrawerOpen
?图标按钮(
图标:图标(
Icons.arrow\u back\u ios,
颜色:颜色(0xffdac6a3),
),
已按下:(){
设定状态(
() {
xOffset=0;
yOffset=0;
scaleFactor=1;
isDrawerOpen=false;
},
);
},
)
:图标按钮(
图标:图标(
图标菜单,
颜色:颜色(0xffdac6a3),
),
已按下:(){
设定状态(
() {
xOffset=230;
yOffset=150;
scaleFactor=0.6;
isDrawerOpen=true;
},
);
},
),
大小盒子(
宽度:10,
),
正文(
“我的日记”,
样式:TextStyle(
颜色:颜色,白色,
字体大小:25.0,
字母间距:1.0,
fontWeight:fontWeight.bold,
),
),
],
),
],
),
大小盒子(
身高:5,,
),
扩大(
孩子:填充(
填充:常量边集。仅限(左:3,右:3,),
子:容器(
装饰:盒子装饰(
颜色:颜色,白色,
边界半径:isDrawerOpen
?边界半径。圆形(40)
:仅限边界半径(
左上:半径。圆形(60),
右上角:半径。圆形(60),
),
),
子:容器(
孩子:DiaryCalenda(),
),
),
),
),
],
),
),
);
}
}
这是我的橙色盒子代码,当我旋转时,我遇到了一些问题。我认为这个问题可能是世界上的第一个“克隆”

          Expanded(
                child: Padding(
                  padding: const EdgeInsets.all(3.0),
                  child: Container(
                    // color: Colors.black,
                    decoration: BoxDecoration(
                      borderRadius: BorderRadius.circular(40),
                      color: Color(0xffdac6a3),
                    ),
                    child: Padding(
                      padding: const EdgeInsets.only(
                        top: 15,
                        left: 30,
                        right: 20,
                      ),
                      child:Column(
                        mainAxisSize: MainAxisSize.max,
                        crossAxisAlignment: CrossAxisAlignment.stretch,
                        children: <Widget>[
                          Row(
                            mainAxisAlignment: MainAxisAlignment.spaceBetween,
                            children: <Widget>[
                              _selectedToday
                                  ? Text(
                                      "Today",
                                      style: TextStyle(
                                        color: Colors.black,
                                        fontWeight: FontWeight.bold,
                                        fontSize: 25,
                                      ),
                                    )
                                  : Text(
                                      _showDate,
                                      style: TextStyle(
                                        color: Colors.black,
                                        fontWeight: FontWeight.bold,
                                        fontSize: 25,
                                      ),
                                    ),
                              Container(
                                height: 45,
                                width: 45,
                                decoration: BoxDecoration(
                                    color: Color(0xffecb45b),
                                    borderRadius: BorderRadius.circular(10)),
                                child: Center(
                                  child: IconButton(
                                    icon: Icon(
                                      Icons.add,
                                      color: Colors.black,
                                      size: 20,
                                    ),
                                    onPressed: () => Navigator.pushNamed(
                                        context, AddEventScreen.routeName),
                                  ),
                                ),
                              ),
                            ],
                          ),
                          Expanded(
                            child: Container(
                              child: ListView(
                                children: <Widget>[
                                  ..._selectedEvents.map(
                                    (event) => Container(
                                      height: 70,
                                      child: Padding(
                                        padding: const EdgeInsets.all(8.0),
                                        child: Row(
                                          mainAxisAlignment:
                                              MainAxisAlignment.spaceBetween,
                                          children: <Widget>[
                                            Row(
                                              children: <Widget>[
                                                Container(
                                                  width: 30.0,
                                                  height: 30.0,
                                                  decoration: new BoxDecoration(
                                                    color: Colors.orange,
                                                    shape: BoxShape.circle,
                                                  ),
                                                ),
                                                SizedBox(
                                                  width: 40,
                                                ),
                                                Column(
                                                  mainAxisAlignment:
                                                      MainAxisAlignment.center,
                                                  crossAxisAlignment:
                                                      CrossAxisAlignment.start,
                                                  children: <Widget>[
                                                    Text(
                                                      event.title,
                                                      style: TextStyle(
                                                        fontSize: 18,
                                                        fontWeight:
                                                            FontWeight.bold,
                                                      ),
                                                    ),
                                                    Text(DateFormat('jm')
                                                        .format(event.eventDate)
                                                        .toString()),
                                                  ],
                                                ),
                                              ],
                                            ),
                                            IconButton(
                                              icon: Icon(
                                                Icons.arrow_forward,
                                                color: Colors.black,
                                              ),
                                              onPressed: () {
                                                Navigator.push(
                                                  context,
                                                  MaterialPageRoute(
                                                    builder: (_) =>
                                                        EventDetailsPage(
                                                      event: event,
                                                    ),
                                                  ),
                                                );
                                              },
                                            ),
                                          ],
                                        ),
                                      ),
                                    ),
                                  ),
                                ],
                              ),
                            ),
                          ),
                        ],
                      ),
                      
                    ),
                  ),
                ),
              ),
扩展(
孩子:填充(
填充:常数边集全部(3.0),
子:容器(
//颜色:颜色,黑色,
装饰:盒子装饰(
边界半径:边界半径。圆形(40),
颜色:颜色(0xffdac6a3),
),
孩子:填充(
填充:仅限常量边设置(
前15名,
左:30,,
右:20,,
),
子:列(
mainAxisSize:mainAxisSize.max,
crossAxisAlignment:crossAxisAlignment.stretch,
儿童:[
划船(
mainAxisAlignment:mainAxisAlignment.spaceBetween,
儿童:[
_选择今天
?文本(
“今天”,
样式:TextStyle(
颜色:颜色,黑色,
fontWeight:fontWeight.bold,
尺寸:25,
),
)
:文本(
_展示日期,
样式:TextStyle(
颜色:颜色,黑色,
fontWeight:fontWeight.bold,
尺寸:25,
),