Map attribution & map layers plugin

This commit is contained in:
Vicente J. Ruiz Jurado 2018-08-04 09:14:51 +02:00
parent 726cd6b65d
commit 845c38bf04
9 changed files with 168 additions and 16 deletions

View file

@ -0,0 +1,36 @@
import 'package:flutter/material.dart';
import 'package:flutter/src/widgets/framework.dart';
import 'package:flutter_map/plugin_api.dart';
class AttributionPluginOptions extends LayerOptions {
final String text;
AttributionPluginOptions({this.text = ""});
}
class AttributionPlugin implements MapPlugin {
@override
Widget createLayer(LayerOptions options, MapState mapState) {
if (options is AttributionPluginOptions) {
var style = new TextStyle(
// fontWeight: FontWeight.bold,
fontSize: 12.0,
color: Colors.white,
);
return Padding(
padding: const EdgeInsets.all(5.0),
child: new Text(
options.text,
style: style,
),
);
}
throw ("Unknown options type for Attribution"
"plugin: $options");
}
@override
bool supportsLayer(LayerOptions options) {
return options is AttributionPluginOptions;
}
}