YSChoosePoint.dart 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. import 'package:flutter/cupertino.dart';
  2. import 'package:flutter/material.dart';
  3. import 'package:ysairplane2/base/YSBase.dart';
  4. import 'package:ysairplane2/tools/YSNetWorking.dart';
  5. import 'package:ysairplane2/tools/YSTools.dart';
  6. class YSChoosePoint extends StatefulWidget {
  7. @override
  8. _YSChoosePointState createState() => _YSChoosePointState();
  9. }
  10. class _YSChoosePointState extends State<YSChoosePoint> {
  11. List _dataArray = [];
  12. @override
  13. void initState() {
  14. Future.delayed(Duration(seconds: 0)).then((value){
  15. _getPointData();
  16. });
  17. super.initState();
  18. }
  19. @override
  20. Widget build(BuildContext context) {
  21. return YSBase(
  22. ystitle: '出发点选择',
  23. yschild: Container(
  24. height: MediaQuery.of(context).size.height-MediaQuery.of(context).padding.top-44,
  25. child: ListView.separated(
  26. itemBuilder: (context,index){
  27. return GestureDetector(
  28. onTap: (){
  29. Navigator.of(context).pop(_dataArray[index]);
  30. },
  31. behavior: HitTestBehavior.opaque,
  32. child: Container(
  33. width: MediaQuery.of(context).size.width,
  34. padding: EdgeInsets.all(hsp(30)),
  35. child: Column(
  36. crossAxisAlignment: CrossAxisAlignment.start,
  37. children: [
  38. Text('${_dataArray[index]['dtPartner']['companyName']}',style: TextStyle(fontSize: zsp(30),
  39. color: Color(0xFF000000),fontWeight: FontWeight.bold),),
  40. Text('${_dataArray[index]['setoutInfo']['introduce']}',style: TextStyle(fontSize: zsp(24),color: Color(0xFF999999)),),
  41. ],
  42. ),
  43. ),
  44. );
  45. },
  46. separatorBuilder: (context,index){
  47. return Divider(height: 0.5,thickness: 0.5,color: Color(0xFFF5F5F5),);
  48. },
  49. itemCount: _dataArray.length,
  50. padding: EdgeInsets.all(0),
  51. ),
  52. ),
  53. );
  54. }
  55. _getPointData() async{
  56. Map dict = await ysRequestHttp(context,type: requestType.get,api: '/app/applets/AirTour/getFreedomFly',parameter: {},isLoading: false,isToken: true);
  57. if(dict!=null){
  58. setState(() {
  59. _dataArray = dict['data'];
  60. });
  61. }
  62. }
  63. }