Skip to content

Commit 7d1372f

Browse files
authored
fix: raise attribution widgets above screen insets (#2058)
1 parent eb92ff2 commit 7d1372f

File tree

2 files changed

+77
-83
lines changed

2 files changed

+77
-83
lines changed

lib/src/layer/attribution_layer/rich/widget.dart

Lines changed: 56 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -215,79 +215,71 @@ class _RichAttributionWidgetState extends State<RichAttributionWidget> {
215215
),
216216
];
217217

218-
return Align(
219-
alignment: widget.alignment.real,
220-
child: Stack(
218+
return SafeArea(
219+
child: Align(
221220
alignment: widget.alignment.real,
222-
children: [
223-
Padding(
224-
padding: const EdgeInsets.all(6),
225-
child: widget.animationConfig.popupAnimationBuilder(
226-
context: context,
227-
isExpanded: popupExpanded,
228-
config: widget,
229-
child: DecoratedBox(
230-
decoration: BoxDecoration(
231-
color: widget.popupBackgroundColor ??
232-
Theme.of(context).colorScheme.surface,
233-
border: Border.all(width: 0, style: BorderStyle.none),
234-
borderRadius: widget.popupBorderRadius ??
235-
BorderRadius.only(
236-
topLeft: const Radius.circular(10),
237-
topRight: const Radius.circular(10),
238-
bottomLeft:
239-
widget.alignment == AttributionAlignment.bottomLeft
240-
? Radius.zero
241-
: const Radius.circular(10),
242-
bottomRight:
243-
widget.alignment == AttributionAlignment.bottomRight
244-
? Radius.zero
245-
: const Radius.circular(10),
246-
),
247-
),
248-
child: Padding(
249-
padding: const EdgeInsets.all(8),
250-
child: Column(
251-
mainAxisSize: MainAxisSize.min,
252-
crossAxisAlignment: CrossAxisAlignment.start,
253-
children: [
254-
...widget.attributions.whereType<TextSourceAttribution>(),
255-
if (widget.showFlutterMapAttribution)
256-
const TextSourceAttribution(
257-
"Made with 'flutter_map'",
258-
prependCopyright: false,
259-
textStyle: TextStyle(fontStyle: FontStyle.italic),
260-
),
261-
SizedBox(height: (widget.permanentHeight - 24) + 32),
262-
],
221+
child: Stack(
222+
alignment: widget.alignment.real,
223+
children: [
224+
Padding(
225+
padding: const EdgeInsets.all(6),
226+
child: widget.animationConfig.popupAnimationBuilder(
227+
context: context,
228+
isExpanded: popupExpanded,
229+
config: widget,
230+
child: DecoratedBox(
231+
decoration: BoxDecoration(
232+
color: widget.popupBackgroundColor ??
233+
Theme.of(context).colorScheme.surface,
234+
border: Border.all(width: 0, style: BorderStyle.none),
235+
borderRadius:
236+
widget.popupBorderRadius ?? BorderRadius.circular(10),
237+
),
238+
child: Padding(
239+
padding: const EdgeInsets.all(8),
240+
child: Column(
241+
mainAxisSize: MainAxisSize.min,
242+
crossAxisAlignment: CrossAxisAlignment.start,
243+
children: [
244+
...widget.attributions
245+
.whereType<TextSourceAttribution>(),
246+
if (widget.showFlutterMapAttribution)
247+
const TextSourceAttribution(
248+
"Made with 'flutter_map'",
249+
prependCopyright: false,
250+
textStyle: TextStyle(fontStyle: FontStyle.italic),
251+
),
252+
SizedBox(height: (widget.permanentHeight - 24) + 32),
253+
],
254+
),
263255
),
264256
),
265257
),
266258
),
267-
),
268-
MouseRegion(
269-
onEnter: (_) => setState(() => persistentHovered = true),
270-
onExit: (_) => setState(() => persistentHovered = false),
271-
cursor: SystemMouseCursors.click,
272-
child: AnimatedOpacity(
273-
opacity: persistentHovered || popupExpanded ? 1 : 0.5,
274-
curve: widget.animationConfig.buttonCurve,
275-
duration: widget.animationConfig.buttonDuration,
276-
child: Padding(
277-
padding: const EdgeInsets.all(4),
278-
child: FittedBox(
279-
child: Row(
280-
mainAxisSize: MainAxisSize.min,
281-
children:
282-
widget.alignment == AttributionAlignment.bottomLeft
283-
? persistentAttributionItems.reversed.toList()
284-
: persistentAttributionItems,
259+
MouseRegion(
260+
onEnter: (_) => setState(() => persistentHovered = true),
261+
onExit: (_) => setState(() => persistentHovered = false),
262+
cursor: SystemMouseCursors.click,
263+
child: AnimatedOpacity(
264+
opacity: persistentHovered || popupExpanded ? 1 : 0.5,
265+
curve: widget.animationConfig.buttonCurve,
266+
duration: widget.animationConfig.buttonDuration,
267+
child: Padding(
268+
padding: const EdgeInsets.all(4),
269+
child: FittedBox(
270+
child: Row(
271+
mainAxisSize: MainAxisSize.min,
272+
children:
273+
widget.alignment == AttributionAlignment.bottomLeft
274+
? persistentAttributionItems.reversed.toList()
275+
: persistentAttributionItems,
276+
),
285277
),
286278
),
287279
),
288280
),
289-
),
290-
],
281+
],
282+
),
291283
),
292284
);
293285
}

lib/src/layer/attribution_layer/simple.dart

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -38,25 +38,27 @@ class SimpleAttributionWidget extends StatelessWidget {
3838
});
3939

4040
@override
41-
Widget build(BuildContext context) => Align(
42-
alignment: alignment,
43-
child: ColoredBox(
44-
color: backgroundColor ?? Theme.of(context).colorScheme.surface,
45-
child: GestureDetector(
46-
onTap: onTap,
47-
child: Padding(
48-
padding: const EdgeInsets.all(3),
49-
child: Row(
50-
mainAxisSize: MainAxisSize.min,
51-
children: [
52-
const Text('flutter_map | © '),
53-
MouseRegion(
54-
cursor: onTap == null
55-
? MouseCursor.defer
56-
: SystemMouseCursors.click,
57-
child: source,
58-
),
59-
],
41+
Widget build(BuildContext context) => SafeArea(
42+
child: Align(
43+
alignment: alignment,
44+
child: ColoredBox(
45+
color: backgroundColor ?? Theme.of(context).colorScheme.surface,
46+
child: GestureDetector(
47+
onTap: onTap,
48+
child: Padding(
49+
padding: const EdgeInsets.all(3),
50+
child: Row(
51+
mainAxisSize: MainAxisSize.min,
52+
children: [
53+
const Text('flutter_map | © '),
54+
MouseRegion(
55+
cursor: onTap == null
56+
? MouseCursor.defer
57+
: SystemMouseCursors.click,
58+
child: source,
59+
),
60+
],
61+
),
6062
),
6163
),
6264
),

0 commit comments

Comments
 (0)