'GridView inside PageView flutter
I am new to flutter and in my previous Android app i could make easily any scrollable view inside another with the same direction, working both ways.
I wonder if it's possible in flutter : in this case i have a simple GridView inside a PageView with the same direction (vertical).
I simply want to handle the case where the GridView can't scroll (the top is reached) and let the parent (PageView) handle the gesture.
To precise a bit more, in my Android app i could use simply use the Google class NestedScrollableHost .
See my other answer to this topic in Android.
I would add that the answer to this question could work with any scrollable view inside another with the same direction.
Thanks !
Solution 1:[1]
Set your Gridview parameters as follow:
GridView(
shrinkWrap: true,
physics: NeverScrollableScrollPhysics(),
Solution 2:[2]
use these properties that make its work properly. // important the other is optional.
return SafeArea(
child: Scaffold(
body: Column(
children: [
Expanded(
child: PageView.builder(
physics: const BouncingScrollPhysics(), // important
child: GridView.builder(
gridDelegate:
const SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 2,
// childAspectRatio: MediaQuery.of(context).size.width /
// (MediaQuery.of(context).size.height / 4),
mainAxisExtent: 256,
crossAxisSpacing: 1,
mainAxisSpacing: 1,
),
physics: const ClampingScrollPhysics(), // important
shrinkWrap: true,
scrollDirection: Axis.vertical,
child: YourWidget
)
)
]
)
)
);
);
...
Solution 3:[3]
something-random-on-discord does not support Discord.js v13!
There is a simple fix!
You can take the image.url option and put it in a new embed:
const random = require("something-random-on-discord").Random.getMeme();
await message.channel.send({
files: [random.embed.image.url]
});
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Jim |
| Solution 2 | Yogi Arif Widodo |
| Solution 3 | Turtlepaw |
