ChadCSong

优化地图展示

...@@ -81,7 +81,7 @@ class MembershipPageState extends BaseState<MembershipPage> with WidgetsBindingO ...@@ -81,7 +81,7 @@ class MembershipPageState extends BaseState<MembershipPage> with WidgetsBindingO
81 children: [ 81 children: [
82 initBackBar(), 82 initBackBar(),
83 const Spacer(), 83 const Spacer(),
84 - buildCompleteWidget(), 84 + // buildCompleteWidget(),
85 ], 85 ],
86 ), 86 ),
87 ), 87 ),
......
1 import 'dart:async'; 1 import 'dart:async';
2 import 'dart:convert'; 2 import 'dart:convert';
3 +import 'package:Parlando/base/base_state.dart';
3 import 'package:Parlando/extension/widget_ext.dart'; 4 import 'package:Parlando/extension/widget_ext.dart';
4 import 'package:Parlando/models/nearby_response.dart' as nearby; 5 import 'package:Parlando/models/nearby_response.dart' as nearby;
5 import 'package:Parlando/routers/fluro_navigator.dart'; 6 import 'package:Parlando/routers/fluro_navigator.dart';
...@@ -20,7 +21,7 @@ class AddressSelectPage extends StatefulWidget { ...@@ -20,7 +21,7 @@ class AddressSelectPage extends StatefulWidget {
20 AddressSelectPageState createState() => AddressSelectPageState(); 21 AddressSelectPageState createState() => AddressSelectPageState();
21 } 22 }
22 23
23 -class AddressSelectPageState extends State<AddressSelectPage> { 24 +class AddressSelectPageState extends BaseState<AddressSelectPage> {
24 List<nearby.Results> _nearByList = []; 25 List<nearby.Results> _nearByList = [];
25 final ScrollController _controller = ScrollController(); 26 final ScrollController _controller = ScrollController();
26 LatLng? _center; 27 LatLng? _center;
...@@ -32,10 +33,10 @@ class AddressSelectPageState extends State<AddressSelectPage> { ...@@ -32,10 +33,10 @@ class AddressSelectPageState extends State<AddressSelectPage> {
32 String apiKey = "AIzaSyDQZsMULyO-UtiSht4_MFi1uHT4BIqasjw"; 33 String apiKey = "AIzaSyDQZsMULyO-UtiSht4_MFi1uHT4BIqasjw";
33 nearby.NearbyPlacesResponse nearbyPlacesResponse = nearby.NearbyPlacesResponse(); 34 nearby.NearbyPlacesResponse nearbyPlacesResponse = nearby.NearbyPlacesResponse();
34 35
35 -
36 @override 36 @override
37 void initState() { 37 void initState() {
38 super.initState(); 38 super.initState();
39 + showLoading();
39 _getCurrentLocation(); 40 _getCurrentLocation();
40 } 41 }
41 42
...@@ -81,11 +82,12 @@ class AddressSelectPageState extends State<AddressSelectPage> { ...@@ -81,11 +82,12 @@ class AddressSelectPageState extends State<AddressSelectPage> {
81 isLoading = false; 82 isLoading = false;
82 }); 83 });
83 buildMarkers(); 84 buildMarkers();
85 + hideLoading();
84 } 86 }
85 87
86 void _onMapCreated(GoogleMapController controller) { 88 void _onMapCreated(GoogleMapController controller) {
87 mapController = controller; 89 mapController = controller;
88 - getNearbyPlaces(""); 90 + buildMarkers();
89 } 91 }
90 92
91 void _goToCurrentCenter() { 93 void _goToCurrentCenter() {
...@@ -95,7 +97,7 @@ class AddressSelectPageState extends State<AddressSelectPage> { ...@@ -95,7 +97,7 @@ class AddressSelectPageState extends State<AddressSelectPage> {
95 } 97 }
96 98
97 @override 99 @override
98 - Widget build(BuildContext context) { 100 + Widget buildBody(BuildContext context) {
99 var loaderView = const GFLoader().expanded(flex: 11); 101 var loaderView = const GFLoader().expanded(flex: 11);
100 Widget realList = ListView.separated( 102 Widget realList = ListView.separated(
101 controller: _controller, 103 controller: _controller,
...@@ -113,6 +115,7 @@ class AddressSelectPageState extends State<AddressSelectPage> { ...@@ -113,6 +115,7 @@ class AddressSelectPageState extends State<AddressSelectPage> {
113 }, 115 },
114 ).expanded(flex: 11); 116 ).expanded(flex: 11);
115 if (_nearByList.isEmpty) { 117 if (_nearByList.isEmpty) {
118 + print("isLoading $isLoading _nearByList ${_nearByList.length}");
116 realList = const Center(child: Text("没有找到任何地点")).expanded(flex: 11); 119 realList = const Center(child: Text("没有找到任何地点")).expanded(flex: 11);
117 } 120 }
118 var listHolder = isLoading ? loaderView : realList; 121 var listHolder = isLoading ? loaderView : realList;
...@@ -224,15 +227,24 @@ class _AddressItem extends StatelessWidget { ...@@ -224,15 +227,24 @@ class _AddressItem extends StatelessWidget {
224 227
225 @override 228 @override
226 Widget build(BuildContext context) { 229 Widget build(BuildContext context) {
230 + var styleMain = TextStyle(color: Colors.black87);
231 + var styleSub = TextStyle(color: Colors.black45);
227 return InkWell( 232 return InkWell(
228 onTap: onTap, 233 onTap: onTap,
229 child: Container( 234 child: Container(
230 alignment: Alignment.centerLeft, 235 alignment: Alignment.centerLeft,
231 padding: const EdgeInsets.symmetric(horizontal: 16.0), 236 padding: const EdgeInsets.symmetric(horizontal: 16.0),
232 - height: 50.0,
233 child: Row( 237 child: Row(
238 + crossAxisAlignment: CrossAxisAlignment.center,
234 children: <Widget>[ 239 children: <Widget>[
235 - Text('${data.name}').expanded(), 240 + Column(
241 + mainAxisAlignment: MainAxisAlignment.start,
242 + crossAxisAlignment: CrossAxisAlignment.start,
243 + children: [
244 + Text('${data.name}', style: styleMain),
245 + Text('${data.vicinity}', style: styleSub),
246 + ],
247 + ).paddingTopBottom(10).expanded(),
236 Visibility(visible: isSelected, child: const Icon(Icons.done, color: Colors.blue)) 248 Visibility(visible: isSelected, child: const Icon(Icons.done, color: Colors.blue))
237 ], 249 ],
238 ), 250 ),
......