countries_world_map 0.0.7 countries_world_map: ^0.0.7 copied to clipboard
A simple widget for a customizable world map. Uses a custompainter to paint all countries & islands, which can all be colored based on the ISO two-letter countrycodes.
import 'package:example/pages/random_map.dart';
import 'package:example/pages/supported_countries_map.dart';
import 'package:flutter/material.dart';
void main() {
WidgetsFlutterBinding.ensureInitialized();
runApp(WorldMapExample());
}
class WorldMapExample extends StatelessWidget {
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Worldmap Example',
theme: ThemeData(
primarySwatch: Colors.blue,
visualDensity: VisualDensity.adaptivePlatformDensity),
home: MyHomePage());
}
}
class MyHomePage extends StatefulWidget {
MyHomePage({Key? key}) : super(key: key);
@override
_MyHomePageState createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage>
with SingleTickerProviderStateMixin {
late TabController controller;
@override
void initState() {
controller = TabController(length: 2, initialIndex: 0, vsync: this);
super.initState();
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Countries World Map',
style: TextStyle(color: Colors.blue)),
backgroundColor: Colors.transparent,
elevation: 0,
bottom: TabBar(controller: controller, tabs: [
ListTile(title: Center(child: Text('Random colors'))),
ListTile(title: Center(child: Text('Supported countries')))
])),
// body: Container(
// child: Center(
// child: USAMap(
// usaColors: USAColors(),
// callback: (s, r) => print(s),
// ),
// )));
body: Container(
height: MediaQuery.of(context).size.height,
width: MediaQuery.of(context).size.width,
child: TabBarView(
physics: NeverScrollableScrollPhysics(),
controller: controller,
children: [RandomWorldMapGenrator(), SupportedCountriesMap()]),
));
}
}