fluiver

Last updated:

0 purchases

fluiver Image
fluiver Images
Add to Cart

Description:

fluiver

fluiver #
A comprehensive package that includes expressive extensions, common helpers, and essential widgets.
The expressiveness emulates IDE behaviors rather than merely minimizing code verbosity, distinguishing it from the typical approaches of many other packages.
Extensions #
BuildContext #
Screen Size
context.screenWidth => MediaQuery.of(context).size.width
context.screenHeight => MediaQuery.of(context).size.height
copied to clipboard
Brightness
context.isPlatformDark => MediaQuery.of(context).platformBrightness == Brightness.dark
context.isPlatformLight => MediaQuery.of(context).platformBrightness == Brightness.light
context.isThemeDark => Theme.of(context).brightness == Brightness.dark
context.isThemeLight => Theme.of(context).brightness == Brightness.light
copied to clipboard
Orientation
context.isOrientationPortrait => MediaQuery.of(context).orientation == Orientation.portrait
context.isOrientationLandscape => MediaQuery.of(context).orientation == Orientation.landscape
copied to clipboard
View Padding
context.topViewPadding => MediaQuery.of(context).viewPadding.top
context.bottomViewPadding => MediaQuery.of(context).viewPadding.bottom
context.bottomViewInset => MediaQuery.of(context).viewInsets.bottom
copied to clipboard
Directionality
context.isLTR => Directionality.of(context) == TextDirection.ltr
context.isRTL => Directionality.of(context) == TextDirection.rtl
copied to clipboard
ColorScheme #
// Formula
Color {$type}Color => Theme.of(context).colorScheme.{$type}Color!
copied to clipboard
// Examples
Color primaryColor => Theme.of(context).colorScheme.primaryColor
Color tertiaryColor => Theme.of(context).colorScheme.tertiaryColor
Color onErrorColor => Theme.of(context).colorScheme.onErrorColor
copied to clipboard
TextTheme #
// Formula
TextStyle {$type}TextStyle => Theme.of(context).textTheme.{$type}!
copied to clipboard
// Examples
TextStyle headlineLargeTextStyle => Theme.of(context).textTheme.headlineLarge!
TextStyle bodyLargeTextStyle => Theme.of(context).textTheme.bodyLarge!
TextStyle labelMediumTextStyle => Theme.of(context).textTheme.labelMedium!
copied to clipboard
BorderRadius #
add(double value)
// Formula
myBorderRadius + BorderRadius.add$type$(double value);
copied to clipboard
addAll addLeft addTop addRight addBottom addTopLeft addTopRight addBottomRight addBottomLeft
EdgeInsets #
Add(double value)
// Formula
myEdgeInsets + EdgeInsets.add$type$($type$: value);
copied to clipboard
addAll addLeft addTop addRight addBottom
Set(double value)
// Formula
myEdgeInsets.copyWith($type$: value);
copied to clipboard
setLeft setTop setRight setBottom setHorizontal setVertical
Only
// Formula
EdgeInsets.only($type$: value);
copied to clipboard
setLeft setTop setRight setBottom setHorizontal setVertical
TextStyle #
Color
// Formula
TextStyle get withColor{$type} => textStyle.copyWith(color: {$type});
copied to clipboard
// Examples
TextStyle get withColorWhite38 => textStyle.copyWith(color: Colors.white38);
TextStyle get withColorWhite => textStyle.copyWith(color: Colors.white);
TextStyle get withColorBlack70 => textStyle.copyWith(color: Colors.black70);
copied to clipboard
ThemeColor
// Formula
TextStyle get with{$type}Color => textStyle.copyWith(color: Theme.of(context).colorScheme.{$type});
copied to clipboard
// Example
TextStyle get withPrimaryColor(BuildContext context) => textStyle.copyWith(color: Theme.of(context).colorScheme.primary);
TextStyle get withSecondaryColor(BuildContext context) => textStyle.copyWith(color: Theme.of(context).colorScheme.secondary);
TextStyle get withErrorColor(BuildContext context) => textStyle.copyWith(color: Theme.of(context).colorScheme.error);
copied to clipboard
FontWeight
// Formula
TextStyle get withWeight{$type} => textStyle.copyWith(fontWeight: FontWeight.w${type});
copied to clipboard
// Example
TextStyle get withWeight100 => textStyle.copyWith(fontWeight: FontWeight.w100);
TextStyle get withWeight400 => textStyle.copyWith(fontWeight: FontWeight.w400);
TextStyle get withWeight700 => textStyle.copyWith(fontWeight: FontWeight.w700);
copied to clipboard
TextDecoration
// Formula
with{$type} => textStyle.copyWith(decoration: TextDecoration.{$type});
copied to clipboard
// Examples
withUnderline => textStyle.copyWith(decoration: TextDecoration.underline);
withOverline => textStyle.copyWith(decoration: TextDecoration.overline);
withLineThrough => textStyle.copyWith(decoration: TextDecoration.lineThrough);
copied to clipboard
Size
withSize(double size) => textStyle.copyWith(fontSize: size);
copied to clipboard
DateTime #
TimeOfDay toTime(); /// Creates [TimeOfDay] from [DateTime]
DateTime truncateTime(); /// Sets '0' everything other than [year, month, day].
DateTime withTimeOfDay(TimeOfDay time); /// copies [hour, minute] from [time] and sets '0' everything smaller

