Last updated:
0 purchases
fl utilities
fl_utilities #
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.
API Reference
Getting started #
Add fl_utilities to your dependencies.
flutter add fl_utilities
copied to clipboard
or manually add it to your pubspec.yaml file:
dependencies:
fl_utilities: ^2.0.1
copied to clipboard
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();
});
copied to clipboard
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(),
);
copied to clipboard
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(),
),
]
);
copied to clipboard
Visit API Reference for more details.
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.