create method

  1. @override
Widget create(
  1. ButtonWidgetData data,
  2. Environment environment,
  3. BuildContext context
)
override

create the widget given a WidgetData type data the widget data environment the current Environment context the BuildContext

Implementation

@override
Widget create(ButtonWidgetData data, Environment environment, BuildContext context) {
  // In edit mode, make the button non-interactive
  return IgnorePointer(
    ignoring: true,
    child: ElevatedButton(
      onPressed: () {  }, // This won't be called due to IgnorePointer

      style: ElevatedButton.styleFrom(
          foregroundColor: data.foregroundColor,
          backgroundColor: data.backgroundColor,
          textStyle: data.font?.textStyle(),
          padding: data.padding?.edgeInsets()
      ),
      child: Text(data.label.value),
    ),
  );
}