Search packages, repositories and app categories

dotted_border cover
Package detailsv3.1.0

dotted_border

A flutter package to let users easily add a dotted border around any widget.

AndroidiOSWebmacOSWindowsLinux
30-day downloads
924K
Likes
1.7K
Pub points
160

Install package

flutter pub add dotted_border

Package Overview

Package selection guidance compiled from public package information, community data, and project usage.

The dotted_border package provides a simple way to add dotted borders to any widget in Flutter. It allows developers to customize the appearance of borders with options for color, stroke width, dash length, and gap length. This package is ideal for creating visually appealing UI elements such as input fields, buttons, or containers that require a dashed or dotted outline. It supports all major platforms including Android, iOS, Web, macOS, Windows, and Linux, ensuring consistent styling across devices.

Use cases

  • Adding dotted outlines to input fields
  • Creating styled container borders
  • Designing interactive button highlights
  • Enhancing form element visual feedback
  • Building custom UI components with dashed borders

Key features

  • Customizable dot size and spacing
  • Support for multiple border sides
  • Easy integration with existing widgets
  • Cross-platform compatibility
  • Flexible color and stroke width settings

Suitable for

  • UI designers seeking decorative borders
  • Developers building form interfaces
  • Apps requiring visual feedback on focus states
  • Projects needing consistent dotted styling across platforms
  • Teams using Flutter for multi-platform apps

Considerations

  • May impact performance with many nested borders
  • Limited to border decoration only (no content clipping)
  • Requires manual handling of border overlap with other decorations
  • Not suitable for complex shape borders beyond basic rectangles
  • Best used with lightweight widgets to maintain smooth rendering

Original README

Original README snapshot from the linked source repository. Visit the repository for the latest content.

Dotted Border

pub package

A flutter package to easily add dotted borders around widgets.

Installing

To use this package, add dotted_border as a dependency in your pubspec.yaml file.

Usage

Wrap DottedBorder widget around the child widget

DottedBorder(
  child: Text(
    'Rectangular Border',
    style: TextStyle(
      fontWeight: FontWeight.bold,
    ),
  ),
)
BorderTypes

This package supports the following border options

  • CustomPath
  • RoundedRect
  • Rect
  • Circular
  • Oval
Example
DottedBorder(
  options: RectDottedBorderOptions(
    dashPattern: [10, 5],
    strokeWidth: 2,
    padding: EdgeInsets.all(16),
  ),
  child: Text(
    'Rectangular Border',
    style: TextStyle(
      fontWeight: FontWeight.bold,
    ),
  ),
)
Dash Pattern

You can also specify the Dash Sequence by passing in an Array of Doubles

Example
RectDottedBorderOptions(
  dashPattern: [10, 5],
  strokeWidth: 2,
  padding: EdgeInsets.all(16),
)

The above code block will render a dashed border with the following pattern:

  • 10 pixel wide dash
  • 5 pixel wide space
Custom Path Border

You can also specify a customPath property and it will draw it for you using the provided dash pattern.

Example
DottedBorder(
  options: CustomPathDottedBorderOptions(
    padding: const EdgeInsets.all(8),
    color: Colors.purple,
    strokeWidth: 2,
    dashPattern: [10, 5],
    customPath: (size) => Path()
      ..moveTo(0, size.height)
      ..relativeLineTo(size.width, 0),
  ),
  child: const Text(
    'Custom Path Border',
    style: TextStyle(
      color: Colors.purple,
      fontWeight: FontWeight.bold,
    ),
  ),
)
Output

Flutter dotted border image

Credits

Categories

Source repository

Projects using this package

Rankings