DateTime addYears(int years);
DateTime addMonths(int months);
DateTime addWeeks(int weeks);
DateTime addDays(int days);
DateTime addHours(int hours);
DateTime addMinutes(int minutes);
DateTime addSeconds(int seconds);

bool get isToday;
bool get isTomorrow;
bool get isYesterday;

bool isWithinFromNow(Duration duration); /// Checks is difference between [DateTime.now()] and [DateTime] is smaller than [duration]
copied to clipboard
Map #
bool any(bool Function(K key, V value) test); // Similar to [Iterable.any]
bool every(bool Function(K key, V value) test); // Similar to [Iterable.every]

MapEntry<K, V>? firstWhereOrNull(bool Function(K key, V value) test); // Similar to [Iterable.firstWhereOrNull]
Map<K, V> where(bool Function(K key, V value) test); // Similar to [Iterable.where]
Map<T, V> whereKeyType<T>(); // Similar to [Iterable.whereType]
Map<K, T> whereValueType<T>(); // Similar to [Iterable.whereType]

MapEntry<K, V>? entryOf(K k); // Similar to `[]` operator but returns [MapEntry]
copied to clipboard
Set #
Set<E> subset(int start, [int? end]); // Creates a new sub [Set]
copied to clipboard
String #
String capitalize();
String capitalizeAll({String separator = ' ', String? joiner});
/// Retrieves first letters of each word separated by [separator] and merge them with [joiner]
String initials({String separator = ' ', String joiner = ''});
copied to clipboard
Iterable #
[1, 2, 3].to2D(2) // [[1, 2], [3]]
[[1, 2], [3]].from2D // [1, 2, 3]
[Foo(), Foo(), Foo()].widgetJoin(() => Divider()) // [Foo(), Divider(), Foo(), Divider(), Foo()]
copied to clipboard
Iterable<int> #
int sum(); // sum of every element
double average(); // average value of iterable
Uint8List toBytes(); // Create a byte array from this
copied to clipboard
Iterable<double> #
double sum(); // sum of every element
double average(); // average value of iterable
copied to clipboard
IterableNum<T extends num> #
T get lowest; // lower value in iterable
T get highest; /// highest value in iterable
copied to clipboard
Principles #
Only commonly needed widgets and helpers are implemented.
For extensions, few comparison will explain the motivation behind.
context.mediaQuery // BAD: therefore, it's not implemented
MediaQuery.of(context) // GOOD: better fast read, more characteristic
copied to clipboard
// MediaQuery.of(context).viewInsets.bottom
context.mediaQuery.viewInsets.bottom // BAD: number of dots is same
context.bottomViewInset // GOOD: two dots less and decent readability
copied to clipboard
// Theme.of(context).textTheme.bodyMediumTextStyle!
context.bodyMedium // BAD: less expressive
context.bodyMediumTextStyle // GOOD: more expressive, better auto code-completion
copied to clipboard
Package Name #
Inspired by google/quiver-dart
flutter + quiver = fluiver

License:

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.