From bba0d4e52ccea6ef7aadf1455f7a7c3f4bec5c55 Mon Sep 17 00:00:00 2001 From: zhang <494089941@qq.com> Date: Sun, 7 Feb 2021 10:59:02 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A7=BB=E9=99=A4**=E6=96=87=E4=BB=B6=EF=BC=8C?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E9=97=AE=E5=8D=B7=E8=B0=83=E6=9F=A5=E8=AF=A6?= =?UTF-8?q?=E6=83=85=E9=A1=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../questionnaire_details_page.dart | 282 ------------------ .../questionnaire_detail_page.dart | 72 +++++ .../questionnaire}/questionnaire_page.dart | 5 +- 3 files changed, 76 insertions(+), 283 deletions(-) delete mode 100644 lib/pages/questionnaire_page/questionnaire_details_page/questionnaire_details_page.dart create mode 100644 lib/ui/manager/questionnaire/questionnaire_detail_page.dart rename lib/{pages/questionnaire_page => ui/manager/questionnaire}/questionnaire_page.dart (96%) diff --git a/lib/pages/questionnaire_page/questionnaire_details_page/questionnaire_details_page.dart b/lib/pages/questionnaire_page/questionnaire_details_page/questionnaire_details_page.dart deleted file mode 100644 index 723e4505..00000000 --- a/lib/pages/questionnaire_page/questionnaire_details_page/questionnaire_details_page.dart +++ /dev/null @@ -1,282 +0,0 @@ -// Flutter imports: -import 'package:flutter/cupertino.dart'; -import 'package:flutter/material.dart'; - -// Package imports: -import 'package:flutter_html/flutter_html.dart'; - -// Project imports: -import 'package:akuCommunity/base/base_style.dart'; -import 'package:akuCommunity/routers/page_routers.dart'; -import 'package:akuCommunity/utils/headers.dart'; -import 'package:akuCommunity/widget/bee_scaffold.dart'; -import 'package:akuCommunity/widget/cached_image_wrapper.dart'; - -class QuestionnaireDetailsPage extends StatefulWidget { - final Bundle bundle; - QuestionnaireDetailsPage({Key key, this.bundle}) : super(key: key); - - @override - _QuestionnaireDetailsPageState createState() => - _QuestionnaireDetailsPageState(); -} - -const htmlData = ''' -

亲爱的家长朋友,您好!很高兴您为孩子选择了狮子画 - 室的课程。
- 为了能够在上课中,更好的了解咱们孩子的学习情况和 - 上课感受,更针对性的给孩子们提供更好的学习服务, - 现诚邀请您填写我们的课程满意度调查问卷。所有问卷 - 信息严格保密,请放心填写。 -

