fl_utilities

Dart version Flutter pub points

Test codecov

Simple flutter utilities such as shorthands extension on BuildContext, debounce extension on ValueChanged, CustomListView widget, and more.

This package depend on SDKs so it can be used in any Flutter project.

Getting started

Add fl_utilities to your dependencies.

flutter add fl_utilities

or manually add it to your pubspec.yaml file:

dependencies:
  fl_utilities: ^2.0.1

Then you can use it in your project.

Usage

shorthands extension on BuildContext:

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

Builder(builder: (context) {
  context.theme; // instead of `Theme.of(context)`
  context.mediaQuery; // instead of `MediaQuery.of(context)`

  return const Placeholder();
});

debounce extension on ValueChanged:

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

TextField(
  onChanged: (text) {
    debugPrint('Called after half a second of not typing');
  }.debounce(),
);

Customize ListView item cross axis length using CustomListView:

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

CustomListView(
  // default item delegate
  viewDelegate: CustomListViewDelegate(
    mainAxisLength: 160.0,
    crossAxisLength: 240.0,
    crossAxisAlignment: CustomListViewItemAlignment.center,
  )
  children: [
    CustomListViewItemDelegate(
      // overrides default delegate
      mainAxisLength: 240.0,
      crossAxisLength: 160.0,
      child: const Card(), // actual list item
    ),
    CustomListViewItemDelegate(
      // using default delegate
      child: const Card(),
    ),
  ]
);

Visit API Reference for more details.

Libraries

fl_utilities
Simple flutter utilities such as shorthands extension on BuildContext, debounce extension on ValueChanged,SizedScrollableArea widget, and more.