lm_dx 0.0.4
lm_dx: ^0.0.4 copied to clipboard
lm_dx
LM DX integration
Sample Usage #
import 'package:flutter/material.dart';
import 'package:lm_dx/lm_dx.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'LM - DX',
theme: ThemeData(
colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
useMaterial3: true,
),
home: const MyHomePage(title: 'LM - DX'),
);
}
}
class MyHomePage extends StatefulWidget {
const MyHomePage({super.key, required this.title});
final String title;
@override
State<MyHomePage> createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
final LMDX lmWidgetKit = LMDX();
late Future<void> _initFuture;
@override
void initState() {
super.initState();
_initFuture = lmWidgetKit.init(
'https://healthcare.lucyday.io/',
'SC:healthcare:a3490beca33befa6',
);
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(widget.title),
backgroundColor: Theme.of(context).colorScheme.inversePrimary,
),
body: FutureBuilder<void>(
future: _initFuture,
builder: (context, snapshot) {
if (snapshot.connectionState == ConnectionState.waiting) {
return const Center(child: CircularProgressIndicator());
} else if (snapshot.hasError) {
return Center(child: Text('Error: ${snapshot.error}'));
} else {
return lmWidgetKit.LMWidget({
"__template__": {
"type": "simple-card",
"id": "u-52e2377b-bfcd-4e5e-a22b-ea42086a82aa",
"layout": {"w": 10, "h": 10},
"zoom": 1,
"locked": true,
},
"uiProps": {"tabs": [], "__widget_name__": "dcdf"},
});
}
},
),
);
}
}