diff --git a/lib/screens/onboarding_git_url.dart b/lib/screens/onboarding_git_url.dart index 00e7aa9e..e7af6a4c 100644 --- a/lib/screens/onboarding_git_url.dart +++ b/lib/screens/onboarding_git_url.dart @@ -1,6 +1,8 @@ import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; +import 'package:journal/analytics.dart'; + class OnBoardingGitUrl extends StatefulWidget { final Function doneFunction; @@ -110,7 +112,7 @@ class OnBoardingButton extends StatelessWidget { style: Theme.of(context).textTheme.button, ), color: Theme.of(context).primaryColor, - onPressed: onPressed, + onPressed: this._onPressedWithAnalytics, ), ); } else { @@ -124,9 +126,21 @@ class OnBoardingButton extends StatelessWidget { ), icon: Image.asset(iconUrl, width: 32, height: 32), color: Theme.of(context).primaryColor, - onPressed: onPressed, + onPressed: this._onPressedWithAnalytics, ), ); } } + + void _onPressedWithAnalytics() { + print("onboarding_button_click " + text); + getAnalytics().logEvent( + name: "onboarding_button_click", + parameters: { + 'text': text, + 'icon_url': iconUrl == null ? "" : iconUrl, + }, + ); + onPressed(); + } } diff --git a/lib/screens/onboarding_screens.dart b/lib/screens/onboarding_screens.dart index ca57ff15..815ee13e 100644 --- a/lib/screens/onboarding_screens.dart +++ b/lib/screens/onboarding_screens.dart @@ -353,30 +353,14 @@ class OnBoardingInitialChoice extends StatelessWidget { style: Theme.of(context).textTheme.headline, ), SizedBox(height: 8.0), - SizedBox( - width: double.infinity, - child: RaisedButton( - child: Text( - "Create a New Repo", - textAlign: TextAlign.center, - style: Theme.of(context).textTheme.button, - ), - color: Theme.of(context).primaryColor, - onPressed: onCreateNewRepo, - ), + OnBoardingButton( + text: "Create a New Repo", + onPressed: onCreateNewRepo, ), SizedBox(height: 8.0), - SizedBox( - width: double.infinity, - child: RaisedButton( - child: Text( - "I already have one", - textAlign: TextAlign.center, - style: Theme.of(context).textTheme.button, - ), - color: Theme.of(context).primaryColor, - onPressed: onExistingRepo, - ), + OnBoardingButton( + text: "I already have one", + onPressed: onExistingRepo, ), ], mainAxisAlignment: MainAxisAlignment.center,