parent
c5feb7e9b7
commit
11172fd6a2
@ -1,73 +0,0 @@
|
|||||||
import 'package:aku_new_community/base/base_style.dart';
|
|
||||||
import 'package:aku_new_community/const/resource.dart';
|
|
||||||
import 'package:aku_new_community/constants/api.dart';
|
|
||||||
import 'package:aku_new_community/constants/saas_api.dart';
|
|
||||||
import 'package:aku_new_community/model/common/img_model.dart';
|
|
||||||
import 'package:aku_new_community/models/geographic_information/geographic_information_model.dart';
|
|
||||||
import 'package:aku_new_community/utils/network/base_model.dart';
|
|
||||||
import 'package:aku_new_community/utils/network/net_util.dart';
|
|
||||||
import 'package:aku_new_community/widget/bee_scaffold.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:flutter_easyrefresh/easy_refresh.dart';
|
|
||||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
||||||
import 'package:velocity_x/velocity_x.dart';
|
|
||||||
|
|
||||||
class GeographicInformationPage extends StatefulWidget {
|
|
||||||
GeographicInformationPage({
|
|
||||||
Key? key,
|
|
||||||
}) : super(key: key);
|
|
||||||
|
|
||||||
@override
|
|
||||||
_GeographicInformationPageState createState() =>
|
|
||||||
_GeographicInformationPageState();
|
|
||||||
}
|
|
||||||
|
|
||||||
class _GeographicInformationPageState extends State<GeographicInformationPage> {
|
|
||||||
GeographicInformationModel _model = GeographicInformationModel.init();
|
|
||||||
bool _onload = true;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
return BeeScaffold(
|
|
||||||
bodyColor: Colors.white,
|
|
||||||
title: '地理信息',
|
|
||||||
body: EasyRefresh(
|
|
||||||
firstRefresh: true,
|
|
||||||
header: MaterialHeader(),
|
|
||||||
onRefresh: () async {
|
|
||||||
BaseModel baseModel =
|
|
||||||
await NetUtil().get(API.manager.geographyInformation);
|
|
||||||
if (baseModel.success && baseModel.data != null) {
|
|
||||||
_model = GeographicInformationModel.fromJson(baseModel.data);
|
|
||||||
}
|
|
||||||
_onload = false;
|
|
||||||
setState(() {});
|
|
||||||
},
|
|
||||||
child: _onload
|
|
||||||
? Container()
|
|
||||||
: ListView(
|
|
||||||
children: [
|
|
||||||
SizedBox(
|
|
||||||
child: FadeInImage.assetNetwork(
|
|
||||||
placeholder: R.ASSETS_IMAGES_PLACEHOLDER_WEBP,
|
|
||||||
fit: BoxFit.cover,
|
|
||||||
image: SAASAPI.image(ImgModel.first(_model.imgUrls))),
|
|
||||||
width: double.infinity,
|
|
||||||
height: 424.w,
|
|
||||||
),
|
|
||||||
24.w.heightBox,
|
|
||||||
Padding(
|
|
||||||
padding:
|
|
||||||
EdgeInsets.only(left: 32.w, right: 32.w, top: 40.w),
|
|
||||||
child: Text(
|
|
||||||
_model.content ?? '',
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 26.sp,
|
|
||||||
color: (ktextSubColor),
|
|
||||||
fontWeight: FontWeight.bold),
|
|
||||||
)),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
));
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,73 +1,70 @@
|
|||||||
import 'package:aku_new_community/base/base_style.dart';
|
|
||||||
import 'package:aku_new_community/const/resource.dart';
|
|
||||||
import 'package:aku_new_community/constants/api.dart';
|
import 'package:aku_new_community/constants/api.dart';
|
||||||
import 'package:aku_new_community/constants/saas_api.dart';
|
import 'package:aku_new_community/pages/one_alarm/alarm_detail_page.dart';
|
||||||
import 'package:aku_new_community/model/common/img_model.dart';
|
import 'package:aku_new_community/pages/one_alarm/widget/alarm_page.dart';
|
||||||
import 'package:aku_new_community/models/geographic_information/geographic_information_model.dart';
|
import 'package:aku_new_community/provider/app_provider.dart';
|
||||||
import 'package:aku_new_community/utils/network/base_model.dart';
|
import 'package:aku_new_community/utils/headers.dart';
|
||||||
import 'package:aku_new_community/utils/network/net_util.dart';
|
import 'package:aku_new_community/utils/network/net_util.dart';
|
||||||
import 'package:aku_new_community/widget/bee_scaffold.dart';
|
import 'package:aku_new_community/widget/bee_scaffold.dart';
|
||||||
|
import 'package:amap_flutter_base/amap_flutter_base.dart';
|
||||||
|
import 'package:amap_flutter_map/amap_flutter_map.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_easyrefresh/easy_refresh.dart';
|
import 'package:flutter_icons/flutter_icons.dart';
|
||||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:velocity_x/velocity_x.dart';
|
import 'package:permission_handler/permission_handler.dart';
|
||||||
|
import 'package:provider/provider.dart';
|
||||||
|
import 'package:url_launcher/url_launcher.dart';
|
||||||
|
|
||||||
|
|
||||||
class GeographicInformationPage extends StatefulWidget {
|
class GeographicInformationPage extends StatefulWidget {
|
||||||
GeographicInformationPage({
|
GeographicInformationPage({Key? key}) : super(key: key);
|
||||||
Key? key,
|
|
||||||
}) : super(key: key);
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
_GeographicInformationPageState createState() =>
|
_GeographicInformationPageState createState() => _GeographicInformationPageState();
|
||||||
_GeographicInformationPageState();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class _GeographicInformationPageState extends State<GeographicInformationPage> {
|
class _GeographicInformationPageState extends State<GeographicInformationPage> {
|
||||||
GeographicInformationModel _model = GeographicInformationModel.init();
|
AMapController? _mapController;
|
||||||
bool _onload = false;
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
super.initState();
|
||||||
|
PermissionUtil.getLocationPermission();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void dispose() {
|
||||||
|
super.dispose();
|
||||||
|
_mapController?.disponse();
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
final appProvider = Provider.of<AppProvider>(context);
|
||||||
return BeeScaffold(
|
return BeeScaffold(
|
||||||
bodyColor: Colors.white,
|
|
||||||
title: '地理信息',
|
title: '地理信息',
|
||||||
body: EasyRefresh(
|
body: AMapWidget(
|
||||||
firstRefresh: true,
|
privacyStatement: AMapPrivacyStatement(
|
||||||
header: MaterialHeader(),
|
hasContains: true, hasShow: true, hasAgree: true),
|
||||||
onRefresh: () async {
|
onMapCreated: (controller) {
|
||||||
BaseModel baseModel =
|
final appProvider =
|
||||||
await NetUtil().get(API.manager.geographyInformation);
|
Provider.of<AppProvider>(context, listen: false);
|
||||||
if (baseModel.success && baseModel.data != null) {
|
LatLng _target = LatLng(
|
||||||
_model = GeographicInformationModel.fromJson(baseModel.data);
|
(appProvider.location?['latitude'] ?? 0) as double,
|
||||||
}
|
(appProvider.location?['longitude'] ?? 0) as double,
|
||||||
_onload = false;
|
);
|
||||||
setState(() {});
|
_mapController = controller;
|
||||||
|
_mapController!.moveCamera(
|
||||||
|
CameraUpdate.newCameraPosition(
|
||||||
|
CameraPosition(target: _target, zoom: 18),
|
||||||
|
),
|
||||||
|
);
|
||||||
},
|
},
|
||||||
child: _onload
|
myLocationStyleOptions: MyLocationStyleOptions(
|
||||||
? Container()
|
true,
|
||||||
: ListView(
|
circleFillColor: Theme.of(context).primaryColor.withOpacity(0.2),
|
||||||
children: [
|
circleStrokeColor: Theme.of(context).primaryColor,
|
||||||
SizedBox(
|
|
||||||
child: FadeInImage.assetNetwork(
|
|
||||||
placeholder: R.ASSETS_IMAGES_PLACEHOLDER_WEBP,
|
|
||||||
fit: BoxFit.cover,
|
|
||||||
image: SAASAPI.image(ImgModel.first(_model.imgUrls))),
|
|
||||||
width: double.infinity,
|
|
||||||
height: 424.w,
|
|
||||||
),
|
),
|
||||||
24.w.heightBox,
|
|
||||||
Padding(
|
|
||||||
padding:
|
|
||||||
EdgeInsets.only(left: 32.w, right: 32.w, top: 40.w),
|
|
||||||
child: Text(
|
|
||||||
_model.content ?? '',
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 26.sp,
|
|
||||||
color: (ktextSubColor),
|
|
||||||
fontWeight: FontWeight.bold),
|
|
||||||
)),
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
));
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in new issue