123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605 |
- import 'package:flutter/cupertino.dart';
- import 'package:flutter/material.dart';
- import 'package:flutter/services.dart';
- import 'package:flutter_tzh/base/YSBase.dart';
- import 'package:flutter_tzh/home/view/YSInputView.dart';
- import 'package:flutter_tzh/home/view/YSMapView.dart';
- import 'package:flutter_tzh/tool/YSFileView.dart';
- import 'package:flutter_tzh/tool/YSNetWork.dart';
- import 'package:flutter_tzh/tool/YSTools.dart';
- //TODO:YSHomeListDetailGather
- class YSHomeListDetailGather extends StatefulWidget {
- final int gatherId;
- const YSHomeListDetailGather({Key? key, required this.gatherId}) : super(key: key);
- @override
- YSHomeListDetailGatherState createState() => YSHomeListDetailGatherState();
- }
- class YSHomeListDetailGatherState extends State<YSHomeListDetailGather> {
- bool _isHiden = false;
- final Map _contentMap = {'title':'采样描述'};
- final List _inputArray = [];
- final List _fileArray = [];
- String _value = '';
- @override
- void initState() {
- Future.delayed(const Duration(seconds: 0)).then((value) {
- _getSamplingFieldIndex();
- });
- super.initState();
- }
- @override
- Widget build(BuildContext context) {
- return YSBase(
- ysTitle: '采样',
- ysChild: GestureDetector(
- // onVerticalDragEnd: (value){
- // if(value.primaryVelocity!>0){
- // _isHiden = true;
- // }else if(value.primaryVelocity!<0){
- // _isHiden = false;
- // }
- // setState(() {});
- // },
- child: SingleChildScrollView(
- padding: EdgeInsets.only(left: hsp(20),right: hsp(20),top: hsp(20)),
- child: Column(
- children: [
- ClipRRect(
- borderRadius: const BorderRadius.all(Radius.circular(24)),
- child: Container(
- height: _isHiden?ysHeight(context)-ysTOP(context)-44-hsp(110):hsp(150),
- decoration: const BoxDecoration(
- color: Color(0xFF3E434E)
- ),
- child: const YSMapView(location: {'latitude': 57.24, 'longitude': 127.38},),
- ),
- ),
- GestureDetector(
- onTap: (){
- _isHiden = !_isHiden;
- setState(() {});
- },
- child: Container(
- padding: EdgeInsets.only(top: hsp(10),bottom: hsp(10)),
- child: Image.asset('images/tzh_${_isHiden?'up':'down1'}.png',height: hsp(15),width: hsp(15),),
- ),
- ),
- _isHiden?Container(
- height: hsp(50),
- decoration: const BoxDecoration(
- image: DecorationImage(image: AssetImage('images/tzh_hiden.png') )
- ),
- alignment: Alignment.center,
- padding: EdgeInsets.only(top: hsp(15)),
- child: Text('采样说明',style: TextStyle(fontSize: zsp(14),color: const Color(0xFFDBE1EA)),),
- ):SizedBox(
- height: ysHeight(context)-ysTOP(context)-44-hsp(205),
- child: Column(
- children: [
- SizedBox(
- height: ysHeight(context)-ysTOP(context)-44-hsp(277),
- child: SingleChildScrollView(
- child: Column(
- children: [
- Container(
- width: ysWidth(context)-hsp(40),
- decoration: const BoxDecoration(
- color: Color(0xFF3E434E),
- borderRadius: BorderRadius.all(Radius.circular(24))
- ),
- child: Column(
- children: [
- Container(
- height: hsp(50),
- alignment: Alignment.centerLeft,
- padding: EdgeInsets.only(left: hsp(15),right: hsp(15)),
- decoration: BoxDecoration(
- border: Border(bottom: BorderSide(color: const Color(0x99535966),width: hsp(1)))
- ),
- child: Text('采样描述',style: TextStyle(fontSize: zsp(14),color: const Color(0xFFDBE1EA)),),
- ),
- Container(
- width: ysWidth(context)-hsp(40),
- padding: EdgeInsets.all(hsp(15)),
- constraints: BoxConstraints(minHeight: hsp(100)),
- child: YSInputView2(item: _contentMap),
- )
- ],
- ),
- ),
- Container(
- margin: EdgeInsets.only(top: hsp(15),bottom: hsp(15)),
- padding: EdgeInsets.all(hsp(15)),
- decoration: const BoxDecoration(
- color: Color(0xFF3E434E),
- borderRadius: BorderRadius.all(Radius.circular(24))
- ),
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Container(
- decoration: BoxDecoration(
- color: const Color(0xFF1A1C1F),
- borderRadius: const BorderRadius.all(Radius.circular(3)),
- border: Border.all(color: const Color(0xFF3E434E),width: hsp(1))
- ),
- padding: EdgeInsets.only(left: hsp(12),right: hsp(12),top: hsp(5),bottom: hsp(5)),
- margin: EdgeInsets.only(bottom: hsp(10)),
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Text('有机土壤碳',style: TextStyle(fontSize: zsp(11),color: const Color(0xFFACB5C5)),),
- SizedBox(
- height: hsp(20),
- child: CupertinoTextField(
- placeholder: '请描述内容',
- style: TextStyle(fontSize: zsp(16),color: Colors.white),
- padding: const EdgeInsets.all(0),
- placeholderStyle: TextStyle(fontSize: zsp(16),color: Colors.white),
- decoration: const BoxDecoration(
- color: Colors.transparent
- ),
- suffix: Text('kg',style: TextStyle(fontSize: zsp(11),color: const Color(0xFFACB5C5)),),
- maxLines: 100,
- onChanged: (value){
- _value = value;
- },
- )
- )
- ],
- ),
- ),
- ListView.separated(
- itemBuilder: (context,index){
- Map item = _inputArray[index];
- return Container(
- decoration: BoxDecoration(
- color: const Color(0xFF1A1C1F),
- borderRadius: const BorderRadius.all(Radius.circular(3)),
- border: Border.all(color: const Color(0xFF3E434E),width: hsp(1))
- ),
- padding: EdgeInsets.only(left: hsp(12),right: hsp(12),top: hsp(5),bottom: hsp(5)),
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Text('${item['title']}',style: TextStyle(fontSize: zsp(11),color: const Color(0xFFACB5C5)),),
- SizedBox(
- height: hsp(20),
- child: CupertinoTextField(
- placeholder: '请输入${item['title']}',
- style: TextStyle(fontSize: zsp(16),color: Colors.white),
- padding: const EdgeInsets.all(0),
- placeholderStyle: TextStyle(fontSize: zsp(16),color: Colors.white),
- decoration: const BoxDecoration(
- color: Colors.transparent
- ),
- suffix: Text('${item['unit']}',style: TextStyle(fontSize: zsp(11),color: const Color(0xFFACB5C5)),),
- inputFormatters: [FilteringTextInputFormatter.allow(RegExp("[0-9.]"))],
- keyboardType: const TextInputType.numberWithOptions(),
- maxLines: 100,
- onChanged: (value){
- if(value.isEmpty){
- item.remove('value');
- }else{
- item['value'] = value;
- }
- },
- )
- )
- ],
- ),
- );
- },
- separatorBuilder: (context,index){
- return Container(height: hsp(10),);
- },
- itemCount: _inputArray.length,
- shrinkWrap: true,
- physics: const NeverScrollableScrollPhysics(),
- padding: const EdgeInsets.all(0),
- ),
- Container(
- alignment: Alignment.centerLeft,
- height: hsp(30),
- child: Text('附件',style: TextStyle(fontSize: zsp(11),color: const Color(0xFFACB5C5)),),
- ),
- YSUploadFileView2(fileArray: _fileArray),
- Container(
- alignment: Alignment.centerLeft,
- height: hsp(30),
- child: Text('建议尺寸900*400,最多4张,单个图片不超过20M。',style: TextStyle(fontSize: zsp(11),color: const Color(0xFFACB5C5)),),
- )
- ],
- ),
- ),
- ],
- ),
- ),
- ),
- GestureDetector(
- behavior: HitTestBehavior.opaque,
- onTap: () async{
- FocusScope.of(context).unfocus();
- // LogUtil.d(_fileArray);
- if(_contentMap['value']==null){
- ysFlutterToast('请填写采样描述');
- return;
- }
- if(_value.isEmpty){
- ysFlutterToast('请填写有机土壤碳信息');
- return;
- }
- // for (var element in _inputArray) {
- // if(element['value']==null){
- // ysFlutterToast('请完善${element['title']}');
- // return;
- // }
- // }
- List images = [];
- List video = [];
- for (var element in _fileArray) {
- if('${element['url']}'.contains('.mp4')==true){
- video.add(element['url']);
- }else{
- images.add(element['url']);
- }
- }
- Map request = {};
- request['id'] = widget.gatherId;
- request['describes'] = _contentMap['value'];
- request['recordList'] = _inputArray;
- request['imageList'] = images;
- if(video.isNotEmpty)request['video'] = video.first;
- request['value'] = _value;
- LogUtil.d(request);
- YSNetWork.ysRequestHttp(context, type: RequestType.post, api: '/samplingRecord/add', parameter: request, successSetter: (dict){
- ysFlutterToast('采样点数据更新成功');
- Navigator.of(context).pop('');
- },isLoading: true);
- },
- child: Image.asset('images/tzh_done.png',height: hsp(72),),
- )
- ],
- ),
- )
- ],
- ),
- ),
- ),
- );
- }
- _getSamplingFieldIndex() async{
- YSNetWork.ysRequestHttp(context, type: RequestType.get, api: '/samplingField/index', parameter: {}, successSetter: (dict){
- _inputArray.clear();
- _inputArray.addAll(dict['data']??[]);
- setState(() {});
- });
- }
- }
- //TODO:YSHomeListDetailGather2
- class YSHomeListDetailGather2 extends StatefulWidget {
- final int gatherId;
- const YSHomeListDetailGather2({Key? key, required this.gatherId}) : super(key: key);
- @override
- YSHomeListDetailGather2State createState() => YSHomeListDetailGather2State();
- }
- class YSHomeListDetailGather2State extends State<YSHomeListDetailGather2> {
- bool _isHiden = false;
- final Map _contentMap = {'title':'采样描述'};
- final List _inputArray = [];
- final List _fileArray = [];
- String _value = '';
- @override
- void initState() {
- Future.delayed(const Duration(seconds: 0)).then((value) {
- _getSamplingFieldData();
- });
- super.initState();
- }
- @override
- Widget build(BuildContext context) {
- return YSBase(
- ysTitle: '采样',
- ysChild: GestureDetector(
- // onVerticalDragEnd: (value){
- // if(value.primaryVelocity!>0){
- // _isHiden = true;
- // }else if(value.primaryVelocity!<0){
- // _isHiden = false;
- // }
- // setState(() {});
- // },
- child: SingleChildScrollView(
- padding: EdgeInsets.only(left: hsp(20),right: hsp(20),top: hsp(20)),
- child: Column(
- children: [
- ClipRRect(
- borderRadius: const BorderRadius.all(Radius.circular(24)),
- child: Container(
- height: _isHiden?ysHeight(context)-ysTOP(context)-44-hsp(110):hsp(150),
- decoration: const BoxDecoration(
- color: Color(0xFF3E434E)
- ),
- child: const YSMapView(location: {'latitude': 57.24, 'longitude': 127.38},),
- ),
- ),
- GestureDetector(
- onTap: (){
- _isHiden = !_isHiden;
- setState(() {});
- },
- child: Container(
- padding: EdgeInsets.only(top: hsp(10),bottom: hsp(10)),
- child: Image.asset('images/tzh_${_isHiden?'up':'down1'}.png',height: hsp(15),width: hsp(15),),
- ),
- ),
- _isHiden?Container(
- height: hsp(50),
- decoration: const BoxDecoration(
- image: DecorationImage(image: AssetImage('images/tzh_hiden.png') )
- ),
- alignment: Alignment.center,
- padding: EdgeInsets.only(top: hsp(15)),
- child: Text('采样说明',style: TextStyle(fontSize: zsp(14),color: const Color(0xFFDBE1EA)),),
- ):SizedBox(
- height: ysHeight(context)-ysTOP(context)-44-hsp(205),
- child: SingleChildScrollView(
- child: Column(
- children: [
- Container(
- width: ysWidth(context)-hsp(40),
- decoration: const BoxDecoration(
- color: Color(0xFF3E434E),
- ),
- child: Column(
- children: [
- Container(
- height: hsp(50),
- alignment: Alignment.centerLeft,
- padding: EdgeInsets.only(left: hsp(15),right: hsp(15)),
- decoration: BoxDecoration(
- border: Border(bottom: BorderSide(color: const Color(0x99535966),width: hsp(1)))
- ),
- child: Text('采样描述',style: TextStyle(fontSize: zsp(14),color: const Color(0xFFDBE1EA)),),
- ),
- Container(
- width: ysWidth(context)-hsp(40),
- padding: EdgeInsets.all(hsp(15)),
- constraints: BoxConstraints(minHeight: hsp(100)),
- child: Text('${_contentMap['value']??''}',style: TextStyle(fontSize: zsp(14),color: ysValueColor),),
- )
- ],
- ),
- ),
- Container(
- margin: EdgeInsets.only(top: hsp(15),bottom: hsp(15)),
- padding: EdgeInsets.all(hsp(15)),
- decoration: const BoxDecoration(
- color: Color(0xFF3E434E),
- borderRadius: BorderRadius.all(Radius.circular(24))
- ),
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Container(
- decoration: BoxDecoration(
- color: const Color(0xFF1A1C1F),
- borderRadius: const BorderRadius.all(Radius.circular(3)),
- border: Border.all(color: const Color(0xFF3E434E),width: hsp(1))
- ),
- padding: EdgeInsets.only(left: hsp(12),right: hsp(12),top: hsp(5),bottom: hsp(5)),
- margin: EdgeInsets.only(bottom: hsp(10)),
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Text('有机土壤碳',style: TextStyle(fontSize: zsp(11),color: const Color(0xFFACB5C5)),),
- SizedBox(
- height: hsp(20),
- child: Row(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: [
- Text(_value,style: TextStyle(fontSize: zsp(16),color: Colors.white),),
- Text('kg',style: TextStyle(fontSize: zsp(11),color: const Color(0xFFACB5C5)),)
- ],
- )
- )
- ],
- ),
- ),
- ListView.separated(
- itemBuilder: (context,index){
- Map item = _inputArray[index];
- return Container(
- decoration: BoxDecoration(
- color: const Color(0xFF1A1C1F),
- borderRadius: const BorderRadius.all(Radius.circular(3)),
- border: Border.all(color: const Color(0xFF3E434E),width: hsp(1))
- ),
- padding: EdgeInsets.only(left: hsp(12),right: hsp(12),top: hsp(5),bottom: hsp(5)),
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Text('${item['title']}',style: TextStyle(fontSize: zsp(11),color: const Color(0xFFACB5C5)),),
- SizedBox(
- height: hsp(20),
- child: Row(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: [
- Text('${item['total']??''}',style: TextStyle(fontSize: zsp(16),color: Colors.white),),
- Text('${item['unit']}',style: TextStyle(fontSize: zsp(11),color: const Color(0xFFACB5C5)),)
- ],
- )
- ),
- ],
- ),
- );
- },
- separatorBuilder: (context,index){
- return Container(height: hsp(10),);
- },
- itemCount: _inputArray.length,
- shrinkWrap: true,
- physics: const NeverScrollableScrollPhysics(),
- padding: const EdgeInsets.all(0),
- ),
- Container(
- alignment: Alignment.centerLeft,
- height: hsp(30),
- child: Text('附件',style: TextStyle(fontSize: zsp(11),color: const Color(0xFFACB5C5)),),
- ),
- YSFileView(fileArray: _fileArray),
- ],
- ),
- ),
- ],
- ),
- ),
- )
- ],
- ),
- ),
- ),
- );
- }
- _getSamplingFieldData() async{
- YSNetWork.ysRequestHttp(context, type: RequestType.get, api: '/samplingField/data', parameter: {'pointId':widget.gatherId}, successSetter: (dict){
- Map data = dict['data']??{};
- _value = '${data['value']}';
- _contentMap['value'] = '${data['describes']}';
- _fileArray.add({'url':data['video'],'type':2});
- List imageList = data['imageList']??[];
- for (var element in imageList) {
- _fileArray.add({'url':element,'type':1});
- }
- _inputArray.addAll(data['getDataVoList']??[]);
- setState(() {});
- });
- }
- }
- //TODO:YSHomeListDetailGather3
- class YSHomeListDetailGather3 extends StatefulWidget {
- final int gatherId;
- const YSHomeListDetailGather3({Key? key, required this.gatherId}) : super(key: key);
- @override
- YSHomeListDetailGather3State createState() => YSHomeListDetailGather3State();
- }
- class YSHomeListDetailGather3State extends State<YSHomeListDetailGather3> {
- bool _isHiden = true;
- final Map _contentMap = {'title':'采样描述'};
- final List _inputArray = [];
- final List _fileArray = [];
- String _value = '';
- Map _location = {};
- @override
- void initState() {
- Future.delayed(const Duration(seconds: 0)).then((value) {
- _getSamplingFieldData();
- });
- super.initState();
- }
- @override
- Widget build(BuildContext context) {
- return YSBase(
- ysTitle: '采样',
- ysChild: SingleChildScrollView(
- padding: EdgeInsets.only(left: hsp(20),right: hsp(20),top: hsp(20)),
- child: Stack(
- children: [
- ClipRRect(
- borderRadius: const BorderRadius.all(Radius.circular(24)),
- child: Container(
- height: ysHeight(context)-ysTOP(context)-44-hsp(110),
- decoration: const BoxDecoration(
- color: Color(0xFF3E434E)
- ),
- child: _location.isEmpty?Container():YSMapView(location: _location,),
- ),
- ),
- Container(
- margin: EdgeInsets.only(top: _isHiden?ysHeight(context)-ysTOP(context)-44-hsp(95):hsp(150),),
- child: Column(
- children: [
- GestureDetector(
- onTap: (){
- _isHiden = !_isHiden;
- setState(() {});
- },
- behavior: HitTestBehavior.opaque,
- child: Container(
- padding: EdgeInsets.only(bottom: hsp(10)),
- width: ysWidth(context),
- child: Image.asset('images/tzh_${_isHiden?'up':'down1'}.png',height: hsp(15),width: hsp(15),),
- ),
- ),
- if (_isHiden) Container(
- height: hsp(50),
- decoration: const BoxDecoration(
- image: DecorationImage(image: AssetImage('images/tzh_hiden.png') )
- ),
- alignment: Alignment.center,
- padding: EdgeInsets.only(top: hsp(15)),
- child: Text('采样说明',style: TextStyle(fontSize: zsp(14),color: const Color(0xFFDBE1EA)),),
- ) else ClipRRect(
- borderRadius: const BorderRadius.all(Radius.circular(24)),
- child: Container(
- color: ysBgColor,
- height: ysHeight(context)-ysTOP(context)-44-hsp(215),
- child: SingleChildScrollView(
- child: Column(
- children: [
- Container(
- width: ysWidth(context)-hsp(40),
- decoration: const BoxDecoration(
- color: Color(0xFF3E434E),
- ),
- child: Column(
- children: [
- Container(
- height: hsp(50),
- alignment: Alignment.centerLeft,
- padding: EdgeInsets.only(left: hsp(15),right: hsp(15)),
- decoration: BoxDecoration(
- border: Border(bottom: BorderSide(color: const Color(0x99535966),width: hsp(1)))
- ),
- child: Text('采样描述',style: TextStyle(fontSize: zsp(14),color: const Color(0xFFDBE1EA)),),
- ),
- Container(
- width: ysWidth(context)-hsp(40),
- padding: EdgeInsets.all(hsp(15)),
- constraints: BoxConstraints(minHeight: hsp(100)),
- child: Text('${_contentMap['value']??''}',style: TextStyle(fontSize: zsp(14),color: ysValueColor),),
- )
- ],
- ),
- ),
- Container(
- margin: EdgeInsets.only(top: hsp(15),bottom: hsp(15)),
- padding: EdgeInsets.all(hsp(15)),
- decoration: const BoxDecoration(
- color: Color(0xFF3E434E),
- borderRadius: BorderRadius.all(Radius.circular(24))
- ),
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Container(
- decoration: BoxDecoration(
- color: const Color(0xFF1A1C1F),
- borderRadius: const BorderRadius.all(Radius.circular(3)),
- border: Border.all(color: const Color(0xFF3E434E),width: hsp(1))
- ),
- padding: EdgeInsets.only(left: hsp(12),right: hsp(12),top: hsp(5),bottom: hsp(5)),
- margin: EdgeInsets.only(bottom: hsp(10)),
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Text('有机土壤碳',style: TextStyle(fontSize: zsp(11),color: const Color(0xFFACB5C5)),),
- SizedBox(
- height: hsp(20),
- child: Row(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: [
- Text(_value,style: TextStyle(fontSize: zsp(16),color: Colors.white),),
- Text('kg',style: TextStyle(fontSize: zsp(11),color: const Color(0xFFACB5C5)),)
- ],
- )
- )
- ],
- ),
- ),
- ListView.separated(
- itemBuilder: (context,index){
- Map item = _inputArray[index];
- return Container(
- decoration: BoxDecoration(
- color: const Color(0xFF1A1C1F),
- borderRadius: const BorderRadius.all(Radius.circular(3)),
- border: Border.all(color: const Color(0xFF3E434E),width: hsp(1))
- ),
- padding: EdgeInsets.only(left: hsp(12),right: hsp(12),top: hsp(5),bottom: hsp(5)),
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Text('${item['title']}',style: TextStyle(fontSize: zsp(11),color: const Color(0xFFACB5C5)),),
- SizedBox(
- height: hsp(20),
- child: Row(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: [
- Text('${item['total']??''}',style: TextStyle(fontSize: zsp(16),color: Colors.white),),
- Text('${item['unit']}',style: TextStyle(fontSize: zsp(11),color: const Color(0xFFACB5C5)),)
- ],
- )
- ),
- ],
- ),
- );
- },
- separatorBuilder: (context,index){
- return Container(height: hsp(10),);
- },
- itemCount: _inputArray.length,
- shrinkWrap: true,
- physics: const NeverScrollableScrollPhysics(),
- padding: const EdgeInsets.all(0),
- ),
- Container(
- alignment: Alignment.centerLeft,
- height: hsp(30),
- child: Text('附件',style: TextStyle(fontSize: zsp(11),color: const Color(0xFFACB5C5)),),
- ),
- YSFileView(fileArray: _fileArray),
- ],
- ),
- ),
- ],
- ),
- ),
- ),
- )
- ],
- ),
- )
- ],
- ),
- ),
- );
- }
- _getSamplingFieldData() async{
- YSNetWork.ysRequestHttp(context, type: RequestType.get, api: '/samplingField/data', parameter: {'pointId':widget.gatherId}, successSetter: (dict){
- Map data = dict['data']??{};
- _value = '${data['value']}';
- _contentMap['value'] = '${data['describes']}';
- if(data['video']!=null)_fileArray.add({'url':data['video'],'type':2});
- List imageList = data['imageList']??[];
- for (var element in imageList) {
- _fileArray.add({'url':element,'type':1});
- }
- _inputArray.addAll(data['getDataVoList']??[]);
- if(data['location']!=null){
- _location = data['location'];
- _location['name'] = data['name'];
- _location['coordinates'] = data['geo'];
- }
- setState(() {});
- });
- }
- }
- //TODO:YSHomeListDetailGather4
- class YSHomeListDetailGather4 extends StatefulWidget {
- final int gatherId;
- const YSHomeListDetailGather4({Key? key, required this.gatherId}) : super(key: key);
- @override
- YSHomeListDetailGather4State createState() => YSHomeListDetailGather4State();
- }
- class YSHomeListDetailGather4State extends State<YSHomeListDetailGather4> {
- bool _isHiden = false;
- final Map _contentMap = {'title':'采样描述'};
- final List _inputArray = [];
- final List _fileArray = [];
- Container _widget = Container();
- Map _location = {};
- final TextEditingController _valueController = TextEditingController();
- @override
- void initState() {
- Future.delayed(const Duration(seconds: 0)).then((value) {
- _getSamplingFieldIndex();
- });
- super.initState();
- }
- @override
- void dispose() {
- _valueController.dispose();
- for (var element in _inputArray) {
- TextEditingController controller = element['controller'];
- controller.dispose();
- }
- super.dispose();
- }
- @override
- Widget build(BuildContext context) {
- // LogUtil.d(_inputArray);
- return YSBase(
- ysTitle: '采样',
- ysChild: SingleChildScrollView(
- padding: EdgeInsets.only(left: hsp(20),right: hsp(20),top: hsp(20)),
- child: Stack(
- children: [
- ClipRRect(
- borderRadius: const BorderRadius.all(Radius.circular(24)),
- child: Container(
- height: ysHeight(context)-ysTOP(context)-44-hsp(110),
- decoration: const BoxDecoration(
- color: Color(0xFF3E434E)
- ),
- child: _location.isEmpty?Container():YSMapView(location: _location,),
- ),
- ),
- Container(
- margin: EdgeInsets.only(top: hsp(140)+(_isHiden?ysHeight(context)-ysTOP(context)-44-hsp(235):hsp(10))),
- child: Column(
- children: [
- GestureDetector(
- onTap: (){
- _isHiden = !_isHiden;
- setState(() {});
- },
- behavior: HitTestBehavior.opaque,
- child: Container(
- padding: EdgeInsets.only(bottom: hsp(10)),
- width: ysWidth(context),
- child: Image.asset('images/tzh_${_isHiden?'up':'down1'}.png',height: hsp(15),width: hsp(15),),
- ),
- ),
- if (_isHiden) Container(
- height: hsp(50),
- decoration: const BoxDecoration(
- image: DecorationImage(image: AssetImage('images/tzh_hiden.png') )
- ),
- alignment: Alignment.center,
- padding: EdgeInsets.only(top: hsp(15)),
- child: Text('采样说明',style: TextStyle(fontSize: zsp(14),color: const Color(0xFFDBE1EA)),),
- ) else ClipRRect(
- borderRadius: const BorderRadius.all(Radius.circular(24)),
- child: SizedBox(
- height: ysHeight(context)-ysTOP(context)-44-hsp(205),
- child: Column(
- children: [
- if (_widget.child==null) Container(height: ysHeight(context)-ysTOP(context)-44-hsp(277),) else _widget,
- GestureDetector(
- behavior: HitTestBehavior.opaque,
- onTap: () async{
- FocusScope.of(context).unfocus();
- LogUtil.d(_inputArray);
- if(_contentMap['value']==null){
- ysFlutterToast('请填写采样描述');
- return;
- }
- // if(_valueController.text.isEmpty){
- // ysFlutterToast('请填写有机土壤碳信息');
- // return;
- // }
- // for (var element in _inputArray) {
- // if(element['value']==null){
- // ysFlutterToast('请完善${element['title']}');
- // return;
- // }
- // }
- List images = [];
- List video = [];
- for (var element in _fileArray) {
- if('${element['url']}'.contains('.mp4')==true){
- video.add(element['url']);
- }else{
- images.add(element['url']);
- }
- }
- List inputArray = [];
- for (Map element in _inputArray) {
- Map input = {};
- element.forEach((key, value) {
- if(key!='controller'){
- input[key] = value;
- }
- });
- inputArray.add(input);
- }
- Map request = {};
- request['id'] = widget.gatherId;
- request['describes'] = _contentMap['value'];
- request['recordList'] = inputArray;
- if(images.isNotEmpty)request['imageList'] = images;
- if(video.isNotEmpty)request['video'] = video.first;
- if(_valueController.text.isNotEmpty)request['value'] = _valueController.text;
- LogUtil.d(request);
- // return;
- YSNetWork.ysRequestHttp(context, type: RequestType.post, api: '/samplingRecord/add', parameter: request, successSetter: (dict){
- ysFlutterToast('新增采样成功');
- Navigator.of(context).pop('');
- },isLoading: true);
- },
- child: Image.asset('images/tzh_done.png',height: hsp(72),),
- )
- ],
- ),
- ),
- )
- ],
- ),
- )
- ],
- ),
- ),
- );
- }
- _getSamplingFieldIndex() async{
- YSNetWork.ysRequestHttp(context, type: RequestType.get, api: '/samplingField/index', parameter: {}, successSetter: (dict){
- _inputArray.clear();
- _inputArray.addAll(dict['data']??[]);
- _getSamplingFieldData();
- });
- }
- _getSamplingFieldData() async{
- YSNetWork.ysRequestHttp(context, type: RequestType.get, api: '/samplingField/data', parameter: {'pointId':widget.gatherId}, successSetter: (dict){
- Map data = dict['data']??{};
- if(data['value']!=null)_valueController.text = '${data['value']}';
- if(data['describes']!=null)_contentMap['value'] = '${data['describes']}';
- if(data['video']!=null)_fileArray.add({'url':data['video'],'type':2});
- List imageList = data['imageList']??[];
- for (var element in imageList) {
- _fileArray.add({'url':element,'type':1});
- }
- List getDataVoList = data['getDataVoList']??[];
- if(getDataVoList.isNotEmpty){
- _inputArray.clear();
- _inputArray.addAll(getDataVoList);
- }
- if(data['location']!=null){
- _location = data['location'];
- _location['name'] = data['name'];
- _location['coordinates'] = data['geo'];
- }
- for (var element in _inputArray) {
- element['controller'] =TextEditingController(text: '${element['total']??''}');
- }
- _widget = Container(
- color: ysBgColor,
- height: ysHeight(context)-ysTOP(context)-44-hsp(277),
- child: SingleChildScrollView(
- child: Column(
- children: [
- Container(
- width: ysWidth(context)-hsp(40),
- decoration: const BoxDecoration(
- color: Color(0xFF3E434E),
- borderRadius: BorderRadius.all(Radius.circular(24))
- ),
- child: Column(
- children: [
- Container(
- height: hsp(50),
- alignment: Alignment.centerLeft,
- padding: EdgeInsets.only(left: hsp(15),right: hsp(15)),
- decoration: BoxDecoration(
- border: Border(bottom: BorderSide(color: const Color(0x99535966),width: hsp(1)))
- ),
- child: Text('采样描述',style: TextStyle(fontSize: zsp(14),color: const Color(0xFFDBE1EA)),),
- ),
- Container(
- width: ysWidth(context)-hsp(40),
- padding: EdgeInsets.all(hsp(15)),
- constraints: BoxConstraints(minHeight: hsp(100)),
- child: YSInputView2(item: _contentMap),
- )
- ],
- ),
- ),
- Container(
- margin: EdgeInsets.only(top: hsp(15),bottom: hsp(15)),
- padding: EdgeInsets.all(hsp(15)),
- decoration: const BoxDecoration(
- color: Color(0xFF3E434E),
- borderRadius: BorderRadius.all(Radius.circular(24))
- ),
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Container(
- decoration: BoxDecoration(
- color: const Color(0xFF1A1C1F),
- borderRadius: const BorderRadius.all(Radius.circular(3)),
- border: Border.all(color: const Color(0xFF3E434E),width: hsp(1))
- ),
- padding: EdgeInsets.only(left: hsp(12),right: hsp(12),top: hsp(5),bottom: hsp(5)),
- margin: EdgeInsets.only(bottom: hsp(10)),
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Text('有机土壤碳',style: TextStyle(fontSize: zsp(11),color: const Color(0xFFACB5C5)),),
- SizedBox(
- height: hsp(20),
- child: CupertinoTextField(
- placeholder: '请描述内容',
- style: TextStyle(fontSize: zsp(16),color: Colors.white),
- padding: const EdgeInsets.all(0),
- placeholderStyle: TextStyle(fontSize: zsp(16),color: Colors.white),
- decoration: const BoxDecoration(
- color: Colors.transparent
- ),
- suffix: Text('kg',style: TextStyle(fontSize: zsp(11),color: const Color(0xFFACB5C5)),),
- maxLines: 100,
- controller: _valueController,
- inputFormatters: [NumberFormat()],
- keyboardType: const TextInputType.numberWithOptions(),
- )
- )
- ],
- ),
- ),
- ListView.separated(
- itemBuilder: (context,index){
- Map item = _inputArray[index];
- return Container(
- decoration: BoxDecoration(
- color: const Color(0xFF1A1C1F),
- borderRadius: const BorderRadius.all(Radius.circular(3)),
- border: Border.all(color: const Color(0xFF3E434E),width: hsp(1))
- ),
- padding: EdgeInsets.only(left: hsp(12),right: hsp(12),top: hsp(5),bottom: hsp(5)),
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Text('${item['title']}',style: TextStyle(fontSize: zsp(11),color: const Color(0xFFACB5C5)),),
- SizedBox(
- height: hsp(20),
- child: CupertinoTextField(
- placeholder: '请输入${item['title']}',
- style: TextStyle(fontSize: zsp(16),color: Colors.white),
- padding: const EdgeInsets.all(0),
- placeholderStyle: TextStyle(fontSize: zsp(16),color: Colors.white),
- decoration: const BoxDecoration(
- color: Colors.transparent
- ),
- suffix: Text('${item['unit']}',style: TextStyle(fontSize: zsp(11),color: const Color(0xFFACB5C5)),),
- inputFormatters: [NumberFormat()],
- keyboardType: const TextInputType.numberWithOptions(),
- maxLines: 100,
- onChanged: (value){
- if(value.isEmpty){
- item.remove('value');
- }else{
- item['value'] = value;
- }
- },
- controller: item['controller'],
- )
- )
- ],
- ),
- );
- },
- separatorBuilder: (context,index){
- return Container(height: hsp(10),);
- },
- itemCount: _inputArray.length,
- shrinkWrap: true,
- physics: const NeverScrollableScrollPhysics(),
- padding: const EdgeInsets.all(0),
- ),
- Container(
- alignment: Alignment.centerLeft,
- height: hsp(30),
- child: Text('附件',style: TextStyle(fontSize: zsp(11),color: const Color(0xFFACB5C5)),),
- ),
- YSUploadFileView2(fileArray: _fileArray),
- Container(
- alignment: Alignment.centerLeft,
- height: hsp(30),
- child: Text('建议尺寸900*400,最多4张,单个图片不超过20M。',style: TextStyle(fontSize: zsp(11),color: const Color(0xFFACB5C5)),),
- )
- ],
- ),
- ),
- ],
- ),
- ),
- );
- setState(() {});
- });
- }
- }
- //TODO:YSHomeListDetailGather5
- class YSHomeListDetailGather5 extends StatefulWidget {
- final int gatherId;
- const YSHomeListDetailGather5({Key? key, required this.gatherId}) : super(key: key);
- @override
- YSHomeListDetailGather5State createState() => YSHomeListDetailGather5State();
- }
- class YSHomeListDetailGather5State extends State<YSHomeListDetailGather5> {
- bool _isEdit = false;
- Map _location = {};
- Map _data = {};
- _getSamplingFieldData() async{
- YSNetWork.ysRequestHttp(context, type: RequestType.get, api: '/samplingField/data', parameter: {'pointId':widget.gatherId}, successSetter: (dict){
- _data = dict['data']??{};
- if(_data['location']!=null){
- _location = _data['location'];
- _location['name'] = _data['name'];
- _location['coordinates'] = _data['geo'];
- }
- setState(() {});
- });
- }
- @override
- void initState() {
- networkDelay((){
- _getSamplingFieldData();
- });
- super.initState();
- }
- @override
- Widget build(BuildContext context) {
- return YSBase(
- ysTitle: '采样',
- ysRightWidget: GestureDetector(
- onTap: (){
- _isEdit = !_isEdit;
- setState(() {});
- },
- child: Text(_isEdit?'详情':'编辑',style: TextStyle(fontSize: zsp(16),color: Colors.white),),
- ),
- ysChild: SingleChildScrollView(
- padding: EdgeInsets.only(left: hsp(20),right: hsp(20),top: hsp(20)),
- child: Stack(
- children: [
- ClipRRect(
- borderRadius: const BorderRadius.all(Radius.circular(24)),
- child: Container(
- height: ysHeight(context)-ysTOP(context)-44-hsp(110),
- decoration: const BoxDecoration(
- color: Color(0xFF3E434E)
- ),
- child: _location.isEmpty?Container():YSMapView(location: _location,),
- ),
- ),
- _data.isEmpty?Container():(
- _isEdit?YSHomeListDetailGatherEditView(
- gatherId: widget.gatherId,data: _data,
- ):YSHomeListDetailGatherDetailView(
- data: _data,
- )
- )
- ],
- ),
- ),
- );
- }
- }
- //TODO:YSHomeListDetailGatherEditView
- class YSHomeListDetailGatherEditView extends StatefulWidget {
- final int gatherId;
- final Map data;
- const YSHomeListDetailGatherEditView({Key? key, required this.gatherId, required this.data}) : super(key: key);
- @override
- YSHomeListDetailGatherEditViewState createState() => YSHomeListDetailGatherEditViewState();
- }
- class YSHomeListDetailGatherEditViewState extends State<YSHomeListDetailGatherEditView> {
- bool _isHiden = false;
- final Map _contentMap = {'title':'采样描述'};
- final List _inputArray = [];
- final List _fileArray = [];
- Container _widget = Container();
- final TextEditingController _valueController = TextEditingController();
- @override
- void initState() {
- Future.delayed(const Duration(seconds: 0)).then((value) {
- _getSamplingFieldIndex();
- });
- super.initState();
- }
- @override
- void dispose() {
- _valueController.dispose();
- for (var element in _inputArray) {
- TextEditingController controller = element['controller'];
- controller.dispose();
- }
- super.dispose();
- }
- @override
- Widget build(BuildContext context) {
- return Container(
- margin: EdgeInsets.only(top: hsp(140)+(_isHiden?ysHeight(context)-ysTOP(context)-44-hsp(235):hsp(10))),
- child: Column(
- children: [
- GestureDetector(
- onTap: (){
- _isHiden = !_isHiden;
- setState(() {});
- },
- behavior: HitTestBehavior.opaque,
- child: Container(
- padding: EdgeInsets.only(bottom: hsp(10)),
- width: ysWidth(context),
- child: Image.asset('images/tzh_${_isHiden?'up':'down1'}.png',height: hsp(15),width: hsp(15),),
- ),
- ),
- if (_isHiden) Container(
- height: hsp(50),
- decoration: const BoxDecoration(
- image: DecorationImage(image: AssetImage('images/tzh_hiden.png') )
- ),
- alignment: Alignment.center,
- padding: EdgeInsets.only(top: hsp(15)),
- child: Text('采样说明',style: TextStyle(fontSize: zsp(14),color: const Color(0xFFDBE1EA)),),
- ) else ClipRRect(
- borderRadius: const BorderRadius.all(Radius.circular(24)),
- child: SizedBox(
- height: ysHeight(context)-ysTOP(context)-44-hsp(205),
- child: Column(
- children: [
- if (_widget.child==null) Container(height: ysHeight(context)-ysTOP(context)-44-hsp(277),) else _widget,
- GestureDetector(
- behavior: HitTestBehavior.opaque,
- onTap: () async{
- FocusScope.of(context).unfocus();
- LogUtil.d(_inputArray);
- // if(_contentMap['value']==null){
- // ysFlutterToast('请填写采样描述');
- // return;
- // }
- // if(_valueController.text.isEmpty){
- // ysFlutterToast('请填写有机土壤碳信息');
- // return;
- // }
- // for (var element in _inputArray) {
- // if(element['value']==null){
- // ysFlutterToast('请完善${element['title']}');
- // return;
- // }
- // }
- List images = [];
- List video = [];
- for (var element in _fileArray) {
- if('${element['url']}'.contains('.mp4')==true){
- video.add(element['url']);
- }else{
- images.add(element['url']);
- }
- }
- List inputArray = [];
- for (Map element in _inputArray) {
- Map input = {};
- element.forEach((key, value) {
- if(key!='controller'){
- input[key] = value;
- }
- });
- if(element['value']==null){
- input['value'] = '0';
- }
- inputArray.add(input);
- }
- Map request = {};
- request['id'] = widget.gatherId;
- // request['describes'] = _contentMap['value'];
- request['recordList'] = inputArray;
- if(images.isNotEmpty)request['imageList'] = images;
- if(video.isNotEmpty)request['video'] = video.first;
- if(_valueController.text.isNotEmpty)request['value'] = _valueController.text;
- // LogUtil.d(request);
- // return;
- YSNetWork.ysRequestHttp(context, type: RequestType.post, api: '/samplingRecord/add', parameter: request, successSetter: (dict){
- ysFlutterToast('新增采样成功');
- Navigator.of(context).pop('');
- },isLoading: true);
- },
- child: Image.asset('images/tzh_done.png',height: hsp(72),),
- )
- ],
- ),
- ),
- )
- ],
- ),
- );
- }
- _getSamplingFieldIndex() async{
- YSNetWork.ysRequestHttp(context, type: RequestType.get, api: '/samplingField/index', parameter: {}, successSetter: (dict){
- _inputArray.clear();
- _inputArray.addAll(dict['data']??[]);
- _getSamplingFieldData();
- });
- }
- _getSamplingFieldData() async{
- Map data = widget.data;
- if(data['value']!=null)_valueController.text = '${data['value']}';
- if(data['content']!=null)_contentMap['value'] = '${data['content']}';
- _fileArray.clear();
- if(data['video']!=null)_fileArray.add({'url':data['video'],'type':2});
- List imageList = data['imageList']??[];
- for (var element in imageList) {
- _fileArray.add({'url':element,'type':1});
- }
- List getDataVoList = data['getDataVoList']??[];
- if(getDataVoList.isNotEmpty){
- _inputArray.clear();
- _inputArray.addAll(getDataVoList);
- }
- for (var element in _inputArray) {
- element['controller'] =TextEditingController(text: '${element['total']??''}');
- }
- _widget = Container(
- color: ysBgColor,
- height: ysHeight(context)-ysTOP(context)-44-hsp(277),
- child: SingleChildScrollView(
- child: Column(
- children: [
- Container(
- width: ysWidth(context)-hsp(40),
- decoration: const BoxDecoration(
- color: Color(0xFF3E434E),
- borderRadius: BorderRadius.all(Radius.circular(24))
- ),
- child: Column(
- children: [
- Container(
- height: hsp(50),
- alignment: Alignment.centerLeft,
- padding: EdgeInsets.only(left: hsp(15),right: hsp(15)),
- decoration: BoxDecoration(
- border: Border(bottom: BorderSide(color: const Color(0x99535966),width: hsp(1)))
- ),
- child: Text('采样内容',style: TextStyle(fontSize: zsp(14),color: const Color(0xFFDBE1EA)),),
- ),
- Container(
- width: ysWidth(context)-hsp(40),
- padding: EdgeInsets.all(hsp(15)),
- constraints: BoxConstraints(minHeight: hsp(100)),
- // child: Text(_contentMap['value'],style: TextStyle(fontSize: zsp(14),color: ysValueColor),),
- child: YSInputView2(item: _contentMap,isEnable: false,),
- )
- ],
- ),
- ),
- Container(
- margin: EdgeInsets.only(top: hsp(15),bottom: hsp(15)),
- padding: EdgeInsets.all(hsp(15)),
- decoration: const BoxDecoration(
- color: Color(0xFF3E434E),
- borderRadius: BorderRadius.all(Radius.circular(24))
- ),
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Container(
- decoration: BoxDecoration(
- color: const Color(0xFF1A1C1F),
- borderRadius: const BorderRadius.all(Radius.circular(3)),
- border: Border.all(color: const Color(0xFF3E434E),width: hsp(1))
- ),
- padding: EdgeInsets.only(left: hsp(12),right: hsp(12),top: hsp(5),bottom: hsp(5)),
- margin: EdgeInsets.only(bottom: hsp(10)),
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Text('有机土壤碳',style: TextStyle(fontSize: zsp(11),color: const Color(0xFFACB5C5)),),
- SizedBox(
- height: hsp(20),
- child: CupertinoTextField(
- placeholder: '请描述内容',
- style: TextStyle(fontSize: zsp(16),color: Colors.white),
- padding: const EdgeInsets.all(0),
- placeholderStyle: TextStyle(fontSize: zsp(16),color: Colors.white),
- decoration: const BoxDecoration(
- color: Colors.transparent
- ),
- suffix: Text('kg',style: TextStyle(fontSize: zsp(11),color: const Color(0xFFACB5C5)),),
- maxLines: 100,
- controller: _valueController,
- inputFormatters: [NumberFormat()],
- keyboardType: const TextInputType.numberWithOptions(),
- )
- )
- ],
- ),
- ),
- ListView.separated(
- itemBuilder: (context,index){
- Map item = _inputArray[index];
- return Container(
- decoration: BoxDecoration(
- color: const Color(0xFF1A1C1F),
- borderRadius: const BorderRadius.all(Radius.circular(3)),
- border: Border.all(color: const Color(0xFF3E434E),width: hsp(1))
- ),
- padding: EdgeInsets.only(left: hsp(12),right: hsp(12),top: hsp(5),bottom: hsp(5)),
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Text('${item['title']}',style: TextStyle(fontSize: zsp(11),color: const Color(0xFFACB5C5)),),
- SizedBox(
- height: hsp(20),
- child: CupertinoTextField(
- placeholder: '请输入${item['title']}',
- style: TextStyle(fontSize: zsp(16),color: Colors.white),
- padding: const EdgeInsets.all(0),
- placeholderStyle: TextStyle(fontSize: zsp(16),color: Colors.white),
- decoration: const BoxDecoration(
- color: Colors.transparent
- ),
- suffix: Text('${item['unit']}',style: TextStyle(fontSize: zsp(11),color: const Color(0xFFACB5C5)),),
- inputFormatters: [NumberFormat()],
- keyboardType: const TextInputType.numberWithOptions(),
- maxLines: 100,
- onChanged: (value){
- if(value.isEmpty){
- item.remove('value');
- }else{
- item['value'] = value;
- }
- },
- controller: item['controller'],
- )
- )
- ],
- ),
- );
- },
- separatorBuilder: (context,index){
- return Container(height: hsp(10),);
- },
- itemCount: _inputArray.length,
- shrinkWrap: true,
- physics: const NeverScrollableScrollPhysics(),
- padding: const EdgeInsets.all(0),
- ),
- Container(
- alignment: Alignment.centerLeft,
- height: hsp(30),
- child: Text('附件',style: TextStyle(fontSize: zsp(11),color: const Color(0xFFACB5C5)),),
- ),
- YSUploadFileView2(fileArray: _fileArray),
- Container(
- alignment: Alignment.centerLeft,
- height: hsp(30),
- child: Text('建议尺寸900*400,最多4张,单个图片不超过20M。',style: TextStyle(fontSize: zsp(11),color: const Color(0xFFACB5C5)),),
- )
- ],
- ),
- ),
- ],
- ),
- ),
- );
- setState(() {});
- }
- }
- ////TODO:YSHomeListDetailGatherDetailView
- class YSHomeListDetailGatherDetailView extends StatefulWidget {
- final Map data;
- const YSHomeListDetailGatherDetailView({Key? key, required this.data}) : super(key: key);
- @override
- YSHomeListDetailGatherDetailViewState createState() => YSHomeListDetailGatherDetailViewState();
- }
- class YSHomeListDetailGatherDetailViewState extends State<YSHomeListDetailGatherDetailView> {
- bool _isHiden = true;
- final Map _contentMap = {'title':'采样描述'};
- final List _inputArray = [];
- final List _fileArray = [];
- String _value = '';
- Map _location = {};
- @override
- void initState() {
- Future.delayed(const Duration(seconds: 0)).then((value) {
- _getSamplingFieldData();
- });
- super.initState();
- }
- @override
- Widget build(BuildContext context) {
- return Container(
- margin: EdgeInsets.only(top: _isHiden?ysHeight(context)-ysTOP(context)-44-hsp(95):hsp(150),),
- child: Column(
- children: [
- GestureDetector(
- onTap: (){
- _isHiden = !_isHiden;
- setState(() {});
- },
- behavior: HitTestBehavior.opaque,
- child: Container(
- padding: EdgeInsets.only(bottom: hsp(10)),
- width: ysWidth(context),
- child: Image.asset('images/tzh_${_isHiden?'up':'down1'}.png',height: hsp(15),width: hsp(15),),
- ),
- ),
- if (_isHiden) Container(
- // margin: EdgeInsets.only(top: ysHeight(context)-ysTOP(context)-44-hsp(250)),
- height: hsp(50),
- decoration: const BoxDecoration(
- image: DecorationImage(image: AssetImage('images/tzh_hiden.png') )
- ),
- alignment: Alignment.center,
- padding: EdgeInsets.only(top: hsp(15)),
- child: Text('采样说明',style: TextStyle(fontSize: zsp(14),color: const Color(0xFFDBE1EA)),),
- ) else ClipRRect(
- borderRadius: const BorderRadius.all(Radius.circular(24)),
- child: Container(
- color: ysBgColor,
- height: ysHeight(context)-ysTOP(context)-44-hsp(215),
- child: SingleChildScrollView(
- child: Column(
- children: [
- Container(
- width: ysWidth(context)-hsp(40),
- decoration: const BoxDecoration(
- color: Color(0xFF3E434E),
- ),
- child: Column(
- children: [
- Container(
- height: hsp(50),
- alignment: Alignment.centerLeft,
- padding: EdgeInsets.only(left: hsp(15),right: hsp(15)),
- decoration: BoxDecoration(
- border: Border(bottom: BorderSide(color: const Color(0x99535966),width: hsp(1)))
- ),
- child: Text('采样描述',style: TextStyle(fontSize: zsp(14),color: const Color(0xFFDBE1EA)),),
- ),
- Container(
- width: ysWidth(context)-hsp(40),
- padding: EdgeInsets.all(hsp(15)),
- constraints: BoxConstraints(minHeight: hsp(100)),
- child: Text('${_contentMap['value']??''}',style: TextStyle(fontSize: zsp(14),color: ysValueColor),),
- )
- ],
- ),
- ),
- Container(
- margin: EdgeInsets.only(top: hsp(15),bottom: hsp(15)),
- padding: EdgeInsets.all(hsp(15)),
- decoration: const BoxDecoration(
- color: Color(0xFF3E434E),
- borderRadius: BorderRadius.all(Radius.circular(24))
- ),
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Container(
- decoration: BoxDecoration(
- color: const Color(0xFF1A1C1F),
- borderRadius: const BorderRadius.all(Radius.circular(3)),
- border: Border.all(color: const Color(0xFF3E434E),width: hsp(1))
- ),
- padding: EdgeInsets.only(left: hsp(12),right: hsp(12),top: hsp(5),bottom: hsp(5)),
- margin: EdgeInsets.only(bottom: hsp(10)),
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Text('有机土壤碳',style: TextStyle(fontSize: zsp(11),color: const Color(0xFFACB5C5)),),
- SizedBox(
- height: hsp(20),
- child: Row(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: [
- Text(_value,style: TextStyle(fontSize: zsp(16),color: Colors.white),),
- Text('kg',style: TextStyle(fontSize: zsp(11),color: const Color(0xFFACB5C5)),)
- ],
- )
- )
- ],
- ),
- ),
- ListView.separated(
- itemBuilder: (context,index){
- Map item = _inputArray[index];
- return Container(
- decoration: BoxDecoration(
- color: const Color(0xFF1A1C1F),
- borderRadius: const BorderRadius.all(Radius.circular(3)),
- border: Border.all(color: const Color(0xFF3E434E),width: hsp(1))
- ),
- padding: EdgeInsets.only(left: hsp(12),right: hsp(12),top: hsp(5),bottom: hsp(5)),
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Text('${item['title']}',style: TextStyle(fontSize: zsp(11),color: const Color(0xFFACB5C5)),),
- SizedBox(
- height: hsp(20),
- child: Row(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: [
- Text('${item['total']??''}',style: TextStyle(fontSize: zsp(16),color: Colors.white),),
- Text('${item['unit']}',style: TextStyle(fontSize: zsp(11),color: const Color(0xFFACB5C5)),)
- ],
- )
- ),
- ],
- ),
- );
- },
- separatorBuilder: (context,index){
- return Container(height: hsp(10),);
- },
- itemCount: _inputArray.length,
- shrinkWrap: true,
- physics: const NeverScrollableScrollPhysics(),
- padding: const EdgeInsets.all(0),
- ),
- Container(
- alignment: Alignment.centerLeft,
- height: hsp(30),
- child: Text('附件',style: TextStyle(fontSize: zsp(11),color: const Color(0xFFACB5C5)),),
- ),
- YSFileView(fileArray: _fileArray),
- ],
- ),
- ),
- ],
- ),
- ),
- ),
- )
- ],
- ),
- );
- }
- _getSamplingFieldData() async{
- Map data = widget.data;
- _value = '${data['value']??''}';
- _contentMap['value'] = '${data['content']}';
- _fileArray.clear();
- if(data['video']!=null)_fileArray.add({'url':data['video'],'type':2});
- List imageList = data['imageList']??[];
- for (var element in imageList) {
- _fileArray.add({'url':element,'type':1});
- }
- _inputArray.addAll(data['getDataVoList']??[]);
- if(data['location']!=null){
- _location = data['location'];
- _location['name'] = data['name'];
- }
- setState(() {});
- }
- }
|