BdMap class

An interactive, drillable map of Bangladesh.

Starts at the country level showing the 8 divisions. Tapping a division zooms into it and shows its districts; tapping a district shows its upazilas / thanas. A breadcrumb bar allows navigating back up, and an info panel shows details (and any data you attach) for the selected region.

BdMap(
  onRegionTap: (region) => debugPrint(region.name),
  infoBuilder: (context, region) => Text('Population of ${region.name}'),
)
Inheritance

Constructors

BdMap({Key? key, BdArea maxLevel = BdArea.union, bool showLabels = true, bool useBanglaNames = false, bool showBreadcrumb = true, bool showInfoPanel = true, List<Color>? palette, Color? regionColorBuilder(BdRegion region)?, BdMapData? data, bool showDataList = false, Color borderColor = Colors.white, double borderWidth = 1.0, Color? highlightColor, TextStyle? labelTextStyle, Widget infoBuilder(BuildContext context, BdRegion region)?, ValueChanged<BdRegion>? onRegionTap, ValueChanged<BdRegion?>? onLevelChanged, Duration animationDuration = const Duration(milliseconds: 450), Curve animationCurve = Curves.easeInOutCubic, Color? backgroundColor})
const

Properties

animationCurve → Curve
Curve of the zoom animation between levels.
final
animationDuration → Duration
Duration of the zoom animation between levels.
final
backgroundColor → Color?
Background color behind the map.
final
borderColor → Color
Color of region borders.
final
borderWidth → double
Width of region borders in logical pixels.
final
data → BdMapData?
Your data, keyed by BdRegion.id, for any mix of levels — divisions, districts, upazilas/thanas, and unions all at once. The map keeps its normal colors; the info panel shows the selected region's value and showDataList adds a ranked list (with value bars) of the visible regions. For a choropleth, pass regionColorBuilder: (r) => myData.colorOf(r).
final
hashCode → int
The hash code for this object.
no setterinherited
highlightColor → Color?
Fill color of the currently selected region. Defaults to a lightened version of its own color.
final
infoBuilder → Widget Function(BuildContext context, BdRegion region)?
Builds the content of the info panel for the selected region — the place to show your own data (population, offices, statistics...).
final
key → Key?
Controls how one widget replaces another widget in the tree.
finalinherited
labelTextStyle → TextStyle?
Style for the painted region labels.
final
maxLevel → BdArea
Deepest level the map drills into. Set to BdArea.district to stop at districts (no upazila view).
final
onLevelChanged → ValueChanged<BdRegion?>?
Called when the view drills in or out. null means country level.
final
onRegionTap → ValueChanged<BdRegion>?
Called whenever any region is tapped (before drilling in).
final
palette → List<Color>?
Fill colors cycled through the visible regions. Defaults to a green-toned palette.
final
regionColorBuilder → Color? Function(BdRegion region)?
Overrides the fill color per region. Return null to fall back to the palette. Use this to build choropleth (data) maps.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
showBreadcrumb → bool
Whether the breadcrumb navigation bar is shown above the map.
final
showDataList → bool
Show a tappable, value-sorted list of the currently visible regions below the map (tapping a row drills in, exactly like tapping the map). Only shown when data is provided.
final
showInfoPanel → bool
Whether the default info panel is shown for the selected region. Ignored when infoBuilder is provided (the builder is always shown).
final
showLabels → bool
Whether region name labels are painted on the map.
final
useBanglaNames → bool
Use Bangla (বাংলা) names for labels, breadcrumb and info panel.
final

Methods

createElement() → StatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() → State<BdMap>
Creates the mutable state for this widget at a given location in the tree.
override
debugDescribeChildren() → List<DiagnosticsNode>
Returns a list of DiagnosticsNode objects describing this node's children.
inherited
debugFillProperties(DiagnosticPropertiesBuilder properties) → void
Add additional properties associated with the node.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toDiagnosticsNode({String? name, DiagnosticsTreeStyle? style}) → DiagnosticsNode
Returns a debug representation of the object that is used by debugging tools and by DiagnosticsNode.toStringDeep.
inherited
toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) → String
A string representation of this object.
inherited
toStringDeep({String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug, int wrapWidth = 65}) → String
Returns a string representation of this node and its descendants.
inherited
toStringShallow({String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) → String
Returns a one-line detailed description of the object.
inherited
toStringShort() → String
A short, textual description of this widget.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited