Flutter utilsx

Pub

Pub


## Features

It contains a lot of methods that are daily usage while developing a project. like display dialogs & bottom sheets, check the value is null or not, Date Operations and formation It also helps you to reduce the code and make it more readable.

Usage

This package is very easy to use. You can use it by adding the following code to your project. to lib/main folder.

  • Set up the package in your MaterialApp add the following code to your lib/main folder.
const 
MaterialApp(
navigatorKey: AppCntx.navigatorKey,
home: Home(),
);
  • display Dialogs & Bottom Sheets
  • If you want display bottom sheet you can set just type as DialogType.bottomSheet
Dialogs.showDialogX(
       child : "any widget",
      isCancelable: "click outside of the dialog to close",
      context : "pass context if you don't pass the context"
         " add your MaterialApp navigator key mentioned above",
    ); 
  • If you want to check Dialog is open or not you can use the following code
Dialogs.isDialogOpen;
  • If you want to close Dialog you can use the following code
Dialogs.closeDialog();
  • If you want display bottom sheet you can just call this method
  • This boottom sheet is supported Material3
Dialogs.showBottomSheet(
child : "any widget",
isCancelable: "click outside of the dialog to close",
context : "pass context if you don't pass the context"
" add your MaterialApp navigator key mentioned above",
heightFactor = 0.5,
double elevation=0,
);
  • check the value is null or not
isNotEmpty(dynamic value);
  • Date Operations and formation
stringToDate("25/9/2023", DateFormates.YYYY_MM_DD);
convertTime24Formate("time");
  • validate your form
  • you can validate your form by using the following code
class anyName with ValidationMixn{
  TextFormField(
    validator: (value) => validateEmail(value),
  );
  TextFormField(
  validator: validatePassword,
  );
}
  • Give heigh and with of the widget
  • hp is for height percentage
  • wp is for width percentage
  • heightBox is for height
   20.heightBox
   10.widthBox
   5.hp
  • Read Logs
  • you can read logs by using the following code
  logMessage("your message");
  • Make your any widget Click able with the following code & give Beautiful animation
  SweetButton(
     onPressed: () { },
      child: "Widget"
   )
  • Get date with current month name formate like "23-September-2021"
  • you can pass any date to this method and it will return the date with current month name
  • you can also pass string date to this method and it will return the date with current month name
  getDateByName(DateTime.now());
  stringToDateByName("25-September-2021");
  • Get time Ago from the given date
  • you can pass any date to this method and it will return the time ago from the given date
  calculateTimeDelayInMinutes(
    required DateTime start, 
    required DateTime end
 )
  • Get the current date and time
  • you can get the current date and time by using the following code
  currentDate;
  • BuildContext Extension to get the theme, size, textTheme, colorScheme
  context.theme;
  context.size;
  context.textTheme;
  context.colorScheme;

Additional information

This package is still under development. If you have any suggestions or issues please raise them on GitHub. Also, if you want to contribute to this package please feel free to fork this repository and contribute. And if you like this package please give it a star.