-'''; - -class _QuestionnaireDetailsPageState extends State { - TextEditingController _ideaContent = new TextEditingController(); - - String hintText = '您的宝贵意见是我们前进的明灯'; - - List> _listQuestion = [ - { - 'title': '您的身份是?', - 'option': >[ - {'title': '学员', 'isCheck': false}, - {'title': '家长', 'isCheck': false} - ] - }, - { - 'title': '您所学习的课程是?', - 'option': >[ - {'title': '儿童美术', 'isCheck': false}, - {'title': '素描', 'isCheck': false}, - {'title': '国画', 'isCheck': false}, - {'title': '漫画', 'isCheck': false}, - {'title': '书法', 'isCheck': false}, - {'title': '陶艺', 'isCheck': false} - ] - }, - { - 'title': '您选择我们的原因是?', - 'option': >[ - {'title': '师资力量', 'isCheck': false}, - {'title': '教学口碑', 'isCheck': false}, - {'title': '地理位置', 'isCheck': false}, - {'title': '其他人介绍', 'isCheck': false} - ] - }, - { - 'title': '学习后孩子的成绩是否有所提升?', - 'option': >[ - {'title': '有很大变化有很大变化有很大变化有很大变化有很大变化有很大变化', 'isCheck': false}, - {'title': '变化一般', 'isCheck': false}, - {'title': '没变化', 'isCheck': false} - ] - } - ]; - - Widget _questionCard(String title, List> optionList) { - return Container( - margin: EdgeInsets.only(top: 64.w), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - title, - style: TextStyle( - fontWeight: FontWeight.w600, - fontSize: BaseStyle.fontSize32, - color: BaseStyle.color4a4b51, - ), - ), - Container( - margin: EdgeInsets.only(top: 64.w), - child: Wrap( - runSpacing: 48.w, - children: optionList - .map((item) => InkWell( - onTap: () { - setState(() { - item['isCheck'] = !item['isCheck']; - }); - }, - child: Container( - margin: EdgeInsets.only(left: 15.w), - width: MediaQuery.of(context).size.width / 2.35, - child: Row( - children: [ - Icon( - item['isCheck'] - ? Icons.radio_button_checked - : Icons.radio_button_unchecked, - color: item['isCheck'] - ? BaseStyle.colorffc40c - : BaseStyle.color979797, - size: 32.w, - ), - Container( - margin: EdgeInsets.only(left: 16.w), - width: MediaQuery.of(context).size.width / 3.2, - child: Text( - item['title'], - maxLines: 2, - style: TextStyle( - fontWeight: item['isCheck'] - ? FontWeight.w600 - : FontWeight.normal, - fontSize: BaseStyle.fontSize28, - color: BaseStyle.color4a4b51, - ), - ), - ), - ], - ), - ), - )) - .toList(), - ), - ), - ], - ), - ); - } - - Widget _containerTextField() { - return Container( - padding: EdgeInsets.only(top: 24.w, left: 24.w, right: 32.w), - decoration: BoxDecoration( - borderRadius: BorderRadius.all(Radius.circular(6)), - border: Border.all(color: Color(0xffd4cfbe), width: 1.0), - ), - child: TextFormField( - cursorColor: Color(0xffffc40c), - style: TextStyle( - fontSize: BaseStyle.fontSize28, - fontWeight: FontWeight.w600, - ), - controller: _ideaContent, - onChanged: (String value) {}, - maxLines: 10, - decoration: InputDecoration( - isDense: true, - contentPadding: EdgeInsets.only( - top: 0, - bottom: 0, - ), - hintText: hintText, - border: InputBorder.none, //去掉输入框的下滑线 - fillColor: Colors.white, - filled: true, - hintStyle: TextStyle( - color: BaseStyle.color999999, - fontSize: BaseStyle.fontSize28, - fontWeight: FontWeight.normal, - ), - ), - ), - ); - } - - Widget _positionedBottomBar() { - return Positioned( - bottom: 0, - child: Container( - alignment: Alignment.center, - height: 98.w, - width: MediaQuery.of(context).size.width, - child: InkWell( - onTap: () {}, - child: Container( - alignment: Alignment.center, - color: BaseStyle.colorffc40c, - padding: EdgeInsets.symmetric( - vertical: 26.5.w, - ), - child: Text( - '确认提交', - style: TextStyle( - fontWeight: FontWeight.w600, - fontSize: BaseStyle.fontSize32, - color: ktextPrimary, - ), - ), - ), - ), - ), - ); - } - - @override - Widget build(BuildContext context) { - return BeeScaffold( - title: '问卷调查', - body: Container( - color: Colors.white, - child: Stack( - children: [ - Container( - padding: EdgeInsets.only( - left: 32.w, - right: 32.w, - bottom: 155.w, - ), - child: ListView( - children: [ - Container( - margin: EdgeInsets.only(top: 24.w), - child: ClipRRect( - borderRadius: BorderRadius.all(Radius.circular(4.w)), - child: CachedImageWrapper( - url: widget.bundle.getMap('details')['imagePath'], - width: 686.w, - height: 228.w, - ), - ), - ), - Container( - margin: EdgeInsets.only(top: 40.w), - alignment: Alignment.center, - child: Text( - widget.bundle.getMap('details')['title'], - style: TextStyle( - fontSize: BaseStyle.fontSize32, - color: BaseStyle.color4a4b51, - fontWeight: FontWeight.w600, - ), - ), - ), - Container( - margin: EdgeInsets.only(top: 35.w), - alignment: Alignment.center, - width: 672.w, - child: Html(data: htmlData), - ), - Container( - margin: EdgeInsets.only(top: 129.w), - child: Column( - children: _listQuestion - .map((item) => _questionCard( - item['title'], - item['option'], - )) - .toList(), - ), - ), - Container( - margin: EdgeInsets.only(top: 80.w, bottom: 24.w), - child: Text( - '您的觉得我们需要改进的地方', - style: TextStyle( - fontSize: BaseStyle.fontSize28, color: ktextPrimary), - ), - ), - _containerTextField(), - ], - ), - ), - _positionedBottomBar(), - ], - ), - ), - ); - } -} diff --git a/lib/ui/manager/questionnaire/questionnaire_detail_page.dart b/lib/ui/manager/questionnaire/questionnaire_detail_page.dart new file mode 100644 index 00000000..dd90ed6b --- /dev/null +++ b/lib/ui/manager/questionnaire/questionnaire_detail_page.dart @@ -0,0 +1,72 @@ +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/widget/bee_scaffold.dart'; +import 'package:akuCommunity/widget/buttons/bottom_button.dart'; +import 'package:flutter/material.dart'; +import 'package:akuCommunity/utils/headers.dart'; +import 'package:flutter_easyrefresh/easy_refresh.dart'; + +class QuestionnaireDetailPage extends StatefulWidget { + final int id; + QuestionnaireDetailPage({Key key, this.id}) : super(key: key); + + @override + _QuestionnaireDetailPageState createState() => + _QuestionnaireDetailPageState(); +} + +class _QuestionnaireDetailPageState extends State { + QuestionnaireDetialModel _model; + bool _onload = true; + + Widget _emptyWidget() { + return Container(); + } + + @override + Widget build(BuildContext context) { + return BeeScaffold( + title: '问卷调查', + body: EasyRefresh( + firstRefresh: true, + header: MaterialHeader(), + onRefresh: () async { + _model = await ManagerFunc.questionnairefindById(widget.id); + _onload = false; + }, + child: _onload + ? _emptyWidget() + : ListView( + padding: EdgeInsets.symmetric(horizontal: 32.w, vertical: 24.w), + children: [ + Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(4.w), + ), + width: double.infinity, + height: 228.w, + clipBehavior: Clip.antiAlias, + child: FadeInImage.assetNetwork( + placeholder: R.ASSETS_IMAGES_LOGO_PNG, + image: API.image(_model.voResourcesImgList.first.url)), + ), + 40.w.heightBox, + _model.title.text.color(ktextPrimary).size(32.sp).bold.make(), + 36.w.heightBox, + _model.description.text + .color(ktextPrimary) + .size(28.sp) + .make(), + 130.w.heightBox, + ], + ), + ), + bottomNavi: BottomButton( + child: '确认提交'.text.black.size(32.sp).bold.make(), + onPressed: () {}, + ), + ); + } +} diff --git a/lib/pages/questionnaire_page/questionnaire_page.dart b/lib/ui/manager/questionnaire/questionnaire_page.dart similarity index 96% rename from lib/pages/questionnaire_page/questionnaire_page.dart rename to lib/ui/manager/questionnaire/questionnaire_page.dart index a52baec7..c2533e74 100644 --- a/lib/pages/questionnaire_page/questionnaire_page.dart +++ b/lib/ui/manager/questionnaire/questionnaire_page.dart @@ -2,6 +2,7 @@ import 'package:akuCommunity/base/base_style.dart'; import 'package:akuCommunity/constants/api.dart'; import 'package:akuCommunity/model/manager/questinnaire_model.dart'; import 'package:akuCommunity/pages/things_page/widget/bee_list_view.dart'; +import 'package:akuCommunity/ui/manager/questionnaire/questionnaire_detail_page.dart'; import 'package:akuCommunity/widget/bee_scaffold.dart'; import 'package:akuCommunity/widget/others/stack_avatar.dart'; import 'package:flutter/material.dart'; @@ -111,7 +112,9 @@ class _QuestionnairePageState extends State { // padding: // EdgeInsets.symmetric(horizontal: 30.w, vertical: 8.w), elevation: 0, - onPressed: () {}, + onPressed: () { + QuestionnaireDetailPage(id: model.id,).to(); + }, child: (_getButtonText(model.status)) .text .black