Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore!: remove all leftover deprecated symbols #1730

Merged
merged 6 commits into from
Nov 22, 2023
Merged
Show file tree
Hide file tree
Changes from 3 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
156 changes: 81 additions & 75 deletions example/lib/pages/home.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,80 +19,7 @@ class _HomePageState extends State<HomePage> {
@override
void initState() {
super.initState();

const seenIntroBoxKey = 'seenIntroBox(a)';
if (kIsWeb && Uri.base.host.trim() == 'demo.fleaflet.dev') {
SchedulerBinding.instance.addPostFrameCallback(
(_) async {
final prefs = await SharedPreferences.getInstance();
if (prefs.getBool(seenIntroBoxKey) ?? false) return;

if (!mounted) return;

final width = MediaQuery.of(context).size.width;
await showDialog<void>(
context: context,
builder: (context) => AlertDialog(
icon: UnconstrainedBox(
child: SizedBox.square(
dimension: 64,
child:
Image.asset('assets/ProjectIcon.png', fit: BoxFit.fill),
),
),
title: const Text('flutter_map Live Web Demo'),
content: ConstrainedBox(
constraints: BoxConstraints(
maxWidth: width < 750
? double.infinity
: (width / (width < 1100 ? 1.5 : 2.5)),
),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
const Text(
"This is built automatically off of the latest commits to 'master', so may not reflect the latest release available on pub.dev.\nThis is hosted on Firebase Hosting, meaning there's limited bandwidth to share between all users, so please keep loads to a minimum.",
textAlign: TextAlign.center,
),
Padding(
padding:
const EdgeInsets.only(right: 8, top: 16, bottom: 4),
child: Align(
alignment: Alignment.centerRight,
child: Text(
"This won't be shown again",
style: TextStyle(
color: Theme.of(context)
.colorScheme
.inverseSurface
.withOpacity(0.5),
),
textAlign: TextAlign.right,
),
),
),
],
),
),
actions: [
TextButton.icon(
onPressed: () => Navigator.of(context).pop(),
label: const Text('OK'),
icon: const Icon(Icons.done),
),
],
contentPadding: const EdgeInsets.only(
left: 24,
top: 16,
bottom: 0,
right: 24,
),
),
);
await prefs.setBool(seenIntroBoxKey, true);
},
);
}
_displayWebDemoIntroDialog();
JaffaKetchup marked this conversation as resolved.
Show resolved Hide resolved
}

