hp_pay_pump_list_project 0.0.7 hp_pay_pump_list_project: ^0.0.7 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';
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();
}
// Platform messages are asynchronous, so we initialize in an async method.
Future<void> initPlatformState() async {
String platformVersion;
// Platform messages may fail, so we use a try/catch PlatformException.
// We also handle the message potentially returning null.
try {
platformVersion =
await _hpPayPumpListProjectPlugin.getPlatformVersion() ??
'Unknown platform version';
} on PlatformException {
platformVersion = 'Failed to get platform version.';
}
// If the widget was removed from the tree while the asynchronous platform
// message was in flight, we want to discard the reply rather than calling
// setState to update our non-existent appearance.
if (!mounted) return;
setState(() {
_platformVersion = platformVersion;
});
}
int primaryColor = 0xFF010269;
Map<int, Color> color = {
50: const Color.fromRGBO(4, 131, 184, .1),
100: const Color.fromRGBO(4, 131, 184, .2),
200: const Color.fromRGBO(4, 131, 184, .3),
300: const Color.fromRGBO(4, 131, 184, .4),
400: const Color.fromRGBO(4, 131, 184, .5),
500: const Color.fromRGBO(4, 131, 184, .6),
600: const Color.fromRGBO(4, 131, 184, .7),
700: const Color.fromRGBO(4, 131, 184, .8),
800: const Color.fromRGBO(4, 131, 184, .9),
900: const Color.fromRGBO(4, 131, 184, 1),
};
@override
Widget build(BuildContext context) {
return MaterialApp(
theme: ThemeData(
primarySwatch: MaterialColor(primaryColor, color),
useMaterial3: false),
debugShowCheckedModeBanner: false,
home: const Scaffold(
body: PumpListScreen(
pumpImagePath: 'assets/petrol-pump.png',
nozzleImagePath: 'assets/gasoline-pump.png',
strRoCode: "41030952",
strUserId: "41030952"),
),
);
}
}