xbr_network_freight 3.0.1 copy "xbr_network_freight: ^3.0.1" to clipboard
xbr_network_freight: ^3.0.1 copied to clipboard

tms sdk, include amap,search,location,navi

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:xbr_gaode_amap/xbr_gaode_amap.dart';
import 'package:xbr_gaode_location/xbr_gaode_location.dart';
import 'package:xbr_network_freight/xbr_network_freight.dart';
import 'core/permission_check.dart';
import 'net_freght_page.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();
    ///初始化
    initKey(
      androidKey:"488c701a9879b03854e5324f173d6fbd",
      iosKey: "921894ad2f90670087f59b9356c04769",
    );
    initNetFreight();
  }

  void initKey({androidKey,iosKey}){
    XbrGaodeAmap.initKey(androidKey: androidKey, iosKey: iosKey);
    XbrGaodeAmap.updatePrivacy(hasContains: true, hasShow: true, hasAgree: true);
    XbrGaodeLocation.initKey(androidKey: androidKey, iosKey: iosKey);
    XbrGaodeLocation.updatePrivacy(hasContains: true, hasShow: true, hasAgree: true);
  }

  void initNetFreight(){
    XbrNetworkFreight.init();
  }

  @override
  Widget build(BuildContext context) {
    return const MaterialApp(
      home: IndexPage(),
    );
  }
}

///
/// HOME
///
class IndexPage extends StatefulWidget{
  const IndexPage({Key? key}) : super(key: key);

  @override
  State<IndexPage> createState() => _IndexPageState();
}

class _IndexPageState extends State<IndexPage> {
  String permissionCheck = "正在检查权限";
  @override
  void initState() {
    super.initState();
    permissionInit();
  }

  //权限检查
  void permissionInit() {
    PermissionCheck(context, (success) {
      setState(() {
        permissionCheck = "权限检查成功";
      });
    }).request();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text("网络货运官方SDK,FLUTTER插件"),
      ),
      body: Center(
        child: Column(
          mainAxisSize: MainAxisSize.min,
          children: [
            Text(permissionCheck),
            const SizedBox(height: 20),
            ElevatedButton(
              style: ElevatedButton.styleFrom(minimumSize: const Size(150,48)),
              child: const Text("打开模拟运单(地图)界面"),
              onPressed: () {
                Navigator.push(context, MaterialPageRoute(builder: (context) => const NetFreghtPage()));
              },
            )
          ],
        ),
      ),
    );
  }
}
1
likes
105
pub points
47%
popularity

Publisher

unverified uploader

tms sdk, include amap,search,location,navi

Homepage

Documentation

API reference

License

MulanPSL-2.0 (LICENSE)

Dependencies

flutter, flutter_plugin_android_lifecycle, json_annotation, meta, plugin_platform_interface, stream_transform

More

Packages that depend on xbr_network_freight