Skip to content

Commit

Permalink
refactor: remove flex
Browse files Browse the repository at this point in the history
  • Loading branch information
johannesvedder committed Apr 16, 2024
1 parent 01133cc commit 6509e85
Showing 1 changed file with 21 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,27 +40,24 @@ class _QuestionnaireTaskWidgetState extends State<QuestionnaireTaskWidget> {

@override
Widget build(BuildContext context) {
final questionnaireWidget = QuestionnaireWidget(
widget.task.questions.questions,
header: widget.task.header,
footer: widget.task.footer,
onChange: _responseValidator,
onComplete: (qs) => setState(() {
response = qs;
}),
);
return Flex(direction: Axis.vertical, children: [
Expanded(
child: Column(
children: [
Expanded(
child: Form(
key: formKey,
child: questionnaireWidget,
),
return Column(
children: [
Expanded(
child: Form(
key: formKey,
child: QuestionnaireWidget(
widget.task.questions.questions,
header: widget.task.header,
footer: widget.task.footer,
onChange: _responseValidator,
onComplete: (qs) => setState(() {
response = qs;
}),
),
if (response != null && responseValidator)
ElevatedButton.icon(
),
),
response != null && responseValidator
? ElevatedButton.icon(
style: ButtonStyle(backgroundColor: MaterialStateProperty.all<Color>(Colors.green)),
onPressed: () async {
if (isRedundantClick(loginClickTime)) {
Expand All @@ -83,11 +80,10 @@ class _QuestionnaireTaskWidgetState extends State<QuestionnaireTaskWidget> {
},
icon: _isLoading ? const CircularProgressIndicator(color: Colors.white) : const Icon(Icons.check),
label: Text(AppLocalizations.of(context)!.complete),
),
],
),
)
]);
)
: const SizedBox.shrink(),
],
);
}

void _responseValidator(QuestionnaireState qs) {
Expand Down

0 comments on commit 6509e85

Please sign in to comment.