install_referrer_inetkr 0.0.2
install_referrer_inetkr: ^0.0.2 copied to clipboard
Flutter package for tracking app installs via Google Play Store.
example/lib/main.dart
import 'package:flutter/material.dart';
import 'package:install_referrer_inetkr/install_referrer_inetkr.dart';
import 'package:package_info_plus/package_info_plus.dart';
late String appName;
late Color primaryColor;
late String packageName;
late String version;
void main() async {
WidgetsFlutterBinding.ensureInitialized();
InstallReferrer.instance.init(debug: true);
final packageInfo = await PackageInfo.fromPlatform();
packageName = packageInfo.packageName;
final pluginVersion = await InstallReferrer.instance.getVersion();
version =
'App Version: ${packageInfo.version}+${packageInfo.buildNumber}, plugin: $pluginVersion';
runApp(const MyApp());
}
class MyApp extends StatefulWidget {
const MyApp({super.key});
@override
State<MyApp> createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
home: Scaffold(
body: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Flexible(
child: Center(
child: Padding(
padding: const EdgeInsets.all(40.0),
child: Image.asset(
'assets/images/logo.png',
fit: BoxFit.cover,
),
),
),
),
Flexible(
child: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
'PACKAGE_NAME',
style: TextStyle(fontSize: 18, color: Color(0xFF919EAB)),
),
Text(
packageName,
style: TextStyle(
fontSize: 24,
fontWeight: FontWeight.w500,
color: Color(0xFF637381),
),
),
Text(
version,
style: TextStyle(fontSize: 14, color: Color(0xFF637381)),
),
],
),
),
),
Flexible(
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisSize: MainAxisSize.min,
children: [
Container(
decoration: BoxDecoration(
color: primaryColor,
borderRadius: BorderRadius.circular(16),
),
padding: const EdgeInsets.symmetric(
vertical: 24,
horizontal: 24,
),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Row(
children: [
Text(
'REFERRAL TEST',
style: TextStyle(
color: Colors.white,
fontSize: 16,
fontWeight: FontWeight.w700,
),
),
const SizedBox(width: 4),
Text(
'SAMPLE_APP',
style: TextStyle(
color: Colors.white,
fontSize: 16,
),
),
],
),
const SizedBox(height: 12),
Text(
appName,
style: TextStyle(
color: Colors.white,
fontSize: 48,
fontWeight: FontWeight.w900,
),
),
],
),
),
],
),
),
],
),
),
);
}
}