flutter_app_market 1.1.0 copy "flutter_app_market: ^1.1.0" to clipboard
flutter_app_market: ^1.1.0 copied to clipboard

Android应用跳转到手机的各大应用市场,Google、华为、小米、oppo、vivo、应用宝等各大主流的应用市场.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:flutter_app_market/flutter_app_market.dart';

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

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

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

class _MyAppState extends State<MyApp> {
  final plugin = FlutterAppMarket();
  bool? huawei;
  bool? xiaomi;
  bool? tencent;

  @override
  void initState() {
    super.initState();
    plugin.isInstalled(plugin.getPackageName('huawei')).then((res) {
      setState(() {
        huawei = res;
      });
    });
    plugin.isInstalled(plugin.getPackageName('xiaomi')).then((res) {
      setState(() {
        xiaomi = res;
      });
    });
    plugin.isInstalled(plugin.getPackageName('tencent')).then((res) {
      setState(() {
        tencent = res;
      });
    });
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('打开应用市场Example'),
        ),
        body: Center(
          child: Column(
            mainAxisSize: MainAxisSize.min,
            children: [
              Text('华为应用市场是否安装:${huawei}'),
              ElevatedButton(
                onPressed: () {
                  plugin.openMarket(
                      updateAppPackageName: 'com.yhyx.aimeili',
                      marketPackageName: plugin.getPackageName('huawei'));
                },
                child: Text('华为应用市场'),
              ),
              Text('小米应用市场是否安装:${xiaomi}'),
              ElevatedButton(
                onPressed: () {
                  plugin.openMarket(
                      updateAppPackageName: 'com.yhyx.aimeili',
                      marketPackageName: plugin.getPackageName('xiaomi'));
                },
                child: Text('小米应用市场'),
              ),
              Text('应用宝是否安装:${tencent}'),
              ElevatedButton(
                onPressed: () {
                  plugin.openMarket(
                      updateAppPackageName: 'com.yhyx.aimeili',
                      marketPackageName: plugin.getPackageName('tencent'));
                },
                child: Text('应用宝'),
              ),
              ElevatedButton(
                onPressed: () {
                  plugin.openOtherApp('weixin://');
                },
                child: Text('打开微信'),
              ),
            ],
          ),
        ),
      ),
    );
  }
}
1
likes
125
points
31
downloads

Publisher

unverified uploader

Weekly Downloads

Android应用跳转到手机的各大应用市场,Google、华为、小米、oppo、vivo、应用宝等各大主流的应用市场.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter, plugin_platform_interface

More

Packages that depend on flutter_app_market

Packages that implement flutter_app_market