THelperFunctions class
A utility class containing helper functions for various common tasks.
Constructors
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
computeColorValue(
Color color) → int - Convert a Color to its 32-bit ARGB integer value.
-
getColor(
String value) → Color? -
Returns a color corresponding to the string
value
. You can extend this list to include additional colors as needed. -
getFormattedDate(
DateTime date, {String format = 'dd MMM yyyy'}) → String -
Format a DateTime as a string with the specified
format
(default is 'dd MMM yyyy'). -
getOrderStatusColor(
OrderStatus status) → Color - Returns a color based on the OrderStatus.
-
getPaymentStatusColor(
PaymentStatus status) → Color - Returns a color based on the PaymentStatus.
-
getStartOfWeek(
DateTime date) → DateTime -
Returns the start of the week (Monday) for a given
date
. The returned DateTime is at 00:00:00 (midnight). -
getVerificationStatusColor(
VerificationStatus status) → Color - Returns a color based on the VerificationStatus.
-
isDarkMode(
BuildContext context) → bool - Check if the current theme is dark mode.
-
Navigate to the
screen
passed as an argument. -
removeDuplicates<
T> (List< T> list) → List<T> -
Remove duplicates from a list
list
and return a new list with unique items. -
restoreColorFromValue(
String value) → Color - Restore a Color from a 32-bit ARGB integer value.
-
screenHeight(
) → double - Get the height of the screen.
-
screenSize(
) → Size - Get the size of the screen.
-
screenWidth(
) → double - Get the width of the screen.
-
showAlert(
String title, String message) → void -
Show an alert dialog with a
title
andmessage
. -
showSnackBar(
String message) → void -
Show a SnackBar with the given
message
. -
truncateText(
String text, int maxLength) → String -
Truncate a
text
to the specifiedmaxLength
and append '...' if it exceeds. -
wrapWidgets(
List< Widget> widgets, int rowSize) → List<Widget> -
Wrap widgets in rows based on the specified
rowSize
.