getx_boilerplate_cli 1.0.2
getx_boilerplate_cli: ^1.0.2 copied to clipboard
Command-line interface to generate premium Flutter starter boilerplates utilizing GetX and Clean Architecture.
GetX Boilerplate CLI ๐ #
An enterprise-grade, developer-friendly Command-Line Interface (CLI) tool to instantly scaffold a premium Flutter starter template. Built upon Clean Feature-First Architecture, GetX, Centralized Dependency Injection, Singleton Routing, and deeply customizable Premium UI Components.
Instead of manually cloning a repository and performing tedious search-and-replace naming configurations, this CLI automates the entire process in seconds!
โก Quick Start #
1. Install the CLI Globally #
Activate the CLI tool on your local machine using the Dart SDK package manager:
dart pub global activate getx_boilerplate_cli
Tip
Ensure your system's PATH environment variable includes the Dart SDK pub-cache/bin directory so you can run the command directly from any terminal.
2. Scaffold a New Project #
Run the create command followed by your desired project name (in lowercase with underscores):
getx_boilerplate_cli create my_awesome_app
โ๏ธ What the CLI Handles Automatically #
When you run the create command, the CLI performs the following tasks:
- ๐ฅ Repository Cloning: Clones the absolute latest production-ready template from parentroots/getx.
- ๐งน Git History Cleanup: Deletes the cloned
.gitdirectory so you start with a clean git history for your team. - ๐ง Smart Package Renaming: Recursively scans and renames all namespace declarations and imports from
getx_templatetomy_awesome_app(inpubspec.yaml, Dart source files, Android package manifests, Kotlin imports, iOS configurations, and CMake build configurations). - ๐ Directory Sorting: Renames files and directory packages containing
getx_templateto match your new project. - ๐ฆ Dependency Resolution: Automatically runs
flutter pub getinside the generated project directory so it's ready to run immediately.
๐๏ธ Generated Project Architecture #
The generated project is structured using the industry-proven Clean Feature-First Architecture:
lib/
โโโ core/ # App-wide foundations & configurations
โ โโโ bindings/ # Centralized global Dependency Injection (FENIX-enabled)
โ โโโ config/ # App lifecycle observers & configurations
โ โโโ constants/ # Static app constants (API, storage keys, colors, strings)
โ โโโ errors/ # Global error handling logic & custom exceptions
โ โโโ localization/ # Internationalization & translations
โ โโโ network/ # Singleton HTTP (Dio) and WebSocket Clients
โ โโโ routing/ # Singleton navigation & routes registration
โ โโโ theme/ # Curated light/dark theme config, radius, & typography
โ โโโ utils/ # Helper utilities & extensions
โ
โโโ component/ # Globally shared, highly customizable Common UI widgets
โ โโโ dialogs/ # App dialogs & Common Snackbars
โ โโโ layout/ # Lists, Grids, Dropdowns, Radios, Scaffolds, and CommonText
โ โโโ loading/ # Common shimmers, page loaders & loading overlays
โ โโโ pickers/ # Compressed Multi-Image, Date, Time, and Country pickers
โ โโโ states/ # Empty, Error, Offline, and Retry state views
โ
โโโ features/ # Self-contained modules (Domain layers)
โโโ [feature_name]/ # Example: auth, home, profile
โโโ data/ # Module-specific API integrations & data models
โโโ screen/ # Flattened UI Presentation Layer (View + Controller)
๐จ Common Custom Widgets Encyclopedia #
(Note: In the code snippets below, your_project_name represents the custom package name you passed to the CLI)
All widgets are prefix-unified under the Common namespace. They are designed to enforce responsive layouts, dark/light compatibility, and micro-animations.
๐ Category 1: Form Fields, Inputs & Toggles #
1. CommonButton
๐ก Purpose: Custom button supporting Filled, Outlined, and Text styles, leading/trailing icons, and a built-in loading spinner to handle async operations. โ๏ธ Key Parameters:
| Parameter | Type | Default | Description |
|---|---|---|---|
titleText |
String |
Required | Text to display on the button. |
onTap |
VoidCallback? |
null |
Tap callback. If null, the button is disabled. |
isLoading |
bool |
false |
Renders a loading spinner and disables taps. |
buttonColor |
Color? |
AppColors.primary |
Background color. |
titleColor |
Color? |
Colors.white |
Text color. |
buttonRadius |
double? |
12.0 |
Rounded corners. |
buttonWidth |
double? |
double.infinity |
Set custom width bounds. |
๐ Usage:
CommonButton(
titleText: 'Proceed to Checkout',
isLoading: controller.isSubmitting.value,
onTap: () => controller.checkout(),
)
2. CommonTextField
๐ก Purpose: Highly customizable input text field component featuring automated password visibility toggles, autofocus, and error border styling. โ๏ธ Key Parameters:
| Parameter | Type | Default | Description |
|---|---|---|---|
controller |
TextEditingController? |
null |
Text controller. |
label |
String? |
null |
Label text shown above. |
hint |
String? |
null |
Placeholder hint. |
obscureText |
bool |
false |
Hides input text. |
prefixIcon |
IconData? |
null |
Leading icon. |
validator |
String? Function(String?)? |
null |
Validation logic callback. |
๐ Usage:
CommonTextField(
label: 'Password',
hint: 'Enter your password',
obscureText: controller.obscurePassword.value,
prefixIcon: Icons.lock_outline,
validator: (val) => val!.length < 6 ? 'Password is too short' : null,
)
3. Pinput (OTP Input Field)
๐ก Purpose: Animated pin entry for OTP/verification screens. Integrates the pinput package with custom theme overrides matching the app's visual system.
๐ Usage:
Pinput(
length: 6,
controller: controller.otpController,
defaultPinTheme: defaultPinTheme,
focusedPinTheme: focusedPinTheme,
showCursor: true,
hapticFeedbackType: HapticFeedbackType.lightImpact,
keyboardType: TextInputType.number,
)
4. CommonPhoneTextField
๐ก Purpose: Input designed specifically for international mobile numbers. It includes a built-in searchable country dialing-prefix selector bottom sheet. โ๏ธ Key Parameters:
| Parameter | Type | Default | Description |
|---|---|---|---|
controller |
TextEditingController |
Required | Phone input controller. |
label |
String |
'Phone Number' |
Outer label descriptor. |
initialCountryCode |
String |
'BD' |
Preselected ISO country code. |
๐ Usage:
CommonPhoneTextField(
controller: controller.phoneController,
initialCountryCode: 'BD',
)
5. CommonSearchBar
๐ก Purpose: Sleek search panel that manages its own inner controller and includes a one-click trailing "Clear" button. โ๏ธ Key Parameters:
| Parameter | Type | Default | Description |
|---|---|---|---|
onChanged |
ValueChanged<String>? |
null |
Triggered on character changes. |
hintText |
String |
'Search' |
Input placeholder text. |
๐ Usage:
CommonSearchBar(
hintText: 'Search items...',
onChanged: (query) => controller.search(query),
)
6. CommonRatingBar
๐ก Purpose: Displays ratings. Supports interactive star-based selection and static, read-only star previews. โ๏ธ Key Parameters:
| Parameter | Type | Default | Description |
|---|---|---|---|
rating |
double |
Required | Rating score to display. |
onRatingChanged |
ValueChanged<double>? |
null |
Interactive selector callback. If null, becomes read-only. |
๐ Usage:
CommonRatingBar(
rating: controller.rating.value,
onRatingChanged: (newRating) => controller.submitRating(newRating),
)
7. CommonSwitch
๐ก Purpose: Premium custom toggle switch featuring smooth spring animation and customizable track/thumb sizes. ๐ Usage:
CommonSwitch(
value: controller.isDarkTheme.value,
onChanged: (status) => controller.changeTheme(status),
)
8. CommonTabBar
๐ก Purpose: Animated category sliding selector. Built with custom physics, featuring a beautiful sliding background block indicator. ๐ Usage:
CommonTabBar(
tabs: const ['Ongoing', 'Completed', 'Canceled'],
selectedIndex: controller.activeTab.value,
onTabChanged: (index) => controller.switchTab(index),
)
9. CommonDropdown<T>
๐ก Purpose: Highly styled, customizable dropdown selector wrapper with custom layout themes. ๐ Usage:
CommonDropdown<String>(
hint: "Select Option",
items: ["Option 1", "Option 2", "Option 3"],
value: controller.selectedOption.value,
onChanged: (val) => controller.selectedOption.value = val,
)
10. CommonRadio<T>
๐ก Purpose: Clean custom radio buttons that enforce visual consistency across Android/iOS platforms. ๐ Usage:
CommonRadio<int>(
value: 1,
groupValue: controller.selectedRadio.value,
onChanged: (val) => controller.selectedRadio.value = val,
label: "Male",
)
๐ Category 2: View Layouts, Scaffold & Typography #
11. CommonScaffold
๐ก Purpose: Multi-device viewport standardizer. Auto-constrains content width for desktop screens and configures safe-areas and uniform edge padding. ๐ Usage:
CommonScaffold(
appBar: const CommonAppBar(title: 'Settings'),
body: Column(...),
)
12. CommonAppBar
๐ก Purpose: Unified Top App Bar that automatically shows back-nav arrow buttons based on navigation history. ๐ Usage:
CommonAppBar(
title: 'Edit Profile',
showBack: true,
)
13. CommonBottomNavBar
๐ก Purpose: Premium custom floating bottom navigation bar built with backdrop glassmorphism blurs and animated width-expanding page tab indicators. ๐ Usage:
CommonScaffold(
bottomNavigationBar: const CommonBottomNavBar(),
body: Obx(() => controller.currentPage),
)
14. CommonDrawer
๐ก Purpose: Modern navigation drawer supporting profile headers, animated item selected indicators, and link redirections. ๐ Usage:
CommonScaffold(
drawer: const CommonDrawer(),
body: MainContentWidget(),
)
15. CommonText
๐ก Purpose: Typography standardization widget. Enforces standard Flutter TextStyle styling, font sizing, font weights, and light/dark theme color scaling.
๐ Usage:
CommonText(
'User Account Staged',
style: context.textTheme.headlineMedium,
fontWeight: FontWeight.bold,
)
16. CommonCard
๐ก Purpose: Simple structured wrapper offering standard elevation, borders, padding, and uniform card layout formats. ๐ Usage:
CommonCard(
child: Text('Card Content'),
)
17. CommonImage
๐ก Purpose: Dynamic multi-source image loader that supports asset images, vector SVGs, and network URLs with automatic caching and shimmers. ๐ Usage:
CommonImage(
src: 'https://images.unsplash.com/...',
height: 200,
borderRadius: BorderRadius.circular(16),
)
18. CommonSvgIcon
๐ก Purpose: Renders asset-based SVG images cleanly, injecting custom colors via single-filter color blending. ๐ Usage:
CommonSvgIcon(
asset: 'assets/icons/verified.svg',
color: Colors.blue,
)
19. CommonListView<T>
๐ก Purpose: Scroll list with built-in pull-to-refresh, empty states, and infinite pagination loading indicators. ๐ Usage:
CommonListView<String>(
items: controller.itemsList,
onRefresh: () => controller.refresh(),
onLoadMore: () => controller.loadNextPage(),
itemBuilder: (context, item, index) => ListTile(title: Text(item)),
)
20. CommonGridView<T>
๐ก Purpose: Lazy-loaded paginated grid built with integrated pull-to-refresh and separation properties. ๐ Usage:
CommonGridView<String>(
items: controller.itemsList,
crossAxisCount: 2,
itemBuilder: (context, item, index) => GridItem(item),
)
๐ Category 3: Interactive Pickers & Bottom Sheets #
21. CommonCountryPicker
๐ก Purpose: Searchable modal bottom sheet selector for global countries, highlighting queries and matching check indicators. ๐ Usage:
final result = await CommonCountryPicker.show(
context: context,
selectedCountryCode: selected?.code,
);
22. CommonDatePicker
๐ก Purpose: Premium iOS-style Cupertino date selection wheel in a modern, dark-mode compatible bottom sheet drawer. ๐ Usage:
final result = await CommonDatePicker.show(
context: context,
initialDate: DateTime.now(),
);
23. CommonTimePicker
๐ก Purpose: Cupertino hour/minute time wheel inside a modern dark-mode compatible bottom sheet, returning a standard TimeOfDay.
๐ Usage:
final selectedTime = await CommonTimePicker.show(
context: context,
initialTime: TimeOfDay.now(),
);
24. CommonMultiImagePicker
๐ก Purpose: Compressed multi-file image selector with thumbnail grids, delete hooks, and memory-safe resolution downscaling. ๐ Usage:
CommonMultiImagePicker(
maxImages: 5,
onImagesChanged: (files) => controller.selectedImages.assignAll(files),
)
๐ Category 4: Dialogs & Notifications #
25. CommonDialog
๐ก Purpose: Premium alert and choice dialog supporting success, error, warning, info, and confirmation variants. ๐ Usage:
final confirmed = await CommonDialog.showConfirmation(
context: context,
title: 'Delete Item?',
subtitle: 'Confirm permanent deletion.',
);
26. CommonSnackbar
๐ก Purpose: Custom floating alert notification panel built on top of Get.snackbar featuring colored feedback bars.
๐ Usage:
CommonSnackbar.showSuccess(title: 'Success', message: 'Action completed.');
27. LoadingDialog
๐ก Purpose: Modal overlay layout that blocks touch gestures during heavy asynchronous processing events. ๐ Usage:
showDialog(
context: context,
barrierDismissible: false,
builder: (context) => const LoadingDialog(message: 'Processing...'),
);
๐ Category 5: Loading Indicators, Shimmers & Skeletons #
28. ShimmerBox
๐ก Purpose: Core rectangular skeleton block used to create loading placeholder cards. ๐ Usage:
ShimmerBox(width: 120, height: 16)
29. CommonShimmerCard
๐ก Purpose: Pre-formatted card placeholders that match list items layout definitions. ๐ Usage:
const CommonShimmerCard()
30. LoadingOverlay
๐ก Purpose: Translucent full-screen overlay panel showing custom spinner messages. ๐ Usage:
LoadingOverlay(message: 'Uploading...')
31. PaginationLoader
๐ก Purpose: Subtle foot loader shown at list margins during page pagination. ๐ Usage:
PaginationLoader()
๐ Category 6: Empty, Offline & Error Fallback Views #
32. EmptyStateWidget
๐ก Purpose: Fallback illustration displayed when collection elements return empty lists. ๐ Usage:
EmptyStateWidget(
title: 'No Data',
description: 'Try adding elements.',
)
33. ErrorStateWidget
๐ก Purpose: Retry illustration display presented when data fetching fails. ๐ Usage:
ErrorStateWidget(
errorMessage: 'Something went wrong.',
onRetry: () => controller.reload(),
)
34. NoInternetWidget
๐ก Purpose: View shown automatically when device internet connectivity is offline. ๐ Usage:
NoInternetWidget(onRetry: () => controller.retry())
35. RetryWidget
๐ก Purpose: Simple inline action trigger to re-perform failed processes. ๐ Usage:
RetryWidget(onRetry: () => controller.retry())
๐ฑ Premium High-Readability Extensions #
Unified extension methods reduce widget layout tree nesting:
1. Spacing Extensions (lib/core/utils/extenstion/screen_extensions.dart) #
Append .height or .width to integers or doubles for responsive layout spacing:
16.heightโ ResponsiveSizedBox(height: 16.h)24.widthโ ResponsiveSizedBox(width: 24.w)
2. Context Extensions (lib/core/utils/extenstion/context_extensions.dart) #
Directly access themes, color schemes, and screen dimension constraints from the current context:
context.themeโ Quick access toTheme.of(context)context.colorSchemeโ Quick access to the color scheme tokenscontext.screenWidthโ Current display width
3. Widget Layout Extensions (lib/core/utils/extenstion/widget_extensions.dart) #
Add responsiveness, paddings, and alignment inline without wrapping widgets manually:
widget.paddingAll(16.h)widget.paddingSymmetric(horizontal: 20.w)widget.visible(condition)
Example usage:
import 'package:your_project_name/core/utils/extenstion/screen_extensions.dart';
import 'package:your_project_name/core/utils/extenstion/context_extensions.dart';
import 'package:your_project_name/core/utils/extenstion/widget_extensions.dart';
@override
Widget build(BuildContext context) {
return Column(
children: [
CommonText(
'Workspace Settings',
style: context.textTheme.headlineMedium,
color: context.colorScheme.primary,
),
12.height,
CommonText(
'Subheading',
style: context.textTheme.bodyMedium,
).paddingSymmetric(horizontal: 16.w),
],
);
}
๐ System Services & Helpers #
1. System Permissions Utility (PermissionHelper) #
Managed under lib/services/permissions/permission_helper.dart, this helper allows silent checking of permission states before request triggers:
// Check if access is already granted
final bool isAlreadyGranted = await PermissionHelper.check(Permission.camera);
if (!isAlreadyGranted) {
// Triggers native system prompt dialog
final bool status = await PermissionHelper.camera();
if (!status) {
// If permanently denied, prompt user to redirect to App System Settings
await openAppSettings();
}
}
2. URL & Intent Launcher Helper (UrlLauncherHelper) #
Easily trigger email intents, website URLs, and external applications securely:
UrlLauncherHelper.email("support@example.com");
UrlLauncherHelper.open("https://pub.dev");
๐ License #
This project is licensed under the MIT License. See the LICENSE file in the repository for details.