All Projects β†’ JonasWanke β†’ black_hole_flutter

JonasWanke / black_hole_flutter

Licence: Apache-2.0 license
πŸ›  A package absorbing all Flutter utility functions, including extension functions and commonly used widgets

Programming Languages

dart
5743 projects

Projects that are alternatives of or similar to black hole flutter

shelvery-aws-backups
Automating EBS RDS EC2 backups on lambda
Stars: ✭ 31 (+72.22%)
Mutual labels:  utility
hasmail
Simple tray icon for detecting new email on IMAP servers
Stars: ✭ 29 (+61.11%)
Mutual labels:  utility
eth-rpc-errors
Ethereum RPC Errors
Stars: ✭ 78 (+333.33%)
Mutual labels:  utility
cornerstone widget
A jupyter widget for the cornerstone library to make showing flashy images with nice tools easier.
Stars: ✭ 25 (+38.89%)
Mutual labels:  widgets
fltk-rs
Rust bindings for the FLTK GUI library.
Stars: ✭ 929 (+5061.11%)
Mutual labels:  widgets
ceed-cpp
CEGUI unified editor (CEED) for editing layout files and more
Stars: ✭ 44 (+144.44%)
Mutual labels:  widgets
aws-docker-deploy
Scripts and templates for deploying docker containers to aws / elastic beanstalk
Stars: ✭ 18 (+0%)
Mutual labels:  utility
discord-paginationembed
A pagination utility for MessageEmbed in Discord.JS
Stars: ✭ 93 (+416.67%)
Mutual labels:  utility
vstutils
Small framework for easy generates web-applications (SPA or Single Page Application).
Stars: ✭ 39 (+116.67%)
Mutual labels:  utility
js-utils
πŸ”₯ A collection of some JavaScript utility functions for everyday use
Stars: ✭ 16 (-11.11%)
Mutual labels:  utility
steam go
Simple steam auth util in golang
Stars: ✭ 22 (+22.22%)
Mutual labels:  utility
Venus
A Windows Dock Widget Written in Pure Python
Stars: ✭ 17 (-5.56%)
Mutual labels:  widgets
UnitySettings
Runtime debugging menu (like setting on Android) for Unity.
Stars: ✭ 26 (+44.44%)
Mutual labels:  utility
telegram-counter-bot
A simple, easy to use counter bot to keep track of all the amazing things in your Telegram group!
Stars: ✭ 29 (+61.11%)
Mutual labels:  utility
widgets
πŸš€ Dojo - UI widgets.
Stars: ✭ 82 (+355.56%)
Mutual labels:  widgets
Timesheet-Hero
Small utility to keep track of your time
Stars: ✭ 31 (+72.22%)
Mutual labels:  utility
widgets
Widgets for blockchain data visualizations
Stars: ✭ 94 (+422.22%)
Mutual labels:  widgets
laika
Log, test, intercept and modify Apollo Client's operations
Stars: ✭ 99 (+450%)
Mutual labels:  utility
suspend
suspend/resume a list of processes in Windows
Stars: ✭ 23 (+27.78%)
Mutual labels:  utility
whatsapp-jpeg-repair
A handy tool to fix jpeg files downloaded from WhatsApp and prevent errors upon opening these files in Adobe Photoshop.
Stars: ✭ 30 (+66.67%)
Mutual labels:  utility

πŸ›  A package absorbing all Flutter utility functions, including extension functions and commonly used widgets.

πŸ“„ Bottom Sheet

Show modal bottom sheets using: context.showModalBottomSheet().

FancyBottomSheet demo

Also, this package adds a custom FancyBottomSheet with a drag indicator at the top. You can create one using context.showFancyModalBottomSheet().

πŸ— BuildContext

In Flutter, you often see the pattern <Class>.of(context) (e.g., Theme.of(context)). This package adds extension getters on BuildContext for those classes so you can just say:

Extension Shortcut for
context.defaultTextStyle DefaultTextStyle.of(context)
context.directionality Directionality.of(context)
context.form Form.of(context)
context.locale Localizations.localeOf(context)
context.materialLocalizations MaterialLocalizations.of(context)
context.mediaQuery MediaQuery.of(context)
context.overlay Overlay.of(context)
context.pageStorage PageStorage.of(context)
context.scaffold Scaffold.of(context)
context.scaffoldOrNull Scaffold.of(context, nullOk: true)
context.textTheme Theme.of(context).textTheme
context.theme Theme.of(context)

