YSHomeMsgSetting.dart 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. import 'package:flutter/material.dart';
  2. import 'package:flutter/cupertino.dart';
  3. import 'package:ysairplane/base/YSBase.dart';
  4. import 'package:ysairplane/tools/YSNetWorking.dart';
  5. import 'package:ysairplane/tools/YSTools.dart';
  6. class YSHomeMsgSetting extends StatefulWidget {
  7. @override
  8. _YSHomeMsgSettingState createState() => _YSHomeMsgSettingState();
  9. }
  10. class _YSHomeMsgSettingState extends State<YSHomeMsgSetting> {
  11. bool _isOpen = false;
  12. @override
  13. Widget build(BuildContext context) {
  14. return YSBase(
  15. ystitle: '设置',
  16. yschild: Container(
  17. width: MediaQuery.of(context).size.width,
  18. height: MediaQuery.of(context).size.height-MediaQuery.of(context).padding.top-44,
  19. color: Color(0xFFF1F2F3),
  20. child: Column(
  21. children: [
  22. Container(
  23. padding: EdgeInsets.all(hsp(30)),
  24. color: Color(0xFFFAFAFA),
  25. child: Row(
  26. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  27. children: [
  28. Text('消息提醒',style: TextStyle(fontSize: zsp(34),color: Color(0xFF333333)),),
  29. GestureDetector(
  30. onTap: (){
  31. _postMsgSetting();
  32. },
  33. child: Container(
  34. height: hsp(60),
  35. width: hsp(100),
  36. child: Image.asset(_isOpen==false?'lib/images/kaiguankai.png':'lib/images/kaiguanguan.png'),
  37. ),
  38. )
  39. ],
  40. ),
  41. )
  42. ],
  43. ),
  44. ),
  45. );
  46. }
  47. _postMsgSetting() async{
  48. Map dict = await ysRequestHttp(context,type: requestType.get,api: '/app/applets/message/setWarning',parameter: {'isWarning':_isOpen==true?1:-1},
  49. isLoading: false,isToken: true,refresh: (){_postMsgSetting();});
  50. if(dict!=null){
  51. setState(() {
  52. _isOpen = !_isOpen;
  53. });
  54. }
  55. }
  56. }