octant 0.0.6 copy "octant: ^0.0.6" to clipboard
octant: ^0.0.6 copied to clipboard

outdated

Octant SDK is a lightweight SDK that helps to collect and report device's location, which also provide Http API to query users' travelled distance or history locations. Developed by Nextbillion AI Pte Ltd

example/lib/main.dart

import 'package:flutter/material.dart';

import 'package:octant/octant.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatefulWidget {
  const MyApp({Key? key}) : super(key: key);

  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  @override
  void initState() {
    super.initState();
    Octant.init('1', '1', 'https://nextbillion.zodme.com');
    Octant.enableDebug(true);
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Plugin example app'),
        ),
        body: SingleChildScrollView(
          child: Column(
            children: [
              Container(
                height: 50,
              ),
              GradientButton('start service', () {
                Octant.startService('ic_launcher', 'Octant Example',
                    'location tracking in progress...');
              }),
              Container(
                height: 50,
              ),
              const GradientButton('start tracing', Octant.startTracing),
              Container(
                height: 50,
              ),
              const GradientButton('stop service', Octant.stopService),
              Container(
                height: 50,
              ),
              GradientButton('Configure intervals', () {
                Octant.configureIntervals(12, 1);
              }),
              Container(
                height: 50,
              ),
              GradientButton('QueryRanking', () {
                int startTime = DateTime.now()
                    .subtract(const Duration(days: 7))
                    .millisecond;
                int endTime = DateTime.now().microsecond;
                int limit = 10;
                String remarkCode = "0";
                List<String> userCodeList = ['0', '1', '2'];
                Octant.queryRanking(
                    startTime, endTime, limit, userCodeList, remarkCode);
              }),
              Container(
                height: 50,
              ),
              GradientButton('QueryUserCoord', () {
                int startTime = DateTime.now()
                    .subtract(const Duration(days: 7))
                    .millisecond;
                int endTime = DateTime.now().microsecond;
                int limit = 10;
                String remarkCode = "0";
                Octant.queryUserCoordinate(
                    startTime, endTime, limit, remarkCode);
              }),
            ],
          ),
        ),
      ),
    );
  }
}

class GradientButton extends StatelessWidget {
  const GradientButton(this.text, this.onPressed, {Key? key}) : super(key: key);

  final String text;
  final VoidCallback? onPressed;

  @override
  Widget build(BuildContext context) {
    return Container(
      height: 50,
      margin: const EdgeInsets.all(16),
      child: RaisedButton(
        onPressed: onPressed,
        shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(80)),
        padding: const EdgeInsets.all(0),
        child: Ink(
          decoration: BoxDecoration(
              gradient: const LinearGradient(
                colors: [Color(0xff374ABE), Color(0xff64B6ff)],
                begin: Alignment.centerLeft,
                end: Alignment.centerRight,
              ),
              borderRadius: BorderRadius.circular(30.0)),
          child: Container(
            constraints: const BoxConstraints(minHeight: 50, maxWidth: 250),
            alignment: Alignment.center,
            child: Text(
              text,
              textAlign: TextAlign.center,
              style: const TextStyle(color: Colors.white),
            ),
          ),
        ),
      ),
    );
  }
}
0
likes
0
points
4
downloads

Publisher

unverified uploader

Weekly Downloads

Octant SDK is a lightweight SDK that helps to collect and report device's location, which also provide Http API to query users' travelled distance or history locations. Developed by Nextbillion AI Pte Ltd

Homepage

License

unknown (license)

Dependencies

flutter

More

Packages that depend on octant

Packages that implement octant