1
0
Fork 0
phizclip-flutter-demo/lib/main.dart

125 lines
4.1 KiB
Dart
Raw Normal View History

2020-02-27 17:33:10 +08:00
import 'package:flutter/material.dart';
2020-02-28 12:36:13 +08:00
import 'dart:async';
import 'dart:io';
import 'package:mop/mop.dart';
2020-02-27 17:33:10 +08:00
void main() => runApp(MyApp());
2020-02-28 12:36:13 +08:00
class MyApp extends StatefulWidget {
2020-02-27 17:33:10 +08:00
@override
2020-02-28 12:36:13 +08:00
_MyAppState createState() => _MyAppState();
2020-02-27 17:33:10 +08:00
}
2020-02-28 12:36:13 +08:00
class _MyAppState extends State<MyApp> {
2020-02-27 17:33:10 +08:00
@override
2020-02-28 12:36:13 +08:00
void initState() {
super.initState();
init();
}
2020-02-27 17:33:10 +08:00
2020-02-28 12:36:13 +08:00
// Platform messages are asynchronous, so we initialize in an async method.
Future<void> init() async {
if (Platform.isIOS) {
final res = await Mop.instance.initialize(
2020-11-12 09:55:45 +08:00
'22LyZEib0gLTQdU3MUauATBwgfnTCJjdr7FCnywmAEM=', 'bdfd76cae24d4313',
2022-03-29 21:49:03 +08:00
apiServer: 'https://api.finclip.com', apiPrefix: '/api/v1/mop');
2020-02-28 12:36:13 +08:00
print(res);
} else if (Platform.isAndroid) {
final res = await Mop.instance.initialize(
2020-11-12 09:55:45 +08:00
'22LyZEib0gLTQdU3MUauATBwgfnTCJjdr7FCnywmAEM=', 'bdfd76cae24d4313',
2022-03-29 21:49:03 +08:00
apiServer: 'https://api.finclip.com', apiPrefix: '/api/v1/mop');
2020-02-28 12:36:13 +08:00
print(res);
}
if (!mounted) return;
2020-02-27 17:33:10 +08:00
}
2020-03-07 19:51:04 +08:00
// 5e637a18cbfae4000170fa7a
2020-02-27 17:33:10 +08:00
@override
Widget build(BuildContext context) {
2020-02-28 12:36:13 +08:00
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: const Text('凡泰极客小程序 Flutter 插件'),
),
body: Center(
child: Container(
padding: EdgeInsets.only(
top: 20,
2020-02-27 17:33:10 +08:00
),
2020-02-28 12:36:13 +08:00
child: Column(
children: <Widget>[
Container(
2020-03-07 19:51:04 +08:00
width: 140,
2020-02-28 12:36:13 +08:00
decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(5)),
gradient: LinearGradient(
colors: const [Color(0xFF12767e), Color(0xFF0dabb8)],
stops: const [0.0, 1.0],
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
),
),
2022-12-14 16:37:45 +08:00
child: TextButton(
2020-02-28 12:36:13 +08:00
onPressed: () {
2020-11-13 13:56:07 +08:00
Mop.instance.openApplet('5facb3a52dcbff00017469bd',
2020-03-07 19:51:04 +08:00
path: 'pages/index/index', query: '');
2020-02-28 12:36:13 +08:00
},
child: Text(
2020-03-07 19:51:04 +08:00
'打开画图小程序',
2020-02-28 12:36:13 +08:00
style: TextStyle(color: Colors.white),
),
),
),
SizedBox(height: 30),
Container(
2020-03-07 19:51:04 +08:00
width: 140,
2020-02-28 12:36:13 +08:00
decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(5)),
gradient: LinearGradient(
colors: const [Color(0xFF12767e), Color(0xFF0dabb8)],
stops: const [0.0, 1.0],
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
),
),
2022-12-14 16:37:45 +08:00
child: TextButton(
2020-02-28 12:36:13 +08:00
onPressed: () {
2020-11-12 09:55:45 +08:00
Mop.instance.openApplet('5fa214a29a6a7900019b5cc1');
2020-02-28 12:36:13 +08:00
},
child: Text(
'打开官方小程序',
style: TextStyle(color: Colors.white),
),
),
),
2020-03-07 19:51:04 +08:00
SizedBox(height: 30),
Container(
width: 140,
decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(5)),
gradient: LinearGradient(
colors: const [Color(0xFF12767e), Color(0xFF0dabb8)],
stops: const [0.0, 1.0],
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
),
),
2022-12-14 16:37:45 +08:00
child: TextButton(
2020-03-07 19:51:04 +08:00
onPressed: () {
2020-11-12 09:55:45 +08:00
Mop.instance.openApplet('5fa215459a6a7900019b5cc3');
2020-03-07 19:51:04 +08:00
},
child: Text(
'我的对账单',
style: TextStyle(color: Colors.white),
),
),
),
2020-02-28 12:36:13 +08:00
],
2020-02-27 17:33:10 +08:00
),
2020-02-28 12:36:13 +08:00
),
2020-02-27 17:33:10 +08:00
),
),
);
}
}