one_target_mobile_sdk 0.0.11
one_target_mobile_sdk: ^0.0.11 copied to clipboard
G1 tracking's plugin
import 'dart:io';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:one_target_mobile_sdk/one_target_mobile_sdk.dart';
import 'package:one_target_mobile_sdk_example/common/constant.dart';
import 'package:one_target_mobile_sdk_example/screens/tracking/advancedTracking/search_flight_screen.dart';
import 'package:one_target_mobile_sdk_example/screens/tracking/simpleTracking/simple_tracking_screen.dart';
import 'common/utils.dart';
void main() async {
WidgetsFlutterBinding.ensureInitialized();
_setupTracking();
runApp(const MyApp());
}
void _setupTracking() {
var result = Constant.setEnv(Constant.ENV_DEV);
// var result = Constant.setEnv(Constant.ENV_STAG);
// var result = Constant.setEnv(Constant.ENV_PROD);
Utils.log("initState>>> result $result");
bool isShowLog = false;
if (kDebugMode) {
isShowLog = true;
}
// isShowLog= false;
G1SDK
.setupSDK(
Constant.getEnv(),
Constant.getWorkSpaceId(),
isShowLog: isShowLog,
isEnableIAM: true,
)
.then((isSetupSuccess) {
Utils.log("_setupTracking isSetupSuccess $isSetupSuccess");
});
}
class MyApp extends StatefulWidget {
const MyApp({Key? key}) : super(key: key);
@override
State<MyApp> createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
@override
void initState() {
super.initState();
}
@override
Widget build(BuildContext context) {
return GetMaterialApp(
enableLog: true,
debugShowCheckedModeBanner: true,
defaultTransition: Transition.cupertino,
home: Scaffold(
appBar: AppBar(
leading: IconButton(
icon: const Icon(Icons.arrow_back_ios, color: Colors.white),
onPressed: () {
exit(0);
},
),
centerTitle: true,
title: const Text('OneTargetMobileSDK'),
),
body: Container(
padding: const EdgeInsets.all(16.0),
child: ListView(
physics: const BouncingScrollPhysics(),
children: [
SampleButton(
text: "Simple tracking",
onPressed: () {
Get.to(() => const SimpleTrackingScreen());
},
),
SampleButton(
text: "Advanced tracking",
onPressed: () {
Get.to(() => const SearchFlightScreen());
},
),
],
),
),
),
);
}
}