Flutter 点击区域问题

点击范围出现不是自己设置的宽高区域
检查背景色是否设置,背景不设置默认是Widget自适应的点击区域
        Expanded(
            child: GestureDetector(
              onTap: () {
                _onClickEditGroup(context, groupModule.editGroupLists[index]
                    .name, groupModule.editGroupLists[index].id);
              },
              child: Container(
// 背景色需要设置,背景不设置默认是文字自适应宽的点击区域,
// 当只有一个文字点击区域就会出现很小的情况
                color: Colors.white,
                height: 49,
                child: Padding(
                    padding: EdgeInsets.only(left: 10, right: 20),
                    child: Align(
                      alignment: Alignment.centerLeft,
                      child: Text(
                        groupModule.editGroupLists[index].name,
                        overflow: TextOverflow.ellipsis,
                        maxLines: 1,
                        style: TextStyle(fontSize: 16),
                        textAlign: TextAlign.center,
                      ),
                    )
                ),
              ),
            )
        ),

你可能感兴趣的:(Flutter 点击区域问题)