Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

没有appbar的情况下显示异常 #35

Closed
MugWorld opened this issue Oct 6, 2020 · 3 comments
Closed

没有appbar的情况下显示异常 #35

MugWorld opened this issue Oct 6, 2020 · 3 comments

Comments

@MugWorld
Copy link

MugWorld commented Oct 6, 2020

显示异常的情况是需要很高的高度才会显示gridview的内容

// var gridView = GridView.count(
// physics: NeverScrollableScrollPhysics(),
// crossAxisCount: _menuCount,
// childAspectRatio: (_screenWidth / _menuCount) / widget.height,
// children: widget.items.map((item) {
// return _menu(item);
// }).toList(),
// );
var gridView = ListView(
scrollDirection: Axis.horizontal,
physics: NeverScrollableScrollPhysics(),
children: widget.items.map((item) {
return _menu(item);
}).toList(),
);

然后改成这样才会显示正常

@MugWorld
Copy link
Author

MugWorld commented Oct 6, 2020

appBar: PreferredSize(
child: AppBar(
brightness: Brightness.dark,
backgroundColor: Theme.of(context).primaryColor,
elevation: 0,
),
preferredSize: Size.fromHeight(-media.viewPadding.top)),好像可以通过这种处理

@MugWorld MugWorld closed this as completed Oct 6, 2020
@sec7et
Copy link

sec7et commented May 8, 2021

显示异常的情况是需要很高的高度才会显示gridview的内容

// var gridView = GridView.count(
// physics: NeverScrollableScrollPhysics(),
// crossAxisCount: _menuCount,
// childAspectRatio: (_screenWidth / _menuCount) / widget.height,
// children: widget.items.map((item) {
// return _menu(item);
// }).toList(),
// );
var gridView = ListView(
scrollDirection: Axis.horizontal,
physics: NeverScrollableScrollPhysics(),
children: widget.items.map((item) {
return _menu(item);
}).toList(),
);

然后改成这样才会显示正常

你好,我在一个不需要AppBar的页面上使用,用了你下面回复的方法设置了preferredSize,但是就会出现header点击不了的问题。这个情况你有碰到吗?

@sec7et
Copy link

sec7et commented May 8, 2021

0_0 好吧,似乎Scaffold并不是必须的,去掉就正常了。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants