-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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
1 parent
c0440f2
commit cea324b
Showing
2 changed files
with
47 additions
and
0 deletions.
There are no files selected for viewing
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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."), | ||
), | ||
); | ||
} | ||
} |