@override
Expand Down Expand Up @@ -120,7 +47,6 @@ class _HomePageState extends State<HomePage> {
RichAttributionWidget(
popupInitialDisplayDuration: const Duration(seconds: 5),
animationConfig: const ScaleRAWA(),
showFlutterMapAttribution: false,
attributions: [
TextSourceAttribution(
'OpenStreetMap contributors',
Expand Down Expand Up @@ -167,4 +93,84 @@ class _HomePageState extends State<HomePage> {
),
);
}

// Displays an introduction dialog when the Live Web Demo is first loaded for
// a user
void _displayWebDemoIntroDialog() {
// Changing this will cause the dialog to show again for all users
const seenIntroDialogKey = 'seenIntroDialog';

if (kIsWeb && Uri.base.host.trim() == 'demo.fleaflet.dev') {
SchedulerBinding.instance.addPostFrameCallback(
(_) async {
final prefs = await SharedPreferences.getInstance();
if (prefs.getBool(seenIntroDialogKey) ?? false) return;

if (!mounted) return;

final width = MediaQuery.of(context).size.width;
await showDialog<void>(
context: context,
builder: (context) => AlertDialog(
icon: UnconstrainedBox(
child: SizedBox.square(
dimension: 64,
child:
Image.asset('assets/ProjectIcon.png', fit: BoxFit.fill),
),
),
title: const Text('flutter_map Live Web Demo'),
content: ConstrainedBox(
constraints: BoxConstraints(
maxWidth: width < 750
? double.infinity
: (width / (width < 1100 ? 1.5 : 2.5)),
),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
const Text(
"This is built automatically off of the latest commits to 'master', so may not reflect the latest release available on pub.dev.\nThis is hosted on Firebase Hosting, meaning there's limited bandwidth to share between all users, so please keep loads to a minimum.",
textAlign: TextAlign.center,
),
Padding(
padding:
const EdgeInsets.only(right: 8, top: 16, bottom: 4),
child: Align(
alignment: Alignment.centerRight,
child: Text(
"This won't be shown again",
style: TextStyle(
color: Theme.of(context)
.colorScheme
.inverseSurface
.withOpacity(0.5),
),
textAlign: TextAlign.right,
),
),
),
],
),
),
actions: [
TextButton.icon(
onPressed: () => Navigator.of(context).pop(),
label: const Text('OK'),
icon: const Icon(Icons.done),
),
],
contentPadding: const EdgeInsets.only(
left: 24,
top: 16,
bottom: 0,
right: 24,
),
),
);
await prefs.setBool(seenIntroDialogKey, true);
},
);
}
}
}
1 change: 0 additions & 1 deletion lib/flutter_map.dart
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ export 'package:flutter_map/src/map/options/options.dart';
export 'package:flutter_map/src/map/widget.dart';
export 'package:flutter_map/src/misc/bounds.dart';
export 'package:flutter_map/src/misc/center_zoom.dart';
export 'package:flutter_map/src/misc/fit_bounds_options.dart';
export 'package:flutter_map/src/misc/move_and_rotate_result.dart';
export 'package:flutter_map/src/misc/point_extensions.dart';
export 'package:flutter_map/src/misc/position.dart';
Expand Down
4 changes: 1 addition & 3 deletions lib/src/gestures/flutter_map_interactive_viewer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -388,9 +388,7 @@ class FlutterMapInteractiveViewerState
void _onPointerSignal(PointerSignalEvent pointerSignal) {
// Handle mouse scroll events if the enableScrollWheel parameter is enabled
if (pointerSignal is PointerScrollEvent &&
(InteractiveFlag.hasScrollWheelZoom(_interactionOptions.flags) ||
// ignore: deprecated_member_use_from_same_package
_interactionOptions.enableScrollWheel) &&
InteractiveFlag.hasScrollWheelZoom(_interactionOptions.flags) &&
pointerSignal.scrollDelta.dy != 0) {
// Prevent scrolling of parent/child widgets simultaneously. See
// [PointerSignalResolver] documentation for more information.
Expand Down
10 changes: 0 additions & 10 deletions lib/src/layer/tile_layer/tile_error_evict_callback.dart
Original file line number Diff line number Diff line change
@@ -1,15 +1,5 @@
part of 'tile_layer.dart';

@Deprecated(
'Prefer creating a custom `TileProvider` instead. '
'This option has been deprecated as it is out of scope for the `TileLayer`. '
'This option is deprecated since v6.',
)
typedef TemplateFunction = String Function(
String str,
Map<String, String> data,
);

enum EvictErrorTileStrategy {
/// Never evict images for tiles which failed to load.
none,
Expand Down
38 changes: 1 addition & 37 deletions lib/src/layer/tile_layer/tile_layer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -135,14 +135,6 @@ class TileLayer extends StatefulWidget {
// Defaults to TileDisplay.fadeIn().
final TileDisplay tileDisplay;

/// Color shown behind the tiles
@Deprecated(
'Prefer `MapOptions.backgroundColor`. '
'This property has been removed simplify interaction when using multiple `TileLayer`s. '
'This property is deprecated since v6.',
)
final Color? backgroundColor;

/// Provider with which to load map tiles
///
/// The default is [NetworkTileProvider] which supports both IO and web
Expand Down Expand Up @@ -199,13 +191,6 @@ class TileLayer extends StatefulWidget {
/// This callback will be executed if an error occurs when fetching tiles.
final ErrorTileCallBack? errorTileCallback;

@Deprecated(
'Prefer creating a custom `TileProvider` instead. '
'This option has been deprecated as it is out of scope for the `TileLayer`. '
'This option is deprecated since v6.',
)
final TemplateFunction? templateFunction;

/// Function which may Wrap Tile with custom Widget
/// There are predefined examples in 'tile_builder.dart'
final TileBuilder? tileBuilder;
Expand Down Expand Up @@ -250,12 +235,6 @@ class TileLayer extends StatefulWidget {
this.subdomains = const ['a', 'b', 'c'],
this.keepBuffer = 2,
this.panBuffer = 1,
@Deprecated(
'Prefer `MapOptions.backgroundColor`. '
'This property has been removed simplify interaction when using multiple `TileLayer`s. '
'This property is deprecated since v6.',
)
this.backgroundColor,
this.errorImage,
final TileProvider? tileProvider,
this.tms = false,
Expand All @@ -267,12 +246,6 @@ class TileLayer extends StatefulWidget {
/// Defaults to `false` when `null`.
final bool? retinaMode,
this.errorTileCallback,
@Deprecated(
'Prefer creating a custom `TileProvider` instead. '
'This option has been deprecated as it is out of scope for the `TileLayer`. '
'This option is deprecated since v6.',
)
this.templateFunction,
this.tileBuilder,
this.evictErrorTileStrategy = EvictErrorTileStrategy.none,
this.reset,
Expand Down Expand Up @@ -570,19 +543,10 @@ class _TileLayerState extends State<TileLayer> with TickerProviderStateMixin {
}

return MobileLayerTransformer(
// ignore: deprecated_member_use_from_same_package
child: _addBackgroundColor(
Stack(children: tiles..sort(renderOrder)),
),
child: Stack(children: tiles..sort(renderOrder)),
);
}

@Deprecated('Remove once `backgroundColor` is removed')
Widget _addBackgroundColor(Widget child) {
final color = widget.backgroundColor;
return color == null ? child : ColoredBox(color: color, child: child);
}

TileImage _createTileImage({
required TileCoordinates coordinates,
required TileBoundsAtZoom tileBoundsAtZoom,
Expand Down
14 changes: 0 additions & 14 deletions lib/src/map/camera/camera.dart
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,6 @@ class MapCamera {
/// value in radians.
final double rotation;

@Deprecated(
'Prefer `nonRotatedSize`. '
'This getter has been changed to fix the capitalization. '
'This getter is deprecated since v6.',
)
Point<double> get nonrotatedSize => nonRotatedSize;

/// The size of the map view ignoring rotation. This will be the size of the
/// FlutterMap widget.
final Point<double> nonRotatedSize;
Expand All @@ -63,13 +56,6 @@ class MapCamera {
/// Lazily calculated field
double? _rotationRad;

@Deprecated(
'Prefer `visibleBounds`. '
'This getter has been changed to clarify its meaning. '
'This getter is deprecated since v6.',
)
LatLngBounds get bounds => visibleBounds;

/// This is the [LatLngBounds] corresponding to four corners of this camera.
/// This takes rotation in to account.
LatLngBounds get visibleBounds => _bounds ??= LatLngBounds(
Expand Down
Loading