flutter_ortho 0.0.5 flutter_ortho: ^0.0.5 copied to clipboard
flutter ortho package
import 'package:flutter/material.dart';
import 'package:flutter_ortho/flutter_ortho.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Ortho Demo',
theme: ThemeData(
primarySwatch: Colors.yellow,
),
home: const OrthoDemoPage(title: 'Ortho Demo Page'),
);
}
}
class OrthoDemoPage extends StatefulWidget {
const OrthoDemoPage({Key? key, required this.title}) : super(key: key);
final String title;
@override
State<OrthoDemoPage> createState() => _OrthoDemoPageState();
}
class _OrthoDemoPageState extends State<OrthoDemoPage> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(widget.title),
),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
ElevatedButton(
style: ElevatedButton.styleFrom(primary: Colors.black),
onPressed: () async {
///config init to be passed to url
const config = {
// "publicKey": "<your-public-key>",
"amount": 90000,
"short-url": "core-flow",
};
///slug name (payment sdk medium)
const slug = 'Ortho-okra-short-url-flutter';
OrthoModel reply = await FlutterOrtho.create(
orthoKey: 'ortho-flow-testt',
context: context,
bottomSheetColor: Colors.green,
slug: slug,
config: config,
);
debugPrint(reply.data);
//do what you want with the reply
},
child: const Text(
'Open Ortho Widget',
style: TextStyle(color: Colors.white),
)),
],
),
),
);
}
}