🎨 Colors

Handy extensions on Brightness:

Extension Explanation
brightness.isDark ≙ brightness == Brightness.dark
brightness.isLight ≙ brightness == Brightness.light
brightness.opposite opposite Brightness
brightness.color Color representing this brightness, i.e.:
Β· Colors.white for Brightness.light
Β· Colors.black for Brightness.dark
brightness.contrastColor opposite of brightness.color (above)

isDark, isLight, and contrastColor can also be used on ThemeData directly.

Handy extensions on Color:

Extension Explanation
color.estimatedBrightness estimated Brightness based on color's luminance
color.isOpaque if opacity is 1.0
color.alphaBlendOn(Color background) resulting Color when drawing color on top of background
color.withAdditionalOpacity(double opacity) applies opacity by multiplying it to the existing opacity
color.withAdditionalAlpha(int alpha) like above, but with an integer alpha
color.hsl ≙ HSLColor.fromColor(color)
color.hsv ≙ HSVColor.fromColor(color)

And if you can't decide on a color, just use random.nextColor(), random.nextColorHsl() or random.nextColorHsv()!

Convert between alpha and opacity with int.alphaToOpacity and double.opacityToAlpha.

🌈 Material Design colors

Material Design specifies different opacities of white and black colors to use for text of different emphases on colored backgrounds. You can now use the highEmphasisOnColor, mediumEmphasisOnColor and disabledOnColor extension getters on Color to make your text legible!

There are also getters on ThemeData for contrast colors on the primary, accent, background, and error colors.

🧭 Navigation

Access your navigation-related information via extension methods:

Extension Shortcut for
context.navigator Navigator.of(context)
context.rootNavigator Navigator.of(this, rootNavigator: true)
context.modalRoute ModalRoute.of(context)

Push a new route and pop all previous routes (e.g., when signing out the user):

navigator.pushAndRemoveAll(/* new route */);
// Or using a named route:
navigator.pushNamedAndRemoveAll(/* route name */);

Log navigation events to the console:

MaterialApp(
  navigatorObservers: [LoggingNavigatorObserver()],
  // ...
)
// Prints:
// Navigator: didPush /dashboard β†’ /articles/12345
// Navigator: didPop /dashboard ← /articles/12345

Note: This uses the name of routes, so it only works with named routes. If you want to handle all your routing declaratively with proper deep links, check out my package 🧭 flutter_deep_linking :)

πŸ“± Widgets

πŸ”³ Buttons

Did you ever want to show a progress indicator inside a button? Or were annoyed to conditionally set a Button's onPressed to disable it? Fear no more — black_hole_flutter has got you covered!

Button demo

In FancyFab (a FloatingActionButton), FancyTextButton, FancyOutlinedButton, and FancyElevatedButton, we introduce some new parameters:

πŸ₯” ChipGroup

ChipGroup demo

Wraps multiple chips and can optionally show a title above these.

πŸ₯™ FillOrWrap

FillOrWrap demo

A layout with two different behaviors:

  • By default, all children are positioned next to each other with equal widths. This is comparable to a Row with all children wrapped in Expanded.
  • If the children are too wide to fit in a single line, or one child would become smaller than its reported minimum width, the children get positioned below each other ("wrapped"). This is similar to a Column with MainAxisSize.min.

↔ SeparatedButtons

SeparatedButtons demo

A container wrapping multiple buttons with an interpunct (Β·) between each one. It's recommended to use TextButtons as children.

πŸ“š TitleAndSubtitle

Did you ever want to show a subtitle (in addition to a main title) in your AppBar? Use TitleAndSubtitle (very creative name, I know):

AppBar(
  title: TitleAndSubtitle(
    title: Text('My title'),
    subtitle: Text('My optional subtitle'),
  ),
)

πŸ–Ό RenderObject

When writing a custom layout, you might find this extension on ContainerRenderObjectMixin useful:

Extension Explanation
containerRenderObjectMixin.children Returns all children using firstChild and childAfter

↕ Size

Extension Explanation
size.diagonal length of the diagonal of a rectangle with this Size
size.squaredDiagonal ≙ size.diagonal * size.diagonal
size.coerceAtLeast(Size minimum) Ensures size is not smaller than minimum in any axis
size.coerceAtMost(Size maximum) Ensures size is not larger than minimum in any axis
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].