lib 0.2.3 copy "lib: ^0.2.3" to clipboard
lib: ^0.2.3 copied to clipboard

This is a library that contains all the common widgets and functions used in the project.

LIB #

lib, is a library of useful utils, widgets, extensions, and more for Flutter. it can speed up your development process and help you build beautiful apps with less code.

Table of contents #

Installation #

Add the package to your project's pubspec.yaml:

dependencies:
  lib: ^0.2.2

Then run:

flutter pub get

Quick start #

Import the library in your Dart code:

import 'package:lib/lib.dart';

The package re‑exports all widgets, extensions and utilities so you can access them directly.

Utils #

Platforms #

A simple helper that exposes the running platform and OS information (works on web).

final name = Platforms.platformName; // "Windows", "Web", etc.
final uri = Platforms.injectToUrl('https://example.com/data');

Widgets #

Below are the most commonly used widgets with examples.

DisabledBox #

Wrap any widget to make it temporarily inactive with optional overlay note.

DisabledBox(
  enabled: isSaving == false,
  note: Text('Saving...'),
  child: ElevatedButton(onPressed: () {}, child: Text('Submit')),
)

LoadingBox #

Shows a CircularProgressIndicator on top of its child when loading is true.

LoadingBox(
  loading: isLoading,
  child: ListView(...),
)

TextPlaceholder #

Replace text with grey bars while content is loading.

TextPlaceholder(
  enabled: isLoading,
  lines: 3,
  width: 150,
)

You can provide a child to display once loading completes.

ScrollableArea #

A scrollable container that optionally displays directional arrows and callbacks.

ScrollableArea(
  scrollable: true,
  refreshable: true,
  onRefresh: (metrics) async { await fetchNewData(); },
  child: Column(children: items),
)

You can customize the arrow visibility, paging behaviour, or supply your own builder.

Panel #

A simple panel with optional header/title and action button.

Panel(
  title: Text('Account'),
  action: TextButton(onPressed: _logout, child: Text('Logout')),
  child: Padding(
    padding: EdgeInsets.all(16),
    child: Text('Welcome back!'),
  ),
  elevation: 4,
  borderRadius: BorderRadius.circular(8),
)

PanelCard and PanelBar are helpers for card-style containers and formatted bars.

FlexTable #

Flexible, configurable rows/columns for complex table layouts.

FlexTable(
  configs: [
    FlexTableItemConfig.flex(2),
    FlexTableItemConfig.size(width: 120),
  ],
  selectable: true,
  onSelectChanged: (selection) { print(selection); },
  child: Column(
    children: [
      FlexTableItem.header(children: [Text('Name'), Text('Age')]),
      FlexTableItem(children: [Text('Alice'), Text('30')]),
    ],
  ),
)

EasyTab #

A lightweight tab bar that shows corresponding content below.

EasyTabBar(
  tabs: [Text('Home'), Text('Settings')],
  children: [HomePage(), SettingsPage()],
)

Sonner notifications #

A tiny notification system powered by overlays. Wrap your app with NotificationProvider then call showNotification.

NotificationProvider(
  child: MaterialApp(home: MyHome()),
);

// elsewhere
final notif = showNotification(
  data: NotificationData(title: 'Saved', body: 'Your changes were saved.'),
  builder: (ctx, data, n) => ListTile(
    leading: Icon(Icons.check),
    title: Text(data.title ?? ''),
    trailing: IconButton(
      icon: Icon(Icons.close),
      onPressed: () => n.close(),
    ),
  ),
);

// update later
notif.replace(Text('Completed!'));

Notifications can be managed programmatically and styled however you like.

Extensions #

Color extension #

Convert a Flutter Color to a web-style hex string.

final hex = Colors.blue.toStringWeb(); // "#0000ff"

DateTime extension #

Get a human-readable duration since a DateTime.

final created = DateTime.parse('2026-02-20');
print(created.getFormattedDuration()); // "8 days" or "2 hours"

Utilities #

See the Platforms section above for platform information helpers.

Publishing #

To publish this package yourself follow these steps:

  1. Make sure publish_to is set to https://pub.dev in pubspec.yaml (done).
  2. Update the version: field to a new semver when releasing changes.
  3. Run a dry run to validate:
    flutter pub publish --dry-run
    
  4. If there are no issues, publish for real:
    flutter pub publish
    

You will be prompted to log in with your Google account if not authenticated.

The package will then be available at https://pub.dev/packages/lib.

License #

This project is licensed under the MIT License.

0
likes
140
points
335
downloads

Publisher

verified publisherphysia.dev

Weekly Downloads

This is a library that contains all the common widgets and functions used in the project.

Homepage
Repository (GitHub)

Documentation

API reference

License

MIT (license)

Dependencies

flutter

More

Packages that depend on lib