import 'package:flutter/material.dart'; import 'package:flutter/cupertino.dart'; import 'package:ysairplane/base/YSBase.dart'; import 'package:ysairplane/tools/YSTools.dart'; class YSChooseLocation extends StatefulWidget { @override _YSChooseLocationState createState() => _YSChooseLocationState(); } class _YSChooseLocationState extends State { int _index = 9999; bool _isChoose = false; @override Widget build(BuildContext context) { return YSBase( ystitle: '选择登机地址', yschild: Stack( children: [ GestureDetector( onTap: (){ setState(() { _isChoose = true; }); }, child: Container( height: MediaQuery.of(context).size.height-MediaQuery.of(context).padding.top-44, width: MediaQuery.of(context).size.width, color: Colors.lightGreen, ), ), if(_isChoose==true)Container( margin: EdgeInsets.only(top: MediaQuery.of(context).size.height*0.4), height: MediaQuery.of(context).size.height*0.6-MediaQuery.of(context).padding.top-44, decoration: BoxDecoration( color: Colors.white, borderRadius: BorderRadius.only(topLeft: Radius.circular(10),topRight: Radius.circular(10)) ), child: ListView.separated( itemBuilder: (context,index){ return GestureDetector( onTap: (){ setState(() { _index = index; }); Navigator.of(context).pop({'display':'西安市长安区','location':'34,108'}); }, behavior: HitTestBehavior.opaque, child: Container( padding: EdgeInsets.all(hsp(30)), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text('西安市长安区',style: TextStyle(fontSize: zsp(30),color: Colors.black,fontWeight: FontWeight.bold),), Text('樱花广场',style: TextStyle(fontSize: zsp(24),color: Color(0xFF999999)),) ], ), Icon(Icons.check,color: _index==index?Color(0xFF007EFF):Colors.transparent,size: hsp(50),) ], ), ), ); }, separatorBuilder: (context,index){ return Divider(height: 0.5,thickness: 0.5,color: Color(0xFFF1F2F4),); }, itemCount: 10, padding: EdgeInsets.all(0), ), ), ], ), ); } }