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

outdated

a colorful plugin for android & ios.

example/lib/main.dart

import 'package:amap_plugin/amap_plugin.dart';
import 'package:amap_plugin/model/location/options.dart';
import 'package:amap_plugin/model/method/interface.dart';
import 'package:amap_plugin_example/map/map.dart';
import 'package:flutter/material.dart';
import 'dart:async';

import 'package:flutter/services.dart';
// import 'package:amap_plugin/yykit.dart';

void main() {
  runApp( MaterialApp(
    title: 'My app', // used by the OS task switcher
    home: const MyApp(),
    routes: <String, WidgetBuilder>{
      '/map':(BuildContext context) => const MapView(),
    },
  ));
}

class MyApp extends StatefulWidget {
  const MyApp({super.key});

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

class _MyAppState extends State<MyApp> {

  /// 初始化插件
  final _plugin = AMapUtilities();

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

    /// 设置接收消息方法
    _plugin.responseMethod(handleMessage);
  }
  /// 设置接收消息方法
  Future<dynamic> handleMessage(MethodCall call) async {
    print(call.method);
    print(call.arguments);
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('地图插件', style: TextStyle(fontSize: 16, fontWeight: FontWeight.normal),),
          // centerTitle: true,
          elevation: 0,
        ),
        backgroundColor: Colors.white,
        body: ListView(
          children: [
            Text("关于定位"),
            ListTile(title: const Text('开启持续定位'), dense: true, onTap: () {
              _plugin.executionMethod(methodName: AMapMethod.location.startLocation, param: LocationOptions().parameters());
            },),
            ListTile(title: const Text('开启单次定位'), dense: true, onTap: () {
              _plugin.executionMethod(methodName: AMapMethod.location.startLocation, param: LocationOptions(isOnceLocation: true).parameters());
            },),
            ListTile(title: const Text('停止定位'), dense: true, onTap: () {
              _plugin.executionMethod(methodName: AMapMethod.location.stopLocation, param: LocationOptions().parameters());
            },),
            Text("关于地图"),
            ListTile(title: const Text('地图基础'), dense: true, onTap: () {
              Navigator.push(context, MaterialPageRoute(builder: (context) {
                return const MapView();
              }));
            },),
          ],
        )
      ),
    );
  }
}
1
likes
0
points
11
downloads

Publisher

unverified uploader

Weekly Downloads

a colorful plugin for android & ios.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter, flutter_web_plugins, plugin_platform_interface

More

Packages that depend on yykit

Packages that implement yykit