nexora_chai_flutter 1.0.1
nexora_chai_flutter: ^1.0.1 copied to clipboard
The official Nexora Chai SDK for Flutter. Accept M-Pesa tips in your mobile app with a single line of code.
example/main.dart
import 'package:flutter/material.dart';
import 'package:nexora_chai_flutter/nexora_chai_flutter.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Nexora Chai Demo',
theme: ThemeData(
primaryColor: const Color(0xFF914D00),
useMaterial3: true,
),
home: const DemoPage(),
);
}
}
class DemoPage extends StatelessWidget {
const DemoPage({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('Support Me on Nexora Chai'),
centerTitle: true,
),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
const Icon(
Icons.coffee_rounded,
size: 80,
color: Color(0xFF914D00),
),
const SizedBox(height: 24),
const Text(
'Buy me a Chai!',
style: TextStyle(
fontSize: 24,
fontWeight: FontWeight.bold,
),
),
const SizedBox(height: 8),
const Text(
'Support my creative journey with a tip.',
style: TextStyle(color: Colors.grey),
),
const SizedBox(height: 40),
ElevatedButton(
onPressed: () {
// Show the Nexora Chai Checkout Widget
showModalBottomSheet(
context: context,
isScrollControlled: true,
backgroundColor: Colors.transparent,
builder: (context) => const ChaiCheckoutView(
username: 'nevan', // Your creator username
amount: 500, // Pre-filled amount (optional)
fanName: 'Demo User', // Pre-filled name (optional)
),
);
},
style: ElevatedButton.styleFrom(
backgroundColor: const Color(0xFF914D00),
foregroundColor: Colors.white,
padding: const EdgeInsets.symmetric(horizontal: 40, vertical: 16),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(16),
),
),
child: const Text(
'Support Creator',
style: TextStyle(
fontSize: 18,
fontWeight: FontWeight.bold,
),
),
),
],
),
),
);
}
}