Files
rog_app/lib/widgets/base_layer_widget.dart

48 lines
1.6 KiB
Dart

import 'package:flutter/material.dart';
import 'package:flutter_map/flutter_map.dart';
//import 'package:flutter_map_tile_caching/flutter_map_tile_caching.dart';
class BaseLayer extends StatelessWidget {
const BaseLayer({super.key});
@override
Widget build(BuildContext context) {
return TileLayer(
urlTemplate: "https://cyberjapandata.gsi.go.jp/xyz/std/{z}/{x}/{y}.png",
/*userAgentPackageName: 'com.example.app',*/
/*
tileProvider: FMTC.instance('OpenStreetMap (A)').getTileProvider(
settings: FMTCTileProviderSettings(
behavior: CacheBehavior.values.byName('cacheFirst'),
cachedValidDuration: const Duration(days: 14),
),
),
*/
userAgentPackageName: 'com.example.app',
tileBuilder: (context, tileWidget, tile) {
return Stack(
fit: StackFit.passthrough,
children: [
tileWidget,
/*
if (tile.loadError != null)
Center(
child: Icon(Icons.error, color: Colors.red.withOpacity(0.5)),
),
*/
],
);
},
errorTileCallback: (tile, error, stackTrace) {
debugPrint('Tile load error: $error');
debugPrint('Stack trace: $stackTrace');
},
);
}
}
// var Esri_WorldImagery = L.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}', {
// attribution: 'Tiles © Esri — Source: Esri, i-cubed, USDA, USGS, AEX, GeoEye, Getmapping, Aerogrid, IGN, IGP, UPR-EGP, and the GIS User Community'
// });