defaultWidget static method

Widget defaultWidget({
  1. required String source,
  2. void onSourceTapped()?,
  3. TextStyle sourceTextStyle = const TextStyle(color: Color(0xFF0078a8)),
  4. Alignment alignment = Alignment.bottomRight,
})

Quick constructor for a more classic styled attibution box

Displayed as a padded translucent white box with the following text: 'flutter_map | © source'.

Provide onSourceTapped to carry out a function when the box is tapped. If that isn't null, the source text will have sourceTextStyle styling - which defaults to a link styling.

Implementation

static Widget defaultWidget({
  required String source,
  void Function()? onSourceTapped,
  TextStyle sourceTextStyle = const TextStyle(color: Color(0xFF0078a8)),
  Alignment alignment = Alignment.bottomRight,
}) =>
    Align(
      alignment: alignment,
      child: ColoredBox(
        color: const Color(0xCCFFFFFF),
        child: GestureDetector(
          onTap: onSourceTapped,
          child: Padding(
            padding: const EdgeInsets.all(3),
            child: Row(
              mainAxisSize: MainAxisSize.min,
              children: [
                const Text('flutter_map | © '),
                MouseRegion(
                  cursor: onSourceTapped == null
                      ? MouseCursor.defer
                      : SystemMouseCursors.click,
                  child: Text(
                    source,
                    style: onSourceTapped == null ? null : sourceTextStyle,
                  ),
                ),
              ],
            ),
          ),
        ),
      ),
    );