diff --git a/.github/actions/changelog/action.yaml b/.github/actions/changelog/action.yaml
index 9e97240..9ede200 100644
--- a/.github/actions/changelog/action.yaml
+++ b/.github/actions/changelog/action.yaml
@@ -238,7 +238,12 @@ runs:
ENTRY_SUFFIX="($COMMIT_LINK by $contributors)"
# Process subject line
- if [[ "$message" =~ $CONV_REGEX ]]; then
+ if [[ "$message" =~ ^BREAKING[\ -]CHANGE:[[:space:]]*.+ ]]; then
+ # Subject line is a breaking change declaration
+ BREAKING_DESC=$(echo "$message" | sed -E 's/^BREAKING[ -]CHANGE:[[:space:]]*//')
+ [ ! -f /tmp/breaking.txt ] && echo "### 🚨 Breaking Changes" > /tmp/breaking.txt
+ echo "- $BREAKING_DESC $ENTRY_SUFFIX" >> /tmp/breaking.txt
+ elif [[ "$message" =~ $CONV_REGEX ]]; then
categorize_line "$message" "$ENTRY_SUFFIX"
else
[ ! -f /tmp/changes.txt ] && echo "### 📝 Changes" > /tmp/changes.txt
@@ -288,6 +293,23 @@ runs:
echo "- No changes detected" > changelog.txt
fi
+ # Generate diff stats
+ DIFFSTAT=$(git diff --shortstat ${FROM_REF}..${TO_REF} 2>/dev/null || true)
+ if [ -n "$DIFFSTAT" ]; then
+ FILES_CHANGED=$(echo "$DIFFSTAT" | sed -E 's/^ *([0-9]+) files? changed.*/\1/')
+ INSERTIONS=$(echo "$DIFFSTAT" | grep -oE '[0-9]+ insertions?' | grep -oE '[0-9]+' || echo "0")
+ DELETIONS=$(echo "$DIFFSTAT" | grep -oE '[0-9]+ deletions?' | grep -oE '[0-9]+' || echo "0")
+
+ {
+ echo "### 📊 Diff Stats"
+ echo "| Metric | Count |"
+ echo "|--------|------:|"
+ echo "| 📄 Files changed | ${FILES_CHANGED} |"
+ echo "| 🟢 Insertions | \$\\color{green}\\textsf{+${INSERTIONS}}\$ |"
+ echo "| 🔴 Deletions | \$\\color{red}\\textsf{-${DELETIONS}}\$ |"
+ } > diffstats.txt
+ fi
+
- name: Format Changelog
if: ${{ steps.check-skip.outputs.skip != 'true' }}
id: format
@@ -307,6 +329,10 @@ runs:
echo ""
cat changelog.txt
echo ""
+ if [ -f diffstats.txt ]; then
+ cat diffstats.txt
+ echo ""
+ fi
echo "---"
echo ""
echo "🤖 Auto-generated by changelog workflow"
diff --git a/CHANGELOG.md b/CHANGELOG.md
index fb011d3..44c2168 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,9 @@
# Changelog
+## 7.5.17
+
+- Updated attributions on `ThemedTileLayer` for OpenStreetMaps.
+
## 7.5.16
- Native support for `TZDateTime` on Date and DateTime pickers.
diff --git a/example/pubspec.lock b/example/pubspec.lock
index 1295f70..8929f5a 100644
--- a/example/pubspec.lock
+++ b/example/pubspec.lock
@@ -390,7 +390,7 @@ packages:
path: ".."
relative: true
source: path
- version: "7.5.16"
+ version: "7.5.17"
leak_tracker:
dependency: transitive
description:
diff --git a/lib/src/map/src/layers/tile.dart b/lib/src/map/src/layers/tile.dart
index 0996d85..895b951 100644
--- a/lib/src/map/src/layers/tile.dart
+++ b/lib/src/map/src/layers/tile.dart
@@ -79,7 +79,6 @@ class _ThemedTileLayerState extends State {
bool get isDark => Theme.of(context).brightness == .dark;
String get _osmUrl => 'https://tile.openstreetmap.org/{z}/{x}/{y}.png';
- // String get _osmUrl => 'http://127.0.0.1:5000/{z}/{x}/{y}.png';
String get _mapboxUrl {
if (layer.source != .mapbox) return _osmUrl;
@@ -225,7 +224,6 @@ class _ThemedTileLayerState extends State {
}
String get _layrzAttributionLight => 'https://cdn.layrz.com/resources/layrz/logo/normal.png';
- // String get _layrzAttributionDark => 'https://cdn.layrz.com/resources/layrz/logo/white.png';
String get _mapboxAttributionLight => 'https://cdn.layrz.com/resources/map_attributions/mapbox_maps/normal.png';
String get _mapboxAttributionDark => 'https://cdn.layrz.com/resources/map_attributions/mapbox_maps/white.png';
@@ -266,46 +264,90 @@ class _ThemedTileLayerState extends State {
}
: {};
- TileLayer _buildTile({required String urlTemplate}) {
- return TileLayer(
- urlTemplate: urlTemplate,
- minZoom: widget.minZoom,
- maxZoom: widget.maxZoom,
- minNativeZoom: widget.minZoom.toInt(),
- maxNativeZoom: widget.maxZoom.toInt(),
- tileProvider: NetworkTileProvider(
- headers: headers,
-
- /// Setting for the previous CancellableNetworkTileProvider
- abortObsoleteRequests: widget.isCancellable,
- ),
-
- keepBuffer: buffer,
- panBuffer: buffer,
- );
+ String _googleUrl = '';
+ String get _urlTemplate {
+ switch (layer.source) {
+ case .osm:
+ return _osmUrl;
+ case .mapbox:
+ return _mapboxUrl;
+ case .here:
+ return _hereUrl;
+ case .google:
+ return _googleUrl;
+ case .custom:
+ return _customUrl;
+ }
+ }
+
+ @override
+ void initState() {
+ super.initState();
+ if (layer.source == MapSource.google) _initializeGoogleMaps();
+ }
+
+ @override
+ void didUpdateWidget(covariant ThemedTileLayer oldWidget) {
+ super.didUpdateWidget(oldWidget);
+
+ if (oldWidget.layer?.id != widget.layer?.id && layer.source == MapSource.google) {
+ _initializeGoogleMaps();
+ }
+ }
+
+ Future _initializeGoogleMaps() async {
+ setState(() => _googleUrl = '');
+ String? url = await _fetchGoogleAuth(layer: layer);
+ if (url != null) setState(() => _googleUrl = url);
}
@override
Widget build(BuildContext context) {
return Stack(
children: [
+ if (_urlTemplate.isNotEmpty) ...[
+ TileLayer(
+ urlTemplate: _urlTemplate,
+ minZoom: widget.minZoom,
+ maxZoom: widget.maxZoom,
+ minNativeZoom: widget.minZoom.toInt(),
+ maxNativeZoom: widget.maxZoom.toInt(),
+ tileProvider: NetworkTileProvider(
+ headers: headers,
+
+ /// Setting for the previous CancellableNetworkTileProvider
+ abortObsoleteRequests: widget.isCancellable,
+ ),
+
+ keepBuffer: buffer,
+ panBuffer: buffer,
+ ),
+ ],
if (layer.source == .osm) ...[
- _buildTile(urlTemplate: _osmUrl),
Align(
alignment: .bottomLeft,
child: Padding(
padding: const .all(10),
- child: Image.network(
- _layrzAttributionLight,
- width: 80,
- height: 20,
- filterQuality: .medium,
- alignment: .centerLeft,
+ child: Container(
+ decoration: generateContainerElevation(context: context, elevation: 0),
+ padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 2.5),
+ child: RichText(
+ text: TextSpan(
+ style: Theme.of(context).textTheme.bodySmall,
+ children: [
+ TextSpan(text: "Map data from"),
+ TextSpan(
+ text: " OpenStreetMap ",
+ style: Theme.of(context).textTheme.bodySmall?.copyWith(fontWeight: .bold),
+ ),
+ TextSpan(text: "and their contributors"),
+ ],
+ ),
+ ),
),
),
),
] else if (layer.source == .mapbox) ...[
- _buildTile(urlTemplate: _mapboxUrl),
Align(
alignment: .bottomLeft,
child: Padding(
@@ -320,7 +362,6 @@ class _ThemedTileLayerState extends State {
),
),
] else if (layer.source == MapSource.here) ...[
- _buildTile(urlTemplate: _hereUrl),
Align(
alignment: Alignment.bottomLeft,
child: Padding(
@@ -335,18 +376,6 @@ class _ThemedTileLayerState extends State {
),
),
] else if (layer.source == .google) ...[
- FutureBuilder(
- future: _fetchGoogleAuth(layer: layer),
- builder: (context, snapshot) {
- if (snapshot.hasData) {
- if (snapshot.data != null) {
- return _buildTile(urlTemplate: snapshot.data!);
- }
- }
-
- return const SizedBox.expand();
- },
- ),
Align(
alignment: .bottomLeft,
child: Padding(
@@ -361,7 +390,6 @@ class _ThemedTileLayerState extends State {
),
),
] else ...[
- _buildTile(urlTemplate: _customUrl),
Align(
alignment: .bottomLeft,
child: Padding(
diff --git a/pubspec.yaml b/pubspec.yaml
index 26112eb..9578a57 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -1,6 +1,6 @@
name: layrz_theme
description: Layrz standard styling library for Flutter. Widget library following the Material Design 3 guidelines, with a focus on reliavility and functionality.
-version: "7.5.16"
+version: "7.5.17"
homepage: https://theme.layrz.com
repository: https://github.com/goldenm-software/layrz_theme
@@ -40,7 +40,7 @@ dependencies:
two_dimensional_scrollables: ^0.3.4
sync_scroll_controller: ^1.0.1
web: ^1.1.0
- flutter_map: ^8.2.1
+ flutter_map: ^8.2.2
flutter_highlight: ^0.7.0
highlight: ^0.7.0
code_text_field: ^1.1.0