搜尋套件、儲存庫與 APP 分類

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 項

原始碼儲存庫

使用此套件的專案

暫無相關資料。