buildLayer method

  1. @override
Widget buildLayer(
  1. BuildContext context,
  2. MapState map
)
override

override this function for every map layers

Implementation

@override
Widget buildLayer(BuildContext context, MapState map) {
  final double viewTop = MediaQuery.of(context).viewPadding.top;
  final EdgeInsets margin = this.margin ??
      EdgeInsets.only(
        top: viewTop + 15,
        right: 20,
      );

  return Positioned.fill(
    child: Align(
      alignment: alignment,
      child: Container(
        width: 40,
        height: 40,
        margin: margin,
        child: FittedBox(
          child: FloatingActionButton(
            heroTag: null,
            onPressed: () => map.controller.rotate(0.0, animate: true),
            backgroundColor: Colors.white,
            child: Transform.rotate(
              angle: map.angle,
              child: icon ??
                  SvgPicture.asset('packages/universe/assets/compass.svg'),
            ),
          ),
        ),
      ),
    ),
  );
}