mirror of
https://github.com/GitJournal/GitJournal.git
synced 2025-06-28 01:45:55 +08:00
OnBoarding: Send analytics on each button press
This commit is contained in:
@ -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: <String, dynamic>{
|
||||
'text': text,
|
||||
'icon_url': iconUrl == null ? "" : iconUrl,
|
||||
},
|
||||
);
|
||||
onPressed();
|
||||
}
|
||||
}
|
||||
|
@ -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,
|
||||
|
Reference in New Issue
Block a user