limo_sdk_flu 1.3.4
limo_sdk_flu: ^1.3.4 copied to clipboard
limo sdk flutter
example/lib/main.dart
import 'package:flutter/material.dart';
import 'manage/init_sdk.dart';
import 'manage/listenerManager.dart';
import 'routers/Routers.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatefulWidget {
@override
_MyAppState createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
@override
void initState() {
super.initState();
_setSDK();
_setListen();
}
_setSDK() {
InitManger.initLimo();
}
_setListen() {
InitManger.initListen();
ListenerManager.nativeListen();
ListenerManager.downLoadListen();
}
@override
Widget build(BuildContext context) {
return MaterialApp(
// home: MyHome(),
routes: limoRouters,
initialRoute: "/",
);
}
}
class MyHome extends StatelessWidget {
const MyHome({Key? key}) : super(key: key);
Widget buildButton(BuildContext context, String title, VoidCallback onTap) {
return SizedBox(
width: double.infinity,
height: 50,
child: ElevatedButton(
style: ElevatedButton.styleFrom(backgroundColor: Colors.white),
onPressed: onTap,
child: Text(
title,
style: const TextStyle(color: Colors.black, fontSize: 20.0),
),
),
);
}
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.black,
body: Center(
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 30),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
const Text(
'Limo SDK Demo',
style: TextStyle(fontSize: 30.0, color: Colors.white),
),
const SizedBox(height: 40),
// 2. 加载信息流按钮
buildButton(context, "加载信息流", () {
Navigator.pushNamed(context, "/nativeRouter");
}),
const SizedBox(height: 20),
],
),
),
),
);
}
}