flutter_mono 2.0.0
flutter_mono: ^2.0.0 copied to clipboard
An unofficial plugin for using Mono Connect SDK https://mono.co
example/lib/main.dart
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_mono/flutter_mono.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return AnnotatedRegion<SystemUiOverlayStyle>(
value: SystemUiOverlayStyle(
statusBarColor: Colors.transparent,
systemNavigationBarColor: Colors.white,
),
child: MaterialApp(
title: 'Mono Flutter Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
),
debugShowCheckedModeBanner: false,
home: MyHomePage(title: 'Mono Demo'),
),
);
}
}
class MyHomePage extends StatefulWidget {
MyHomePage({Key? key, this.title}) : super(key: key);
final String? title;
@override
_MyHomePageState createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
String? code = '';
final monoPublicKey = '';
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(
widget.title ?? '',
style: TextStyle(
color: Colors.black,
fontSize: 18,
),
),
centerTitle: true,
brightness: Brightness.light,
backgroundColor: Colors.white,
),
backgroundColor: Colors.white,
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
SelectableText(
code ?? '',
style: TextStyle(
color: monoColor,
fontWeight: FontWeight.w600,
fontSize: 25,
),
),
const SizedBox(height: 60),
Column(
children: [
Container(
height: 50,
width: 260,
child: CupertinoButton(
color: monoColor,
child: Center(
child: Text(
'Launch Mono',
style: TextStyle(
color: Colors.white,
),
),
),
onPressed: () async {
await MonoFlutter.launchMono(
context,
key: monoPublicKey,
onClosed: () {
Navigator.pop(context);
},
onSuccess: (String _code) {
setState(() {
code = _code;
});
Navigator.pop(context);
},
);
},
),
),
],
),
],
)),
);
}
}
final monoColor = Color(0xff182cd1);