Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/ssh/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 带“的颤振抽屉测试错误”;右侧的RenderFlex溢出188个像素。”;_Flutter_Flutter Layout_Flutter Test - Fatal编程技术网

Flutter 带“的颤振抽屉测试错误”;右侧的RenderFlex溢出188个像素。”;

Flutter 带“的颤振抽屉测试错误”;右侧的RenderFlex溢出188个像素。”;,flutter,flutter-layout,flutter-test,Flutter,Flutter Layout,Flutter Test,我正在为我的应用程序编写一些测试。目前我一直在测试抽屉。在各种大小的模拟器上,它运行时没有问题(从240x432到1440x2960),但当我尝试运行一个简单的测试时,会抛出以下错误: ══╡ EXCEPTION CAUGHT BY RENDERING LIBRARY ╞═════════════════════════════════════════════════════════ The following assertion was thrown during layout: A R

我正在为我的应用程序编写一些测试。目前我一直在测试抽屉。在各种大小的模拟器上,它运行时没有问题(从240x432到1440x2960),但当我尝试运行一个简单的测试时,会抛出以下错误:

   ══╡ EXCEPTION CAUGHT BY RENDERING LIBRARY ╞═════════════════════════════════════════════════════════
The following assertion was thrown during layout:
A RenderFlex overflowed by 188 pixels on the right.

The overflowing RenderFlex has an orientation of Axis.horizontal.
The edge of the RenderFlex that is overflowing has been marked in the rendering with a yellow and
black striped pattern. This is usually caused by the contents being too big for the RenderFlex.
Consider applying a flex factor (e.g. using an Expanded widget) to force the children of the
RenderFlex to fit within the available space instead of being sized to their natural size.
This is considered an error condition because it indicates that there is content that cannot be
seen. If the content is legitimately bigger than the available space, consider clipping it with a
ClipRect widget before putting it in the flex, or using a scrollable container rather than a Flex,
like a ListView.
The specific RenderFlex in question is: RenderFlex#1ae2c relayoutBoundary=up17 OVERFLOWING:
  creator: Row ← Center ← Padding ← Container ← IconTheme ← Builder ← Listener ← _GestureSemantics ←
    RawGestureDetector ← GestureDetector ← Listener ← InkWell ← ⋯
  parentData: offset=Offset(0.0, 0.0) (can use size)
  constraints: BoxConstraints(0.0<=w<=256.0, 0.0<=h<=Infinity)
  size: Size(256.0, 24.0)
  direction: horizontal
  mainAxisAlignment: start
  mainAxisSize: min
  crossAxisAlignment: center
  textDirection: ltr
  verticalDirection: down
◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤
════════════════════════════════════════════════════════════════════════════════════════════════════
将其中的文本(“继续使用Facebook”、“登录谷歌”)更改为更短的文本也可以解决这一问题

测试(请注意,我目前只是试图避免出错,一旦我弄明白了这一点,就会提交断言)

testWidgets(“抽屉”,
(WidgetTester测试仪)异步{
最终GlobalKey _scaffoldKey=GlobalKey();
BuildContext-savedContext;
等待测试仪.pumpWidget(
材料聚丙烯(
住家:建筑商(
生成器:(BuildContext上下文){
savedContext=上下文;
返回脚手架(
钥匙:_scaffoldKey,
抽屉:HomePageDrawer(),
主体:容器(),
);
},
),
),
);
等待检测仪。泵();//无效
_scaffoldKey.currentState.openDrawer();
等待测试仪。泵();
});

在您发布此消息六个月后,我似乎也遇到了同样的问题。你设法解决了吗?@Mulder我最后做了别的事情。然而,如果我现在尝试这个,我可能会将它包装在一个扩展的小部件中。
          Padding(
          padding: EdgeInsets.symmetric(vertical: 32, horizontal: 16),
          child: Column(
            children: [
              FacebookSignInButton(
                onPressed: _fbLogin,
              ),
              GoogleSignInButton(
                onPressed: _googleLogin,
              )
            ],
            crossAxisAlignment: CrossAxisAlignment.stretch,
          ))
   testWidgets("Drawer",
        (WidgetTester tester) async {
          final GlobalKey<ScaffoldState> _scaffoldKey = GlobalKey<ScaffoldState>();
          BuildContext savedContext;
          await tester.pumpWidget(
            MaterialApp(
              home: Builder(
                builder: (BuildContext context) {
                  savedContext = context;
                  return Scaffold(
                    key: _scaffoldKey,
                    drawer: HomePageDrawer(),
                    body: Container(),
                  );
                },
              ),
            ),
          );
          await tester.pump(); // no effect
          _scaffoldKey.currentState.openDrawer();
          await tester.pump();
    });