misc_utilities/misc
library
Functions
-
backgroundGradient({required int primaryLinearGradientColor, required int primaryColor})
→ LinearGradient
-
backgroundGradient
-
bottomSheet({required BuildContext context, required BottomSheetBuilder builder})
→ void
-
bottomSheet
-
checkInactivityTime(String? inActivitySetInTime, String? expiresAt)
→ UserInactivityStatus
-
check inactivity time
if inactivity period is less than an half an hour --- just resume
if inactivity time is greater than 1 and less than 12 hours --- require pin
if inactivity period is greater than 12 hours --- require login
inActivitySetInTime
represents the last time the user was active in the app.
when user logs in or creates an account, this value is set to the current timestamp.
It's is then update every often when the app moves back to the foreground.
-
convertDateToString({required DateTime date, required String format})
→ String
-
convertDateToString
-
convertStringToDate({required String dateTimeString, required String format})
→ DateTime
-
convertStringToDate converts a valid date time string to a DateTime object
-
customRoundedPinBoxDecoration(Color borderColor, Color pinBoxColor, {double borderWidth = 1.0, double? radius})
→ BoxDecoration
-
customRoundedPinBoxDecoration
-
dismissSnackBar(String text, Color color, BuildContext context)
→ SnackBarAction
-
Dismiss snackbar
-
extractNamesInitials => Extracts name initials from a name
-
formatCurrency(dynamic amount)
→ String
-
formatCurrency formats the amount passed in, into a human readable amount
-
formatPhoneNumber({required String countryCode, required String phoneNumber})
→ String
-
formatPhoneNumber
-
genericFetchFunction({required StreamController streamController, required BuildContext context, required String queryString, required Map<String, dynamic> variables, required String logTitle, String? logDescription})
→ Future
-
Generic Fetch Function
a generic fetch function for fetching all the problems, allergies
medications, tests and diagnoses for the current patient
in an episode
-
getCoverValidityPeriod(String validTo)
→ String
-
getCoverValidityPeriod gets the validity period of a cover
-
getDeviceType(BuildContext context)
→ DeviceScreensType
-
getDeviceType
-
getGreetingMessage(String? firstName, {int? currentHour})
→ String
-
getGreetingMessage gets the current time of day and determines which type of greetings to show
to the user
-
getIdType({required String idType, required bool userString})
→ String
-
Get ID Type
gets the selected ID type
-
getUploadId({required Map<String, dynamic> fileData, required BuildContext context})
→ Future<String>
-
Get Upload ID
get ID of uploaded file
-
getValidityDate(String validTo)
→ String
-
getValidityDateformats the validity date into a human readable format
-
launchWhatsApp({required String phone, required String message, required Future<bool> launch})
→ Future<String?>
-
Launch WhatsApp
Function that launches WhatsApp
-
localPath({Future<Directory> fetchApplicationDirectory() = getApplicationDocumentsDirectory})
→ Future<String>
-
localPath
-
parseAuthTypes(List<String> authenticationTypes)
→ String
-
returns the list of auth types by removing the last comma
-
parseError(Map<String, dynamic>? body)
→ String?
-
-
removeUnderscores(String sentence)
→ String
-
removeUnderscores removes underscores from a sentence
-
showErrorSnackbar(BuildContext ctx, [String? msg, Color color = Colors.red])
→ void
-
howErrorSnackbar
-
snackbar({required dynamic content, int durationSeconds = 10, String? label, Function? callback})
→ SnackBar
-
snackbar
-
titleCase(String sentence)
→ String
-
titleCase returns a title cased sentence
-
trimWhitespace(String param)
→ String
-
trim white space
Removes white spaces in between a string, at the beginning and at the end
-
uploadMutationVariable(Map<String, dynamic> payload)
→ Map<String, dynamic>
-
uploadMutationVariable
-
validateEmail(String email)
→ bool
-
validateEmail validates an email against a regex
-
validateKenyanNumber(String phone)
→ bool
-
validateKenyanNumber checks if a number is either has either prefix of '+254111', '+254110', '+254100', '+2540101', '+254102' or '+2547xx'
-
validatePhoneNumber(String phone)
→ bool
-
validatePhoneNumber checks if a number is either a
Kenyan
, American
, UK
or Belgium
phone number