import 'package:flutter/widgets.dart';
import 'package:get/get.dart';
import 'package:mpcore/mpcore.dart';
import 'package:mpflutter_template/second_page.dart';
void main() {
runApp(MyApp());
MPCore().connectToHostChannel();
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return GetMPApp(
title: 'MPFlutter Demo',
color: Colors.blue,
routes: {
'/': (context) => MyHomePage(),
'/second': (context) => MySecondPage(),
},
navigatorObservers: [MPCore.getNavigationObserver()],
);
}
}
class Controller extends GetxController {
var count = 0.obs;
increment() => count++;
}
class MyHomePage extends StatelessWidget {
@override
Widget build(BuildContext context) {
final Controller c = Get.put(Controller());
return MPScaffold(
name: 'Template',
body: Center(
child: GestureDetector(
onTap: () {
c.increment();
},
child: Container(
width: 200,
height: 200,
color: Colors.blue,
child: Center(
child: Obx(() {
return Text(
"Clicks: ${c.count}",
style: TextStyle(
fontSize: 18,
fontWeight: FontWeight.bold,
color: Colors.white,
),
);
}),
),
),
),
),
);
}
}