Kartal
extension library for helping while coding application for dart & flutter
Install / Use
/learn @VB10/KartalREADME
kartal
My birth country is Kartal, so I created an extension to give born more power.
You should look at the example folder if you want to see an example using these extensions.
Context extension
<img src="https://github.com/VB10/kartal/blob/master/github/context_extension.png?raw=true" alt="Context Extension" width="400"/>You can use context.border to all.
Border
You can use this extension for border properties with context.border. For example
context.border.lowRadius // it equals to device width divided by 0.02
context.border.lowRadius// it equals to device width divided by 0.02context.border.normalRadius// it equals to device width divided by 0.05context.border.highRadius// it equals to device width divided by 0.1context.border.normalBorderRadius// it equals to device width divided by 0.05context.border.lowBorderRadius// it equals to device width divided by 0.02context.border.highBorderRadius// it equals to device width divided by 0.1context.border.roundedRectangleBorderLow// it equals to device width divided by 0.02context.border.roundedRectangleAllBorderNormal// it equals to device width divided by 0.05context.border.roundedRectangleBorderNormal// it equals to device width divided by 0.02context.border.roundedRectangleBorderMedium// it equals to device width divided by 0.04context.border.roundedRectangleBorderHigh// it equals to device width divided by 0.1
Device
You can use for device properties with context.device. For example: context.device.isSmallScreen
context.device.isSmallScreen// The range is defined as0 <= width < 300.context.device.isMediumScreen// The range is defined as300 <= width < 600.context.device.isLargeScreen// The range is defined as600 <= width < 900.context.device.isAndroidDevice// Returns true if the device is an Android device.context.device.isIOSDevice// Returns true if the device is an iOS device.context.device.isWindowsDevice// Returns true if the device is a Windows device.context.device.isLinuxDevice// Returns true if the device is a Linux device.context.device.isMacOSDevice// Returns true if the device is a macOS device.
General
You can use for general properties with context.general. For example: context.general.appTheme
context.general.mediaQuery(MediaQueryData)context.general.appTheme(ThemeData)context.general.textTheme(TextTheme)context.general.primaryTextTheme(TextTheme)context.general.colorScheme(ColorScheme)context.general.isKeyBoardOpen// Returns true if the keyboard is open.context.general.keyboardPadding// When the keyboard is open, it returns the padding value of the keyboard.context.general.appBrightness(Brightness)context.general.focusNode(FocusNode)context.general.unfocus// Removes focus from the currently focused input field or widget.
Navigation
<img src="https://github.com/VB10/kartal/blob/master/github/navigation_extension.png?raw=true" alt="Navigation Extension" width="300"/>You can use for default navigation properties with context.navigation. For example: context.navigation.pop()
context.navigation.pop// Pops the current route off the navigator.popWithRoot/// Pops the current route off the navigator and returns to the root route.navigateName<T extends Object?>// Pushes a named route onto the navigator.navigateToReset<T extends Object?>// Pushes a named route onto the navigator and removes all previous routes.navigateToPage<T extends Object?>// Pushes a new route onto the navigator. </details>
Padding
You can use for padding properties with context.padding. For example: context.padding.low
low is 0.01, normal is 0.02, medium is 0.04, high is 0.1 of the device height. (Basically, it is a percentage of the device height.)
context.padding.low// Add [0.01 percentage of device height ] padding to all sidescontext.padding.normal// Add [0.02 percentage of device height ] padding to all sidescontext.padding.medium// Add [0.04 percentage of device height ] padding to all sidescontext.padding.high// Add [0.1 percentage of device height ] padding to all sidescontext.padding.horizontalLow// Add [0.01 percentage of device height ] padding to horizontal sidescontext.padding.horizontalNormal// Add [0.02 percentage of device height ] padding to horizontal sidescontext.padding.horizontalMedium// Add [0.04 percentage of device height ] padding to horizontal sidescontext.padding.horizontalHigh// Add [0.1 percentage of device height ] padding to horizontal sidescontext.padding.verticalLow// Add [0.01 percentage of device height ] padding to vertical sidescontext.padding.verticalNormal// Add [0.02 percentage of device height ] padding to vertical sidescontext.padding.verticalMedium// Add [0.04 percentage of device height ] padding to vertical sidescontext.padding.verticalHigh// Add [0.1 percentage of device height ] padding to vertical sidescontext.padding.onlyLeftLow// Add [0.01 percentage of device height ] padding to left sidecontext.padding.onlyLeftNormal// Add [0.02 percentage of device height ] padding to left sidecontext.padding.onlyLeftMediumcontext.padding.onlyLeftHigh// Add [0.1 percentage of device height ] padding to left sidecontext.padding.onlyRightLow// Add [0.01 percentage of device height ] padding to right sidecontext.padding.onlyRightNormal// Add [0.02 percentage of device height ] padding to right sidecontext.padding.onlyRightMedium// Add [0.04 percentage of device height ] padding to right sidecontext.padding.onlyRightHigh// Add [0.1 percentage of device height ] padding to right sidecontext.padding.onlyBottomLow// Add [0.01 percentage of device height ] padding to bottom sidecontext.padding.onlyBottomNormal// Add [0.02 percentage of device height ] padding to bottom sidecontext.padding.onlyBottomMedium// Add [0.04 percentage of device height ] padding to bottom sidecontext.padding.onlyBottomHigh// Add [0.1 percentage of device height ] padding to bottom sidecontext.padding.onlyTopLow// Add [0.01 percentage of device height ] padding to top sidecontext.padding.onlyTopNormal// Add [0.02 percentage of device height ] padding to top sidecontext.padding.onlyTopMedium// Add [0.04 percentage of device height ] padding to top sidecontext.padding.onlyTopHigh// Add [0.1 percentage of device height ] padding to top side
Size
You can use for size properties with context.sized. For example: context.sized.low
context.sized.height// Height of the current device.context.sized.width// Width of the current device.context.sized.lowValue// 0.01 percentage of the current widget's height.context.sized.normalValue// 0.02 percentage of the current widget's height.context.sized.mediumValue// 0.04 percentage of the current widget's height.context.sized.highValue// 0.1 percentage of the current widget's height.context.sized.dynamicWidth(double val)// Calculates and returns a dynamic width value based on the providedvaland the current widget's width.context.sized.dynamicHeight(double val)// Calculates and returns a dynamic height value based on the providedvaland the current widget's height.context.sized.emptySizedWidthBoxLow// 0.01 percentage to width empty width boxcontext.sized.emptySizedWidthBoxLow3x// 0.03 percentage of width to empty width boxcontext.sized.emptySizedWidthBoxNormal// 0.05 percentage to width empty width boxcontext.sized.emptySizedWidthBoxHigh// 0.1 percentage to width empty width boxcontext.sized.emptySizedHeightBoxLow// 0.01 percentage to height empty height boxcontext.sized.emptySizedHeightBoxLow3x// 0.03 percentage of height to empty height boxcontext.sized.emptySizedHeightBoxNormal// 0.05 percentage to height empty height boxcontext.sized.emptySizedHeightBoxHigh// 0.1 percentage to height empty height box
Popup
You can use context.popupManager to all
showLoader(Function): A method shows loader indicator by pushing aDialogRoute. Takes optionalid,barrierDismissibleandwidgetBuilder.hideLoader(Function): A method hides current active loader by removingDialogRoute. Takes optionalid. Ifidis not provided will close latest one.
String extension
<img src="https://github.com/VB10/kartal/blob/master/github/string_extension.png?raw=true" alt="String Extension"

