Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 27 additions & 1 deletion .github/actions/changelog/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -307,6 +329,10 @@ runs:
echo ""
cat changelog.txt
echo ""
if [ -f diffstats.txt ]; then
cat diffstats.txt
echo ""
fi
echo "---"
echo ""
echo "<sub>🤖 Auto-generated by changelog workflow</sub>"
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
2 changes: 1 addition & 1 deletion example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@ packages:
path: ".."
relative: true
source: path
version: "7.5.16"
version: "7.5.17"
leak_tracker:
dependency: transitive
description:
Expand Down
110 changes: 69 additions & 41 deletions lib/src/map/src/layers/tile.dart
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ class _ThemedTileLayerState extends State<ThemedTileLayer> {
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;
Expand Down Expand Up @@ -225,7 +224,6 @@ class _ThemedTileLayerState extends State<ThemedTileLayer> {
}

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';
Expand Down Expand Up @@ -266,46 +264,90 @@ class _ThemedTileLayerState extends State<ThemedTileLayer> {
}
: {};

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<void> _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(
Expand All @@ -320,7 +362,6 @@ class _ThemedTileLayerState extends State<ThemedTileLayer> {
),
),
] else if (layer.source == MapSource.here) ...[
_buildTile(urlTemplate: _hereUrl),
Align(
alignment: Alignment.bottomLeft,
child: Padding(
Expand All @@ -335,18 +376,6 @@ class _ThemedTileLayerState extends State<ThemedTileLayer> {
),
),
] else if (layer.source == .google) ...[
FutureBuilder<String?>(
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(
Expand All @@ -361,7 +390,6 @@ class _ThemedTileLayerState extends State<ThemedTileLayer> {
),
),
] else ...[
_buildTile(urlTemplate: _customUrl),
Align(
alignment: .bottomLeft,
child: Padding(
Expand Down
4 changes: 2 additions & 2 deletions pubspec.yaml
Original file line number Diff line number Diff line change
@@ -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

Expand Down Expand Up @@ -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
Expand Down