sd_utils

sd_utils is a Flutter package that combines reusable chip UI components with utility formatters, extensions, and text input formatters in one scalable SDK-style library.

Features

  • Animated chip UI system built on BaseChip
  • 10+ chip variants for selection, filtering, avatars, gradients, outlines, and toggles
  • Theme-aware styling with ChipStyle and SdChipThemeData
  • Date and amount formatters with null-safe fallbacks
  • Extensions for nullable strings, numbers, and dates
  • Input formatters for amount and date text fields
  • Interactive example app for UI and formatter workflows

Installation

dependencies:
  sd_utils: ^1.0.0

Usage

Chip Usage

import 'package:flutter/material.dart';
import 'package:sd_utils/sd_utils.dart';

Wrap(
  spacing: 12,
  runSpacing: 12,
  children: const [
    BasicChip(label: 'Default'),
    SelectableChip(
      label: 'Verified',
      icon: Icons.verified_rounded,
      initialSelected: true,
    ),
    GradientChip(label: 'Premium'),
    OutlinedChip(label: 'Invite only'),
  ],
);

Date Formatting

final apiDate = DateFormatter.fromApi('2026-04-20T10:15:30Z');
final readable = DateTime(2026, 4, 20).toFormatted(pattern: 'dd MMM, yyyy');

Currency Formatting

final total = AmountFormatter.format(1250000);
final compact = AmountFormatter.formatCompact(1250000);
final viaExtension = 1250000.toCurrency();

Nullable Text Handling

final username = nullableName.orDash();
final title = 'sd utils package'.toTitleCase();

Screenshots

Recommended screenshot slots for pub.flutter-io.cn and GitHub:

  • docs/screenshots/chips-demo.png
  • docs/screenshots/formatters-demo.png

See the live demo source in example/lib/main.dart.

Contributing

  1. Fork the repository.
  2. Create a feature branch.
  3. Run dart format ., flutter analyze, and flutter test.
  4. Open a pull request with a clear summary and screenshots for UI changes.

License

MIT License. See LICENSE.