jbdev 0.0.2
jbdev: ^0.0.2 copied to clipboard
A lightweight Flutter utility package containing custom extensions, validators, and helper functions built for internal use across JBDEV apps and projects.
π¦ jbdev (Internal Utility Package) #
A collection of extensions, widgets, and helpers to streamline JBDEV app development. Maintained by Jatin Batra β not for public use.
π§ Core Setup #
Wrap your app:
App.init();
runApp(Jbdev(
builder: (ctx, navKey) => MaterialApp(navigatorKey: navKey, home: HomePage()),
));
Quick config:
App.currencySymbol = "βΉ";
App.locale = JBLocale.en_IN;
App.timezone = JBTimezone.ist;
βοΈ JBConfig Settings #
Customize:
- Default button styles
- Popup / BottomSheet UI
- Locale, timezone, symbol
Override widgets:
JBConfig.defCurrencySymbol = 'βΉ';
JBConfig.defLocale = JBLocale.en_IN;
JBConfig.defTimezone = JBTimezone.ist;
JBConfig.loadingPopupWidget = (ctx) => MyCustomLoading();
JBConfig.popupWidget = (ctx, popup) => MyCustomPopup(popup);
JBConfig.bottomSheetWidget = (ctx, popup) => MyBottomSheet(popup);
JBConfig.bottomSheetMaxHeight = 0.8;
JBConfig.bottomSheetBorderRadius = 16;
JBConfig.bottomSheetBackgroundColor = Colors.white;
JBConfig.bottomSheetBarrierBlur = 4;
JBConfig.popupBarrierColor = Colors.black54;
JBConfig.popupBorderRadius = 16;
JBConfig.popupPadding = EdgeInsets.all(26);
JBConfig.popupBarrierBlur = 4;
JBConfig.popupBackgroundColor = Colors.white;
JBConfig.defaultButton = JBButtonProperties(
color: Colors.blue,
textColor: Colors.white,
);
JBConfig.buttons = {
"success": JBButtonProperties(color: Colors.green, textColor: Colors.white),
"error": JBButtonProperties(color: Colors.red, textColor: Colors.white),
"primary:light": JBButtonProperties(color: Colors.blue.shade100, textColor: Colors.black),
// Add more types as needed
};
π² SharedPreferencesManager #
save(),get(),remove(),clear()- Supports
String,bool,int,double,List<String>,toJson()objects
π Utilities #
Loading #
showLoading(); // show
hideLoading(); // hide
Popups #
showJBPopup(popup);
hideJBPopup("id");
hideJBAllPopups();
π² JBButton #
Custom-styled button via JBConfig.buttons:
JBButton(
text: "Save",
type: "success",
onPressed: () {},
);
Supports icon, gradient, radius, etc.
π§ Extensions (Quick Access) #
BuildContext #
screenWidth,isDarkModepush("/route"),launchAction(JBAction)
Enum #
.fromString("value", fallback: ...)
DateTime #
.toJBTimezone(),.toShortDate(),.toRelativeTime(),.age,.isWeekend
Color #
HexColor.fromHex("#abc123")color.toHex()
String #
.camelCase,.snakeCase,.slugify(),.isEmail,.isPan,.toEnum(...)
num #
.money(),.half,.pluralize("apple"),.seconds
Object? #
.toNum(),.toBool(),.toDateTime(),.toList(),.isEmptyValue
TextStyle #
.sm,.xl,.primary,.underline,.ellipsis
Widget #
.withPadding(),.centered(),.onTap(),.scrollable(),.withSize()
π Log Utility #
Log.e("Error"); // π΄
Log.i("Info"); // π΅
Log.s("Success"); // π’
β Debug only, uses ANSI color in terminal.
β Best Practices #
- Call
App.init()early - Use fallback/defaults for missing styles
- Centralize UI config via
JBConfig - Use extensions for cleaner and faster UI