0 purchases
ccci utils
CCCI Utils #
This documentation provides an overview of the CCCI Utils, including custom widgets, utility classes, and network handling.
Table of Contents #
Custom Widgets
CCard Widget
CButton Widget
CircularLoading Widget
Utility Classes
AppLogger
RouteHandler
DioExceptions
DioClient
Custom Widgets #
CCard Widget #
The CCard widget is a customizable card widget that provides flexible styling options such as padding, margin, border radius, outline, gradient, and background color. It is designed to be used for displaying content within cards with customizable styles.
Usage:
CCard(
child: Text('This is a card content'),
borderRadius: BorderRadius.circular(10),
color: Colors.white,
hasOutline: true,
outlineColor: Colors.grey,
);
copied to clipboard
CButton Widget #
The CButton widget is a custom button widget that supports loading state, outline style, and gradients. It extends the functionality of the ElevatedButton by providing options for loading state, outline style, and gradient background. It utilizes the CCard widget for its background and styling
Usage:
CButton(
label: 'Submit',
onPressed: () {
// Handle button press
},
isLoading: false,
isOutline: false,
gradient: LinearGradient(
colors: [Colors.blue, Colors.green],
),
);
copied to clipboard
CircularLoading Widget #
The CircularLoading widget is a circular loading indicator similar to CupertinoActivityIndicator. It is used for indicating loading state within the application. It encapsulates the loading indicator within a centered container for easy integration.
Usage:
CircularLoading(
color: Colors.blue,
strokeWidth: 3,
);
copied to clipboard
Utility Classes #
AppLogger
The AppLogger class is a utility class for logging messages in the application at different levels of severity. It provides static methods for logging debug, info, warning, error, and verbose messages. Additionally, it includes methods for logging API requests, responses, and errors.
Usage: #
AppLogger.debug('Debug message');
AppLogger.error('Error message');
AppLogger.logApiRequest(url: 'https://api.example.com', method: 'GET');
copied to clipboard
RouteHandler #
The RouteHandler class is a utility class for handling navigation operations within the application. It provides methods for pushing, popping, and replacing routes in the navigator stack. These methods facilitate seamless navigation between different screens and components within the application.
RouteHandler.push(context, HomePage());
RouteHandler.pop(context);
copied to clipboard
DioExceptions #
The DioExceptions class is a custom exception class that handles errors from Dio requests. It provides custom error messages based on different types of Dio exceptions encountered, including connection timeouts, receive timeouts, bad responses, and unknown errors.
Usage: #
try {
// Dio request
} catch (e) {
if (e is DioException) {
final dioException = DioExceptions.fromDioError(e);
print(dioException.message);
}
}
copied to clipboard
DioClient #
The DioClient class encapsulates functionality for making HTTP requests using the Dio package. It includes methods for making GET, POST, PUT, and DELETE requests with configurable options and interceptors. This class provides a convenient and efficient way to interact with APIs and handle network requests within the application.
Dart Dependencies #
To use the DioClient, you need to have the following Dart packages in your pubspec.yaml:
dependencies:
dio
flutter_dotenv
copied to clipboard
Configuration Files #
Make sure you have the necessary configuration files:
. env
Usage:
BASE_URL=<your_base_url>
copied to clipboard
config.json
Usage:
{
"development": {
"current": true,
"baseUrl": "https://dev.example.com"
},
"production": {
"current": false,
"baseUrl": "https://api.example.com"
}
}
copied to clipboard
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.