搜索分类、插件与代码仓

add_to_google_wallet 封面
插件详情v0.0.5

add_to_google_wallet

一个提供“添加到 Google Wallet”按钮的 Flutter 插件。

Android
近 30 天下载
1500
喜欢数
36
Pub 分数
160

安装插件

flutter pub add add_to_google_wallet

插件介绍

基于插件公开信息、社区数据与项目使用情况整理的选型参考。

一个 Flutter 插件,可实现 '添加到 Google Wallet' 按钮的集成,使用户能够轻松将数字凭证、票券和会员卡直接添加到他们的 Google Wallet 应用中。专为 Android 设计,该插件简化了在 Flutter 应用中创建和管理数字钱包的过程。通过平台通道利用 Google 的原生钱包 API,该插件提供了无缝的用户体验。

适合场景

  • 将活动门票添加到 Google Wallet
  • 通过移动应用程序发放忠诚卡
  • 数字分发登机牌
  • 启用数字礼品卡
  • 简化会员卡的访问

主要特点

  • 仅限 Android 的平台支持
  • 原生 Google Wallet 集成
  • 简单按钮实现
  • 安全的密码数据处理
  • 平台通道通信

适合对象

  • 面向 Android 的 Flutter 应用
  • 活动票务平台
  • 忠诚度与奖励计划
  • 旅行和交通应用
  • 零售和电子商务应用

使用建议

  • 仅限安卓设备
  • 目标设备上需要 Google Wallet 应用
  • 依赖 Google Play 服务
  • 需要正确的通行配置和签名
  • 可能需要额外的后端设置才能生成通行证

原始 README

以下为关联源码仓库的 README 原文快照,最新内容请访问源码仓库。

Add To Google Wallet

A Flutter plugin that provides the Add To Google Wallet Button.

Overview

The goal of this plugin is to simplify the implementation of Add To Google Wallet feature.

Prerequisites

Before plugin can be used, make sure to complete all of the prerequisites listed below.

  1. Sign up for a Google Wallet API Issuer account
  2. Authorize your app
  3. Create a Passes Class
  4. Create a Passes Object

Usage

Installation

To use this plugin, add add_to_google_wallet as a dependency in your pubspec.yaml file.

dependencies:
  add_to_google_wallet: ^0.0.5

or run this command:

flutter pub add add_to_google_wallet 
Example usage
import 'package:add_to_google_wallet/widgets/add_to_google_wallet_button.dart';
import 'package:flutter/material.dart';
import 'package:uuid/uuid.dart';

void main() => runApp(const MaterialApp(home: MyApp()));

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

  @override
  Widget build(BuildContext context) => Scaffold(
        body: Center(
          child: AddToGoogleWalletButton(
            pass: _examplePass,
            onSuccess: () => _showSnackBar(context, 'Success!'),
            onCanceled: () => _showSnackBar(context, 'Action canceled.'),
            onError: (Object error) => _showSnackBar(context, error.toString()),
            locale: const Locale.fromSubtags(
              languageCode: 'fr',
              countryCode: 'FR',
            ),
          ),
        ),
      );

  void _showSnackBar(BuildContext context, String text) =>
      ScaffoldMessenger.of(context).showSnackBar(SnackBar(content: Text(text)));
}

final String _passId = const Uuid().v4();
const String _passClass = 'example';
const String _issuerId = '3333000000000000000';
const String _issuerEmail = 'example@example.com';

final String _examplePass = """ 
    {
      "iss": "$_issuerEmail",
      "aud": "google",
      "typ": "savetowallet",
      "origins": [],
      "payload": {
        "genericObjects": [
          {
            "id": "$_issuerId.$_passId",
            "classId": "$_issuerId.$_passClass",
            "genericType": "GENERIC_TYPE_UNSPECIFIED",
            "hexBackgroundColor": "#4285f4",
            "logo": {
              "sourceUri": {
                "uri": "https://storage.googleapis.com/wallet-lab-tools-codelab-artifacts-public/pass_google_logo.jpg"
              }
            },
            "cardTitle": {
              "defaultValue": {
                "language": "en",
                "value": "Google I/O '22 [DEMO ONLY]"
              }
            },
            "subheader": {
              "defaultValue": {
                "language": "en",
                "value": "Attendee"
              }
            },
            "header": {
              "defaultValue": {
                "language": "en",
                "value": "Alex McJacobs"
              }
            },
            "barcode": {
              "type": "QR_CODE",
              "value": "$_passId"
            },
            "heroImage": {
              "sourceUri": {
                "uri": "https://storage.googleapis.com/wallet-lab-tools-codelab-artifacts-public/google-io-hero-demo-only.jpg"
              }
            },
            "textModulesData": [
              {
                "header": "POINTS",
                "body": "1234",
                "id": "points"
              }
            ]
          }
        ]
      }
    }
""";

See the example app for more examples.

Demo

所属分类

依赖

依赖清单 2 项

源码仓库

使用此插件的项目

暂无相关数据。