singleSelectChip function

dynamic singleSelectChip({
  1. required String text,
  2. List? data,
  3. TextEditingController? controller,
  4. Function? onDonePressed,
  5. void onSelectedChanged(
    1. String
    )?,
})

Implementation

singleSelectChip({
  required String text,
  List? data,
  TextEditingController? controller,
  Function? onDonePressed,
  void Function(String)? onSelectedChanged,
}) async
{
  return showDialog(
      context: Get.context!,
      //barrierDismissible: true,
      builder: (BuildContext context) {
        //ApplicationController applicationController = Get.find<ApplicationController>();
        return AlertDialog(
          title: Text(text),
          // Row(
          //   children: <Widget>[
          //     //if( !showSearch )
          //       Expanded(child: Text(text)),
          //
          //     //if( showSearch )
          //       Expanded(
          //         child: Container(
          //           padding: EdgeInsets.only(top: 5),
          //           child: CustomTextFormField(
          //             keyboardType: TextInputType.text,
          //             //autofocus: true,
          //             labelText: 'nav_Recherche'.tr,
          //             hintText: 'nav_RechercheHint'.tr,
          //             onChanged: (String? value) {
          //               //this.chantUser.position = value ?? '';
          //             },
          //             validator: (String? value) {
          //               if (value!.isEmpty) {
          //                 return '${'msg_required'.tr}';
          //               }
          //               return null;
          //             },
          //           ),
          //         ),
          //       ),
          //
          //     // if( !showSearch )
          //     //   IconButton(icon: const Icon(Icons.search),
          //     //       color: ColorResources.getColor(color: Colors.black),
          //     //       onPressed: () =>
          //     //           setState(() {
          //     //             showSearch = !showSearch;
          //     //           })),
          //     //
          //     // if( showSearch )
          //       IconButton(icon: const Icon(Icons.close),
          //           color: ColorResources.getColor(color: Colors.black),
          //           onPressed: () => Navigator.pop(context)),
          //   ],
          // ),
          titlePadding:
              const EdgeInsets.only(left: 10.0, right: 0.0, top: 0, bottom: 0),
          content: SingleSelectDialog(
            data: data,
            onSelectedChanged: (selected) => onSelectedChanged!(selected),
          ),
          contentPadding: const EdgeInsets.only(
              left: 10.0, right: 10.0, top: 5.0, bottom: 5.0),
          actions: <Widget>[
            TextButton(
              onPressed: onDonePressed != null
                  ? onDonePressed()
                  : () {
                      Navigator.pop(context);
                    },
              child: Text('done'.tr),
            ),
          ],
        );
      });
}