ids_material_sdk 2.8.1
ids_material_sdk: ^2.8.1 copied to clipboard
Networking, Faster APi, Cached APi, Save server cost, IDS Material SDK, IDSMaterialSDK, MultiselectDropDown, DropDown, Custom Button, Networking Services, Theme, Standard TextField, Password Field
#IDS Material SDK
IDS Material SDK callbacks :
- IDSMultiSelectDropDown;
- Networking API
Usage #
Example code of networking api. use case is that when api return the array response. use the below sample code snippet in your project, This code snipped is for form data based api. #
var request = {"UserName":"ddd","Password":"ddd"};
final Future<List<dynamic>> apiResponse =
IDSApiManager().postFormDataInBgArray("http://ids.com/api/v1/login", request, {"Connection":"keep-alive"});
apiResponse.then((response) => {
IDSHelper.debugJSON(response)
});
Example code of texfield. use the below sample code snippet in your project. #
IDSUITextField(
controller: loginProvider?.passController,
hintText: "Password",
prefixIcon: Icons.email,
prefixIconColor: Style.grey,
hintTextColor: Style.grey,
textColor: Style.black,
borderColor: Style.grey,
focusedBorderColor: Style.darkBlue,
validator: (value) {
// Implement validation logic if necessary
return null;
},
)
Example code of networking api. use the below sample code snippet in your project, This code snipped is for get method. #
final Future<Map<String, dynamic>> apiResponse =
IDSApiManager().getInBg("http://ids.com/api/v1/getUsers");
apiResponse.then((response) => {
IDSHelper.debugJSON(response)
});
Example code of networking api. use the below sample code snippet in your project, This code snipped is upload the file with parameters. #
var request = {"UserName":"ddd","Password":"ddd"};
final Future<Map<String, dynamic>> apiResponse =
IDSApiManager().uploadFormData("http://ids.com/api/v1/uploadDocuments", request, "local-url-path-of-file", {"Connection":"keep-alive"});
apiResponse.then((response) => {
IDSHelper.debugJSON(response)
});
Example code of networking api. use the below sample code snippet in your project, This code snipped is for json body payload based api. #
var request = {"UserName":"ddd","Password":"ddd"};
final Future<Map<String, dynamic>> apiResponse =
IDSApiManager().postInBg("http://ids.com/api/v1/login", request, {"Connection":"keep-alive"});
apiResponse.then((response) => {
IDSHelper.debugJSON(response)
});
Example code of networking api. use the below sample code snippet in your project, This code snipped is for form data based api. #
var request = {"UserName":"ddd","Password":"ddd"};
final Future<Map<String, dynamic>> apiResponse =
IDSApiManager().postFormDataInBg("http://ids.com/api/v1/login", request, {"Connection":"keep-alive"});
apiResponse.then((response) => {
IDSHelper.debugJSON(response)
});
Custom Drop down List array and string array usage #
Flutter code snippet #
@override
Widget build(BuildContext context) =>
IDSMultiSelectDropDown(
limit: 3,
onChanged: (List<String> x) {
setState(() {
selectedJobRole = x;
});
},
options: jobRole ?? [],
selectedValues: selectedJobRole,
onLimitMessage: (limit) {
APPHelper.showToast("You can only select 3 items");
},
whenEmpty: 'Select Job Role',
);
navigateToIDSDropDown(int code, String key, List<dynamic>? array) {
showDialog(
context: context,
builder: (BuildContext context) {
return Center(
child: Dialog(
shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.all(Radius.circular(10))),
child: IDSDropDown(
appBarBg:Color.red,
requestedCode: code,
jsonKeyName: key,
dropDownArray: array,
callback: (requestedCode, json) {
if (requestedCode == 1) {
setState(() {
industryDropValue = json["name"];
});
}
if (requestedCode == 2) {
setState(() {
countryDropValue = json["name"];
});
}
},
),
),
);
});
}
navigateToIDSDropDownString(int code, List<String> array) {
showDialog(
context: context,
builder: (BuildContext context) {
return Center(
child: Dialog(
shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.all(Radius.circular(10))),
child: SizedBox(
height: MediaQuery.of(context).size.width,
child: IDSDropDownString(
appBarBg:Color.red,
requestedCode: code,
dropDownArray: array,
callback: (requestedCode, value) {
if (requestedCode == 1) {
setState(() {
employeeDropValue = value;
});
}
},
),
),
),
);
});
}