mirror of
https://github.com/GitJournal/GitJournal.git
synced 2025-06-28 18:03:14 +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/material.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
|
|
||||||
|
import 'package:journal/analytics.dart';
|
||||||
|
|
||||||
class OnBoardingGitUrl extends StatefulWidget {
|
class OnBoardingGitUrl extends StatefulWidget {
|
||||||
final Function doneFunction;
|
final Function doneFunction;
|
||||||
|
|
||||||
@ -110,7 +112,7 @@ class OnBoardingButton extends StatelessWidget {
|
|||||||
style: Theme.of(context).textTheme.button,
|
style: Theme.of(context).textTheme.button,
|
||||||
),
|
),
|
||||||
color: Theme.of(context).primaryColor,
|
color: Theme.of(context).primaryColor,
|
||||||
onPressed: onPressed,
|
onPressed: this._onPressedWithAnalytics,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
@ -124,9 +126,21 @@ class OnBoardingButton extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
icon: Image.asset(iconUrl, width: 32, height: 32),
|
icon: Image.asset(iconUrl, width: 32, height: 32),
|
||||||
color: Theme.of(context).primaryColor,
|
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,31 +353,15 @@ class OnBoardingInitialChoice extends StatelessWidget {
|
|||||||
style: Theme.of(context).textTheme.headline,
|
style: Theme.of(context).textTheme.headline,
|
||||||
),
|
),
|
||||||
SizedBox(height: 8.0),
|
SizedBox(height: 8.0),
|
||||||
SizedBox(
|
OnBoardingButton(
|
||||||
width: double.infinity,
|
text: "Create a New Repo",
|
||||||
child: RaisedButton(
|
|
||||||
child: Text(
|
|
||||||
"Create a New Repo",
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
style: Theme.of(context).textTheme.button,
|
|
||||||
),
|
|
||||||
color: Theme.of(context).primaryColor,
|
|
||||||
onPressed: onCreateNewRepo,
|
onPressed: onCreateNewRepo,
|
||||||
),
|
),
|
||||||
),
|
|
||||||
SizedBox(height: 8.0),
|
SizedBox(height: 8.0),
|
||||||
SizedBox(
|
OnBoardingButton(
|
||||||
width: double.infinity,
|
text: "I already have one",
|
||||||
child: RaisedButton(
|
|
||||||
child: Text(
|
|
||||||
"I already have one",
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
style: Theme.of(context).textTheme.button,
|
|
||||||
),
|
|
||||||
color: Theme.of(context).primaryColor,
|
|
||||||
onPressed: onExistingRepo,
|
onPressed: onExistingRepo,
|
||||||
),
|
),
|
||||||
),
|
|
||||||
],
|
],
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
Reference in New Issue
Block a user