I used Stack on my code but when i run the code it gets an error

The code:
import ‘package:flutter/material.dart’;

class Story extends StatelessWidget {
final int index;
final Uri postURI;

const Story(this.index, this.postURI, {Key? key}) : super(key: key);

Widget build(BuildContext context) {
return InkWell(
child: Stack(
alignment: Alignment.topRight,
children: [
borderRadius: BorderRadius.circular(10),
child: Image.network(
fit: BoxFit.cover,
if (index % 3 == 0)
const Padding(
padding: EdgeInsets.symmetric(vertical: 8.0, horizontal: 4),
child: Stack(
alignment: Alignment.center,
children: [
backgroundColor: Colors.white,
maxRadius: 7,
backgroundColor: Colors.red,
maxRadius: 5,
The Error:
25:22: Error: Cannot invoke a non-‘const’ constructor where a const expression is expected.
Try using a constructor or factory that is ‘const’.
child: Stack(
Target kernel_snapshot failed: Exception

FAILURE: Build failed with an exception.

  • Where:
    Script ‘/Users/seifadine/Developer/flutter/packages/flutter_tools/gradle/flutter.gradle’ line: 1151

  • What went wrong:
    Execution failed for task ‘:app:compileFlutterBuildDebug’.

Process ‘command ‘/Users/seifadine/Developer/flutter/bin/flutter’’ finished with non-zero exit value 1

  • Try:

Run with --stacktrace option to get the stack trace.
Run with --info or --debug option to get more log output.
Run with --scan to get full insights.

Exception: Gradle task assembleDebug failed with exit code 1

Besides that your code is unreadable for not using code markup, that is not at all a Gradle question and thus not suited for a Gradle community forum.

You have some compilation error in your code as displayed in your error message.