From b21ac897609e419fc0f6ac3024f3634796ff12e6 Mon Sep 17 00:00:00 2001 From: ningyuwen Date: Mon, 6 May 2019 16:24:14 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8F=91=E5=B8=83=E9=A1=B5=E9=9D=A2=E4=BF=9D?= =?UTF-8?q?=E5=AD=98=E4=BD=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/provider/fragment_friend_provider.dart | 6 ------ lib/provider/publish_post_provider.dart | 9 +++++++++ lib/search/search_page.dart | 2 +- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/lib/provider/fragment_friend_provider.dart b/lib/provider/fragment_friend_provider.dart index e73f15b..5505a23 100644 --- a/lib/provider/fragment_friend_provider.dart +++ b/lib/provider/fragment_friend_provider.dart @@ -44,18 +44,13 @@ class FragmentFriendProvider { bool _convertMap(map, refresh) { print(map); if (map is List) { - if (_data != null && _data.length > 0) { -// print("data 0 id is: ${_data[0].id}"); - } List posts = new List(); for (var value in map) { Posts post = Posts.fromJson(value); posts.add(post); } if (refresh) { -// print("post id is: ${posts[0].id}"); if (posts[0].id == _data[0].id) { -// print("下拉刷新的数据一样"); ToastUtil.showToast("暂无更多数据"); return false; } @@ -68,7 +63,6 @@ class FragmentFriendProvider { } return true; } else { -// print("出现错误"); if (_firstLoad) { _fetcher.sink.addError(map); } else { diff --git a/lib/provider/publish_post_provider.dart b/lib/provider/publish_post_provider.dart index 0a54317..4d81d7a 100644 --- a/lib/provider/publish_post_provider.dart +++ b/lib/provider/publish_post_provider.dart @@ -2,6 +2,7 @@ import 'dart:io'; import 'package:amap_location/amap_location.dart'; import 'package:image_picker/image_picker.dart'; +import 'package:mmkv_flutter/mmkv_flutter.dart'; import 'package:my_mini_app/been/consume_post_been.dart'; import 'package:my_mini_app/util/api_util.dart'; import 'package:permission_handler/permission_handler.dart'; @@ -82,6 +83,7 @@ class PublishPostProvider { publishBeen.latitude = location.latitude; publishBeen.position = position; publishBeen.district = location.district; + _saveMyLocation(location); setPosition(position); } @@ -104,6 +106,13 @@ class PublishPostProvider { } } } + + void _saveMyLocation(AMapLocation location) async { + MmkvFlutter mmkv = await MmkvFlutter.getInstance(); //初始化mmkv + await mmkv.setDouble("myNowPositionLongitude", location.longitude); + await mmkv.setDouble("myNowPositionLatitude", location.latitude); + await mmkv.setBool("loadMapPagePresent", true); //以前是否打开过map page + } } class PublishBeen { diff --git a/lib/search/search_page.dart b/lib/search/search_page.dart index 080f713..34ce54e 100644 --- a/lib/search/search_page.dart +++ b/lib/search/search_page.dart @@ -174,7 +174,7 @@ class _SearchSuggestState extends State<_SearchSuggestWidget> crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( - "为您推荐以下分类:", + "热门分类:", style: Theme.of(context).textTheme.title, ), Divider(),