添加问卷调查单选模块

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