Latest source merged from Syncfusion

This commit is contained in:
pipeline 2020-12-29 15:50:49 +05:30
Родитель 05410377de
Коммит aa3ac0e247
8 изменённых файлов: 236 добавлений и 91 удалений

Просмотреть файл

@ -98,3 +98,7 @@ class MyAppState extends State<MyApp> {
![Cell builder](images/builders/cell-builder.png)
## See also
[How to customize the date range picker cells using builder in the Flutter (SfDateRangePicker)](https://www.syncfusion.com/kb/12208/how-to-customize-the-date-range-picker-cells-using-builder-in-the-flutter-sfdaterangepicker)

Просмотреть файл

@ -174,4 +174,16 @@ Widget build(BuildContext context) {
## See also
[How to customize the month cell of the Flutter date range picker (SfDateRangePicker)?](https://www.syncfusion.com/kb/11307/how-to-customize-the-month-cell-of-the-flutter-date-range-picker-sfdaterangepicker)
[How to customize the month cell of the Flutter date range picker (SfDateRangePicker)?](https://www.syncfusion.com/kb/11307/how-to-customize-the-month-cell-of-the-flutter-date-range-picker-sfdaterangepicker)
[How to style the current month date cell in the Flutter date range picker (SfDateRangePicker)](https://www.syncfusion.com/kb/12190/how-to-style-the-current-month-date-cell-in-the-flutter-date-range-picker-sfdaterangepicker)
[How to change the week end dates in the Flutter date range picker (SfDateRangePicker)](https://www.syncfusion.com/kb/12182/how-to-change-the-week-end-dates-in-the-flutter-date-range-picker-sfdaterangepicker)
[How to change the month format in the Flutter date range picker (SfDateRangePicker)](https://www.syncfusion.com/kb/12169/how-to-change-the-month-format-in-the-flutter-date-range-picker-sfdaterangepicker)
[How to customize the selected range cells in the Flutter date range picker (SfDateRangePicker)](https://www.syncfusion.com/kb/12148/how-to-customize-the-selected-range-cells-in-the-flutter-date-range-picker)
[How to add the indicator in the month cells of the date range picker (SfDateRangePicker), when the Flutter event calendar (SfCalendar) has an appointments?](https://www.syncfusion.com/kb/12119/how-to-add-the-indicator-in-the-month-cells-of-the-date-range-picker-sfdaterangepicker-when)
[How to add custom fonts in Flutter date range picker (SfDateRangePicker)](https://www.syncfusion.com/kb/12212/how-to-add-custom-fonts-in-flutter-date-range-picker-sfdaterangepicker)

Просмотреть файл

@ -0,0 +1,17 @@
---
title: Essential Studio for Flutter Weekly Nuget Release Release Notes
description: Essential Studio for Flutter Weekly Nuget Release Release Notes
platform: flutter
documentation: ug
---
# Essential Studio for Flutter Release Notes
{% include release-info.html date="December 30, 2020" version="v18.4.0.32" %}
{% directory path: _includes/release-notes/v18.4.0.32 %}
{% include {{file.url}} %}
{% enddirectory %}

Просмотреть файл

@ -774,4 +774,18 @@ You can customize the displaying time format in the appointment widget in the mo
[How to design and configure your appointment editor in event calendar widget Flutter](https://www.syncfusion.com/kb/11204/how-to-design-and-configure-your-appointment-editor-in-event-calendar-widget-flutter)
[How to get appointment details from the OnTap event of the flutter event calendar](https://www.syncfusion.com/kb/10999/how-to-get-appointment-details-from-the-ontap-event-of-the-flutter-event-calendar)
[How to get appointment details from the OnTap event of the Flutter event calendar](https://www.syncfusion.com/kb/10999/how-to-get-appointment-details-from-the-ontap-event-of-the-flutter-event-calendar)
[How to style the appointment in the Flutter event calendar (SfCalendar)] (https://www.syncfusion.com/kb/12162/how-to-style-the-appointment-in-the-flutter-event-calendar-sfcalendar)
[How to exclude the dates from recurrence appointments in the Flutter event calendar (SfCalendar)](https://www.syncfusion.com/kb/12161/how-to-exclude-the-dates-from-recurrence-appointments-in-the-flutter-event-calendar)
[How to add recurring appointments until the specified date in the Flutter event calendar (SfCalendar)](https://www.syncfusion.com/kb/12158/how-to-add-recurring-appointments-until-the-specified-date-in-the-flutter-event-calendar)
[How to add the appointments to the Fire base database using appointment editor in the Flutter event calendar (SfCalendar)](https://www.syncfusion.com/kb/12110/how-to-add-the-appointments-to-the-firebase-database-using-appointment-editor-in-the)
[How to work with the Fire base database and the Flutter event calendar (SfCalendar) for appointments](https://www.syncfusion.com/kb/12067/how-to-work-with-the-firebase-database-and-the-flutter-event-calendar-sfcalendar-for)
[How to add google calendar events to the Flutter event calendar (SfCalendar)](https://www.syncfusion.com/kb/12116/how-to-add-google-calendar-events-to-the-flutter-event-calendar-sfcalendar)
[How to add additional attributes in events in the Flutter event calendar (SfCalendar)](https://www.syncfusion.com/kb/12209/how-to-add-additional-attributes-in-events-in-the-flutter-event-calendar-sfcalendar)

Просмотреть файл

@ -318,4 +318,13 @@ Widget build(BuildContext context) {
{% endhighlight %}
{% endtabs %}
![Time regions builder](images/builder/timeregion-builder.png)
![Time regions builder](images/builder/timeregion-builder.png)
## See also
[How to customize the special time region using custom builder in the Flutter event calendar (SfCalendar)](https://www.syncfusion.com/kb/12192/how-to-customize-the-special-time-region-using-custom-builder-in-the-flutter-event-calendar)
[How to customize the appointments using custom builder in the Flutter event calendar (SfCalendar)](https://www.syncfusion.com/kb/12191/how-to-customize-the-appointments-using-custom-builder-in-the-flutter-event-calendar)
[How to customize the month cell based on the appointment using builder in the Flutter calendar (SfCalendar)](https://www.syncfusion.com/kb/12210/how-to-customize-the-month-cell-based-on-the-appointment-using-builder-in-the-flutter)

Просмотреть файл

@ -407,4 +407,8 @@ You can get the complete getting started sample from [here](https://github.com/S
[How to update event calendar (SfCalendar) DisplayDate using showDatePicker in flutter](https://www.syncfusion.com/kb/11010/how-to-update-event-calendar-sfcalendar-displaydate-using-showdatepicker-in-flutter)
[How can we move to specific time while switching from month to day view in Flutter event calendar](https://www.syncfusion.com/kb/10943/how-can-we-move-to-specific-time-while-switching-from-month-to-day-view-in-flutter-event)
[How can we move to specific time while switching from month to day view in Flutter event calendar](https://www.syncfusion.com/kb/10943/how-can-we-move-to-specific-time-while-switching-from-month-to-day-view-in-flutter-event)
[How to customize the cell border in the Flutter event calendar (SfCalendar)](https://www.syncfusion.com/kb/12118/how-to-customize-the-cell-border-in-the-flutter-event-calendar-sfcalendar)
[How to apply theming in Flutter event calendar (SfCalendar)?](https://www.syncfusion.com/kb/11899/how-to-apply-theming-in-flutter-event-calendar-sfcalendar)

Просмотреть файл

@ -126,3 +126,5 @@ Widget build(BuildContext context) {
## See also
[How to add custom header and view header in Flutter event calendar widget](https://www.syncfusion.com/kb/10997/how-to-add-custom-header-and-view-header-in-flutter-event-calendar-widget)
[How to style a header in the Flutter event calendar (SfCalendar)](https://www.syncfusion.com/kb/12144/how-to-style-a-header-in-the-flutter-event-calendar-sfcalendar)

Просмотреть файл

@ -15,19 +15,19 @@ Markers can be used to denote the locations. It is possible to use the built-in
### Shape layer
You can show markers at any position on the map by providing latitude and longitude position to the [`MapMarker`](https://pub.dev/documentation/syncfusion_flutter_maps/latest/maps/MapMarker-class.html), which is the widget returns from the [`MapShapeLayer.markerBuilder`](https://pub.dev/documentation/syncfusion_flutter_maps/latest/maps/MapShapeLayer/markerBuilder.html) property.
You can show markers at any position on the map by providing latitude and longitude position to the [`MapMarker`](https://pub.dev/documentation/syncfusion_flutter_maps/latest/maps/MapMarker-class.html), which is the widget returns from the [`markerBuilder`](https://pub.dev/documentation/syncfusion_flutter_maps/latest/maps/MapLayer/markerBuilder.html) property.
The [`markerBuilder`](https://pub.dev/documentation/syncfusion_flutter_maps/latest/maps/MapLayer/markerBuilder.html) callback will be called number of times equal to the value specified in the [`initialMarkersCount`](https://pub.dev/documentation/syncfusion_flutter_maps/latest/maps/MapLayer/initialMarkersCount.html) property. The default value of the [`initialMarkersCount`](https://pub.dev/documentation/syncfusion_flutter_maps/latest/maps/MapLayer/initialMarkersCount.html) property is `null`.
{% tabs %}
{% highlight Dart %}
List<Model> data;
MapShapeSource dataSource;
List<Model> _data;
MapShapeSource _dataSource;
@override
void initState() {
data = const <Model>[
_data = const <Model>[
Model('Brazil', -14.235004, -51.92528),
Model('Germany', 51.16569, 10.451526),
Model('Australia', -25.274398, 133.775136),
@ -35,11 +35,11 @@ void initState() {
Model('Russia', 61.52401, 105.318756)
];
dataSource = MapShapeSource.asset(
_dataSource = MapShapeSource.asset(
'assets/world_map.json',
shapeDataField: 'name',
dataCount: data.length,
primaryValueMapper: (index) => data[index].country,
dataCount: _data.length,
primaryValueMapper: (index) => _data[index].country,
);
super.initState();
}
@ -55,12 +55,12 @@ Widget build(BuildContext context) {
child: SfMaps(
layers: <MapLayer>[
MapShapeLayer(
source: dataSource,
source: _dataSource,
initialMarkersCount: 5,
markerBuilder: (BuildContext context, int index) {
return MapMarker(
latitude: data[index].latitude,
longitude: data[index].longitude,
latitude: _data[index].latitude,
longitude: _data[index].longitude,
);
},
),
@ -97,11 +97,11 @@ The [`markerBuilder`](https://pub.dev/documentation/syncfusion_flutter_maps/late
{% tabs %}
{% highlight Dart %}
List<Model> data;
List<Model> _data;
@override
void initState() {
data = const <Model>[
_data = const <Model>[
Model('Brazil', -14.235004, -51.92528),
Model('Germany', 51.16569, 10.451526),
Model('Australia', -25.274398, 133.775136),
@ -125,8 +125,8 @@ Widget build(BuildContext context) {
initialMarkersCount: 5,
markerBuilder: (BuildContext context, int index) {
return MapMarker(
latitude: data[index].latitude,
longitude: data[index].longitude,
latitude: _data[index].latitude,
longitude: _data[index].longitude,
iconColor: Colors.blue,
);
},
@ -168,12 +168,12 @@ N>
{% tabs %}
{% highlight Dart %}
List<Model> data;
MapShapeSource dataSource;
List<Model> _data;
MapShapeSource _dataSource;
@override
void initState() {
data = <Model>[
_data = <Model>[
Model(-14.235004, -51.92528),
Model(51.16569, 10.451526),
Model(-25.274398, 133.775136),
@ -181,7 +181,7 @@ void initState() {
Model(61.52401, 105.318756)
];
dataSource = MapShapeSource.asset(
_dataSource = MapShapeSource.asset(
'assets/world_map.json',
shapeDataField: 'name',
);
@ -199,12 +199,12 @@ Widget build(BuildContext context) {
child: SfMaps(
layers: <MapLayer>[
MapShapeLayer(
source: dataSource,
source: _dataSource,
initialMarkersCount: 5,
markerBuilder: (BuildContext context, int index){
return MapMarker(
latitude: data[index].latitude,
longitude: data[index].longitude,
latitude: _data[index].latitude,
longitude: _data[index].longitude,
iconType: MapIconType.triangle,
size: Size(18, 18),
iconColor: Colors.green[200],
@ -240,13 +240,13 @@ You can show custom marker using the `child` property of the [`MapMarker`](https
{% tabs %}
{% highlight Dart %}
List<Model> data;
List<Widget> iconsList;
MapShapeSource dataSource;
List<Model> _data;
List<Widget> _iconsList;
MapShapeSource _dataSource;
@override
void initState() {
data = <Model>[
_data = <Model>[
Model(-14.235004, -51.92528),
Model(51.16569, 10.451526),
Model(-25.274398, 133.775136),
@ -254,7 +254,7 @@ void initState() {
Model(61.52401, 105.318756)
];
iconsList = <Widget>[
_iconsList = <Widget>[
Icon(Icons.add_location),
Icon(Icons.airplanemode_active),
Icon(Icons.add_alarm),
@ -262,7 +262,7 @@ void initState() {
Icon(Icons.account_balance)
];
dataSource = MapShapeSource.asset(
_dataSource = MapShapeSource.asset(
'assets/world_map.json',
shapeDataField: 'name',
);
@ -280,13 +280,13 @@ Widget build(BuildContext context) {
child: SfMaps(
layers: <MapLayer>[
MapShapeLayer(
source: dataSource,
source: _dataSource,
initialMarkersCount: 5,
markerBuilder: (BuildContext context, int index){
return MapMarker(
latitude: data[index].latitude,
longitude: data[index].longitude,
child: iconsList[index],
latitude: _data[index].latitude,
longitude: _data[index].longitude,
child: _iconsList[index],
);
},
),
@ -313,23 +313,25 @@ class Model {
## Adding markers dynamically
You can add markers dynamically using the [`MapShapeLayerController.insertMarker`](https://pub.dev/documentation/syncfusion_flutter_maps/latest/maps/MapShapeLayerController/insertMarker.html) method. The [`markerBuilder`](https://pub.dev/documentation/syncfusion_flutter_maps/latest/maps/MapLayer/markerBuilder.html) will be called for the respective index once [`insertMarker`](https://pub.dev/documentation/syncfusion_flutter_maps/latest/maps/MapShapeLayerController/insertMarker.html) method is called. The [`controller`](https://pub.dev/documentation/syncfusion_flutter_maps/latest/maps/MapShapeLayer/controller.html) property of [`MapShapeLayer`](https://pub.dev/documentation/syncfusion_flutter_maps/latest/maps/MapShapeLayer-class.html) has to be set with the new instance of [`MapShapeLayerController`](https://pub.dev/documentation/syncfusion_flutter_maps/latest/maps/MapShapeLayerController-class.html).
You can add markers dynamically using the [`insertMarker`](https://pub.dev/documentation/syncfusion_flutter_maps/latest/maps/MapLayerController/insertMarker.html) method. The [`markerBuilder`](https://pub.dev/documentation/syncfusion_flutter_maps/latest/maps/MapLayer/markerBuilder.html) will be called for the respective index once [`insertMarker`](https://pub.dev/documentation/syncfusion_flutter_maps/latest/maps/MapLayerController/insertMarker.html) method is called. The [`controller`](https://pub.dev/documentation/syncfusion_flutter_maps/latest/maps/MapShapeLayer/controller.html) property of [`MapShapeLayer`](https://pub.dev/documentation/syncfusion_flutter_maps/latest/maps/MapShapeLayer-class.html) has to be set with the new instance of [`MapShapeLayerController`](https://pub.dev/documentation/syncfusion_flutter_maps/latest/maps/MapShapeLayerController-class.html).
Marker will be inserted at the given index if the index value is less than or equal to the current available index and the marker will be added as a last item if the index value is greater than the current available index.
N> You can get the current markers count from [`MapShapeLayerController.markersCount`](https://pub.dev/documentation/syncfusion_flutter_maps/latest/maps/MapShapeLayerController/markersCount.html).
### For shape layer
{% tabs %}
{% highlight Dart %}
List<Model> data;
MapShapeLayerController controller;
MapShapeSource dataSource;
List<Model> _data;
MapShapeLayerController _controller;
MapShapeSource _dataSource;
Random random = Random();
@override
void initState() {
data = <Model>[
_data = <Model>[
Model(-14.235004, -51.92528),
Model(51.16569, 10.451526),
Model(-25.274398, 133.775136),
@ -337,11 +339,11 @@ void initState() {
Model(61.52401, 105.318756)
];
dataSource = MapShapeSource.asset(
_dataSource = MapShapeSource.asset(
'assets/world_map.json',
shapeDataField: 'name',
);
controller = MapShapeLayerController();
_controller = MapShapeLayerController();
super.initState();
}
@ -358,26 +360,101 @@ Widget build(BuildContext context) {
SfMaps(
layers: <MapLayer>[
MapShapeLayer(
source: dataSource,
source: _dataSource,
initialMarkersCount: 5,
markerBuilder: (BuildContext context, int index){
return MapMarker(
latitude: data[index].latitude,
longitude: data[index].longitude,
latitude: _data[index].latitude,
longitude: _data[index].longitude,
child: Icon(Icons.add_location),
);
},
controller: controller,
controller: _controller,
),
],
),
RaisedButton(
child: Text('Add marker'),
onPressed: () {
data.add(Model(
_data.add(Model(
-180 + random.nextInt(360).toDouble(),
-55 + random.nextInt(139).toDouble()));
controller.insertMarker(5);
_controller.insertMarker(5);
},
),
],
),
),
)
),
);
}
class Model {
Model(this.latitude, this.longitude);
final double latitude;
final double longitude;
}
{% endhighlight %}
{% endtabs %}
### For Tile layer
{% tabs %}
{% highlight Dart %}
List<Model> _data;
MapTileLayerController _controller;
Random random = Random();
@override
void initState() {
_data = <Model>[
Model(-14.235004, -51.92528),
Model(51.16569, 10.451526),
Model(-25.274398, 133.775136),
Model(20.593684, 78.96288),
Model(61.52401, 105.318756)
];
_controller = MapTileLayerController();
super.initState();
}
@override
Widget build(BuildContext context) {
return Scaffold(
body: Center(
child: Container(
height: 350,
child: Padding(
padding: EdgeInsets.only(left: 15, right: 15),
child: Column(
children: [
SfMaps(
layers: <MapLayer>[
MapTileLayer(
urlTemplate: 'https://tile.openstreetmap.org/{z}/{x}/{y}.png',
initialMarkersCount: 5,
markerBuilder: (BuildContext context, int index){
return MapMarker(
latitude: _data[index].latitude,
longitude: _data[index].longitude,
child: Icon(Icons.add_location),
);
},
controller: _controller,
),
],
),
RaisedButton(
child: Text('Add marker'),
onPressed: () {
_data.add(Model(
-180 + random.nextInt(360).toDouble(),
-55 + random.nextInt(139).toDouble()));
_controller.insertMarker(5);
},
),
],
@ -402,21 +479,23 @@ class Model {
## Updating the existing markers
You can update multiple markers at a same time by passing indices to the [`updateMarkers`](https://pub.dev/documentation/syncfusion_flutter_maps/latest/maps/MapShapeLayerController/updateMarkers.html) method in the [`MapShapeLayerController`](https://pub.dev/documentation/syncfusion_flutter_maps/latest/maps/MapShapeLayerController-class.html). The [`markerBuilder`](https://pub.dev/documentation/syncfusion_flutter_maps/latest/maps/MapLayer/markerBuilder.html) will be called again for the respective indices once [`updateMarkers`](https://pub.dev/documentation/syncfusion_flutter_maps/latest/maps/MapShapeLayerController/updateMarkers.html) method is called.
You can update multiple markers at a same time by passing indices to the [`updateMarkers`](https://pub.dev/documentation/syncfusion_flutter_maps/latest/maps/MapLayerController/updateMarkers.html) method in the [`MapShapeLayerController`](https://pub.dev/documentation/syncfusion_flutter_maps/latest/maps/MapShapeLayerController-class.html). The [`markerBuilder`](https://pub.dev/documentation/syncfusion_flutter_maps/latest/maps/MapLayer/markerBuilder.html) will be called again for the respective indices once [`updateMarkers`](https://pub.dev/documentation/syncfusion_flutter_maps/latest/maps/MapLayerController/updateMarkers.html) method is called.
N> You can get the current markers count from [`MapShapeLayerController.markersCount`](https://pub.dev/documentation/syncfusion_flutter_maps/latest/maps/MapShapeLayerController/markersCount.html).
N>
* You can get the current markers count from [`MapShapeLayerController.markersCount`](https://pub.dev/documentation/syncfusion_flutter_maps/latest/maps/MapShapeLayerController/markersCount.html).
* You can refer this [`snippet`](https://help.syncfusion.com/flutter/maps/markers#for-tile-layer) to update the markers dynamically for tile layer.
{% tabs %}
{% highlight Dart %}
List<Model> data;
MapShapeLayerController controller;
Widget markerWidget;
MapShapeSource dataSource;
List<Model> _data;
MapShapeLayerController _controller;
Widget _markerWidget;
MapShapeSource _dataSource;
@override
void initState() {
data = <Model>[
_data = <Model>[
Model(-14.235004, -51.92528),
Model(51.16569, 10.451526),
Model(-25.274398, 133.775136),
@ -424,13 +503,13 @@ void initState() {
Model(61.52401, 105.318756)
];
dataSource = MapShapeSource.asset(
_dataSource = MapShapeSource.asset(
'assets/world_map.json',
shapeDataField: 'name',
);
controller = MapShapeLayerController();
markerWidget = Icon(Icons.add_location);
_controller = MapShapeLayerController();
_markerWidget = Icon(Icons.add_location);
super.initState();
}
@ -447,16 +526,16 @@ Widget build(BuildContext context) {
SfMaps(
layers: <MapLayer>[
MapShapeLayer(
source: dataSource,
source: _dataSource,
initialMarkersCount: 5,
markerBuilder: (BuildContext context, int index){
return MapMarker(
latitude: data[index].latitude,
longitude: data[index].longitude,
child: markerWidget,
latitude: _data[index].latitude,
longitude: _data[index].longitude,
child: _markerWidget,
);
},
controller: controller,
controller: _controller,
),
],
),
@ -464,8 +543,8 @@ Widget build(BuildContext context) {
child: Text('Update marker'),
onPressed: () {
List<int> updateList = <int>[1, 2];
markerWidget = Icon(Icons.airplanemode_active);
controller.updateMarkers(updateList);
_markerWidget = Icon(Icons.people);
_controller.updateMarkers(updateList);
},
),
],
@ -490,20 +569,22 @@ class Model {
## Deleting a marker
You can remove marker at any index using the [`removeMarkerAt`](https://pub.dev/documentation/syncfusion_flutter_maps/latest/maps/MapShapeLayerController/removeMarkerAt.html) method.
You can remove marker at any index using the [`removeMarkerAt`](https://pub.dev/documentation/syncfusion_flutter_maps/latest/maps/MapLayerController/removeMarkerAt.html) method.
N> You can get the current markers count from [`MapShapeLayerController.markersCount`](https://pub.dev/documentation/syncfusion_flutter_maps/latest/maps/MapShapeLayerController/markersCount.html).
N>
* You can get the current markers count from [`MapShapeLayerController.markersCount`](https://pub.dev/documentation/syncfusion_flutter_maps/latest/maps/MapShapeLayerController/markersCount.html).
* You can refer this [`snippet`](https://help.syncfusion.com/flutter/maps/markers#for-tile-layer) to update the markers dynamically for tile layer.
{% tabs %}
{% highlight Dart %}
List<Model> data;
MapShapeLayerController controller;
MapShapeSource dataSource;
List<Model> _data;
MapShapeLayerController _controller;
MapShapeSource _dataSource;
@override
void initState() {
data = <Model>[
_data = <Model>[
Model(-14.235004, -51.92528),
Model(51.16569, 10.451526),
Model(-25.274398, 133.775136),
@ -511,11 +592,11 @@ void initState() {
Model(61.52401, 105.318756)
];
dataSource = MapShapeSource.asset(
_dataSource = MapShapeSource.asset(
'assets/world_map.json',
shapeDataField: 'name',
);
controller = MapShapeLayerController();
_controller = MapShapeLayerController();
super.initState();
}
@ -532,23 +613,23 @@ Widget build(BuildContext context) {
SfMaps(
layers: <MapLayer>[
MapShapeLayer(
source: dataSource,
source: _dataSource,
initialMarkersCount: 5,
markerBuilder: (BuildContext context, int index){
return MapMarker(
latitude: data[index].latitude,
longitude: data[index].longitude,
latitude: _data[index].latitude,
longitude: _data[index].longitude,
child: Icon(Icons.add_location),
);
},
controller: controller,
controller: _controller,
),
],
),
RaisedButton(
child: Text('Remove marker'),
onPressed: () {
controller.removeMarkerAt(4);
_controller.removeMarkerAt(4);
},
),
],
@ -573,20 +654,22 @@ class Model {
## Clearing the markers
You can clear all markers using the [`clearMarkers`](https://pub.dev/documentation/syncfusion_flutter_maps/latest/maps/MapShapeLayerController/clearMarkers.html) method.
You can clear all markers using the [`clearMarkers`](https://pub.dev/documentation/syncfusion_flutter_maps/latest/maps/MapLayerController/clearMarkers.html) method.
N> You can get the current markers count from [`MapShapeLayerController.markersCount`](https://pub.dev/documentation/syncfusion_flutter_maps/latest/maps/MapShapeLayerController/markersCount.html).
N>
* You can get the current markers count from [`MapShapeLayerController.markersCount`](https://pub.dev/documentation/syncfusion_flutter_maps/latest/maps/MapShapeLayerController/markersCount.html).
* You can refer this [`snippet`](https://help.syncfusion.com/flutter/maps/markers#for-tile-layer) to update the markers dynamically for tile layer.
{% tabs %}
{% highlight Dart %}
List<Model> data;
MapShapeLayerController controller;
MapShapeSource dataSource;
List<Model> _data;
MapShapeLayerController _controller;
MapShapeSource _dataSource;
@override
void initState() {
data = <Model>[
_data = <Model>[
Model(-14.235004, -51.92528),
Model(51.16569, 10.451526),
Model(-25.274398, 133.775136),
@ -594,11 +677,11 @@ void initState() {
Model(61.52401, 105.318756)
];
dataSource = MapShapeSource.asset(
_dataSource = MapShapeSource.asset(
'assets/world_map.json',
shapeDataField: 'name',
);
controller = MapShapeLayerController();
_controller = MapShapeLayerController();
super.initState();
}
@ -615,23 +698,23 @@ Widget build(BuildContext context) {
SfMaps(
layers: <MapLayer>[
MapShapeLayer(
source: dataSource,
source: _dataSource,
initialMarkersCount: 5,
markerBuilder: (BuildContext context, int index){
return MapMarker(
latitude: data[index].latitude,
longitude: data[index].longitude,
latitude: _data[index].latitude,
longitude: _data[index].longitude,
child: Icon(Icons.add_location),
);
},
controller: controller,
controller: _controller,
),
],
),
RaisedButton(
child: Text('Clear marker'),
onPressed: () {
controller.clearMarkers();
_controller.clearMarkers();
},
),
],