awareframework_locations 0.1.1 copy "awareframework_locations: ^0.1.1" to clipboard
awareframework_locations: ^0.1.1 copied to clipboard

A new flutter plugin project.

example/lib/main.dart

import 'package:flutter/material.dart';

import 'package:awareframework_locations/awareframework_locations.dart';

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

class MyApp extends StatefulWidget {
  late LocationSensor sensor;
  LocationData data = LocationData();
  @override
  _MyAppState createState() => new _MyAppState();
}

class _MyAppState extends State<MyApp> {
  bool sensorState = true;

  @override
  void initState() {
    super.initState();

    var config = LocationSensorConfig()
      ..debug = true
      ..label = "label";

    // // init sensor without a context-card
    widget.sensor = new LocationSensor.init(config);

    // card = new AccelerometerCard(sensor: sensor,);
  }

  @override
  Widget build(BuildContext context) {
    return new MaterialApp(
      home: new Scaffold(
        appBar: new AppBar(
          title: const Text('Plugin Example App'),
        ),
        body: Column(
          children: [
            TextButton(
                onPressed: () {
                  widget.sensor.onLocationChanged.listen((event) {
                    setState(() {
                      Text("Latitude:\t${event.latitude}");
                      Text("Longitude:\t${event.longitude}");
                    });
                  });
                  widget.sensor.start();
                },
                child: Text("Start")),
            TextButton(
                onPressed: () {
                  widget.sensor.stop();
                },
                child: Text("Stop")),
            TextButton(
                onPressed: () {
                  widget.sensor.sync();
                },
                child: Text("Sync")),
          ],
        ),
      ),
    );
  }
}
0
likes
100
pub points
0%
popularity

Publisher

unverified uploader

A new flutter plugin project.

Homepage

Documentation

API reference

License

unknown (LICENSE)

Dependencies

awareframework_core, flutter

More

Packages that depend on awareframework_locations