I make the Stack widget as usual, but the InkWell widget doesn’t appear on top of the blue Container. For the experiment, I put other widgets in its place and everything works. What did I do wrong? Here is the part of the code:
Stack(
children: [
Container(height: 280, color: Colors.blue,),
Row(
children: [
InkWell(
onTap: () {
Navigator.of(context).pushReplacement(
MaterialPageRoute(
builder: (context) =>
Mainpage()));
},
splashColor: Colors.brown.withOpacity(0.5),
child: Ink(
height: 48,
width: 48,
decoration: const BoxDecoration(
image: DecorationImage(
image:
AssetImage('assets/dagger.png'),
fit: BoxFit.cover,
),
),
),
),
],
),
Here I made the container transparent and you can see that InkWell is there and is located under the container:
2
Answers
You can wrap
InkWell
toPositioned
and set the position with theStack
and wrap yourInkWell
to aMaterial
widget. This is for making sure thatInkWell
has a parent that can handle the tap event:happy coding…
Make your Inc widget in Material widget :