flutterbudpay 0.0.4 flutterbudpay: ^0.0.4 copied to clipboard
A Flutter plugin for making payments via BudPay Payment Gateway. Completely supports all the platform.
import 'package:example/newpage.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter/scheduler.dart';
import 'themeclass.dart';
// To get started quickly, change this to your heroku deployment of
// https://github.com/PaystackHQ/sample-charge-card-backend
// Step 1. Visit https://github.com/PaystackHQ/sample-charge-card-backend
// Step 2. Click "Deploy to heroku"
// Step 3. Login with your heroku credentials or create a free heroku account
// Step 4. Provide your secret key and an email with which to start all test transactions
// Step 5. Replace {YOUR_BACKEND_URL} below with the url generated by heroku (format https://some-url.herokuapp.com)
String backendUrl = '{YOUR_BACKEND_URL}';
// Set this to a public key that matches the secret key you supplied while creating the heroku instance
String budpayPublicKey = '{YOUR_budpay_PUBLIC_KEY}';
const String appName = 'Budpay Example';
void main() {
runApp(MyApp());
}
class MyApp extends StatefulWidget {
MyApp({Key? key}) : super(key: key);
@override
State<MyApp> createState() => _MyAppState();
static _MyAppState of(BuildContext context) =>
context.findAncestorStateOfType<_MyAppState>()!;
}
class _MyAppState extends State<MyApp> {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: appName,
debugShowCheckedModeBanner: false,
themeMode: _themeMode, // 2) ← ← ← use "state" field here //////////////
theme: ThemeClass.lightTheme,
darkTheme: ThemeClass.darkTheme,
home: Newpage(),
);
}
/// 1) our themeMode "state" field
ThemeMode _themeMode = ThemeMode.system;
/// 3) Call this to change theme from any context using "of" accessor
/// e.g.:
/// MyApp.of(context).changeTheme(ThemeMode.dark);
void changeTheme(ThemeMode themeMode) {
setState(() {
_themeMode = themeMode;
});
}
}
const Color green = Color(0xFF3db76d);
const Color lightBlue = Color(0xFF34a5db);
const Color navyBlue = Color(0xFF031b33);
bool get isDarkMode {
var brightness = SchedulerBinding.instance.window.platformBrightness;
return brightness == Brightness.dark;
}