{"id":13683896,"url":"https://github.com/esenmx/fluiver","last_synced_at":"2025-04-13T12:28:41.705Z","repository":{"id":43141519,"uuid":"452247431","full_name":"esenmx/fluiver","owner":"esenmx","description":"An expressive extensions and helpers package focused on productivity.","archived":false,"fork":false,"pushed_at":"2024-05-11T04:18:30.000Z","size":220,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-13T12:28:34.018Z","etag":null,"topics":["dart","extension-methods","flutter","helpers","utils","widgets"],"latest_commit_sha":null,"homepage":"","language":"Dart","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/esenmx.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-01-26T11:21:38.000Z","updated_at":"2024-05-11T04:18:33.000Z","dependencies_parsed_at":"2024-01-14T15:26:04.083Z","dependency_job_id":"10ed1155-0e83-48a7-b9bc-1c35eedc3350","html_url":"https://github.com/esenmx/fluiver","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/esenmx%2Ffluiver","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/esenmx%2Ffluiver/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/esenmx%2Ffluiver/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/esenmx%2Ffluiver/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/esenmx","download_url":"https://codeload.github.com/esenmx/fluiver/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248713700,"owners_count":21149749,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dart","extension-methods","flutter","helpers","utils","widgets"],"created_at":"2024-08-02T14:00:20.092Z","updated_at":"2025-04-13T12:28:41.686Z","avatar_url":"https://github.com/esenmx.png","language":"Dart","funding_links":[],"categories":["Dart"],"sub_categories":[],"readme":"# fluiver\n\nA comprehensive package that includes expressive extensions, common helpers, and essential widgets.\n\nThe expressiveness emulates IDE behaviors rather than merely minimizing code verbosity, distinguishing it from the typical approaches of many other packages.\n\n## Extensions\n\n### [BuildContext](https://api.flutter.dev/flutter/widgets/BuildContext-class.html)\n\n#### Screen Size\n\n```dart\ncontext.screenWidth =\u003e MediaQuery.of(context).size.width\ncontext.screenHeight =\u003e MediaQuery.of(context).size.height\n```\n\n#### Brightness\n\n```dart\ncontext.isPlatformDark =\u003e MediaQuery.of(context).platformBrightness == Brightness.dark\ncontext.isPlatformLight =\u003e MediaQuery.of(context).platformBrightness == Brightness.light\ncontext.isThemeDark =\u003e Theme.of(context).brightness == Brightness.dark\ncontext.isThemeLight =\u003e Theme.of(context).brightness == Brightness.light\n```\n\n#### Orientation\n\n```dart\ncontext.isOrientationPortrait =\u003e MediaQuery.of(context).orientation == Orientation.portrait\ncontext.isOrientationLandscape =\u003e MediaQuery.of(context).orientation == Orientation.landscape\n```\n\n#### View Padding\n\n```dart\ncontext.topViewPadding =\u003e MediaQuery.of(context).viewPadding.top\ncontext.bottomViewPadding =\u003e MediaQuery.of(context).viewPadding.bottom\ncontext.bottomViewInset =\u003e MediaQuery.of(context).viewInsets.bottom\n```\n\n#### Directionality\n\n```dart\ncontext.isLTR =\u003e Directionality.of(context) == TextDirection.ltr\ncontext.isRTL =\u003e Directionality.of(context) == TextDirection.rtl\n```\n\n### [ColorScheme](https://api.flutter.dev/flutter/material/ColorScheme-class.html)\n\n```dart\n// Formula\nColor {$type}Color =\u003e Theme.of(context).colorScheme.{$type}Color!\n```\n\n```dart\n// Examples\nColor primaryColor =\u003e Theme.of(context).colorScheme.primaryColor\nColor tertiaryColor =\u003e Theme.of(context).colorScheme.tertiaryColor\nColor onErrorColor =\u003e Theme.of(context).colorScheme.onErrorColor\n```\n\n### [TextTheme](https://api.flutter.dev/flutter/material/TextTheme-class.html)\n\n```dart\n// Formula\nTextStyle {$type}TextStyle =\u003e Theme.of(context).textTheme.{$type}!\n```\n\n```dart\n// Examples\nTextStyle headlineLargeTextStyle =\u003e Theme.of(context).textTheme.headlineLarge!\nTextStyle bodyLargeTextStyle =\u003e Theme.of(context).textTheme.bodyLarge!\nTextStyle labelMediumTextStyle =\u003e Theme.of(context).textTheme.labelMedium!\n```\n\n### [BorderRadius](https://api.flutter.dev/flutter/painting/BorderRadius-class.html)\n\n#### add(double value)\n\n```dart\n// Formula\nmyBorderRadius + BorderRadius.add$type$(double value);\n```\n\n`addAll` `addLeft` `addTop` `addRight` `addBottom` `addTopLeft` `addTopRight` `addBottomRight` `addBottomLeft`\n\n### [EdgeInsets](https://api.flutter.dev/flutter/painting/EdgeInsets-class.html)\n\n#### Add(double value)\n\n```dart\n// Formula\nmyEdgeInsets + EdgeInsets.add$type$($type$: value);\n```\n\n`addAll` `addLeft` `addTop` `addRight` `addBottom`\n\n#### Set(double value)\n\n```dart\n// Formula\nmyEdgeInsets.copyWith($type$: value);\n```\n\n`setLeft` `setTop` `setRight` `setBottom` `setHorizontal` `setVertical`\n\n#### Only\n\n```dart\n// Formula\nEdgeInsets.only($type$: value);\n```\n\n`setLeft` `setTop` `setRight` `setBottom` `setHorizontal` `setVertical`\n\n### [TextStyle](https://api.flutter.dev/flutter/painting/TextStyle-class.html)\n\n#### [Color](https://api.flutter.dev/flutter/painting/TextStyle/color.html)\n\n```dart\n// Formula\nTextStyle get withColor{$type} =\u003e textStyle.copyWith(color: {$type});\n```\n\n```dart\n// Examples\nTextStyle get withColorWhite38 =\u003e textStyle.copyWith(color: Colors.white38);\nTextStyle get withColorWhite   =\u003e textStyle.copyWith(color: Colors.white);\nTextStyle get withColorBlack70 =\u003e textStyle.copyWith(color: Colors.black70);\n```\n\n#### [ThemeColor](https://api.flutter.dev/flutter/painting/TextStyle/color.html)\n\n```dart\n// Formula\nTextStyle get with{$type}Color =\u003e textStyle.copyWith(color: Theme.of(context).colorScheme.{$type});\n```\n\n```dart\n// Example\nTextStyle get withPrimaryColor(BuildContext context)   =\u003e textStyle.copyWith(color: Theme.of(context).colorScheme.primary);\nTextStyle get withSecondaryColor(BuildContext context) =\u003e textStyle.copyWith(color: Theme.of(context).colorScheme.secondary);\nTextStyle get withErrorColor(BuildContext context)     =\u003e textStyle.copyWith(color: Theme.of(context).colorScheme.error);\n```\n\n#### [FontWeight](https://api.flutter.dev/flutter/painting/TextStyle/fontWeight.html)\n\n```dart\n// Formula\nTextStyle get withWeight{$type} =\u003e textStyle.copyWith(fontWeight: FontWeight.w${type});\n```\n\n```dart\n// Example\nTextStyle get withWeight100 =\u003e textStyle.copyWith(fontWeight: FontWeight.w100);\nTextStyle get withWeight400 =\u003e textStyle.copyWith(fontWeight: FontWeight.w400);\nTextStyle get withWeight700 =\u003e textStyle.copyWith(fontWeight: FontWeight.w700);\n```\n\n#### [TextDecoration](https://api.flutter.dev/flutter/painting/TextStyle/decoration.html)\n\n```dart\n// Formula\nwith{$type} =\u003e textStyle.copyWith(decoration: TextDecoration.{$type});\n```\n\n```dart\n// Examples\nwithUnderline   =\u003e textStyle.copyWith(decoration: TextDecoration.underline);\nwithOverline    =\u003e textStyle.copyWith(decoration: TextDecoration.overline);\nwithLineThrough =\u003e textStyle.copyWith(decoration: TextDecoration.lineThrough);\n```\n\n#### [Size](https://api.flutter.dev/flutter/painting/TextStyle/fontSize.html)\n\n```dart\nwithSize(double size) =\u003e textStyle.copyWith(fontSize: size);\n```\n\n### [DateTime](https://api.dart.dev/stable/dart-core/DateTime-class.html)\n\n```dart\nTimeOfDay toTime(); /// Creates [TimeOfDay] from [DateTime]\nDateTime truncateTime(); /// Sets '0' everything other than [year, month, day].\nDateTime withTimeOfDay(TimeOfDay time); /// copies [hour, minute] from [time] and sets '0' everything smaller\n\nDateTime addYears(int years);\nDateTime addMonths(int months);\nDateTime addWeeks(int weeks);\nDateTime addDays(int days);\nDateTime addHours(int hours);\nDateTime addMinutes(int minutes);\nDateTime addSeconds(int seconds);\n\nbool get isToday;\nbool get isTomorrow;\nbool get isYesterday;\n\nbool isWithinFromNow(Duration duration); /// Checks is difference between [DateTime.now()] and [DateTime] is smaller than [duration]\n```\n\n### [Map](https://api.dart.dev/stable/dart-core/Map-class.html)\n\n```dart\nbool any(bool Function(K key, V value) test); // Similar to [Iterable.any]\nbool every(bool Function(K key, V value) test); // Similar to [Iterable.every]\n\nMapEntry\u003cK, V\u003e? firstWhereOrNull(bool Function(K key, V value) test); // Similar to [Iterable.firstWhereOrNull]\nMap\u003cK, V\u003e where(bool Function(K key, V value) test); // Similar to [Iterable.where]\nMap\u003cT, V\u003e whereKeyType\u003cT\u003e(); // Similar to [Iterable.whereType]\nMap\u003cK, T\u003e whereValueType\u003cT\u003e(); // Similar to [Iterable.whereType]\n\nMapEntry\u003cK, V\u003e? entryOf(K k); // Similar to `[]` operator but returns [MapEntry]\n```\n\n### [Set](https://api.dart.dev/stable/dart-core/Set-class.html)\n\n```dart\nSet\u003cE\u003e subset(int start, [int? end]); // Creates a new sub [Set]\n```\n\n### [String](https://api.dart.dev/stable/dart-core/String-class.html)\n\n```dart\nString capitalize();\nString capitalizeAll({String separator = ' ', String? joiner});\n/// Retrieves first letters of each word separated by [separator] and merge them with [joiner]\nString initials({String separator = ' ', String joiner = ''});\n```\n\n### [Iterable](https://api.dart.dev/stable/dart-core/Iterable-class.html)\n\n```dart\n[1, 2, 3].to2D(2) // [[1, 2], [3]]\n[[1, 2], [3]].from2D // [1, 2, 3]\n[Foo(), Foo(), Foo()].widgetJoin(() =\u003e Divider()) // [Foo(), Divider(), Foo(), Divider(), Foo()]\n```\n\n### Iterable\\\u003cint\u003e\n\n```dart\nint sum(); // sum of every element\ndouble average(); // average value of iterable\nUint8List toBytes(); // Create a byte array from this\n```\n\n### Iterable\\\u003cdouble\u003e\n\n```dart\ndouble sum(); // sum of every element\ndouble average(); // average value of iterable\n```\n\n### IterableNum\\\u003cT extends num\u003e\n\n```dart\nT get lowest; // lower value in iterable\nT get highest; /// highest value in iterable\n```\n\n## Principles\n\nOnly commonly needed widgets and helpers are implemented.\n\nFor extensions, few comparison will explain the motivation behind.\n\n```dart\ncontext.mediaQuery // BAD: therefore, it's not implemented\nMediaQuery.of(context) // GOOD: better fast read, more characteristic\n```\n\n```dart\n// MediaQuery.of(context).viewInsets.bottom\ncontext.mediaQuery.viewInsets.bottom // BAD: number of dots is same\ncontext.bottomViewInset // GOOD: two dots less and decent readability\n```\n\n```dart\n// Theme.of(context).textTheme.bodyMediumTextStyle!\ncontext.bodyMedium // BAD: less expressive\ncontext.bodyMediumTextStyle // GOOD: more expressive, better auto code-completion\n```\n\n### Package Name\n\nInspired by [google/quiver-dart](https://github.com/google/quiver-dart)\n\n`flutter` + `quiver` = `fluiver`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fesenmx%2Ffluiver","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fesenmx%2Ffluiver","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fesenmx%2Ffluiver/lists"}