我正在尝试为每个孩子使用带有单独MainAxisValues的颤动行小部件,但是它不起作用

时间:2019-01-11 02:55:21

标签: dart flutter

import React from "react";
import { render, cleanup } from "react-testing-library";
import "jest-dom/extend-expect";

afterEach(cleanup);  // clean up the DOM after each test

describe("Verify UI state based on jobs", () => {
  it("mounts with no previous data", () => {
    const { getByTestId } = render(<Component data={[]} />);
    expect(getByTestId("refresh-button")).toBeDisabled();  // SUCCESS
  });

  it("mounts with previous data", () => {
    const { getByTestId } = render(<Component data={["hi"]} />);
    expect(getByTestId("refresh-button")).not.toBeDisabled();  // SUCCESS
  });
});

2 个答案:

答案 0 :(得分:0)

您的语法无效。这是一种快速而肮脏的方法,但是可以完成工作。

Row(
      mainAxisAlignment: MainAxisAlignment.start,
      children: <Widget>[
        Container(
          width: 40,
          height: 40,
          child: DecoratedBox(
              decoration: BoxDecoration(
            borderRadius: BorderRadius.all(Radius.circular(40.0)),
            color: Colors.teal,
            image: DecorationImage(
              image: AssetImage('assets/fly.jpg'),
              // ...
            ),
            // ...
          )),
        ),
        Column(
            children: <Widget>[
              Text(
                'James Henry',
                textAlign: TextAlign.left,
              ),
              Row(
                children: <Widget>[Text('status: '), Text('Test Completed')],
              )
            ],
          ),
          Expanded(
            child: Container(),
          ),
        Icon(Icons.remove_circle_outline),
      ],
    ),

答案 1 :(得分:0)

Oops自己弄清楚了,我在中间的项目上使用了扩展的小部件,这样ti就会占用所有剩余的空间,这样我就可以让项目浮动let并保持正确的状态