fl_utilities 2.0.0 fl_utilities: ^2.0.0 copied to clipboard
Simple flutter utilities that may be useful.
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.
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.0
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(
children: [
CustomListViewItemDelegate(
mainAxisLength: 160.0,
crossAxisLength: 240.0,
child: const Card(),
),
]
);
Visit API Reference for more details.