Skip to content

Commit

Permalink
Add an example to the repo
Browse files Browse the repository at this point in the history
This adds an example to the repo

[changelog]
added: Added an example directory to include a quick example to be displayed on pub.dev
  • Loading branch information
anthonycastelli committed May 15, 2024
1 parent c0440f2 commit cea324b
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 0 deletions.
Empty file added example/lib/main.dart
Empty file.
47 changes: 47 additions & 0 deletions example/main.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import 'package:appfit/appfit.dart';
import 'package:flutter/material.dart';

void main() {
runApp(const MyApp());
}

class MyApp extends StatelessWidget {
const MyApp({super.key});

@override
Widget build(BuildContext context) {
return const MaterialApp(
title: 'AppFit Example',
home: AppFitExample(),
);
}
}

class AppFitExample extends StatefulWidget {
const AppFitExample({super.key});

@override
AppFitExampleState createState() => AppFitExampleState();
}

class AppFitExampleState extends State<AppFitExample> {
final appFit = AppFit(configuration: AppFitConfiguration(apiKey: "API_KEY"));

@override
void initState() {
super.initState();
appFit.trackEvent('screen_name', properties: {'name': 'AppFit Example'});
}

@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('AppFit Example'),
),
body: const Center(
child: Text("Welcome to the AppFit example app."),
),
);
}
}

0 comments on commit cea324b

Please sign in to comment.