flutter_custom_utils
library
Functions
-
buildString(void builderAction(StringBuffer sb))
→ String
-
-
cBuildString(void builderAction(StringBuffer sb))
→ String
-
Builds a new string by populating a newly created StringBuffer using the provided
builderAction
and then converting it to String.
-
cFormUrlEncode(Map<String, String> data)
→ String
-
Converts a map to a URL-encoded string.
-
cGetDeviceId()
→ Future<String>
-
Retrieves the device ID for various platforms, including iOS, Android, Windows, Linux, Web, and macOS.
-
cGetGridRatio({required BuildContext context, required int crossAxisCount, required int height, required int width, bool logData = false, double? discardSize})
→ double
-
Calculate the
childAspectRatio
for a GridView based on item dimensions and crossAxisCount
.
-
cGetOffer({required double offerPrice, required double ordinalPrice, dynamic round = false, dynamic suffix = ' %', dynamic prefix = ''})
→ String
-
Calculates the discount percentage based on the original price and the offer price.
-
cGetResCrossCountGrid({required BuildContext context, required int width, bool logData = false, double? discardSize})
→ int
-
Calculate the responsive
crossAxisCount
for a GridView based on item width.
-
cGetResGridRatio({required BuildContext context, required int height, required int width, bool logData = false, double? discardSize})
→ double
-
Calculate the responsive
childAspectRatio
for a GridView based on item dimensions.
-
cLog(String body, {String n = 'repad.dev'})
→ void
-
Logs data in green color in Visual Studio Code (VS Code) console.
-
cPickAndCropImage(BuildContext context, {dynamic cropDisable = false, Widget? title, dynamic aspectRatio = 1.7, dynamic allowedExtensions = const ['png', 'jpg', 'jpeg'], int? maxFileSizeInBytes, required dynamic okButton(Uint8List data, String fileName), required dynamic cancelButton(), dynamic errors(String message)?})
→ dynamic
-
Opens a file picker dialog allowing the user to select an image file, optionally crop it, and then perform actions based on user interaction.
-
cSetHashUrl()
→ void
-
Sets the URL strategy of your web app to using a leading has (
#
) instead
of paths.
-
cSetPathUrl()
→ void
-
Sets the URL strategy of your web app to using paths instead of a leading
hash (
#
).
-
cTakePicture(GlobalKey<State<StatefulWidget>> key)
→ Future<Uint8List>
-
Takes a screenshot of a widget using a GlobalKey and returns it as a Uint8List (PNG image).
-
getDeviceId()
→ Future<String>
-
-
getGridRatio({required BuildContext context, required int crossAxisCount, required int height, required int width, bool logData = false})
→ double
-
-
getResCrossCountGrid({required BuildContext context, required int width, bool logData = false})
→ int
-
-
getResGridRatio({required BuildContext context, required int height, required int width, bool logData = false})
→ double
-
-
getSize(BuildContext context)
→ Size
-
Get the size of the screen from a given BuildContext.
-
mQuery(BuildContext context)
→ MediaQueryData
-
Get the
MediaQueryData
object from a given BuildContext.