12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394 |
- import 'package:flutter/cupertino.dart';
- import 'package:flutterappfuyou/code/base/YSBase.dart';
- import 'package:flutterappfuyou/code/base/YSNetWorking.dart';
- import 'package:flutterappfuyou/code/version2/YSMineQuestionnaireDetail.dart';
- class YSMineQuestionnaire extends StatefulWidget {
- const YSMineQuestionnaire({Key key}) : super(key: key);
- @override
- _YSMineQuestionnaireState createState() => _YSMineQuestionnaireState();
- }
- class _YSMineQuestionnaireState extends State<YSMineQuestionnaire> {
- List _dataArray = [];
- @override
- void initState() {
- Future.delayed(Duration(seconds: 0)).then((value) {
- _refreshData();
- });
- super.initState();
- }
- @override
- Widget build(BuildContext context) {
- return YSBase(
- ystitle: '调查问卷',
- yschild: Container(
- height: MediaQuery.of(context).size.height,
- width: MediaQuery.of(context).size.width,
- child: _dataArray.length==0?Container(
- alignment: Alignment.center,
- child: Image.asset('lib/images/none.png',height: 200,width: 200,),
- ):ListView.separated(
- itemBuilder: (context,index){
- Map item = _dataArray[index];
- String statusStr = item['status']=='load'?'未开始':item['status']=='progress'?'进行中':item['status']=='end'?'已结束':'已停止';
- return GestureDetector(
- onTap: (){
- Navigator.of(context).push(
- CupertinoPageRoute(builder: (context){
- return YSMineQuestionnaireDetail(questionId: item['id']);
- })
- );
- },
- behavior: HitTestBehavior.opaque,
- child: Container(
- padding: EdgeInsets.all(15),
- child: LayoutBuilder(
- builder: (context,conSize){
- return Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Container(
- padding: EdgeInsets.only(bottom: 10),
- child: Row(
- children: [
- Container(
- width: conSize.maxWidth-80,
- padding: EdgeInsets.only(right: 10),
- child: Text(item['title']??'',style: TextStyle(fontSize: 14,color: Color(0xFF606266)),),
- ),
- Container(
- width: 80,
- child: Text(statusStr,style: TextStyle(fontSize: 10,color: Color(0xFFD0021B)),),
- alignment: Alignment.centerRight,
- )
- ],
- ),
- ),
- Text('开始时间:${item['time_start']??''} 截止时间:${item['time_end']??''}',style: TextStyle(fontSize: 8,color: Color(0xFF989898)),),
- ],
- );
- },
- ),
- ),
- );
- },
- separatorBuilder: (context,index){
- return Container(height: 5,color: Color(0xFFF5F3F0),);
- },
- itemCount: _dataArray.length,
- padding: EdgeInsets.only(top: 10),
- ),
- ),
- );
- }
- _refreshData() async{
- Map dict = await ysRequestHttp(context, requestType.get, 'naire/list',{});
- if(dict!=null){
- _dataArray = dict['data']??[];
- setState(() {});
- }
- }
- }
|