ids_material_sdk 3.9.8
ids_material_sdk: ^3.9.8 copied to clipboard
IDS Material SDK for Flutter offers fast networking, cache optimisation, custom widgets like Multi-Select DropDown, theming tools, and performance boosts to reduce server costs.
[3.9.8] - 2025-05-17
- Form url encoded functionality build
- API bug fixes
void _exampleStatus() {
final requestParams = {
'vehicle': 'MH46CU0008',
'branch': '11'
};
final headers = {
'Content-Type': 'application/x-www-form-urlencoded',
};
var response = IDSApiManager().sendFormEncodedRequest(
endPoint: 'url-here',
param: requestParams,
headers: headers,
method: IDSMethodType.post,
);
response.then((result) {
// π Handle the response
debugPrint('β
Vehicle Status Response: $result');
}).catchError((error) {
// β Handle errors
debugPrint('β Error occurred: $error');
});
}
[3.9.7] - 2025-05-17
- Networking IDSHttpClient made. Using this to interact with any server api
- // Use client.get(), client.post(), etc.
- Bug fixes and optimization
Future<void> fetchData() async {
final client = IDSHttpClient();
final Uri url = Uri.parse('https://jsonplaceholder.typicode.com/posts/1');
try {
final response = await client.get(url);
if (response.statusCode == 200) {
print('Response body: ${response.body}');
} else {
print('Request failed with status: ${response.statusCode}');
}
} catch (e) {
print('Error: $e');
}
}
Future<void> postFormData() async {
final client = IDSHttpClient();
final Uri url = Uri.parse('https://example.com/api');
final headers = {
'Content-Type': 'application/x-www-form-urlencoded',
};
final body = {
'username': 'test_user',
'password': '123456',
};
final request = http.Request('POST', url)
..headers.addAll(headers)
..bodyFields = body;
try {
final streamedResponse = await client.send(request);
final response = await http.Response.fromStream(streamedResponse);
if (response.statusCode == 200) {
print('Response body: ${response.body}');
} else {
print('Request failed with status: ${response.statusCode}');
}
} catch (e) {
print('Error: $e');
}
}
[3.9.6] - 2025-05-16
- Using the get method to fetch the data in array
- Bug fixes
void showDemoOfGetMethod() {
final Future<List<dynamic>> apiResponse = IDSApiManager()
.getArrayInBg('url-here', 'hedear here');
apiResponse.then((response) => {
setState(() {
var tripStatusArray = response;
}),
});
}
[3.9.5] - 2025-04-20
- IDSLoader hide issue fixed
- IDSFloatTextFieldTile class name renamed
[3.9.4] - 2025-04-20
- IDSFloatTextFieldTitle & IDSFloatTextField
- Lint issue fixed for the entire SDK
Widget showDecimalField() {
return IDSFloatTextField(
controller: priceController,
hintText: 'Enter product price',
prefixIcon: Icons.attach_money,
prefixIconColor: Colors.green,
borderColor: Colors.grey,
focusedBorderColor: Colors.green,
textColor: Colors.black,
hintTextColor: Colors.grey,
validator: (value) {
if (value == null || value.isEmpty) {
return 'Please enter a price';
}
final double? parsedValue = double.tryParse(value);
if (parsedValue == null || parsedValue <= 0) {
return 'Enter a valid price';
}
return null;
},
);
}
[3.9.3] - 2025-04-10
- IDSTextAreaTitle & IDSTextArea bug fixes.
[3.9.2] - 2025-04-10
- TextArea new line issue fixed.
- IDSTextAreaTitle new line field added. by default newline will come.
[3.9.1] - 2025-04-08
- Public access IDSCryptoConfiguration & IDSCryptoManager
- Code clean up
[3.9.0] - 2025-04-07
- IDSCryptoManager developed and tested in flutter code
- Code formatted
- Code cleanup
void cryptoExample() {
// Sample payload to encrypt
Map<String, dynamic> param = {
"username": "8967564321",
"countryCode": "+91"
};
// Step 1: Convert your data to JSON string
final jsonData = jsonEncode(param);
print("Sending this JSON to be encrypted: $jsonData");
// Step 2: Create an instance of IDSCryptoConfiguration with a secure password
final crypto = IDSCryptoConfiguration(
password: 'b6edf65dd8e3db',
);
// Step 3: Use the high-level manager to handle encryption/decryption
final cryptoManager = IDSCryptoManager(crypto: crypto);
// Step 4: Encrypt the data
final encrypted = cryptoManager.encryptText(jsonData);
print('\nEncrypted Text:\n$encrypted\n');
// Step 5: Decrypt the data back to its original form
final decrypted = cryptoManager.decryptText(encrypted);
print('Decrypted Text:\n$decrypted');
}
[3.8.1] - 2025-03-04
- kSizeBox and kSizeBoxWidth added 1 to 100 and more use dynamic functions
new kHeight & kWidth Usage example, it will support n- number of parameter: #
Widget build(BuildContext context) {
return Column(
children: [
kHeight(10),
kWidth(10),
],
);
}
[3.8.0] - 2025-03-03
AppButton - Configurable Button #
πΉ Basic Button #
Widget showExample() {
return AppButton(title: "Submit");
}
πΉ Button with Custom Background & Text Color #
Widget showExample() {
return AppButton(
title: "Confirm",
backgroundColor: Colors.green,
textColor: Colors.white,
);
}
πΉ Button with Click Action #
Widget showExample() {
return AppButton(
title: "Tap Me",
onTap: () {
print("Button clicked!");
},
);
}
πΉ Button with Custom Size #
Widget showExample() {
return AppButton(
title: "Large Button",
height: 80,
width: 200,
);
}
AppButton is fully configurable & functional! ππ₯
AppBorderButton - Configurable Border Button #
A customizable bordered button widget for Flutter.
π Features #
- Customizable title, text color, and background
- Customizable border color and radius
- Adjustable height and width
- Clickable with
onTap
action
β Example Usage #
πΉ Basic Button #
Widget showExample() {
return AppBorderButton(title: "Submit");
}
πΉ Button with Custom Colors #
Widget showExample() {
return AppBorderButton(
title: "Confirm",
borderColor: Colors.blue,
textColor: Colors.blue,
);
}
πΉ Button with Custom Size #
Widget showExample() {
return AppBorderButton(
title: "Large Button",
height: 80,
width: 200,
);
}
πΉ Button with Click Action #
Widget showExample() {
return AppBorderButton(
title: "Tap Me",
onTap: () {
print("Button clicked!");
},
);
}
AppBorderButton is fully configurable & functional! ππ₯
IDSButton - Configurable Button Widget #
A customizable button widget for Flutter.
π Features #
- Customizable title, text color, and background
- Adjustable height, width, and border radius
- Supports custom padding and text styles
- Clickable with
onPressed
action - Optional border support
β Example Usage #
πΉ Basic Button #
Widget showExample() {
return IDSButton(
title: "Submit",
onPressed: () {
print("Button clicked!");
},
);
}
πΉ Button with Custom Background & Text Color #
Widget showExample() {
return IDSButton(
title: "Confirm",
onPressed: () {
print("Confirmed!");
},
backgroundColor: Colors.green,
textColor: Colors.white,
);
}
πΉ Button with Custom Size #
Widget showExample() {
return IDSButton(
title: "Large Button",
onPressed: () {
print("Large button clicked!");
},
height: 80,
width: 200,
);
}
πΉ Button with Custom Text Style #
Widget showExample() {
return IDSButton(
title: "Styled Button",
onPressed: () {
print("Styled button clicked!");
},
textStyle: TextStyle(
fontSize: 20,
fontWeight: FontWeight.w600,
color: Colors.orange,
),
);
}
πΉ Button with Border #
Widget showExample() {
return IDSButton(
title: "Outlined Button",
onPressed: () {
print("Outlined button clicked!");
},
backgroundColor: Colors.transparent,
textColor: Colors.blue,
border: Border.all(color: Colors.blue, width: 2),
);
}
π IDSButton is fully configurable & functional π₯
Widget showProgress() {
return Padding(
padding: EdgeInsets.zero,
child: UIProgressIndicator(
progressValue: 0.5,
height: 12,
activeColor: AppColors.stepActiveColor,
inactiveColor: AppColors.stepInActiveColor,
),
);
}
Widget showStepProgress() {
return Padding(
padding: EdgeInsets.zero,
child: UIStepProgressWidget(
totalSteps: 4,
currentStep: currentStep,
height: 12,
activeColor: AppColors.stepActiveColor,
inactiveColor: AppColors.stepInActiveColor,
horizontalMargin: 5,
),
);
}
IDSDialog #
A universal Flutter dialog utility for displaying simple alert dialogs with a title and an "OK" button.
Usage Basic Example #
Customizing Text and Button #
void showDialog() {
ElevatedButton(
onPressed: () {
IDSDialog.showMessage(
context: context,
message: "Custom Styled Dialog!",
buttonText: "Close",
textStyle: TextStyle(fontSize: 20, fontWeight: FontWeight.w600, color: Colors.blue),
buttonTextStyle: TextStyle(fontSize: 16, color: Colors.red),
);
},
child: Text("Show Dialog"),
);
}
Allowing Dismiss on Tap Outside #
void showDialog() {
ElevatedButton(
onPressed: () {
IDSDialog.showMessage(
context: context,
message: "Tap outside to close",
barrierDismissible: true, // Allows closing the dialog by tapping outside
);
},
child: Text("Show Dialog"),
);
}
Simple use cases #
void showDialog() {
ElevatedButton(
onPressed: () {
IDSDialog.showMessage(
context: context,
message: "Hello!, This is simple IDS material SDK dialog",
);
},
child: Text("Show Dialog"),
);
}
Features #
- Simple and reusable.
- Customizable title and button text.
- Customizable text styles.
- Supports
barrierDismissible
to allow or prevent dismissal by tapping outside.
[3.7.0] - 2025-02-15
- IDSApiManager().postFormDataInBg in this function method type added as IDSMethodType.post use the below code snippet
IDSMethodType method;
void validateRequest() {
var request4 = {"UserName": "ddd", "Password": "ddd"};
final Future<Map<String, dynamic>> apiResponse5 = IDSApiManager()
.postFormDataInBg("http://ids.com/api/v1/login", request4,
{"Connection": "keep-alive"}, IDSMethodType.post);
apiResponse5.then((response) => {IDSHelper.debugJSON(response)});
}
- Hereβs an example demonstrating how to use the sendFormRequest method for different HTTP methods:
class ApiService {
final IDSApiManager _apiManager = IDSApiManager(); // Replace with actual API manager instance
/// Logs in the user with a username and password.
Future<dynamic> loginUser() async {
return await _apiManager.sendFormRequest(
endPoint: "https://api.example.com/login",
param: {
"username": "test_user",
"password": "secure_password"
},
headers: {
"Content-Type": "application/x-www-form-urlencoded",
"Authorization": "Bearer your_token"
},
method: IDSMethodType.post,
);
}
/// Fetches a list of users with pagination.
Future<dynamic> getUsers() async {
return await _apiManager.sendFormRequest(
endPoint: "https://api.example.com/users",
param: {
"page": "1",
"limit": "10"
},
headers: {
"Authorization": "Bearer your_token"
},
method: IDSMethodType.get,
);
}
/// Updates a user's details.
Future<dynamic> updateUser() async {
return await _apiManager.sendFormRequest(
endPoint: "https://api.example.com/user/123",
param: {
"name": "Updated Name",
"email": "updated_email@example.com"
},
headers: {
"Authorization": "Bearer your_token"
},
method: IDSMethodType.put,
);
}
/// Deletes a user by ID.
Future<dynamic> deleteUser() async {
return await _apiManager.sendFormRequest(
endPoint: "https://api.example.com/user/123",
param: {}, // DELETE requests usually don't need a body
headers: {
"Authorization": "Bearer your_token"
},
method: IDSMethodType.delete,
);
}
}
void main() async {
final apiService = ApiService();
print("Logging in...");
final loginResponse = await apiService.loginUser();
print("Login Response: $loginResponse\n");
print("Fetching Users...");
final usersResponse = await apiService.getUsers();
print("Users Response: $usersResponse\n");
print("Updating User...");
final updateResponse = await apiService.updateUser();
print("Update Response: $updateResponse\n");
print("Deleting User...");
final deleteResponse = await apiService.deleteUser();
print("Delete Response: $deleteResponse\n");
}
- Example of IDSResponseHandler
void exampleOfResponseHandler() async {
dynamic response = await IDSApiManager().sendFormRequest(
endPoint: "https://api.example.com/user",
param: {},
headers: {},
method: IDSMethodType.get,
);
if (IDSResponseHandler.isJsonObject(response)) {
Map<String, dynamic> userData = IDSResponseHandler.asJsonObject(response);
print("User ID: ${userData['id']}");
}
if (IDSResponseHandler.isJsonArray(response)) {
List<dynamic> products = IDSResponseHandler.asJsonArray(response);
print("First product: ${products[0]}");
}
if (IDSResponseHandler.asString(response)) {
String statusMessage = IDSResponseHandler.asString(response);
print("First product: $statusMessage");
}
}
- sendRequest
Benchmark API for IDSApiManager().sendRequest
Method #
This API is designed to test the sendRequest
function, which supports GET, POST, PUT, PATCH, DELETE HTTP methods with JSON payloads.
π Base URL #
π 1. GET Request - Fetch Data #
Endpoint: #
Query Parameters: #
Parameter | Type | Required | Description |
---|---|---|---|
page | int | β | Page number (default: 1) |
limit | int | β | Number of records per page (default: 10) |
Example Usage in IDSApiManager().sendRequest
: #
void getExample() async {
final response = await IDSApiManager().sendRequest(
endPoint: "https://benchmarkapi.example.com/users",
param: { "page": 1, "limit": 10 },
headers: { "Authorization": "Bearer your_token" },
method: IDSMethodType.get,
);
print(response);
}
{
"status": 200,
"data": [
{ "id": 1, "name": "Alice Doe", "email": "alice@example.com" },
{ "id": 2, "name": "Bob Smith", "email": "bob@example.com" }
]
}
- π 2. POST Request - Create User
- Endpoint: POST /users
- Request Body:
{
"name": "John Doe",
"email": "john.doe@example.com"
}
Example Usage in IDSApiManager().sendRequest: #
void postExample() async {
final response = await IDSApiManager().sendRequest(
endPoint: "https://benchmarkapi.example.com/users",
param: { "name": "John Doe", "email": "john.doe@example.com" },
headers: {
"Content-Type": "application/json",
"Authorization": "Bearer your_token"
},
method: IDSMethodType.post,
);
print(response);
}
{
"status": 201,
"message": "User created successfully",
"user": {
"id": 123,
"name": "John Doe",
"email": "john.doe@example.com"
}
}
- π 3. PUT Request - Update User
- Endpoint: PUT /users/{id}
Example Usage in IDSApiManager().sendRequest #
void putExample() async {
final response = await IDSApiManager().sendRequest(
endPoint: "https://benchmarkapi.example.com/users/123",
param: { "name": "John Updated", "email": "john.updated@example.com" },
headers: { "Authorization": "Bearer your_token" },
method: IDSMethodType.put,
);
print(response);
}
{
"status": 200,
"message": "User updated successfully"
}
- π 4. PATCH Request - Partial Update
- Endpoint: PATCH /users/{id}
Example Usage in IDSApiManager().sendRequest: #
void patchExample() async {
final response = await IDSApiManager().sendRequest(
endPoint: "https://benchmarkapi.example.com/users/123",
param: { "email": "new.email@example.com" },
headers: { "Authorization": "Bearer your_token" },
method: IDSMethodType.patch,
);
print(response);
}
{
"status": 200,
"message": "User email updated successfully"
}
- π 5. DELETE Request - Remove User
- Endpoint: DELETE /users/{id}
Example Usage in IDSApiManager().sendRequest: #
void deleteExample() async {
final response = await IDSApiManager().sendRequest(
endPoint: "https://benchmarkapi.example.com/users/123",
param: {}, // DELETE usually doesn't require a body
headers: { "Authorization": "Bearer your_token" },
method: IDSMethodType.delete,
);
print(response);
}
{
"status": 200,
"message": "User deleted successfully"
}
π 6. Benchmarking Performance #
Load Testing with _sendRequest #
- Measure response time using DateTime.now().
- Test with JMeter, k6, or Locust.
- Use a loop to send multiple concurrent requests.
Example Dart Code for Benchmarking #
void benchmarkAPI() async {
final stopwatch = Stopwatch()..start();
for (int i = 0; i < 10; i++) {
await sendRequest(
endPoint: "https://benchmarkapi.example.com/users",
param: {},
headers: { "Authorization": "Bearer your_token" },
method: IDSMethodType.get,
);
}
stopwatch.stop();
print("Total execution time: ${stopwatch.elapsedMilliseconds} ms");
}
benchmarkAPI();
[3.6.0] - 2025-02-12
- Bug fixing and code optimisation
import 'package:ids_material_sdk/public/index.dart';
void loaderExample() async {
IDSLoader(context).showLoader();
try {
await Future.delayed(Duration(seconds: 3)); // Simulate a network call
} finally {
IDSLoader(context).hideLoader();
}
}
[3.5.1] - 2025-02-11
- Public access added
[3.5.0] - 2025-02-11
Added #
uploadMultiPartFormData
: This function allows uploading multiple files of any type (e.g., images, PDFs, videos, audio, documents) in a single request using multipart form data.IDSDownloadManager
: Introduced a new feature to efficiently manage file downloads, providing support for pause, resume, and retry capabilities with enhanced error handling.IDSChipsRadioGroup
: Introduced a new feature to efficiently manage option selections using chip-styled radio buttons. Provides support for dynamic option updates, state synchronization, and enhanced UI customization with properties like background color, text color, and border.IDSInternetChecker
β Reliable Internet Monitoring Utility
- On-Demand Connectivity Check:
- Use
isConnected()
to verify the current internet connection whenever required, such as before making API calls.
- Use
- Real-Time Connectivity Notifications:
- The
onConnectionChange
stream allows the app to react to connectivity changes immediately. For example:- Display a banner when the internet is lost.
- Automatically retry failed requests when the connection is restored.
- The
- Cross-Platform Support: Works seamlessly across Android, iOS, Web, and Desktop platforms.
Improved #
- Enhanced file handling capabilities to support a wider range of file formats.
- Optimized network requests for better performance with large file uploads.
Fixed #
- Resolved minor bugs related to file upload error handling and response parsing.
Example of uploadMultiPartFormData #
void uploadFileWithData() async {
final response = await uploadMultiPartFormData(
endPoint: "https://example.com/upload",
payloadParams: {
'userId': '12345',
'description': 'Uploading multiple files',
},
fileUploads: {
'profileImage': ['path/to/profile_image.jpg'],
'document': ['path/to/document.pdf'],
'audioClip': ['path/to/audio.mp3'],
'files':['path/to/audio.mp3', 'path/to/video.mpv4', 'path/to/images.jpg']
},
headers: {
'Authorization': 'Bearer your_token_here',
'Content-Type': 'multipart/form-data',
},
method: IDSMethodType.POST,
);
if (response['success']) {
print('Files uploaded successfully!');
} else {
print('Upload failed: ${response['error']}');
}
}
Example of IDSDownloadManager download files #
/// Example usage demonstrating how to use the [IDSDownloadManager] to download files
/// import this line import 'package:ids_material_sdk/downloads/index.dart';
void exampleUsage(String fileUrl) {
IDSDownloadManager.instance.download(
url: fileUrl,
success: (fileBytes) async {
// Handle successful download, e.g., display the file
//print('Download successful. File size: ${fileBytes.lengthInBytes} bytes');
/* /// path_provider add this in your pub file if not exist
final fileName = fileUrl.split('/').last;
final tempDir = await getTemporaryDirectory();
final file = File('${tempDir.path}/$fileName');
await file.writeAsBytes(fileBytes.lengthInBytes as List<int>);*/
},
failure: (error) {
// Handle download error
//print('Download failed with error: $error');
},
);
}
Example of IDSChipsRadioGroup #
String _selectedValue = "";
/// Use this function to create the widget
Widget buildRadioGroup() {
return IDSChipsRadioGroup(
options: ["Yes", "No"],
selectedOption: _selectedValue,
onChanged: (value) {
setState(() {
_selectedValue = value;
});
},
chipsHeight: 40,
chipsSelectedBgColor: Colors.indigoAccent,
);
}
How They Work Together #
Both IDSChipsRadioGroup
and IDSInternetChecker
enhance the overall user experience:
IDSChipsRadioGroup
improves the visual interaction for option selection, offering a modern and responsive design.IDSInternetChecker
ensures the app can dynamically respond to internet connectivity, providing seamless offline and online transitions. These utilities help create robust, user-friendly apps that are both visually appealing and functionally reliable.
/// Internet connection example
Future<void> checkConnection() async {
// 1. Check the current internet connection status
bool isConnected = await IDSInternetChecker.isConnected();
// 2. Listen for changes in internet connectivity status
IDSInternetChecker.onConnectionChange.listen((isConnected) {
if (isConnected) {
// 3. Handle internet reconnection
if (kDebugMode) {
print("Internet reconnected");
}
} else {
// 4. Handle internet disconnection
if (kDebugMode) {
print("Internet connection lost");
}
}
});
}
3.4.0
-
IDSExpandableCard components created
-
uploadMultiPartFormData api error handling did that
-
Code snippet added in the example file function name = uploadFormData
3.3.0
- uploadMultiPartFormData api create to upload the multiple or single file in the form
- Code clean up and formation
- SDK API name uploadMultiPartFormData
3.2.0
- index.dart file added to avoid multiple file import
- IDSTextArea UI issues fixes
- Multidrop down code format issue fixed
3.1.0
- ids_multiselect_drop_down.dart code formatting issue fixed
- SearchArrayDialog created code snippet available in example code.
3.0.1
- Bug fixes of the bottom nav bar. below configuration property added in the bottom nav bar
-
this.enableTopShadow = true,
-
this.blurRadius = 2.0,
-
this.spreadRadius = 0.2,
-
this.offset = -2,
-
this.shadowColor = Colors.black12,
3.0.0
- IDSBottomNavigationAppBar widget created
- IDSBottomNavigationAppBar this widget is fully customizable as per the user case of the app
- Code snippet https://github.com/vinod1988/ids_bottom_nav_bar_example
- IDSTextAreaTitle formatting issue fixed
- IDSTextArea formatting issue fixed
2.8.8
- IDSTextAreaTitle widget added in the material sdk
- IDSTextArea widget added in the material sdk
2.8.7
- IDSDropdownTitle widget added in the material sdk
2.8.6
- IDSFieldTitle widget added in the material sdk
- code formatted as per dart formatter
- code clean up and widget optimization
2.8.5
- postFormDataInBg 500 error handle and send back in response
- IDSNumberTextField created to user only number fields in the form
- IDSUITextField keyboard type parameter added in the constructor
2.8.4
- postFormDataInBg return type changed to Map<String, dynamic>
2.8.3
- UIPasswordField parameter issue fixed. below lib version upgraded
- xml: ^6.5.0
- logger: ^2.5.0
- states_rebuilder: ^6.4.0 _
2.8.2
- Example code added
- 500 server error print in the log, for debugging purpose only
- Readme file updated
- UIPasswordField suffix icon added for password show and hide functionality
2.8.1
- Error Handling: Implement robust error handling mechanisms for all Payment Authorization Interface (PAI) processes to gracefully handle 500 errors.
- Documentation Update: Update the existing documentation to reflect the latest implementation changes and best practices.
- Code Optimization: Review and optimize the codebase for performance and efficiency.
- Security Enhancement: Conduct a thorough security audit and implement necessary measures to strengthen the system's security posture.
2.8.0
- postFormDataInBgArray [when api return the array response]
2.7.0
- Document updated
2.6.0
- PasswordField
- Documentations
2.5.0
- UITextField
- Networking services enhancements
2.4.0
- APi logic separated
2.3.0
- Form data request api implemented
2.2.1
- API bug fixing
2.2.0
- Networking api added
- Custom Button Style
- Constants
- Networking logger
2.1.0
- Optimization
2.0.1
- SKD upgraded to support 3.3
2.0.0
- New html widget added
1.0.2
- drop down key name changed
1.0.1
- Drop down html content issue fixed
1.0.0
- Version 1.0 released
0.0.3
- TODO: Describe initial release.
0.0.2
- TODO: Describe initial release.
0.0.1
- TODO: Describe initial release.