Skip to content

Commit 21caaa8

Browse files
committed
fix: export extra classes for play o hood
1 parent 69b63d9 commit 21caaa8

17 files changed

Lines changed: 215 additions & 80 deletions

File tree

.fvmrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
"flutter": "3.27.4"
2+
"flutter": "3.38.9"
33
}

.github/workflows/melos-ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,5 @@ jobs:
1111
secrets: inherit
1212
permissions: write-all
1313
with:
14-
subfolder: '.' # add optional subfolder to run workflow in
15-
flutter_version: 3.27.4
14+
subfolder: "." # add optional subfolder to run workflow in
15+
flutter_version: 3.38.9

.github/workflows/release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ name: Iconica Standard Component Release Workflow
44
on:
55
release:
66
types: [published]
7-
7+
88
workflow_dispatch:
99

1010
jobs:
1111
call-global-iconica-workflow:
1212
uses: Iconica-Development/.github/.github/workflows/component-release.yml@master
1313
secrets: inherit
14-
permissions: write-all
14+
permissions: write-all

README.md

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,16 +27,10 @@ So before setting it to false you need to provide a google maps API key in the A
2727
```dart
2828
LocationMapOptions(
2929
enableOpenMapsTileLayer: true,
30-
tileProvider: CancellableNetworkTileProvider(),
30+
tileProvider: NetworkTileProvider(),
3131
)
3232
```
3333

