This package aims to provide set of question types with options and gets the response in custom generalized data. So the forms can be generated using certain rules and control it from server.
Features
Render question from server and capture its response
Getting started
TODO: List prerequisites and provide or point to information on how to start using the package.
Usage
import 'package:flutter/material.dart';
import 'package:question_frame/question_frame.dart';
import 'package:question_frame/src/model/option.dart';
final sampleQuestion = FrameQuestion(
id: 1,
mId: 1,
qKey: 'name',
qLabel: "Enter Your name",
qType: 'stringInput',
qMandatory: true,
mandatoryMessage: "Name is required for further interactions.",
onLoad: "",
onLoadMsg: '',
onActivity: "validateName",
onActivityMsg: "not a valid name",
qImage: '',
qAudio: '',
qVideo: '',
options: [
FrameOption(1, 1, -1, 2),
],
qHint: "Write your name below",
);
void main() {
final Map<FrameQuestion, FrameUserResponse> questionResponseMap = {};
final List<FrameQuestion> frameQuestion = [
sampleQuestion,
sampleQuestion.copyWith(
id: 2,
qKey: 'age',
onActivity: 'validateAge',
onActivityMsg: 'Not a Valid age',
qType: 'intInput'),
];
questionResponseMap.addEntries(
frameQuestion.map(
(question) => MapEntry(
question,
FrameUserResponse(
qId: question.id,
qType: question.qType,
options: question.options,
tag: question.qKey,
),
),
),
);
runApp(
MaterialApp(
home: FrameWidget(
questionResponseMap: questionResponseMap,
),
),
);
}
prepare a map of question(FrameQuestion) and corresponding userResponse(FrameUserResponse) and pass it to the frame widget.
Additional information
TODO: Tell users more about the package: where to find more information, how to contribute to the package, how to file issues, what response they can expect from the package authors, and more.
Libraries
- question_frame
- Support for doing something awesome.