Skip to content

A collection of useful classes and extensions so obvious you'll wonder why they aren't offical.

License

Notifications You must be signed in to change notification settings

rafaelcolladojr/obvious

Repository files navigation

Obvious 💡

style: very good analysis Powered by Mason License: MIT

A collection of useful classes and extensions so obvious you'll wonder why they aren't offical

Installation 💻

Install via flutter pub add:

dart pub add obvious

What's the point of this?

After years of copy-n-pasting the same constructor param values and other tedious actions as Flutter developers, it was time to package these actions into sensible, almost obvious classes and extensions we can all benefit from.

The easiest example (and my favorite) is needing to set all but one argument for EdgeInsets.only to the same value.

That's when ObviousEdgeInsets.except() was born:

ObviousEdgeInsets.except(bottom: 8)

// is synonimous with:

EdgeInsets.only(left: 8, top: 8, right: 8)

Features

Clases

  • ObviousEdgeInsets.except
  • ObviousConditionalExpanded

Extensions

num -> EdgeInsets

  • insetAll
  • insetHorizontal
  • insetVertical
  • insetLeft
  • insetTop
  • insetBottom
  • insetRight

num -> Duration

  • ms
  • seconds
  • minutes
  • hours
  • days

num -> SizedBox

  • heightBox
  • widthBox

BuildContext -> MediaQuery.sizeOf

  • screenHeight
  • screenWidth
  • aspectRatio
  • isMobile
  • padding
  • viewPadding
  • viewInsets
  • isTablet
  • isDesktop

BuildContext -> Navigator

  • push
  • pushReplacement
  • pushAndRemoveUntil
  • pushNamed
  • pushReplacementNamed
  • pushNamedAndRemoveUntil
  • pop
  • maybePop
  • popAndPushNamed

BuildContext -> Dialogs

  • showNewDialog
  • showSnackbar

Inspiration / Special thanks

This project was heavily inspired by other libraries like:

About

A collection of useful classes and extensions so obvious you'll wonder why they aren't offical.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages