countries_world_map 1.0.0-1 countries_world_map: ^1.0.0-1 copied to clipboard
A simple widget for a customizable WorldMap (or any country of choice). Uses a custompainter to paint all countries & islands, which can all be colored based on the ISO two-letter countrycodes (or state ID).
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(SMapExampleApp());
}
class SMapExampleApp 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: 3, 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('Supported countries'))),
ListTile(title: Center(child: Text('Random colors'))),
// ListTile(title: Center(child: Text('Africa'))),
])),
body: Container(
height: MediaQuery.of(context).size.height,
width: MediaQuery.of(context).size.width,
child: TabBarView(
physics: NeverScrollableScrollPhysics(),
controller: controller,
children: [
SupportedCountriesMap(),
RandomWorldMapGenrator(),
// AfricaContinent()
]),
));
}
}