merchant_app 1.0.5 copy "merchant_app: ^1.0.5" to clipboard
merchant_app: ^1.0.5 copied to clipboard

Flutter plugin for integrating a HP PAY into your app

example/lib/main.dart

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

import 'package:flutter/services.dart';
import 'package:hp_pay_pump_list_project/hp_pay_pump_list_project.dart';
import 'package:hp_pay_pump_list_project/screens/pump_list_screen.dart';
import 'package:hp_pay_pump_list_project/screens/sms/send_sms_screen.dart';
import 'package:hp_pay_pump_list_project_example/app_colors.dart';

import 'own_class.dart';

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

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

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

class _MyAppState extends State<MyApp> {
  String _platformVersion = 'Unknown';
  final _hpPayPumpListProjectPlugin = HpPayPumpListProject();

  @override
  void initState() {
    super.initState();
    initPlatformState();
    // Set the callback function in the plugin
    // myPlugin.setCallback((data) {
    //   // Navigate to another screen when the callback is triggered
    //   Navigator.push(
    //     context,
    //     MaterialPageRoute(
    //         builder: (context) => const SendSMSScreen(
    //               smsDetails: "",
    //             )),
    //   );
    // });
  }

  Future<void> initPlatformState() async {
    String platformVersion;
    try {
      platformVersion =
          await _hpPayPumpListProjectPlugin.getPlatformVersion() ??
              'Unknown platform version';
    } on PlatformException {
      platformVersion = 'Failed to get platform version.';
    }

    if (!mounted) return;

    setState(() {
      _platformVersion = platformVersion;
    });
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      theme: ThemeData(
          primarySwatch:
              MaterialColor(AppColors.primaryColor, AppColors.primarySwatch),
          useMaterial3: false),
      debugShowCheckedModeBanner: false,
      home: Scaffold(
        body: PumpListScreen(
          pumpImagePath: 'assets/petrol-pump.png',
          nozzleImagePath: 'assets/gasoline-pump.png',
          strRoCode: "41030952",
          strUserId: "41030952",
          onTransactionPressed: (transactionRes, context) {
            Navigator.push(
              context,
              MaterialPageRoute(builder: (context) => const OwnClass()),
            );
          },
        ),
      ),
    );
  }
}
1
likes
110
points
40
downloads

Publisher

unverified uploader

Weekly Downloads

Flutter plugin for integrating a HP PAY into your app

Documentation

API reference

License

MIT (license)

Dependencies

awesome_dialog, flutter, http, plugin_platform_interface

More

Packages that depend on merchant_app