RichAttributionWidget constructor

const RichAttributionWidget({
  1. Key? key,
  2. required List<SourceAttribution> attributions,
  3. AttributionAlignment alignment = AttributionAlignment.bottomRight,
  4. Widget openButton(
    1. BuildContext context,
    2. VoidCallback open
    )?,
  5. Widget closeButton(
    1. BuildContext context,
    2. VoidCallback close
    )?,
  6. Color? popupBackgroundColor,
  7. BorderRadius? popupBorderRadius,
  8. double permanentHeight = 24,
  9. bool showFlutterMapAttribution = true,
  10. RichAttributionWidgetAnimation animationConfig = const FadeRAWA(),
  11. Duration popupInitialDisplayDuration = Duration.zero,
})

A prebuilt dynamic attribution layer that supports both logos and text through SourceAttributions

TextSourceAttributions are shown in a popup box that can be visible or invisible. Its state is toggled by a tri-state openButton/closeButton :

  1. Not hovered, not opened: faded button, invisible box
  2. Hovered, not opened: full opacity button, invisible box
  3. Opened: full opacity button, visible box

The hover state on mobile devices is unspecified, but the behaviour is usually inconsequential on mobile devices anyway, due to the fingertip covering the entire button.

LogoSourceAttributions are shown adjacent to the open/close button, to comply with some stricter tile server requirements (such as Mapbox). These are usually supplemented with a TextSourceAttribution.

The popup box also closes automatically on any interaction with the map.

Animations are built in by default, and configured/handled through RichAttributionWidgetAnimation - see that class and the animationConfig property for more information. By default, a simple fade/opacity animation is provided by FadeRAWA. ScaleRAWA is also available.

Read the documentation on the individual properties for more information and customizability.

Implementation

const RichAttributionWidget({
  super.key,
  required this.attributions,
  this.alignment = AttributionAlignment.bottomRight,
  this.openButton,
  this.closeButton,
  this.popupBackgroundColor,
  this.popupBorderRadius,
  this.permanentHeight = 24,
  this.showFlutterMapAttribution = true,
  this.animationConfig = const FadeRAWA(),
  this.popupInitialDisplayDuration = Duration.zero,
});