getBullet function

Widget getBullet(
  1. BuildContext context,
  2. int depth,
  3. double size
)

Creates a bullet widget for list items based on depth.

Returns different bullet styles for different nesting levels:

  • Depth 0: Filled circle
  • Depth 1: Hollow circle (stroke only)
  • Depth 2+: Filled square

Parameters:

  • context (BuildContext, required): Build context for theme access.
  • depth (int, required): Nesting depth (0 = top level).
  • size (double, required): Size of the bullet in logical pixels.

Returns: Widget — a centered bullet widget.

Example:

getBullet(context, 0, 6.0) // Filled circle bullet

Implementation

Widget getBullet(BuildContext context, int depth, double size) {
  final themeData = Theme.of(context);
  if (depth == 0) {
    return Center(
      child: Container(
        width: size,
        height: size,
        decoration: BoxDecoration(
          color: themeData.colorScheme.foreground,
          shape: BoxShape.circle,
        ),
      ),
    );
  }
  if (depth == 1) {
    return Center(
      child: Container(
        width: size,
        height: size,
        decoration: BoxDecoration(
          border: Border.all(
            color: themeData.colorScheme.foreground,
            width: 1,
          ),
          shape: BoxShape.circle,
        ),
      ),
    );
  }
  return Center(
    child: Container(
      width: size,
      height: size,
      decoration: BoxDecoration(
        color: themeData.colorScheme.foreground,
      ),
    ),
  );
}