CoolUtil class

Utility class providing common Flutter UI helpers and widgets.

This class contains static methods and constants for creating commonly used widgets, text styles, dialogs, and UI components.

Constructors

CoolUtil()

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 Properties

outlinedRounded25rNoneBorder InputBorder
A pre-configured InputBorder with rounded corners and no visible border.
getter/setter pair

Static Methods

animatedRoute<T>(Widget nextWidget) PageRouteBuilder<T>
Creates an animated route with right-to-left slide transition.
bodyLargeSize(BuildContext context) double?
Gets the bodyLarge font size from the theme.
boldText(BuildContext context, String text) Widget
Creates a Text widget with bold font weight.
boolToYesNo(bool? val) String?
Converts a nullable boolean to 'Yes'/'No' string.
buildAndJoinDivider<T>({required List<T> items, required Widget widgetBuilder(T item)}) List<Widget>
Builds widgets from items and joins them with dividers.
buildAndJoinWidgets<T>({required List<T> items, required Widget widgetBuilder(T item), required Widget interleaved, bool startWithInterleaver = true, bool endWithInterleaver = true, Widget? title}) List<Widget>
Builds widgets from items and joins them with an interleaved separator.
captionStyle(BuildContext context, {Color? foreColor}) TextStyle
Creates a caption text style from the theme.
captionText(BuildContext context, String text, {String? tooltip}) Widget
Creates a caption-styled Text widget with optional tooltip.
centerText(String text) Widget
Creates a centered text widget.
clipboardCopyableText(BuildContext context, String text, {void onCopied(String text)?, TextStyle? style}) Widget
Creates a text widget with a copy-to-clipboard button.
clipboardCopyButton(BuildContext context, String textToCopy, {void onCopied(String text)?, double? iconSize, String tooltip = 'Click to Copy'}) Widget
Creates an icon button that copies text to clipboard when pressed.
defaultRoute<T>(Widget nextWidget) MaterialPageRoute<T>
Creates a standard MaterialPageRoute for the given widget.
disabledText(BuildContext context, String text, {TextAlign? textAlign}) Widget
Creates a Text widget with disabled styling.
disabledTextStyle(BuildContext context) TextStyle
Creates a text style with the theme's disabled color.
displayLargeSize(BuildContext context) double?
Gets the displayLarge font size from the theme.
displayMediumSize(BuildContext context) double?
Gets the displayMedium font size from the theme.
displaySmallSize(BuildContext context) double?
Gets the displaySmall font size from the theme.
headlineLargeSize(BuildContext context) double?
Gets the headlineLarge font size from the theme.
headlineMediumSize(BuildContext context) double?
Gets the headlineMedium font size from the theme.
inputDialog({required BuildContext context, required String title, String? defaultValue, String okButtonName = 'OK', String hintText = 'Type here', FormFieldValidator<String>? validator}) Future<String?>
Shows an input dialog for text entry.
joinWidgets(List<Widget> widgets, Widget interleaved) List<Widget>
Joins a list of widgets with an interleaved separator widget.
listView<T>(BuildContext context, {required List<T> items, required Widget widgetBuilder(T item), String? msgOnEmpty, String? title, bool addDivider = true, bool startWithDivider = true, double gap = 0, bool shrinkWrap = false, Color dividerColor = Colors.grey, Widget? titleWidget}) Widget
networkErrorPage({String? errorMsg, Icon? icon}) Widget
Creates a centered error page widget for network errors.
onInkCard({required GestureTapCallback? onTap, required Widget child, double radius = 10, double? elevation, Color? cardColor, EdgeInsetsGeometry? margin}) Widget
Creates a tappable card with ink splash effect.
textOnColor(BuildContext context, {required String text, bool expanded = false, TextStyle? style, Color? backgroundColor, TextAlign? textAlign, double horizontalGap = 10, double verticalGap = 10, Color textColor = Colors.black87}) Widget
Creates a text widget on a colored rounded container background.
whiteContainer() Widget
Creates a simple white container widget.
widgetOnColor(BuildContext context, {required Widget widget, Color? backgroundColor, EdgeInsetsGeometry? padding}) Widget
Wraps a widget in a colored rounded container.
wrapInFormField<T>({required FormFieldValidator<T>? validator, required Widget child, String? labelText, bool? filled, InputBorder? border, double childTopPadding = 5, EdgeInsetsGeometry? contentPadding, Widget? suffixIcon}) Widget
Wraps a widget in a FormField with InputDecorator for validation display.
wrapInYesCancelConfirmDialog(BuildContext context, String title, {String? contentString, Widget? contentWidget, String action1Text = 'Yes', required VoidCallback action1, Color? action1ButtonFgColor, String cancelActionText = 'Cancel', bool preActionValidation()?}) → void
Shows a confirmation dialog with Yes/Cancel buttons.
yesNoToBool(Object val) bool
Converts a 'Yes'/'No' string to a boolean value.