black_hole_flutter 0.2.3
black_hole_flutter: ^0.2.3 copied to clipboard
π A package absorbing all Flutter utility functions, including extension functions and commonly used widgets
π A package absorbing all Flutter utility functions, including extension functions and commonly used widgets.
BuildContext
#
In Flutter you often see the pattern <Class>.of(context)
(e.g. [Theme.of(context)
][Theme.of]). This package adds extension getters on [BuildContext
][BuildContext] for those classes so you can just say:
context.theme // β Theme.of(context)
context.textTheme // β Theme.of(context).textTheme
context.navigator // β Navigator.of(context)
context.rootNavigator // β Navigator.of(this, rootNavigator: true)
context.scaffold // β Scaffold.of(context)
context.form // β Form.of(context)
// ... and many others!
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!
In FancyFab
(a FloatingActionButton
), FancyFlatButton
, FancyOutlineButton
& FancyRaisedButton
, we introduce some new parameters:
isLoading
: Setting this totrue
shows aCircularProgressIndicator
and disables this button. You can optionally specify aloadingChild
(loadingLabel
onFancyFab
) to show next to the progress indicator.isEnabled
: Settings this tofalse
disables this button, even ifonPressed
is set.
Material 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.