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

outdated

Octant location tacking SDK by Nextbillion 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', 'replace your base url here');
    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
pub points
0%
popularity

Publisher

unverified uploader

Octant location tacking SDK by Nextbillion Pte Ltd

Homepage

License

unknown (LICENSE)

Dependencies

flutter

More

Packages that depend on octant