添加问卷调查单选模块

hmxc
张萌 4 years ago
parent e208d398df
commit c0e98280a7

@ -2,6 +2,7 @@ import 'package:akuCommunity/base/base_style.dart';
import 'package:akuCommunity/constants/api.dart';
import 'package:akuCommunity/model/manager/questionnaire_detail_model.dart';
import 'package:akuCommunity/pages/manager_func.dart';
import 'package:akuCommunity/ui/manager/questionnaire/questionnaire_siglecheck.dart';
import 'package:akuCommunity/widget/bee_scaffold.dart';
import 'package:akuCommunity/widget/buttons/bee_single_check.dart';
import 'package:akuCommunity/widget/buttons/bottom_button.dart';
@ -21,46 +22,46 @@ class QuestionnaireDetailPage extends StatefulWidget {
class _QuestionnaireDetailPageState extends State<QuestionnaireDetailPage> {
QuestionnaireDetialModel _model;
bool _onload = true;
int _select;
Widget _emptyWidget() {
return Container();
}
Widget _singleCheck(String title, List<QuestionnaireChoiceVoList> answers) {
return Container(
width: double.infinity,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
title.text.black.size(32.sp).bold.make(),
64.w.heightBox,
Flex(
direction: Axis.horizontal,
children: [
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
...answers.oddList().map((e){
return Row(
children: [
BeeSingleCheck(
value: e.id,
groupValue: ,
),
],
);
}).toList(),
].sepWidget(separate: 48.w.heightBox),
).expand(flex: 1),
Column(
children: [],
).expand(flex: 1),
],
)
],
),
);
}
// Widget _singleCheck(String title, List<QuestionnaireChoiceVoList> answers) {
// return Container(
// width: double.infinity,
// child: Column(
// crossAxisAlignment: CrossAxisAlignment.start,
// children: [
// title.text.black.size(32.sp).bold.make(),
// 64.w.heightBox,
// Flex(
// direction: Axis.horizontal,
// children: [
// Column(
// crossAxisAlignment: CrossAxisAlignment.start,
// children: <Widget>[
// ...answers.oddList().map((e){
// return Row(
// children: [
// BeeSingleCheck(
// value: e.id,
// groupValue: ,
// ),
// ],
// );
// }).toList(),
// ].sepWidget(separate: 48.w.heightBox),
// ).expand(flex: 1),
// Column(
// children: [],
// ).expand(flex: 1),
// ],
// )
// ],
// ),
// );
// }
@override
Widget build(BuildContext context) {
@ -105,9 +106,16 @@ class _QuestionnaireDetailPageState extends State<QuestionnaireDetailPage> {
.size(28.sp)
.make(),
130.w.heightBox,
_singleCheck(
'title',
_model.questionnaireTopicVoList.first
QuestionnaireSingleCheck(
title: 'title',
selected: _select,
onPressed: (id) {
_select = id;
setState(() {
});
},
answers: _model.questionnaireTopicVoList.first
.questionnaireChoiceVoList)
],
),

@ -0,0 +1,86 @@
import 'package:akuCommunity/model/manager/questionnaire_detail_model.dart';
import 'package:akuCommunity/widget/buttons/bee_single_check.dart';
import 'package:flutter/material.dart';
import 'package:akuCommunity/utils/headers.dart';
class QuestionnaireSingleCheck extends StatefulWidget {
final String title;
final List<QuestionnaireChoiceVoList> answers;
final int selected;
final Function(int) onPressed;
QuestionnaireSingleCheck(
{Key key, this.title, this.answers, this.selected, this.onPressed})
: super(key: key);
@override
_QuestionnaireSingleCheckState createState() =>
_QuestionnaireSingleCheckState();
}
class _QuestionnaireSingleCheckState extends State<QuestionnaireSingleCheck> {
@override
Widget build(BuildContext context) {
return Container(
width: double.infinity,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
widget.title.text.black.size(32.sp).bold.make(),
64.w.heightBox,
Padding(
padding: EdgeInsets.symmetric(horizontal: 96.w),
child: Flex(
direction: Axis.horizontal,
children: [
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
...widget.answers.oddList().map((e) {
return Row(
children: [
GestureDetector(
onTap: () {
widget.onPressed(e.id);
},
child: BeeSingleCheck(
value: e.id,
groupValue: widget.selected,
),
),
16.w.widthBox,
e.answer.text.black.size(28.sp).make(),
],
);
}).toList(),
].sepWidget(separate: 48.w.heightBox),
).expand(flex: 1),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
...widget.answers.evenList().map((e) {
return Row(
children: [
GestureDetector(
onTap: () {
widget.onPressed(e.id);
},
child: BeeSingleCheck(
value: e.id,
groupValue: widget.selected,
),
),
16.w.widthBox,
e.answer.text.black.size(28.sp).make(),
],
);
}).toList(),
].sepWidget(separate: 48.w.heightBox),
).expand(flex: 1),
],
),
)
],
),
);
}
}
Loading…
Cancel
Save