fleasy 0.3.1 fleasy: ^0.3.1 copied to clipboard
Useful and easy to use extensions, helper classes and widgets to create Flutter apps easier.
Fleasy #
Fleasy helps create Flutter apps easier by providing useful and easy to use extensions, helper classes and widgets.
The goal is that by using this package you have to write less (repeating) and more clean and readable code.
Overview #
- Extensions on
String
andString?
- Extensions on
DateTime
- Extensions on
List<DateTime>
- Extensions on
BuildContext
(Adaptive helpers) - Extensions on
BuildContext
(Navigation helpers) - Extensions on
BuildContext
(Flashbars) - Extensions on
List?
- Extensions on
List
Date
helper classDeviceType
helper classInsets
helper class- Flutter Widgets
- Analysis Options
Features #
All features with links to their page in the documentation:
-
Extensions on
String
andString?
: #Note: All getters also do a null check if used on
String?
.-
isNotBlank
Whether the string contains characters except of whitespace characters. -
isBlank
Whether the string is either empty or solely made of whitespace characters. -
isEmail
Whether the string is a valid email. -
isUrl
Whether the string is a valid url. -
isEasyPassword
Whether the string is a valid easy password. -
isMediumPassword
Whether the string is a valid medium password. -
isStrongPassword
Whether the string is a valid strong password. -
toNullIfBlank()
Returns null if the stringisBlank
or it's text if itisNotBlank
. -
addHttps()
Adds https:// to the link if it does not contain https:// or http:// already. This is helpful to make a link openable when using the url_launcher package for example.
-
-
Extensions on
DateTime
: #-
copyWith(...)
Returns a copy with the overridden (given) attributes. -
format(...)
Returns a String which represents the date formatted by the given pattern. -
isToday
Whether the date is today. -
isYesterday
Whether the date is yesterday. -
isTomorrow
Whether the date is tomorrow. -
isFutureDay
Whether the date is a day in the future. -
isSameDay(...)
Whether the date is on the same day (regardless of the time) as the given date. -
timeIsZero
Whether the time of the date is zero/empty. -
copyWithEmptyTime()
Returns a copy with time set to zero/empty.
-
-
Extensions on
List<DateTime>
: #-
containsDate(...)
Whether the list contains the given date (regardless of the time). -
indexOfDate(...)
Returns the index of the given date (regardless of the time).
-
-
Extensions on
BuildContext
(Adaptive helpers): #-
mediaQuery
TheMediaQueryData
from the closest instance of this class that encloses the given context. -
screenWidth
The horizontal extent of the screen size. -
screenHeight
The vertical extent of the screen size. -
screenIsLandscape
Whether the device is in landscape mode. -
screenIsPortrait
Whether the device is in portrait mode. -
formFactor
Returns the correct FormFactor based on the FormFactorBreakpoints. -
screenSize
Returns the correct ScreenSize based on the FormFactorBreakpoints.
-
-
Extensions on
BuildContext
(Navigation helpers): #-
pushPage(...)
Push the given page onto the navigator. -
pushRoute(...)
Push the given route onto the navigator. -
popPage(...)
Pop the top-most route off the navigator and dismiss the keyboard. -
canPopPage()
Whether the navigator can be popped. -
dismissKeyboard()
Dismisses the keyboard.
-
-
Extensions on
BuildContext
(Flashbars): #The extensions use the awesome flash package:
-
showSuccessFlashbar(...)
Shows a success flashbar/toast with a customizable text. -
showInfoFlashbar(...)
Shows an info flashbar/toast with a customizable text. -
showErrorFlashbar(...)
Shows an error flashbar/toast with a customizable text (optional). -
showNoConnectionFlashbar()
Shows a no connection flashbar/toast with a customizable text (optional).
-
-
Extensions on
List?
: #-
isNotBlank
Whether the list is not empty nor null. -
isBlank
Whether the list is empty or null.
-
-
Extensions on
List
: #-
find(...)
Returns either the first element of the list which satisfies the provided test or null if there is none.
-
-
Date
helper class: #-
today()
DateTime.now()
without time (time set to zero). -
tomorrow()
TheDateTime
of tomorrow (without time (time set to zero)). -
yesterday()
TheDateTime
of yesterday (without time (time set to zero)).
-
-
DeviceType
helper class: #With the help of this class you can easily find out on which platform the app is currently running and most importantly: in a web-safe way! It uses the awesome universal_platform package.
-
isIOS
Whether the app is running on iOS. -
isAndroid
Whether the app is running on android. -
isMacOS
Whether the app is running on macOS. -
isLinux
Whether the app is running on linux. -
isWindows
Whether the app is running on windows. -
isWeb
Whether the app is running on the web. -
isDesktop
Whether the app is running on desktop (windows, macOS or linux). -
isMobile
Whether the app is running on mobile (android or iOS). -
isDesktopOrWeb
Whether the app is running on desktop or web. -
isMobileOrWeb
Whether the app is running on mobile or web.
-
-
Insets
helper class: #A single source of truth for styling values like padding, spacing, corner shape, font sizes, and so on. These constants can then be used in place of hard-coded numeric values.
-
Flutter Widgets: #
-
EasyFutureBuilder
A wrapper aroundFutureBuilder
which makes it easy to display the various states of fetching data from the givenFuture
. See example. -
EasyStreamBuilder
A wrapper aroundStreamBuilder
which makes it easy to display the various states of streaming data from the givenStream
. See example.
-
-
Analysis options: #
You can use the same analysis options which this package uses by simply including them in your
analysis_options.yaml
file:include: package:fleasy/analysis_options.yaml
They are based on:
- package:flutter_lints (therefore also package:lints)
- my favorite rules from package:dart_code_metrics
- my favorite lint rules which are not present in package:flutter_lints
For more details, have a look at the
analysis_options.yaml
file here.
To-Do's: #
- ✅ Improve README
- ✅ Document the complete code
- ✅ Create example app
- ✅ Add automatic GitHub test workflow
- ❌ Add more tests (feel free to contribute ;))
- ❌ Create more examples (full example apps and code snippets)
Note: #
This package is still in early stages. If you notice any bugs not present in issues, please file a new issue. If you are willing to fix or enhance things yourself, you are very welcome to make a pull request.
Also: Feedback and suggestions are very welcome. Just open an issue or write an email to info@jensbecker.dev.