34-
When using the openmaps tilelayer from the flutter_maps package it is recommended to use the [CancellableNetworkTileProvider](https://pub.dev/packages/flutter_map_cancellable_tile_provider) especially on Web where performance is drastically improved. Because flutter_locations shouldn't depend on flutter_map_cancellable_tile_provider it is not included in the dependencies. You can add it to your pubspec.yaml file like this:
35-
36-
```yaml
37-
dependencies:
38-
flutter_map_cancellable_tile_provider: ^latest_version
39-
```
4034

4135
For the features of this userstory permissions are required for each platform.
4236

apps/example/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,11 @@
55
*.swp
66
.DS_Store
77
.atom/
8+
.build/
89
.buildlog/
910
.history
1011
.svn/
12+
.swiftpm/
1113
migrate_working_dir/
1214

1315
# IntelliJ related

apps/example/lib/main.dart

Lines changed: 20 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,13 @@
11
import "package:device_preview/device_preview.dart";
22
import "package:flutter/material.dart";
33
import "package:flutter_locations/flutter_locations.dart";
4-
import "package:flutter_map_cancellable_tile_provider/flutter_map_cancellable_tile_provider.dart";
54

65
void main() {
76
runApp(
87
DevicePreview(
98
enabled: true,
109
isToolbarVisible: true,
11-
availableLocales: const [
12-
Locale("en_US"),
13-
Locale("nl_NL"),
14-
],
10+
availableLocales: const [Locale("en_US"), Locale("nl_NL")],
1511
builder: (_) => const App(),
1612
),
1713
);
@@ -22,28 +18,25 @@ class App extends StatelessWidget {
2218

2319
@override
2420
Widget build(BuildContext context) => MaterialApp(
25-
builder: DevicePreview.appBuilder,
26-
locale: DevicePreview.locale(context),
27-
supportedLocales: const [
28-
Locale("en", "US"),
29-
Locale("nl", "NL"),
30-
],
31-
theme: ThemeData.light(),
32-
darkTheme: ThemeData.dark(),
33-
home: LocationsUserStory(
34-
options: LocationsOptions(
35-
respositoryInterface: LocationsLocalRepository(density: 7),
36-
mapOptions: LocationsMapOptions(
37-
zoom: 7,
38-
initialLocation: const Location(
39-
latitude: 52.2056435,
40-
longitude: 5.2,
41-
),
42-
// Openmaps works without an API key
43-
enableOpenMapsTileLayer: true,
44-
tileProvider: CancellableNetworkTileProvider(),
45-
),
21+
builder: DevicePreview.appBuilder,
22+
locale: DevicePreview.locale(context),
23+
supportedLocales: const [Locale("en", "US"), Locale("nl", "NL")],
24+
theme: ThemeData.light(),
25+
darkTheme: ThemeData.dark(),
26+
home: LocationsUserStory(
27+
options: LocationsOptions(
28+
respositoryInterface: LocationsLocalRepository(density: 7),
29+
mapOptions: LocationsMapOptions(
30+
zoom: 7,
31+
initialLocation: const Location(latitude: 52.2056435, longitude: 5.2),
32+
// Open street maps works without an API key
33+
enableOpenMapsTileLayer: true,
34+
tileProvider: NetworkTileProvider(
35+
// Open street maps requires a useragent
36+
headers: {"User-Agent": "TempApp / 0.5"},
4637
),
4738
),
48-
);
39+
),
40+
),
41+
);
4942
}

apps/example/pubspec.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ description: "Flutter Locations userstory example app"
33

44
version: 1.0.0+1
55
environment:
6-
sdk: ">=3.4.3 <4.0.0"
6+
sdk: ">=3.8.0 <4.0.0"
77

88
dependencies:
99
device_preview: ^1.2.0
@@ -12,7 +12,6 @@ dependencies:
1212
flutter_locations:
1313
hosted: https://forgejo.internal.iconica.nl/api/packages/internal/pub
1414
version: ^1.0.0
15-
flutter_map_cancellable_tile_provider: ^3.0.2
1615

1716
dev_dependencies:
1817
flutter_test:

packages/flutter_locations/lib/flutter_locations.dart

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,13 @@
22
library flutter_locations;
33

44
export "package:dart_locations_repository_interface/dart_locations_repository_interface.dart";
5+
export "package:flutter_map/flutter_map.dart";
56

67
export "src/config/locations_options.dart";
78
export "src/config/locations_translations.dart";
89
export "src/config/map/controls_options.dart";
910
export "src/config/map/map_options.dart";
11+
export "src/ui/widgets/home.dart";
12+
export "src/ui/widgets/map/map.dart";
1013
export "src/userstories.dart";
14+
export "src/util/scope.dart";

packages/flutter_locations/lib/src/config/locations_options.dart

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// ignore_for_file: public_member_api_docs, sort_constructors_first
12
import "package:flutter/material.dart";
23
import "package:flutter_locations/flutter_locations.dart";
34
import "package:flutter_locations/src/config/list/list_options.dart";
@@ -29,6 +30,24 @@ class LocationsOptions {
2930

3031
/// The list options.
3132
final LocationsListOptions listOptions;
33+
34+
LocationsOptions copy(LocationsOptions Function(LocationsOptions old) copy) =>
35+
copy(this);
36+
37+
LocationsOptions copyWith({
38+
LocationsRepositoryInterface? respositoryInterface,
39+
LocationsTranslations? translations,
40+
LocationsBaseScreenBuilder? builder,
41+
LocationsMapOptions? mapOptions,
42+
LocationsListOptions? listOptions,
43+
}) =>
44+
LocationsOptions(
45+
respositoryInterface: respositoryInterface ?? this.respositoryInterface,
46+
translations: translations ?? this.translations,
47+
builder: builder ?? this.builder,
48+
mapOptions: mapOptions ?? this.mapOptions,
49+
listOptions: listOptions ?? this.listOptions,
50+
);
3251
}
3352

3453
///

packages/flutter_locations/lib/src/config/map/map_options.dart

Lines changed: 50 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// ignore_for_file: public_member_api_docs, sort_constructors_first
12
import "package:dart_locations_repository_interface/dart_locations_repository_interface.dart";
23
import "package:flutter/material.dart";
34
import "package:flutter_locations/src/config/map/controls_options.dart";
@@ -9,6 +10,7 @@ import "package:flutter_map/flutter_map.dart";
910
class LocationsMapOptions {
1011
/// [LocationsMapOptions] constructor
1112
const LocationsMapOptions({
13+
this.controller,
1214
this.zoom,
1315
this.maxZoom = 18.0,
1416
this.minZoom = 3.0,
@@ -17,13 +19,15 @@ class LocationsMapOptions {
1719
this.onMapReady,
1820
this.searchBuilder = DefaultLocationsMapSearch.builder,
1921
this.markerBuilder = DefaultLocationsMapMarker.builder,
22+
this.markerClusterBuilder = DefaultLocationsMapMarkerCluster.builder,
2023
this.controlsOptions = const LocationsMapControlsOptions.empty(),
2124
this.enableOpenMapsTileLayer = false,
2225
this.tileProvider,
2326
});
2427

2528
///
2629
const LocationsMapOptions.empty({
30+
this.controller,
2731
this.additionalLayers = const [],
2832
this.initialLocation = const Location(latitude: 0, longitude: 0),
2933
this.zoom,
@@ -32,11 +36,15 @@ class LocationsMapOptions {
3236
this.onMapReady,
3337
this.searchBuilder = DefaultLocationsMapSearch.builder,
3438
this.markerBuilder = DefaultLocationsMapMarker.builder,
39+
this.markerClusterBuilder = DefaultLocationsMapMarkerCluster.builder,
3540
this.controlsOptions = const LocationsMapControlsOptions.empty(),
3641
this.enableOpenMapsTileLayer = false,
3742
this.tileProvider,
3843
});
3944

45+
///
46+
final MapController? controller;
47+
4048
/// The layers containing everything other than the actual tilelayer.
4149
final List<Widget> additionalLayers;
4250

@@ -67,6 +75,9 @@ class LocationsMapOptions {
6775
///
6876
final LocationMapMarkerBuilder markerBuilder;
6977

78+
///
79+
final LocationMapMarkerClusterBuilder markerClusterBuilder;
80+
7081
///
7182
final LocationsMapControlsOptions controlsOptions;
7283

@@ -75,9 +86,41 @@ class LocationsMapOptions {
7586
final bool enableOpenMapsTileLayer;
7687

7788
/// [TileProvider] used of the openmaps tile layer. This can be used to add
78-
/// CancellableNetworkTileProvider or other tile providers to improve
89+
/// NetworkTileProvider or other tile providers to improve
7990
/// performance without creating a dependency in flutter_locations.
8091
final TileProvider? tileProvider;
92+
93+
LocationsMapOptions copyWith({
94+
MapController? controller,
95+
List<Widget>? additionalLayers,
96+
Location? initialLocation,
97+
VoidCallback? onMapReady,
98+
double? zoom,
99+
double? maxZoom,
100+
double? minZoom,
101+
LocationMapSearchBuilder? searchBuilder,
102+
LocationMapMarkerBuilder? markerBuilder,
103+
LocationMapMarkerClusterBuilder? markerClusterBuilder,
104+
LocationsMapControlsOptions? controlsOptions,
105+
bool? enableOpenMapsTileLayer,
106+
TileProvider? tileProvider,
107+
}) =>
108+
LocationsMapOptions(
109+
controller: controller ?? this.controller,
110+
additionalLayers: additionalLayers ?? this.additionalLayers,
111+
initialLocation: initialLocation ?? this.initialLocation,
112+
onMapReady: onMapReady ?? this.onMapReady,
113+
zoom: zoom ?? this.zoom,
114+
maxZoom: maxZoom ?? this.maxZoom,
115+
minZoom: minZoom ?? this.minZoom,
116+
searchBuilder: searchBuilder ?? this.searchBuilder,
117+
markerBuilder: markerBuilder ?? this.markerBuilder,
118+
markerClusterBuilder: markerClusterBuilder ?? this.markerClusterBuilder,
119+
controlsOptions: controlsOptions ?? this.controlsOptions,
120+
enableOpenMapsTileLayer:
121+
enableOpenMapsTileLayer ?? this.enableOpenMapsTileLayer,
122+
tileProvider: tileProvider ?? this.tileProvider,
123+
);
81124
}
82125

83126
///
@@ -92,3 +135,9 @@ typedef LocationMapMarkerBuilder = Widget Function(
92135
BuildContext context,
93136
LocationItem locationItem,
94137
);
138+
139+
///
140+
typedef LocationMapMarkerClusterBuilder = Widget Function(
141+
BuildContext,
142+
List<Marker> markers,
143+
);

0 commit comments

Comments
 (0)