重构example项目结构
This commit is contained in:
@ -1,22 +1,13 @@
|
||||
import 'package:amap_map/amap_map.dart';
|
||||
import 'package:x_amap_base/x_amap_base.dart';
|
||||
import 'package:amap_map_example/base_page.dart';
|
||||
import 'package:amap_map_example/const_config.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class MarkerAddAfterMapPage extends BasePage {
|
||||
MarkerAddAfterMapPage(String title, String subTitle) : super(title, subTitle);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) => _Body();
|
||||
}
|
||||
|
||||
class _Body extends StatefulWidget {
|
||||
class MarkerAddAfterMapPage extends StatefulWidget {
|
||||
@override
|
||||
_BodyState createState() => _BodyState();
|
||||
}
|
||||
|
||||
class _BodyState extends State<_Body> {
|
||||
class _BodyState extends State<MarkerAddAfterMapPage> {
|
||||
static final LatLng defaultPosition = const LatLng(39.909187, 116.397451);
|
||||
//需要先设置一个空的map赋值给AMapWidget的markers,否则后续无法添加marker
|
||||
final Map<String, Marker> _markers = <String, Marker>{};
|
||||
|
@ -2,23 +2,14 @@ import 'dart:math';
|
||||
|
||||
import 'package:amap_map/amap_map.dart';
|
||||
import 'package:x_amap_base/x_amap_base.dart';
|
||||
import 'package:amap_map_example/base_page.dart';
|
||||
import 'package:amap_map_example/const_config.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class MarkerAddWithMapPage extends BasePage {
|
||||
MarkerAddWithMapPage(String title, String subTitle) : super(title, subTitle);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) => _Body();
|
||||
}
|
||||
|
||||
class _Body extends StatefulWidget {
|
||||
class MarkerAddWithMapPage extends StatefulWidget {
|
||||
@override
|
||||
_BodyState createState() => _BodyState();
|
||||
}
|
||||
|
||||
class _BodyState extends State<_Body> {
|
||||
class _BodyState extends State<MarkerAddWithMapPage> {
|
||||
static final LatLng mapCenter = const LatLng(39.909187, 116.397451);
|
||||
final Map<String, Marker> _initMarkerMap = <String, Marker>{};
|
||||
|
||||
|
@ -2,33 +2,21 @@ import 'dart:async';
|
||||
import 'dart:typed_data';
|
||||
import 'dart:ui';
|
||||
|
||||
import 'package:amap_map_example/base_page.dart';
|
||||
import 'package:amap_map_example/const_config.dart';
|
||||
import 'package:amap_map_example/widgets/amap_switch_button.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
|
||||
import 'package:amap_map/amap_map.dart';
|
||||
import 'package:x_amap_base/x_amap_base.dart';
|
||||
import 'dart:math';
|
||||
|
||||
class MarkerConfigDemoPage extends BasePage {
|
||||
MarkerConfigDemoPage(String title, String subTitle) : super(title, subTitle);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return _Body();
|
||||
}
|
||||
}
|
||||
|
||||
class _Body extends StatefulWidget {
|
||||
const _Body();
|
||||
class MarkerConfigDemoPage extends StatefulWidget {
|
||||
const MarkerConfigDemoPage();
|
||||
|
||||
@override
|
||||
State<StatefulWidget> createState() => _State();
|
||||
}
|
||||
|
||||
class _State extends State<_Body> {
|
||||
class _State extends State<MarkerConfigDemoPage> {
|
||||
static final LatLng mapCenter = const LatLng(39.909187, 116.397451);
|
||||
|
||||
Map<String, Marker> _markers = <String, Marker>{};
|
||||
|
@ -1,22 +1,13 @@
|
||||
import 'package:amap_map/amap_map.dart';
|
||||
import 'package:x_amap_base/x_amap_base.dart';
|
||||
import 'package:amap_map_example/base_page.dart';
|
||||
import 'package:amap_map_example/const_config.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class MarkerCustomIconPage extends BasePage {
|
||||
MarkerCustomIconPage(String title, String subTitle) : super(title, subTitle);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) => _Body();
|
||||
}
|
||||
|
||||
class _Body extends StatefulWidget {
|
||||
class MarkerCustomIconPage extends StatefulWidget {
|
||||
@override
|
||||
_BodyState createState() => _BodyState();
|
||||
}
|
||||
|
||||
class _BodyState extends State<_Body> {
|
||||
class _BodyState extends State<MarkerCustomIconPage> {
|
||||
static final LatLng markerPosition = const LatLng(39.909187, 116.397451);
|
||||
final Map<String, Marker> _initMarkerMap = <String, Marker>{};
|
||||
String? _currentMarkerId;
|
||||
|
@ -1,4 +1,3 @@
|
||||
import 'package:amap_map_example/base_page.dart';
|
||||
import 'package:amap_map_example/widgets/amap_switch_button.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
@ -6,22 +5,14 @@ import 'package:flutter/widgets.dart';
|
||||
import 'package:amap_map/amap_map.dart';
|
||||
import 'package:x_amap_base/x_amap_base.dart';
|
||||
|
||||
class PolygonDemoPage extends BasePage {
|
||||
PolygonDemoPage(String title, String subTitle) : super(title, subTitle);
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return _Body();
|
||||
}
|
||||
}
|
||||
|
||||
class _Body extends StatefulWidget {
|
||||
const _Body();
|
||||
class PolygonDemoPage extends StatefulWidget {
|
||||
const PolygonDemoPage();
|
||||
|
||||
@override
|
||||
State<StatefulWidget> createState() => _State();
|
||||
}
|
||||
|
||||
class _State extends State<_Body> {
|
||||
class _State extends State<PolygonDemoPage> {
|
||||
_State();
|
||||
|
||||
// Values when toggling Polygon color
|
||||
|
@ -1,4 +1,3 @@
|
||||
import 'package:amap_map_example/base_page.dart';
|
||||
import 'package:amap_map_example/widgets/amap_switch_button.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
@ -6,22 +5,14 @@ import 'package:flutter/widgets.dart';
|
||||
import 'package:amap_map/amap_map.dart';
|
||||
import 'package:x_amap_base/x_amap_base.dart';
|
||||
|
||||
class PolylineDemoPage extends BasePage {
|
||||
PolylineDemoPage(String title, String subTitle) : super(title, subTitle);
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return _Body();
|
||||
}
|
||||
}
|
||||
|
||||
class _Body extends StatefulWidget {
|
||||
const _Body();
|
||||
class PolylineDemoPage extends StatefulWidget {
|
||||
const PolylineDemoPage();
|
||||
|
||||
@override
|
||||
State<StatefulWidget> createState() => _State();
|
||||
}
|
||||
|
||||
class _State extends State<_Body> {
|
||||
class _State extends State<PolylineDemoPage> {
|
||||
_State();
|
||||
|
||||
// Values when toggling polyline color
|
||||
|
@ -1,27 +1,17 @@
|
||||
import 'package:amap_map_example/base_page.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
|
||||
import 'package:amap_map/amap_map.dart';
|
||||
import 'package:x_amap_base/x_amap_base.dart';
|
||||
|
||||
class PolylineGeodesicDemoPage extends BasePage {
|
||||
PolylineGeodesicDemoPage(String title, String subTitle)
|
||||
: super(title, subTitle);
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return _Body();
|
||||
}
|
||||
}
|
||||
|
||||
class _Body extends StatefulWidget {
|
||||
const _Body();
|
||||
class PolylineGeodesicDemoPage extends StatefulWidget {
|
||||
const PolylineGeodesicDemoPage();
|
||||
|
||||
@override
|
||||
State<StatefulWidget> createState() => _State();
|
||||
}
|
||||
|
||||
class _State extends State<_Body> {
|
||||
class _State extends State<PolylineGeodesicDemoPage> {
|
||||
_State();
|
||||
|
||||
// Values when toggling polyline color
|
||||
|
@ -1,27 +1,16 @@
|
||||
import 'package:amap_map/amap_map.dart';
|
||||
import 'package:amap_map_example/base_page.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
|
||||
import 'package:x_amap_base/x_amap_base.dart';
|
||||
|
||||
class PolylineTextureDemoPage extends BasePage {
|
||||
PolylineTextureDemoPage(String title, String subTitle)
|
||||
: super(title, subTitle);
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return _Body();
|
||||
}
|
||||
}
|
||||
|
||||
class _Body extends StatefulWidget {
|
||||
const _Body();
|
||||
class PolylineTextureDemoPage extends StatefulWidget {
|
||||
const PolylineTextureDemoPage();
|
||||
|
||||
@override
|
||||
State<StatefulWidget> createState() => _State();
|
||||
}
|
||||
|
||||
class _State extends State<_Body> {
|
||||
class _State extends State<PolylineTextureDemoPage> {
|
||||
_State();
|
||||
|
||||
Map<String, Polyline> _polylines = <String, Polyline>{};
|
||||
|
Reference in New Issue
Block a user