我正在尝试在Flutter中创建一个水平滚动项目列表,我希望该列表仅根据其子项占用必要的高度.通过设计" ListView尝试扩展以适应其横向可用的空间"(来自Flutter文档),我也注意到它占据了视口的整个高度,但有没有办法让它不做这个?理想情况下类似于此(显然不起作用):
new ListView(
scrollDirection: Axis.horizontal,
crossAxisSize: CrossAxisSize.min,
children: <Widget>[
new ListItem(),
new ListItem(),
// ...
],
);
Run Code Online (Sandbox Code Playgroud)
我知道这样做的一种方式是通过包装ListView在Container一个固定的高度.但是,我不一定知道物品的高度:
new Container(
height: 97.0,
child: new ListView(
scrollDirection: Axis.horizontal,
children: <Widget>[
new ListItem(),
new ListItem(),
// ...
],
),
);
Run Code Online (Sandbox Code Playgroud)
我能够通过嵌套一个砍一起"解决方案" Row中SingleChildScrollView的Column一个mainAxisSize: MainAxisSize.min.但是,对我来说,这不是一个解决方案:
new Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
new SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: new Row(
children: <Widget>[
new ListItem(),
new ListItem(),
// ...
],
),
), …Run Code Online (Sandbox Code Playgroud) 我TextInputLayout在我的Android应用程序中使用,以便为我的输入字段实现整洁的浮动标签效果.我知道我也应该使用它TextInputEditText来允许在横向模式下显示提示并且输入填满整个屏幕.
但是,在我的一些输入字段中,我已经使用了自动完成AutoCompleteTextView(IMO的名称确实不一致 - "TextView"而不是"EditText" - 但这是另一个故事)并且显然是直接继承的EditText.因此它没有带来的功能TextInputEditText.
所以我想知道是否有办法实现相同的景观功能(没有自己的TextInputAutoCompleteTextView实现,也就是这样),并且还避免产生的lint警告.我在这里错过了什么吗?我想我得到的是他们没有EditText为这个特定事物制作所有直接和间接子类的自定义版本,所以我希望自己制作?
android autocomplete autocompletetextview android-edittext android-textinputlayout
在火力地堡公司的FireStore,我想只允许(自定义设定),管理员写/更新/删除资源,为此,我已经得到了这些安全规则:
service cloud.firestore {
match /databases/{database}/documents {
match /resources {
allow read;
allow write, update, delete: if get(/users/$(request.auth.uid).isAdmin);
}
match /resources/{resource} {
allow read;
allow write, update, delete: if get(/users/$(request.auth.uid).isAdmin);
}
}
}
Run Code Online (Sandbox Code Playgroud)
我正在使用在users集合中标记为admin的用户登录:

NfwIQAjfNdS85yDvd5yPVDyMTUj2是从身份验证窗格获取的UID:

但是,出于某种原因(更新:确定原因;请参阅答案),在确定我已经使用admin用户登录后,在写入资源集合时,我收到了PERMISSION_DENIED错误.
也许可以从Firestore查看请求日志?然后,我可以看看request.auth.uid与我的收藏和规则相匹配的内容.
我对Ember很新,到目前为止我很喜欢它!但是,我觉得我已经失去了对我的一些HTML元素的控制,特别是<select>菜单和它<option>.
我也希望默认(selected)<option>也被禁用,即具有属性disabled.我习惯于这种方法在选择菜单上设置"占位符",但我也想要其他建议.
例如,如果我有一个性别选择菜单,我想最终得到这段代码:
<select>
<option selected disabled>Please select gender</select>
<option value="m">Male</select>
<option value="f">Female</select>
</select>
Run Code Online (Sandbox Code Playgroud)
我有以下JavaScript和Handlebars代码:
genders = [
Ember.Object.create({value: 'm', label: 'Male'}),
Ember.Object.create({value: 'f', label: 'Female'}),
];
App.GenderSelect = Ember.Select.extend({
contentBinding: "genders",
optionValuePath: "content.value",
optionLabelPath: "content.label"
});
Run Code Online (Sandbox Code Playgroud)
{{view App.GenderSelect prompt="Please select gender"}}
Run Code Online (Sandbox Code Playgroud)
这给了我几乎所需的代码.但是,第一个<option>缺少disabled属性,因此这个问题.
<select>
<option value>Please select gender</select>
<option value="m">Male</select>
<option value="f">Female</select>
</select>
Run Code Online (Sandbox Code Playgroud)
此外,它不设置selected属性,但这不是必需的,因为它是菜单中的第一个选项.
我感谢任何答案,这个问题的直接答案和使用其他方法的有效建议disabled.
提前致谢!
我正在使用Ruby on Rails 3.1(RC1)创建一个Web应用程序.我正在使用Factory Girl,RSpec和Cucumber(与Capybara)进行测试,但是ActionDispatch::ClosedError当我创建新用户时(通过User模型的创建操作),我在某些时候(不是每次)遇到意外的提升.以下是我收到的错误消息:
Cannot modify cookies because it was closed. This means it was already streamed
back to the client or converted to HTTP headers. (ActionDispatch::ClosedError)
Run Code Online (Sandbox Code Playgroud)
使用这些创建用户的方法时会引发错误:
Factory.create( :user )Factory.build( :user ).saveUser.create( { ... } )User.new( { ... } ).save有趣的是,他们在一些测试中工作,但在其他测试中没有,并且它看起来并不随机,尽管我无法弄清楚原因.以下是我的代码的摘录:
需要'spec_helper'
def user
@user ||= Factory.create( :user )
end
def valid_attributes
Factory.attributes_for :user
end
describe UsersController do
describe …Run Code Online (Sandbox Code Playgroud) cucumber rspec2 actiondispatch ruby-on-rails-3.1 factory-bot