boxController property

BoxController? boxController
final

The controller object for the suggestion box. Can be used to control the suggestion box by opening, closing, and refreshing the content.

Use this property to manage the suggestion box externally. For example, to close the suggestion box when the user taps outside the box.

For example:

class ExternalControlExample extends StatelessWidget {
  final _boxController = BoxController();

  @override
  Widget build(BuildContext context) {
    return GestureDetector(
      onTap: () => _boxController.close?.call(),
      child: Scaffold(
        body: Center(
          child: FieldSuggestion(
            boxController: _boxController,
            ...
          ),
        ),
      ),
    );
  }
}

Implementation

final BoxController? boxController;