Commit 0706e987ac5e717eb1358d798ca51195dc12a21b

Authored by wdn127929
1 parent b7ea698e

高德地图选择店铺位置

... ... @@ -58,6 +58,9 @@
<meta-data
android:name="flutterEmbedding"
android:value="2" />
<meta-data
android:name="com.amap.api.v2.apikey"
android:value="dbced781d0acd36184d5b4b54da7188d"/>
</application>
</manifest>
... ...
PODS:
- AMap3DMap (7.5.0):
- AMapFoundation (~> 1.6.3)
- amap_core_fluttify (0.0.1):
- AMapFoundation (~> 1.6)
- Flutter
- foundation_fluttify
- amap_location_fluttify (0.0.1):
- amap_core_fluttify
- AMapLocation (~> 2.6.5)
- Flutter
- foundation_fluttify
- amap_map_fluttify (0.0.1):
- AMap3DMap (~> 7.5.0)
- amap_core_fluttify
- Flutter
- foundation_fluttify
- url_launcher
- amap_search_fluttify (0.0.1):
- amap_core_fluttify
- AMapSearch (~> 7.3.0)
- Flutter
- foundation_fluttify
- AMapFoundation (1.6.4)
- AMapLocation (2.6.7):
- AMapFoundation (~> 1.6.4)
- AMapSearch (7.3.0):
- AMapFoundation (~> 1.6.3)
- audioplayers (0.0.1):
- Flutter
- Bugly (2.5.71)
... ... @@ -7,6 +34,8 @@ PODS:
- Reachability
- contacts_service (0.2.2):
- Flutter
- core_location_fluttify (0.0.1):
- Flutter
- device_info (0.0.1):
- Flutter
- easy_contact_picker (0.0.1):
... ... @@ -31,6 +60,8 @@ PODS:
- FMDB (2.7.5):
- FMDB/standard (= 2.7.5)
- FMDB/standard (2.7.5)
- foundation_fluttify (0.0.1):
- Flutter
- image_picker (0.0.1):
- Flutter
- install_plugin (0.0.1):
... ... @@ -68,9 +99,14 @@ PODS:
- WechatOpenSDK (1.8.7.1)
DEPENDENCIES:
- amap_core_fluttify (from `.symlinks/plugins/amap_core_fluttify/ios`)
- amap_location_fluttify (from `.symlinks/plugins/amap_location_fluttify/ios`)
- amap_map_fluttify (from `.symlinks/plugins/amap_map_fluttify/ios`)
- amap_search_fluttify (from `.symlinks/plugins/amap_search_fluttify/ios`)
- audioplayers (from `.symlinks/plugins/audioplayers/ios`)
- connectivity (from `.symlinks/plugins/connectivity/ios`)
- contacts_service (from `.symlinks/plugins/contacts_service/ios`)
- core_location_fluttify (from `.symlinks/plugins/core_location_fluttify/ios`)
- device_info (from `.symlinks/plugins/device_info/ios`)
- easy_contact_picker (from `.symlinks/plugins/easy_contact_picker/ios`)
- Flutter (from `Flutter`)
... ... @@ -80,6 +116,7 @@ DEPENDENCIES:
- flutter_statusbarcolor (from `.symlinks/plugins/flutter_statusbarcolor/ios`)
- fluttertoast (from `.symlinks/plugins/fluttertoast/ios`)
- fluwx (from `.symlinks/plugins/fluwx/ios`)
- foundation_fluttify (from `.symlinks/plugins/foundation_fluttify/ios`)
- image_picker (from `.symlinks/plugins/image_picker/ios`)
- install_plugin (from `.symlinks/plugins/install_plugin/ios`)
- package_info (from `.symlinks/plugins/package_info/ios`)
... ... @@ -98,6 +135,10 @@ DEPENDENCIES:
SPEC REPOS:
trunk:
- AMap3DMap
- AMapFoundation
- AMapLocation
- AMapSearch
- Bugly
- FlutterIJK
- FMDB
... ... @@ -106,12 +147,22 @@ SPEC REPOS:
- WechatOpenSDK
EXTERNAL SOURCES:
amap_core_fluttify:
:path: ".symlinks/plugins/amap_core_fluttify/ios"
amap_location_fluttify:
:path: ".symlinks/plugins/amap_location_fluttify/ios"
amap_map_fluttify:
:path: ".symlinks/plugins/amap_map_fluttify/ios"
amap_search_fluttify:
:path: ".symlinks/plugins/amap_search_fluttify/ios"
audioplayers:
:path: ".symlinks/plugins/audioplayers/ios"
connectivity:
:path: ".symlinks/plugins/connectivity/ios"
contacts_service:
:path: ".symlinks/plugins/contacts_service/ios"
core_location_fluttify:
:path: ".symlinks/plugins/core_location_fluttify/ios"
device_info:
:path: ".symlinks/plugins/device_info/ios"
easy_contact_picker:
... ... @@ -130,6 +181,8 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/fluttertoast/ios"
fluwx:
:path: ".symlinks/plugins/fluwx/ios"
foundation_fluttify:
:path: ".symlinks/plugins/foundation_fluttify/ios"
image_picker:
:path: ".symlinks/plugins/image_picker/ios"
install_plugin:
... ... @@ -162,10 +215,19 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/webview_flutter/ios"
SPEC CHECKSUMS:
AMap3DMap: fc7c911f5cf079d544ad7faec256c9554cbbb202
amap_core_fluttify: bc2e4245c6a6d869727ed16b009a9fa3dbefcf4a
amap_location_fluttify: b273a9b719a7f877ba426d1c6aeadd520e0bf7b6
amap_map_fluttify: 176c1c6f07f59564a0e7da0e30dada7da56b99aa
amap_search_fluttify: 1654f7c14dd5e690561812dc76576d4fdabeacfb
AMapFoundation: 3638198dfa40be54648570c3520edefad288286b
AMapLocation: a46c30d9930d0f3a3bd21139d8f845d10ac3f01d
AMapSearch: a048bcca3bf0b8083345070e1f193f814bd8dc01
audioplayers: 84f968cea3f2deab00ec4f8ff53358b3c0b3992c
Bugly: fd066c75c4a0eca1440f9b6a84bd37d51bfc85ac
connectivity: c4130b2985d4ef6fd26f9702e886bd5260681467
contacts_service: 849e1f84281804c8bfbec1b4c3eedcb23c5d3eca
core_location_fluttify: 24cc9dcd986ac7059916632d2cb3babb1568ff61
device_info: d7d233b645a32c40dfdc212de5cf646ca482f175
easy_contact_picker: 9ab9dc70e8ddde6e76a19ffc482d7bf899868730
Flutter: 0e3d915762c693b495b44d77113d4970485de6ec
... ... @@ -177,6 +239,7 @@ SPEC CHECKSUMS:
fluttertoast: b644586ef3b16f67fae9a1f8754cef6b2d6b634b
fluwx: 07a55ed66bf3a4961e836a2a411b02dcada32902
FMDB: 2ce00b547f966261cd18927a3ddb07cb6f3db82a
foundation_fluttify: 0c45145e3fad1fb99188e4979daed5b24cd9b278
image_picker: 9c3312491f862b28d21ecd8fdf0ee14e601b3f09
install_plugin: a13e7ddd2bab0c701b48cd359c26d0394125b6fb
package_info: 873975fc26034f0b863a300ad47e7f1ac6c7ec62
... ...
... ... @@ -175,6 +175,7 @@
9705A1C41CF9048500538489 /* Embed Frameworks */,
3B06AD1E1E4923F5004D2608 /* Thin Binary */,
9B9871E299FA5648CFE77D1A /* [CP] Embed Pods Frameworks */,
90026E17DA6CEBB932F17F57 /* [CP] Copy Pods Resources */,
);
buildRules = (
);
... ... @@ -257,6 +258,24 @@
shellPath = /bin/sh;
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin";
};
90026E17DA6CEBB932F17F57 /* [CP] Copy Pods Resources */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources.sh",
"${PODS_ROOT}/AMap3DMap/MAMapKit.framework/AMap.bundle",
);
name = "[CP] Copy Pods Resources";
outputPaths = (
"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/AMap.bundle",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources.sh\"\n";
showEnvVarsInLog = 0;
};
9740EEB61CF901F6004384FC /* Run Script */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
... ...
... ... @@ -42,6 +42,8 @@
<string>weixinULAPI</string>
<string>wechat</string>
<string>weixin</string>
<string>iosamap</string>
<string>amapuri</string>
</array>
<key>LSRequiresIPhoneOS</key>
<true/>
... ... @@ -92,6 +94,6 @@
<key>XG_ACCESS_KEY</key>
<string>INUIMFK21WGH</string>
<key>io.flutter.embedded_views_preview</key>
<true/>
<string>YES</string>
</dict>
</plist>
... ...
import 'dart:io';
import 'package:amap_map_fluttify/amap_map_fluttify.dart';
import 'package:common_utils/common_utils.dart';
import 'package:dio/dio.dart';
import 'package:fluro/fluro.dart';
... ... @@ -67,9 +68,9 @@ Future<void> main() async {
ChangeNotifierProvider<CouponProvider>(
create: (_) => CouponProvider(),
),
// ChangeNotifierProvider<UploadImageProvider>(
// create: (_) => UploadImageProvider(),
// ),
ChangeNotifierProvider<UploadImageProvider>(
create: (_) => UploadImageProvider(),
),
ChangeNotifierProvider<BaseIndoProvider>(
create: (_) => BaseIndoProvider(),
),
... ... @@ -77,7 +78,12 @@ Future<void> main() async {
child: MyApp(),
));
});
await AmapService.instance.init(
iosKey: 'e373581528f8fd901c01dfbda236159e',
androidKey: 'dbced781d0acd36184d5b4b54da7188d');
/// 如果你觉得引擎的日志太多, 可以关闭Fluttify引擎的日志
await enableFluttifyLog(false); // 关闭log
FlutterBugly.init(androidAppId: "f71a313f42", iOSAppId: "3089e4587e");
});
}
... ... @@ -113,7 +119,7 @@ class MyAppState extends State<MyApp> {
doOnIOS: true,
universalLink: "https://xt04.colorcun.com/link/OneKey/");
var result = await isWeChatInstalled;
if (result != null && result) {
if (result != null && result) {
App.isInstallWx = true;
} else {
App.isInstallWx = false;
... ...
import 'dart:io';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:image_picker/image_picker.dart';
import 'package:one_key/models/upload_img_model.dart';
import 'package:one_key/pages/create_store/video_widget.dart';
import 'package:one_key/pages/online_check/photo_view_wiget.dart';
import 'package:one_key/provider/upload_img_provider.dart';
import 'package:one_key/res/colors.dart';
import 'package:one_key/utils/dialog_util.dart';
import 'package:one_key/utils/misc.dart';
import 'package:one_key/utils/navigator_util.dart';
import 'package:one_key/utils/upload_image_util.dart';
import 'package:one_key/utils/utils.dart';
import 'package:one_key/widgets/h_empty_view.dart';
import 'package:one_key/widgets/round_button.dart';
import 'package:one_key/widgets/system_app_bar.dart';
import 'package:one_key/widgets/v_empty_view.dart';
import 'package:permission_handler/permission_handler.dart';
import 'package:provider/provider.dart';
class CreateStorePage extends StatefulWidget {
... ... @@ -19,6 +30,9 @@ class CreateStorePage extends StatefulWidget {
class _CreateStorePageState extends State<CreateStorePage> {
ScrollController _controller;
List<Map> roomType = [];
final picker = ImagePicker();
String storeAddress = '选择地址';
@override
void initState() {
... ... @@ -52,7 +66,7 @@ class _CreateStorePageState extends State<CreateStorePage> {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text('2.您的店铺名称是?',
Text('1.您的店铺名称是?',
style: TextStyle(
fontSize: ScreenUtil().setSp(30), fontWeight: FontWeight.bold)),
VEmptyView(30),
... ... @@ -87,7 +101,239 @@ class _CreateStorePageState extends State<CreateStorePage> {
onEditingComplete: () {
FocusScope.of(context).requestFocus(FocusNode()); //点击空白处隐藏键盘
},
keyboardType: TextInputType.number,
keyboardType: TextInputType.text,
)
],
);
}
//查看大图
_showPhotoView(BuildContext context, int index, List imgs,
{isShow = false, List dashName}) async {
// if (imgs.length == 1 &&
// imgs[0] ==
// 'http://nosqn.colorcun.com/custom/lite-online/image/def-banner.png') {
// imgs[0] = 'http://nosqn.colorcun.com/app/seller-hj-empty.png';
// }
Utils.setBarStatus(false, color: Colors.black);
dynamic result = await showGeneralDialog(
context: context,
barrierDismissible: false,
// barrierColor: Colors.red,
barrierLabel:
MaterialLocalizations.of(context).modalBarrierDismissLabel,
transitionDuration: const Duration(milliseconds: 150),
pageBuilder: (BuildContext context, Animation animation,
Animation secondaryAnimation) {
Widget child = Stack(
children: <Widget>[
PhotoPreview(
initialIndex: index,
photoList: imgs,
isShow: isShow,
dashName: dashName)
],
);
return child;
});
Utils.setBarStatus(true, color: Colors.white);
}
///#相机拍照,单图选择
Future _getFromPictureOrCamera(String title, UploadImgModel imgModel,
imageSource, UploadImageProvider model) async {
final pickedFile = await picker.getImage(source: imageSource);
setState(() {
if (pickedFile != null) {
imgModel.file = File(pickedFile.path);
imgModel.process = 0.01;
} else {
print('No image selected.');
}
});
if (pickedFile != null) {
model.imgSizeTouxiang = 64;
model.touxiang.qiniuUrl = null;
UploadImageUtil().startUploadOnly(
context, File(pickedFile.path), title == '头像' ? 0 : 1, true, model);
}
}
// ///门头照片
// Widget _imageWidget(String title, UploadImgModel uploadImgModel,
// double imgSize, double radius) {
// return Consumer<UploadImageProvider>(builder: (context, model, _) {
// return InkWell(
// onTap: () {
// Utils.getPickPermission(context, () {
// _getFromPictureOrCamera(
// title, uploadImgModel, ImageSource.gallery, model);
// }, PermissionGroup.photos);
// },
// child: Container(
// height: ScreenUtil().setWidth(imgSize * 2),
// child: Row(
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
// children: [
// Text(
// title,
// textAlign: TextAlign.left,
// style: TextStyle(
// color: MyColours.color_333333,
// fontWeight: FontWeight.bold,
// fontSize: ScreenUtil().setSp(34)),
// ),
// Spacer(),
// Stack(
// children: [
// InkWell(
// onTap: () {
// double process;
// String qiniuUrl;
// List<String> tempList = [];
// process = model.erweima.process;
// qiniuUrl = model.erweima.qiniuUrl;
// if (qiniuUrl != null && qiniuUrl != '') {
// tempList.add(qiniuUrl);
// ///没有上传完成的不可以点击
// _showPhotoView(context, 0, tempList);
// } else {
// Utils.getPickPermission(context, () {
// _getFromPictureOrCamera(title, uploadImgModel,
// ImageSource.gallery, model);
// }, PermissionGroup.photos);
// }
// },
// child: ClipRRect(
// borderRadius: BorderRadius.circular(
// ScreenUtil().setWidth(radius)),
// child: uploadImgModel.file == null
// ? uploadImgModel.qiniuUrl != null &&
// uploadImgModel.qiniuUrl != ''
// ? Image.network(
// uploadImgModel.qiniuUrl,
// fit: BoxFit.cover,
// width: ScreenUtil().setWidth(imgSize * 2),
// height: ScreenUtil().setWidth(imgSize * 2),
// )
// : Image.asset(
// Utils.getImgPath(
// title == '头像' ? 'touxiang' : 'erweima'),
// fit: BoxFit.cover,
// width: ScreenUtil().setWidth(imgSize * 2),
// height: ScreenUtil().setWidth(imgSize * 2),
// )
// : Image.file(
// uploadImgModel.file,
// fit: BoxFit.cover,
// width: ScreenUtil().setWidth(imgSize * 2),
// height: ScreenUtil().setWidth(imgSize * 2),
// ),
// ),
// ),
// (uploadImgModel.file != null) &&
// uploadImgModel.process != 1 &&
// uploadImgModel.process != 0.01
// ? Container(
// width: ScreenUtil().setWidth(imgSize * 2),
// height: ScreenUtil().setWidth(imgSize * 2),
// decoration: BoxDecoration(
// borderRadius: BorderRadius.circular(radius),
// color: Color.fromRGBO(0, 0, 0, 0.6)),
// child: Center(
// child: Text('上传中',
// style:
// TextStyle(color: MyColours.color_999999)),
// ),
// )
// : Container(),
// ],
// ),
// HEmptyView(30),
// Image.asset(
// "assets/arr_right_gray.png",
// width: ScreenUtil().setWidth(14),
// height: ScreenUtil().setWidth(22),
// )
// ],
// ),
// ));
// });
// }
//店铺地址
Widget _addressWidget() {
return Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
Text('2.您的店铺位置在?',
style: TextStyle(
fontSize: ScreenUtil().setSp(30), fontWeight: FontWeight.bold)),
VEmptyView(30),
InkWell(
onTap: () async {
Utils.getPickPermission(context, () async {
Map address = await NavigatorUtil.goMapChoicePointPage(context);
if (address != null) {
setState(() {
storeAddress = address['address'];
// 'address':
// 'lat':
// 'lng
});
}
}, PermissionGroup.location);
// bool canContacts =
// await requestPermission(PermissionGroup.locationWhenInUse);
// print(canContacts);
},
child: Text(storeAddress),
)
]);
}
//职位
Widget _positionWidget() {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text('3.您在店铺中担任什么职位?',
style: TextStyle(
fontSize: ScreenUtil().setSp(30), fontWeight: FontWeight.bold)),
VEmptyView(30),
TextField(
// textAlignVertical: TextAlignVertical.bottom,
maxLines: 1,
// //光标颜色
// cursorColor:
// widget.isSelect ? Colors.white : MyColours.color_199095,
//输入文本的样式
style: TextStyle(
fontSize: ScreenUtil().setSp(28),
),
// focusNode: _codeNode,
decoration: InputDecoration(
contentPadding: EdgeInsets.symmetric(
vertical: ScreenUtil().setWidth(6),
horizontal: ScreenUtil().setWidth(20)),
border: OutlineInputBorder(),
hintText: '请输入职位',
hintStyle: TextStyle(
color: MyColours.color_999999,
fontSize: ScreenUtil().setSp(28),
),
// enabledBorder: new UnderlineInputBorder(
// borderSide: BorderSide.none,
// ),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: MyColours.color_199095)),
),
onChanged: (value) {},
onEditingComplete: () {
FocusScope.of(context).requestFocus(FocusNode()); //点击空白处隐藏键盘
},
keyboardType: TextInputType.text,
)
],
);
... ... @@ -98,7 +344,7 @@ class _CreateStorePageState extends State<CreateStorePage> {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text('3.请上传您店铺环境的照片或者视频',
Text('4.请上传您店铺环境的照片或者视频',
style: TextStyle(
fontSize: ScreenUtil().setSp(30), fontWeight: FontWeight.bold)),
VEmptyView(30),
... ... @@ -134,15 +380,26 @@ class _CreateStorePageState extends State<CreateStorePage> {
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text('1.您的店内有哪些包间类型?',
style: TextStyle(
fontSize: ScreenUtil().setSp(30),
fontWeight: FontWeight.bold)),
VEmptyView(30),
Column(children: _roomTypeWidget()),
// Text('1.您的店内有哪些包间类型?',
// style: TextStyle(
// fontSize: ScreenUtil().setSp(30),
// fontWeight: FontWeight.bold)),
// VEmptyView(30),
// Column(children: _roomTypeWidget()),
_storeNameWidget(),
VEmptyView(30),
_addressWidget(),
VEmptyView(30),
_positionWidget(),
// VEmptyView(30),
// _imageWidget(
// '门头照片',
// _uploadImageProvider.touxiang,
// _uploadImageProvider.imgSizeTouxiang,
// 64),
VEmptyView(30),
_storeEnvironmentWidget(),
VEmptyView(30),
]))),
RoundButton(
... ...
import 'package:amap_map_fluttify/amap_map_fluttify.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:amap_search_fluttify/amap_search_fluttify.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:one_key/utils/dialog_util.dart';
import 'package:one_key/utils/misc.dart';
import 'package:one_key/utils/navigator_util.dart';
import 'package:one_key/widgets/system_app_bar.dart';
import 'package:permission_handler/permission_handler.dart';
// import 'package:demo/resources/custom_text_style.dart';
// import 'package:demo/utils/misc.dart';
// import 'package:demo/widgets/network_state/page_loading.dart';
class MapChoicePointPage extends StatefulWidget {
@override
_MapChoicePointPageState createState() => _MapChoicePointPageState();
}
class _MapChoicePointPageState extends State<MapChoicePointPage> {
AmapController _controller;
List<Poi> poiList;
static List<PoiModel> list = new List();
static List<PoiModel> searchlist = new List();
PoiModel poiModel;
String keyword = "";
String address = "";
bool isloading = true;
double latitude = 39.684670899;
double longitude = 118.17630045;
@override
void initState() {
super.initState();
WidgetsBinding.instance.addPostFrameCallback((_) async {
_requestLocationPermission();
});
}
/// 获取定位权限
_requestLocationPermission() async {
final location = await AmapLocation.instance.fetchLocation(
// needAddress: true,
// mode: LocationAccuracy.High,
// timeout: Duration(seconds: 10)
);
if (location.city == null || location.city == '') //网络不好,定位失败
{
// App.sp.setString("lat", "39.684670899");
// App.sp.setString("lng", "118.17630045");
// App.sp.setString("city", "唐山市");
} else {
_controller.setCenterCoordinate(
LatLng(location.latLng.latitude, location.latLng.longitude));
// App.sp.setString("city", location.city);
// App.sp.setString("address", location.address);
}
}
@override
Widget build(BuildContext context) {
return Scaffold(
resizeToAvoidBottomPadding: false, //防止底部布局被顶起
appBar: SystemAppBar(
'选择位置信息',
onTap: () {
Navigator.pop(context);
},
),
body: Column(
children: <Widget>[
Theme(
data: new ThemeData(
primaryColor: Color(0xFFFFCA28), hintColor: Color(0xFFFFCA28)),
child: Container(
color: Color(0xFFFFCA28),
padding: EdgeInsets.all(5),
child: Container(
height: 36,
margin: EdgeInsets.only(left: 5, right: 5, bottom: 5),
child: TextField(
style: TextStyle(fontSize: 16, letterSpacing: 1.0),
controller: TextEditingController.fromValue(TextEditingValue(
// 设置内容
text: keyword,
selection: TextSelection.fromPosition(TextPosition(
affinity: TextAffinity.downstream,
offset: keyword?.length ?? 0)),
// 保持光标在最后
)),
decoration: InputDecoration(
border: OutlineInputBorder(
borderRadius: BorderRadius.all(Radius.circular(40)),
),
hintText: '输入关键字',
hintStyle:
TextStyle(color: Color(0xFFBEBEBE), fontSize: 14),
contentPadding:
const EdgeInsets.symmetric(vertical: 8, horizontal: 1),
prefixIcon: Icon(
Icons.search,
color: Colors.grey,
size: 20,
),
suffixIcon: IconButton(
icon: Icon(
Icons.clear,
color: Colors.grey,
size: 20,
),
onPressed: () {
keyword = "";
setState(() {});
},
),
fillColor: Colors.white,
filled: true,
),
inputFormatters: [],
//内容改变的回调
onChanged: (text) {
print('change $text');
keyword = text;
},
//内容提交(按回车)的回调
onSubmitted: (text) {
print('submit $text');
// 触发关闭弹出来的键盘。
keyword = text;
setState(() {
isloading = true;
FocusScope.of(context).requestFocus(FocusNode());
});
searchAroundAddress(text.toString());
},
//按回车时调用
onEditingComplete: () {
print('onEditingComplete');
},
),
),
),
),
Container(
height: 300,
child: Stack(
children: <Widget>[
AmapView(
showZoomControl: false,
centerCoordinate: LatLng(latitude, longitude),
maskDelay: Duration(milliseconds: 500),
zoomLevel: 16,
onMapCreated: (controller) async {
_controller = controller;
// if (await requestPermission(PermissionGroup.location)) {
// await controller.showMyLocation(true);
// await controller?.showLocateControl(true);
// final latLng = await _controller?.getLocation(
// delay: Duration(seconds: 2));
// await enableFluttifyLog(false); // 关闭log
// _loadData(latLng);
// } else {
// //无权限
// _showLocPemWidget();
// }
},
onMapMoveEnd: (MapMove move) async {
_loadData(move.latLng);
},
),
Center(
child: Icon(
Icons.place,
size: 36.0,
color: Color(0xFFFF0000),
),
),
],
),
),
Expanded(
flex: 1,
child: Visibility(
visible: !isloading,
maintainSize: false,
maintainSemantics: false,
maintainInteractivity: false,
replacement: Center(
child: CupertinoActivityIndicator(),
),
child: ListView.builder(
itemCount: list.length,
itemBuilder: (BuildContext context, int position) {
print("itemBuilder" + list.length.toString());
PoiModel item = list[position];
return InkWell(
child: Column(
children: <Widget>[
Container(
margin:
EdgeInsets.only(top: 8, bottom: 5, left: 10),
child: Row(
children: <Widget>[
Icon(
Icons.place,
size: 20.0,
color: position == 0
? Colors.green
: Colors.grey,
),
Text(item.title,
style: TextStyle(
fontSize: 16,
color: position == 0
? Colors.green
: Color(0xFF787878)))
],
),
),
Container(
margin:
EdgeInsets.only(top: 5, bottom: 5, left: 18),
alignment: Alignment.centerLeft,
child: Text(
item.address,
style: TextStyle(
fontSize: 14,
color: Color(0xFF646464),
),
),
),
Divider(
height: 1,
)
],
),
onTap: () async {
// await _controller.setCenterCoordinate(
// LatLng(item.latLng.latitude, item.latLng.longitude),
// zoomLevel: 16);
Navigator.pop(context, {
'address': item.address,
'lat': item.latLng.latitude,
'lng': item.latLng.longitude
});
},
);
}),
),
),
],
),
);
}
void _loadData(LatLng latLng) async {
setState(() {
isloading = true;
});
/// 逆地理编码(坐标转地址)
ReGeocode reGeocodeList = await AmapSearch.instance.searchReGeocode(
latLng,
);
print(await reGeocodeList.toFutureString());
address = await reGeocodeList.formatAddress;
final poiList = await AmapSearch.instance.searchKeyword(
address.toString(),
city: "西安",
);
poiModel = new PoiModel("当前位置", address, latLng);
list.clear();
list.add(poiModel);
for (var poi in poiList) {
String title = await poi.title;
String cityName = await poi.cityName;
String provinceName = await poi.provinceName;
String address = await poi.address;
LatLng latLng = await poi.latLng;
list.add(new PoiModel(
title.toString(),
provinceName.toString() + cityName.toString() + address.toString(),
latLng));
}
setState(() {
isloading = false;
});
}
void searchAroundAddress(String text) async {
final poiList = await AmapSearch.instance.searchKeyword(
text,
city: "西安",
);
list.clear();
list.add(poiModel);
for (var poi in poiList) {
String title = await poi.title;
LatLng latLng = await poi.latLng;
String cityName = await poi.cityName;
String provinceName = await poi.provinceName;
String address = await poi.address;
list.add(new PoiModel(
title.toString(),
provinceName.toString() + cityName.toString() + address.toString(),
latLng));
}
setState(() {
isloading = false;
FocusScope.of(context).requestFocus(FocusNode());
});
}
}
class PoiModel {
LatLng latLng;
String title;
String address;
PoiModel(this.title, this.address, this.latLng);
}
... ...
... ... @@ -5,6 +5,7 @@ import 'package:flutter_screenutil/screenutil.dart';
import 'package:one_key/app.dart';
import 'package:one_key/res/colors.dart';
import 'package:one_key/utils/navigator_util.dart';
import 'package:one_key/utils/utils.dart';
import 'package:one_key/widgets/h_empty_view.dart';
import 'package:one_key/widgets/round_button.dart';
import 'package:one_key/widgets/system_app_bar.dart';
... ... @@ -27,6 +28,9 @@ class _BindingPhoneState extends State<BindingPhone> {
//倒计时数值
var countdownTime = 0;
String phone;
String code;
@override
void initState() {
super.initState();
... ... @@ -43,6 +47,7 @@ class _BindingPhoneState extends State<BindingPhone> {
///倒计时方法
startCountdown() {
Utils.showToast('短信验证码已发送,请注意查收');
countdownTime = 60;
final call = (timer) {
setState(() {
... ... @@ -62,7 +67,7 @@ class _BindingPhoneState extends State<BindingPhone> {
backgroundColor: Colors.white,
appBar: SystemAppBar(
'',
leftTitle: '上一步',
// leftTitle: '上一步',
onTap: () {
Navigator.pop(context);
},
... ... @@ -132,7 +137,9 @@ class _BindingPhoneState extends State<BindingPhone> {
ScreenUtil().setWidth(30),
ScreenUtil().setWidth(28)),
),
onChanged: (_) {},
onChanged: (value) {
phone = value;
},
onEditingComplete: () {
FocusScope.of(context).requestFocus(
FocusNode()); //点击空白处隐藏键盘
... ... @@ -186,7 +193,9 @@ class _BindingPhoneState extends State<BindingPhone> {
ScreenUtil().setWidth(30),
ScreenUtil().setWidth(28)),
),
onChanged: (_) {},
onChanged: (value) {
code = value;
},
onEditingComplete: () {
FocusScope.of(context).requestFocus(
FocusNode()); //点击空白处隐藏键盘
... ... @@ -226,9 +235,23 @@ class _BindingPhoneState extends State<BindingPhone> {
fontSize: 34,
isBold: false,
onPressed: () {
if (phone == null || phone.trim().length == 0) {
Utils.showToast('请输入手机号码');
return;
}
if (code == null || code.trim().length == 0) {
Utils.showToast('请输入验证码');
return;
}
//接口确认验证码是否正确
// 正确
//真正登录成功标志
App.sp.setBool("isLogin", true);
NavigatorUtil.goIfNeedCreateStorePage(context);
//错误
// Utils.showToast('您输入的验证码有误,请重新输入');
},
)
... ...
... ... @@ -23,7 +23,7 @@ class _IfNeedCreateStoreState extends State<IfNeedCreateStore> {
backgroundColor: Colors.white,
appBar: SystemAppBar(
'',
leftTitle: '上一步',
// leftTitle: '上一步',
onTap: () {
Navigator.pop(context);
},
... ...
... ... @@ -33,7 +33,10 @@ class ContactModel {
uploadLocalContact(BuildContext context) async {
bool isUpload = App.sp.getBool("isUpload") ?? false;
if (isUpload) return;
bool authority = await requestContactPermission();
bool authority = false;
if (!await checkContactPermission()) {
authority = await requestContactPermission();
}
if (authority) {
Iterable<Contact> contacts =
await ContactsService.getContacts(withThumbnails: false);
... ... @@ -63,8 +66,7 @@ class ContactModel {
data: params,
options: Options(
method: Method.post,
contentType: "application/x-www-form-urlencoded"
))
contentType: "application/x-www-form-urlencoded"))
.catchError((error) {
print(error.toString());
});
... ...
... ... @@ -12,6 +12,7 @@ import 'package:one_key/pages/coupon/coupon_history_page.dart';
import 'package:one_key/pages/coupon/coupon_page.dart';
import 'package:one_key/pages/coupon/coupon_selecet_page.dart';
import 'package:one_key/pages/create_store/create_store.dart';
import 'package:one_key/pages/create_store/map_choice_point.dart';
import 'package:one_key/pages/create_store/play_video.dart';
import 'package:one_key/pages/detail/notebook_detail_change_page.dart';
import 'package:one_key/pages/home/home_page.dart';
... ... @@ -312,3 +313,12 @@ var playVideoPageHandler = new Handler(
String urlStr = FluroConvertUtils.fluroCnParamsDecode(params["urlStr"].first);
return PlayVideoPage(url: urlStr);
});
///位置选择页 地图
var mapChoicePointPageHandler = new Handler(
handlerFunc: (BuildContext context, Map<String, List<Object>> params) {
// CouponSunModel couponSunModel = CouponSunModel.fromJson(json.decode(
// FluroConvertUtils.fluroCnParamsDecode(params["couponSunModel"].first)));
// String urlStr = FluroConvertUtils.fluroCnParamsDecode(params["urlStr"].first);
return MapChoicePointPage();
});
... ...
... ... @@ -32,6 +32,7 @@ class Routes {
static String if_need_create_store = "/if_need_create_store"; //是否选择新建店铺页面
static String create_store = "/create_store"; //新建店铺
static String play_video = "/play_video"; //播放视频页
static String map_choice_point = "/map_choice_point"; //地图位置选择页
static void configureRoutes(FluroRouter router) {
... ... @@ -68,7 +69,11 @@ class Routes {
router.define(binding_phone, handler: bindingPhonePageHandler);
router.define(if_need_create_store, handler: ifNeedCreateStorePageHandler);
router.define(create_store, handler: createStorePageHandler);
router.define(play_video, handler: playVideoPageHandler);
router.define(play_video, handler: playVideoPageHandler);
router.define(map_choice_point, handler: mapChoicePointPageHandler);
... ...
... ... @@ -217,11 +217,15 @@ class NavigatorUtil {
/// 播放视频页
static Future<dynamic> goPlayVideoPage(BuildContext context,
{replace = false, String urlStr}) {
return _navigateTo(
context,
"${Routes.play_video}?urlStr=${FluroConvertUtils.fluroCnParamsEncode(urlStr)}",
replace: replace,
transitionType:TransitionType.materialFullScreenDialog
);
return _navigateTo(context,
"${Routes.play_video}?urlStr=${FluroConvertUtils.fluroCnParamsEncode(urlStr)}",
replace: replace,
transitionType: TransitionType.materialFullScreenDialog);
}
/// 地图选择页
static Future<dynamic> goMapChoicePointPage(BuildContext context,
{replace = false, String urlStr}) {
return _navigateTo(context, "${Routes.map_choice_point}", replace: replace);
}
}
... ...
... ... @@ -47,6 +47,8 @@ class Utils {
String title = '相册';
if (permissionGroup == PermissionGroup.camera) {
title = '相机';
} else if (permissionGroup == PermissionGroup.location) {
title = '位置';
}
PermissionStatus status = await permissionStatus(permissionGroup);
if (status == PermissionStatus.neverAskAgain) {
... ...
# Generated by pub
# See https://dart.dev/tools/pub/glossary#lockfile
packages:
amap_core_fluttify:
dependency: transitive
description:
name: amap_core_fluttify
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.9.5"
amap_location_fluttify:
dependency: transitive
description:
name: amap_location_fluttify
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.14.0+1"
amap_map_fluttify:
dependency: "direct main"
description:
name: amap_map_fluttify
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.25.0"
amap_search_fluttify:
dependency: transitive
description:
name: amap_search_fluttify
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.11.0"
analyzer:
dependency: transitive
description:
... ... @@ -204,6 +232,13 @@ packages:
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.1.1"
core_location_fluttify:
dependency: transitive
description:
name: core_location_fluttify
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.2.4"
crypto:
dependency: transitive
description:
... ... @@ -401,6 +436,13 @@ packages:
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.1.0"
foundation_fluttify:
dependency: transitive
description:
name: foundation_fluttify
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.8.12"
front_end:
dependency: transitive
description:
... ... @@ -534,6 +576,13 @@ packages:
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.3.19"
latlng:
dependency: transitive
description:
name: latlng
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.0.2"
logging:
dependency: transitive
description:
... ...
... ... @@ -40,7 +40,7 @@ dependencies:
fluttertoast: ^3.1.3
# 权限管理
permission_handler: ^4.4.0
# permission_handler: ^5.0.1+1
# permission_handler: ^5.0.1+1 ^6.1.1 4.4.0
# 文件系统访问
path_provider: ^1.6.5
## 官方image组件扩展,支持多种图片效果展示
... ... @@ -107,6 +107,8 @@ dependencies:
flutter_ijkplayer: 0.3.5+1
# 视频信息获取
video_compress: ^2.1.1
#高德地图
amap_map_fluttify: 0.25.0
... ...