12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 |
- import 'package:amap_flutter_base/amap_flutter_base.dart';
- import 'package:amap_flutter_map/amap_flutter_map.dart';
- import 'package:flutter/foundation.dart';
- import 'package:flutter/material.dart';
- import 'package:flutter/rendering.dart';
- import 'package:flutter/services.dart';
- import 'package:sport/pages/run/run_page.dart';
- import 'package:sport/pages/run/setting_page.dart';
- import 'package:sport/router/navigator_util.dart';
- import 'package:sport/services/app_lifecycle_state.dart';
- import 'package:sport/widgets/appbar.dart';
- class RunMapPage extends StatefulWidget {
- final int id;
- final bool post;
- final bool share;
- const RunMapPage({Key? key, this.id = 0, this.post = false, this.share = false}) : super(key: key);
- @override
- State<StatefulWidget> createState() => _PageState();
- }
- class _PageState extends LifecycleState<RunMapPage> with RunSetting {
- AMapController? _mapController;
- @override
- void initState() {
- super.initState();
- }
- void _onMapCreated(AMapController controller) {
- _mapController = controller;
- _mapController?.moveCamera(CameraUpdate.newCameraPosition(CameraPosition(tilt: 45.0, zoom: 18, bearing: -15, target: LatLng(23.13170770743485, 113.36392327684825))), animated: true, duration: 2000);
- }
- @override
- Widget build(BuildContext context) {
- return Scaffold(
- backgroundColor: Colors.white,
- appBar: buildAppBar(context, actions: [
- GestureDetector(
- onTap: () async {
- await NavigatorUtil.goPage(context, (context) => SettingPage());
- refreshSetting();
- },
- child: Container(
- width: 44.0,
- height: 44.0,
- decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.circular(50.0)),
- child: Image.asset("lib/assets/img/setgoals_icon_set.png")),
- ),
- ]),
- body: AMapWidget(
- apiKey: AMapApiKey(androidKey: KEY_ANDROID, iosKey: KEY_IOS),
- mapType: selectMapType(this.runMapType),
- buildingsEnabled: true,
- onMapCreated: _onMapCreated,
- initialCameraPosition: CameraPosition(target: LatLng(23.13170770743485, 113.36392327684825), zoom: 16, bearing: -270 ),
- customStyleOptions: customStyleOptions,
- // tiltGesturesEnabled: true,
- // rotateGesturesEnabled: false,
- touchPoiEnabled: false,
- labelsEnabled: false,
- ));
- }
- }
|