SfMapsTheme(
data: SfMapsThemeData(
brightness: Brightness.dark,
layerColor: Colors.grey,
layerStrokeColor: Colors.grey,
layerStrokeWidth: 1,
shapeHoverColor: Colors.black,
shapeHoverStrokeColor: Colors.black,
shapeHoverStrokeWidth: 5,
selectionColor: Colors.yellow,
selectionStrokeWidth: 5,
toggledItemColor: Colors.black,
toggledItemStrokeWidth: 5
),
child: SfMaps(
bool? _isDarkTheme = false; @override void initState() { _source = MapShapeSource.asset( 'assets/australia.json', shapeDataField: 'name', ); super.initState(); } @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar(title: Text('Color around the shape')), body: Center( child: Column( children: [ Container( width: 250, child: CheckboxListTile( value: _isDarkTheme, title: Text('Enable dark theme'), onChanged: (bool? newValue) { setState(() { _isDarkTheme = newValue; }); }, ), ), Expanded( child: ColoredBox( color: _isDarkTheme! ? Colors.black : Colors.white, child: Padding( padding: const EdgeInsets.only(left: 15.0), child: SfMapsTheme( data: SfMapsThemeData( layerColor: Colors.teal, layerStrokeColor: Colors.grey, layerStrokeWidth: 1, shapeHoverColor: Colors.black, shapeHoverStrokeColor: Colors.black, shapeHoverStrokeWidth: 5, selectionColor: Colors.yellow, selectionStrokeWidth: 5, toggledItemColor: Colors.black, toggledItemStrokeWidth: 5), child: SfMaps( layers: [ MapShapeLayer( source: _source, ), ], ), ), ), ), ), SizedBox(height: 20), ], ), ), ); } |