Skip to content

RPQuestionStep

Represents a RPStep holding a single question to be presented to the user.

The rendering of an RPQuestionStep depends on its answerFormat. Each answer type has its own user interface widget.

If you want to present multiple questions on the same page, use an RPFormStep.

Inheritance
Implementers
Annotations

Constructors

RPQuestionStep.fromJson

RPQuestionStep.fromJson(
  1. Map<String, dynamic> json
)

RPQuestionStep

RPQuestionStep({
  1. required String identifier,
  2. required String title,
  3. bool optional = false,
  4. required RPAnswerFormat answerFormat,
  5. bool autoSkip = false,
  6. Duration timeout = const Duration(seconds: 0),
  7. bool autoFocus = false,
  8. String? footnote,
})

Creates a RPQuestionStep.

identifier is a unique id of this step, title is shown as the title of the question), and answerFormat defines the type of questionnaire, as defined in RPAnswerFormat.

Properties

answerFormat

RPAnswerFormat answerFormat
getter/setter pair

The answer format which describes the format how a question can be answered.

autoFocus

bool autoFocus
getter/setter pair

Should the keyboard automatically be displayed when asking a text question? Applies only to RPTextAnswerFormat questions. False by default.

autoSkip

bool autoSkip
getter/setter pair

Should we automatically move to the next step after timeout seconds? False by default.

fromJsonFunction

Function get fromJsonFunction
override

The function which can convert a JSON string to an object of this type.

placeholder

String? placeholder
getter/setter pair

The placeholder text for the Question Steps using an answer format which requires text entry

stepWidget

Widget get stepWidget
override

The widget (UI representation) of the step.

RPQuestionSteps don't have it because their UI representation depends on the Answer Format. Their Answer Format is assessed by RPUIQuestionStep or RPUIFormStep and they return the corresponding UI.

When needed, it should be overridden to fit the different types of Steps.

timeout

Duration timeout
getter/setter pair

If autoSkip is true, defines how long to wait for the answer before automatically skipping to the next step.

Methods

toJson

Map<String, dynamic> toJson()
override

Return a JSON encoding of this object.