google_wallet_button 0.1.2 copy "google_wallet_button: ^0.1.2" to clipboard
google_wallet_button: ^0.1.2 copied to clipboard

Flutter widget providing branded "Add to Google Wallet" and "View in Google Wallet" buttons with automatic locale detection.

example/lib/main.dart

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

void main() => runApp(const ExampleApp());

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

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Google Wallet Button Demo',
      theme: ThemeData(useMaterial3: true),
      home: const ExampleScreen(),
    );
  }
}

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

  void _onPressed(String label) {
    debugPrint('$label tapped');
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: const Text('Google Wallet Button')),
      body: SingleChildScrollView(
        padding: const EdgeInsets.all(24),
        child: Column(
          crossAxisAlignment: CrossAxisAlignment.start,
          children: [
            const Text('Add to Google Wallet — Primary'),
            const SizedBox(height: 8),
            AddToGoogleWalletButton(
              onPressed: () => _onPressed('Add to (primary)'),
            ),
            const SizedBox(height: 24),
            const Text('Add to Google Wallet — Condensed'),
            const SizedBox(height: 8),
            AddToGoogleWalletButton(
              onPressed: () => _onPressed('Add to (condensed)'),
              style: GoogleWalletButtonStyle.condensed,
            ),
            const SizedBox(height: 24),
            const Text('View in Google Wallet — Primary'),
            const SizedBox(height: 8),
            ViewInGoogleWalletButton(
              onPressed: () => _onPressed('View in (primary)'),
            ),
            const SizedBox(height: 24),
            const Text('View in Google Wallet — Condensed'),
            const SizedBox(height: 8),
            ViewInGoogleWalletButton(
              onPressed: () => _onPressed('View in (condensed)'),
              style: GoogleWalletButtonStyle.condensed,
            ),
            const SizedBox(height: 24),
            const Text('Locale override (German)'),
            const SizedBox(height: 8),
            AddToGoogleWalletButton(
              onPressed: () => _onPressed('Add to (de)'),
              locale: const Locale('de'),
            ),
            const SizedBox(height: 24),
            const Text('Custom height (60dp)'),
            const SizedBox(height: 8),
            AddToGoogleWalletButton(
              onPressed: () => _onPressed('Add to (height 60)'),
              height: 60,
            ),
            const SizedBox(height: 24),
            const Text('Disabled'),
            const SizedBox(height: 8),
            const AddToGoogleWalletButton(onPressed: null),
            const SizedBox(height: 24),
          ],
        ),
      ),
    );
  }
}
4
likes
160
points
236
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

Flutter widget providing branded "Add to Google Wallet" and "View in Google Wallet" buttons with automatic locale detection.

Repository (GitHub)
View/report issues
Contributing

Topics

#google-wallet #wallet #button #widget

License

Apache-2.0 (license)

Dependencies

flutter, flutter_svg

More

Packages that depend on google_wallet_button