polymaker 0.0.2 copy "polymaker: ^0.0.2" to clipboard
polymaker: ^0.0.2 copied to clipboard

outdated

Polymaker is a flutter package used to get a list of locations for polygon google maps

example/lib/main.dart

import 'dart:ui';
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
import 'package:polymaker/core/models/location_polygon.dart';
import 'package:polymaker/polymaker.dart' as polymaker;

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'PolyMaker Demo',
      debugShowCheckedModeBanner: false,
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: HomeScreen()
    );
  }
}

class HomeScreen extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text("PolyMaker Demo"),
      ),
      body: HomeBody(),
    );
  }
}

class HomeBody extends StatefulWidget {
  @override
  _HomeBodyState createState() => _HomeBodyState();
}

class _HomeBodyState extends State<HomeBody> {

  List<LocationPolygon> locationList;
  void getLocation() async {
    var result = await polymaker.getLocation(context);
    if (result != null) {
      setState(() {
        locationList = result;
      });
    }
  }

  @override
  void initState() {
    super.initState();
    locationList = new List<LocationPolygon>();
  }

  @override
  Widget build(BuildContext context) {
    return Container(
      width: MediaQuery.of(context).size.width,
      height: MediaQuery.of(context).size.height,
      child: Column(
        mainAxisAlignment: MainAxisAlignment.center,
        crossAxisAlignment: CrossAxisAlignment.center,
        children: <Widget>[
          Text(
            "Location Result: \n" + (locationList != null ? locationList.map((val) => "[${val.latitude}, ${val.longitude}]\n").toString() : "") ,
            textAlign: TextAlign.center,
            style: TextStyle(fontSize: 18),
          ),
          SizedBox(height: 10),
          Container(
            height: 45,
            child: RaisedButton(
              color: Colors.blue,
              shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(10)),
              onPressed: () => getLocation(),
              child: Text(
                "Get Polygon Location",
                style: TextStyle(fontSize: 16, color: Colors.white),
              ),
            ),
          ),
        ],
      ),
    );
  }
}
54
likes
0
pub points
71%
popularity

Publisher

verified publisherleeyurani.com

Polymaker is a flutter package used to get a list of locations for polygon google maps

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter, google_maps_flutter, location, provider, simple_animations

More

Packages that depend on polymaker