In FlutterFlow, how do I pass a Widget Builder into a Custom Code Widget and modify its parameters or state?
15:28 07 Feb 2025

In FlutterFlow, in my custom code Widget I want to pass in a Component (ExhibitCellStatic) as a Widget Builder and use it as an overlay. However, I want to modify its data before including it in my custom code Widget's build() method. I have a "title" parameter specified in the custom code Widget's Widget Builder params:

enter image description here enter image description here

It seems that when instantiating the Widget Builder (ExhibitCellStatic) in the custom code, it's ignoring any parameters...

class CustomComp extends StatefulWidget {
  const CustomComp({
    super.key,
    this.width,
    this.height,
    required this.exhibitCellWidget,

    final double? width;
    final double? height;
    final Widget Function(String? title) exhibitCellWidget;
  });

  @override
  State createState() => _CustomCompState();
}

class _CustomCompState extends State {
  @override
  Widget build(BuildContext context) {
    return widget.exhibitCellWidget("Hello Title") // shows "Title From FF Layout"
  }
}

...instead, it seems to only use what was passed in from where it was specified in the FF layout editor:

enter image description here

Is there any other way to modify the data being displayed in the Widget Builder from within the parent custom code? I thought maybe I could modify the Widget Builder's state variables but having trouble connecting the dots there. Something like:

var exhibitCell = widget.exhibitCellWidget("Ignored Title");
exhibitCell.setState((){
  this.title = "Hello World!";
});

Ideally the widget parameters would just be overridden in the custom code. Is this not supported?

flutter dart flutterflow