merchant_app 1.0.2 copy "merchant_app: ^1.0.2" to clipboard
merchant_app: ^1.0.2 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';

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: const Scaffold(
        body: SendSMSScreen(smsDetails: {}),
        // body: PumpListScreen(
        //   pumpImagePath: 'assets/petrol-pump.png',
        //   nozzleImagePath: 'assets/gasoline-pump.png',
        //   strRoCode: "41030952",
        //   strUserId: "41030952",
        //   onTransactionPressed: (transactionRes) {},
        // ),
      ),
    );
  }
}
1
likes
0
points
38
downloads

Publisher

unverified uploader

Weekly Downloads

Flutter plugin for integrating a HP PAY into your app

License

unknown (license)

Dependencies

flutter, http, plugin_platform_interface

More

Packages that depend on merchant_app