import 'package:flutter/material.dart'; import 'package:flutter/cupertino.dart'; import 'package:ysairplane/base/YSBase.dart'; import 'package:ysairplane/tools/YSNetWorking.dart'; import 'package:ysairplane/tools/YSTools.dart'; class YSHomeMsgSetting extends StatefulWidget { @override _YSHomeMsgSettingState createState() => _YSHomeMsgSettingState(); } class _YSHomeMsgSettingState extends State { bool _isOpen = false; @override Widget build(BuildContext context) { return YSBase( ystitle: '设置', yschild: Container( width: MediaQuery.of(context).size.width, height: MediaQuery.of(context).size.height-MediaQuery.of(context).padding.top-44, color: Color(0xFFF1F2F3), child: Column( children: [ Container( padding: EdgeInsets.all(hsp(30)), color: Color(0xFFFAFAFA), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Text('消息提醒',style: TextStyle(fontSize: zsp(34),color: Color(0xFF333333)),), GestureDetector( onTap: (){ _postMsgSetting(); }, child: Container( height: hsp(60), width: hsp(100), child: Image.asset(_isOpen==false?'lib/images/kaiguankai.png':'lib/images/kaiguanguan.png'), ), ) ], ), ) ], ), ), ); } _postMsgSetting() async{ Map dict = await ysRequestHttp(context,type: requestType.get,api: '/app/applets/message/setWarning',parameter: {'isWarning':_isOpen==true?1:-1}, isLoading: false,isToken: true,refresh: (){_postMsgSetting();}); if(dict!=null){ setState(() { _isOpen = !_isOpen; }); } } }