custom_static_dynamic_dropdown 0.0.1 custom_static_dynamic_dropdown: ^0.0.1 copied to clipboard
Custom Dropdown
import 'package:custom_static_dynamic_dropdown/custom_dropdown.dart';
import 'package:flutter/material.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
useMaterial3: true,
),
home: const MyHomePage(title: 'Flutter Demo Home Page'),
);
}
}
class MyHomePage extends StatefulWidget {
const MyHomePage({super.key, required this.title});
final String title;
@override
State<MyHomePage> createState() => _MyHomePageState();
}
class AuthHelperConfig extends IAuthHelper {
@override
Future<String> getToken() async {
return "Bearer eyJhbGciOiJSUzI1NiIsInR5cCIgOiAiSldUIiwia2lkIiA6ICJjY19tczB2ZjE4RHVtQ3NXSTF3a2ZwVXF6RHFqTDhueE5jeWlEZGl2VktFIn0.eyJleHAiOjE3MDc5MTAwMTAsImlhdCI6MTcwNzkwODIxMCwianRpIjoiNDUyODkwZWItMjdlZi00ZjYyLTk5OTktNmM0MWFhZTIwMDViIiwiaXNzIjoiaHR0cHM6Ly9hdXRoLnNpdC5rYXJraW5vcy5pbi9hdXRoL3JlYWxtcy9rYXJraW5vcyIsImF1ZCI6ImFjY291bnQiLCJzdWIiOiIwOTBlMTVmZC0yMWIzLTRjYTUtOTdkZC1hOTRlZTFiMTUwZDAiLCJ0eXAiOiJCZWFyZXIiLCJhenAiOiJrb25nIiwic2Vzc2lvbl9zdGF0ZSI6IjEwZDViMmNlLTBlMWYtNDVlNi05NTBkLWFmYmE4ZjVkYmFkOCIsImFjciI6IjEiLCJhbGxvd2VkLW9yaWdpbnMiOlsiaHR0cHM6Ly9hcGkuc2l0Lmthcmtpbm9zLmluIl0sInJlYWxtX2FjY2VzcyI6eyJyb2xlcyI6WyJtYW5hZ2UtdWktdGVtcGxhdGUiLCJleHBlcnQiLCJrYXJlbWl0cmEiLCJwcmFjdGl0aW9uZXIiLCJ0ZWxlLXJhZGlvbG9neS1hZG1pbiIsIm9mZmxpbmVfYWNjZXNzIiwidW1hX2F1dGhvcml6YXRpb24iLCJ0ZWxlLXJhZGlvbG9neS1yYWRpb2xvZ2lzdCIsInZ0Yi1jb29yZGluYXRvciJdfSwicmVzb3VyY2VfYWNjZXNzIjp7ImFjY291bnQiOnsicm9sZXMiOlsibWFuYWdlLWFjY291bnQiLCJtYW5hZ2UtYWNjb3VudC1saW5rcyIsInZpZXctcHJvZmlsZSJdfX0sInNjb3BlIjoibWlncmF0aW9uLWVuZHBvaW50LXNjb3BlIGtvbmdfa2FyZW1pdHJhIHByb2ZpbGUga29uZ19leHBlcnQgZW1haWwiLCJlbWFpbF92ZXJpZmllZCI6dHJ1ZSwibmFtZSI6IlJhZGhleXNoeWFtIEphdCIsInByZWZlcnJlZF91c2VybmFtZSI6InJhZGhleXNoeWFtLmphdEBrYXJraW5vcy5pbiIsImdpdmVuX25hbWUiOiJSYWRoZXlzaHlhbSIsImZhbWlseV9uYW1lIjoiSmF0IiwiZW1haWwiOiJyYWRoZXlzaHlhbS5qYXRAa2Fya2lub3MuaW4ifQ.bNETHus20SVwjIVsZ5cJ6m-aq9r5Md-unF2fLpX04QuhNYbLIwnjCWUIGCK1MxDismxXVM1mRcusR-74xvOiRfYPsANaNlUEtGmPJZ2ELFN1CTQza0xKFF1OJ97sCBZYNHMnmte2ag8sueaHQX6_N5PSk0vTGLLaYV9FwJPLDwD0iKtUPCovvtuSSpJ1G9AWDtX9_P7Hv3vNMAMETsfPWVjQpelCG896CtA-xGrhCfPdGzxXekYX5rgGwqBte4mrG8a8ei2RagxqR-wcQ83DfmFakqqAHGQ-mm8AKu5fQcV9i4ABKZvN3xw_egHRqECO88ORbPFxUyVzP9L11EqT2A";
}
}
class DropDownConfig extends DropDownApiConfig {
@override
String getIdKey() {
return "caseId";
}
@override
String getSearchKeyNameInUrl() {
return "searchStr";
}
@override
String getUrl() {
return "https://edge-web.sit.karkinos.in/case/edge/worklist/v7";
}
@override
String getValueKey() {
return "fullName";
}
@override
int singlePageSize() {
return 10;
}
}
class _MyHomePageState extends State<MyHomePage> {
List<CustomDropDownModel> listOfValues = [
CustomDropDownModel(id: "0", valueDisplay: "0"),
CustomDropDownModel(id: "1", valueDisplay: "1"),
CustomDropDownModel(
id: "2", valueDisplay: "2 custom long text which we can test on wrap"),
CustomDropDownModel(id: "3", valueDisplay: "3"),
CustomDropDownModel(id: "4", valueDisplay: "4"),
CustomDropDownModel(id: "5", valueDisplay: "5"),
CustomDropDownModel(id: "6", valueDisplay: "6"),
CustomDropDownModel(id: "7", valueDisplay: "7"),
CustomDropDownModel(id: "8", valueDisplay: "8"),
CustomDropDownModel(id: "9", valueDisplay: "9"),
CustomDropDownModel(id: "10", valueDisplay: "10"),
CustomDropDownModel(id: "11", valueDisplay: "11"),
CustomDropDownModel(id: "12", valueDisplay: "12"),
];
@override
Widget build(BuildContext context) {
return Scaffold(
body: SafeArea(
child: SingleChildScrollView(
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
CommonConfigurationDropDown(
editorPlaceholder: "Static Data Single Select Dropdown",
child: StaticDataSingleSelectDropDown(
listOfValues: listOfValues)),
CommonConfigurationDropDown(
editorPlaceholder:
"Static Data Single Select Searchable Dropdown",
child: StaticDataSingleSelectSearchableDropDown(
listOfValues: listOfValues)),
CommonConfigurationDropDown(
editorPlaceholder: "Static data Multi Select Dropdown",
child: StaticDataMultiSelectDropDown(
listOfValues: listOfValues)),
CommonConfigurationDropDown(
editorPlaceholder:
"Static Data Multi Select Searchable DropDown",
child: StaticDataMultiSelectSearchableDropDown(
listOfValues: listOfValues)),
CommonConfigurationDropDown(
editorPlaceholder: "Dynamic Data Single Select Dropdown",
child: DynamicDataSingleSelectDropdown(
authHelper: AuthHelperConfig(),
dropDownApiConfig: DropDownConfig())),
CommonConfigurationDropDown(
editorPlaceholder:
"Dynamic Data Single Select Searchable Dropdown",
child: DynamicDataSingleSelectSearchableDropdown(
authHelper: AuthHelperConfig(),
dropDownApiConfig: DropDownConfig())),
CommonConfigurationDropDown(
editorPlaceholder:
"Dynamic Data Single Select Pagination Dropdown",
child: DynamicDataSingleSelectPaginationDropdown(
authHelper: AuthHelperConfig(),
dropDownApiConfig: DropDownConfig())),
CommonConfigurationDropDown(
editorPlaceholder:
"Dynamic Data Single Select Searchable Pagination Dropdown",
child: DynamicDataSingleSelectSearchablePaginationDropdown(
authHelper: AuthHelperConfig(),
dropDownApiConfig: DropDownConfig())),
CommonConfigurationDropDown(
editorPlaceholder: "Dynamic Data Multi Select Dropdown",
child: DynamicDataMultiSelectDropdown(
authHelper: AuthHelperConfig(),
callbackSelectedValue: (p0) {
debugPrint("Selected is here ${p0}");
},
dropDownApiConfig: DropDownConfig())),
CommonConfigurationDropDown(
editorPlaceholder:
"Dynamic Data Multi Select Pagination Dropdown",
child: DynamicDataMultiSelectPaginationDropdown(
authHelper: AuthHelperConfig(),
callbackSelectedValue: (p0) {
debugPrint("Selected is here ${p0}");
},
dropDownApiConfig: DropDownConfig())),
CommonConfigurationDropDown(
editorPlaceholder:
"Dynamic Data Multi Select Searchable Pagination Dropdown",
child: DynamicDataMultiSelectSearchablePaginationDropdown(
authHelper: AuthHelperConfig(),
callbackSelectedValue: (p0) {
debugPrint("Selected is here ${p0}");
},
dropDownApiConfig: DropDownConfig())),
CommonConfigurationDropDown(
editorPlaceholder:
"Dynamic Data Multi Select Searchable Dropdown",
child: DynamicDataMultiSelectSearchableDropdown(
authHelper: AuthHelperConfig(),
callbackSelectedValue: (p0) {
debugPrint("Selected is here ${p0}");
},
dropDownApiConfig: DropDownConfig())),
],
),
),
),
);
}
}