Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

prefer const #95

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
75 changes: 27 additions & 48 deletions example/lib/event.dart
Original file line number Diff line number Diff line change
Expand Up @@ -34,31 +34,29 @@ class _EventScreenState extends State<EventScreen> {

@override
Widget build(BuildContext context) {
final width = MediaQuery.of(context).size.width;
final defaultWidth = width * 0.65;
return Scaffold(
appBar: AppBar(
backgroundColor: Color(0xff4f44e0),
title: Text("Event"),
title: const Text("Event"),
),
body: Center(
child: ListView(
children: [
const SizedBox(height: 40),
SizedBox(
height: 40,
),
SizedBox(
width: MediaQuery.of(context).size.width * 0.65,
width: defaultWidth,
child: MixpanelButton(
text: 'Track w/o Properties',
onPressed: () {
_mixpanel.track("Track Event!");
},
),
),
const SizedBox(height: 20),
SizedBox(
height: 20,
),
SizedBox(
width: MediaQuery.of(context).size.width * 0.65,
width: defaultWidth,
child: MixpanelButton(
text: 'Track with Properties',
onPressed: () {
Expand All @@ -79,36 +77,31 @@ class _EventScreenState extends State<EventScreen> {
},
),
),
const SizedBox(height: 20),
SizedBox(
height: 20,
),
SizedBox(
width: MediaQuery.of(context).size.width * 0.65,
width: defaultWidth,
child: MixpanelButton(
text: 'Identify',
onPressed: () {
_mixpanel.identify("testDistinctId3");
},
),
),
const SizedBox(height: 20),
SizedBox(
height: 20,
),
SizedBox(
width: MediaQuery.of(context).size.width * 0.65,
width: defaultWidth,
child: MixpanelButton(
text: 'Get Distinct ID',
onPressed: () async {
String? distinctId = await _mixpanel.getDistinctId();
Widget okButton = TextButton(
child: Text("OK"),
child: const Text("OK"),
onPressed: () {
Navigator.of(context).pop();
},
);

AlertDialog alert = AlertDialog(
title: Text("Result"),
title: const Text("Result"),
content: Text("${distinctId}"),
actions: [
okButton,
Expand All @@ -125,11 +118,9 @@ class _EventScreenState extends State<EventScreen> {
},
),
),
const SizedBox(height: 20),
SizedBox(
height: 20,
),
SizedBox(
width: MediaQuery.of(context).size.width * 0.65,
width: defaultWidth,
child: MixpanelButton(
text: 'Time Event 2 secs',
onPressed: () {
Expand All @@ -141,11 +132,9 @@ class _EventScreenState extends State<EventScreen> {
},
),
),
const SizedBox(height: 20),
SizedBox(
height: 20,
),
SizedBox(
width: MediaQuery.of(context).size.width * 0.65,
width: defaultWidth,
child: MixpanelButton(
text: 'Get Current SuperProperties',
onPressed: () async {
Expand All @@ -154,23 +143,19 @@ class _EventScreenState extends State<EventScreen> {
_showAlert(context, "Super Properties", jsonString);
}),
),
const SizedBox(height: 20),
SizedBox(
height: 20,
),
SizedBox(
width: MediaQuery.of(context).size.width * 0.65,
width: defaultWidth,
child: MixpanelButton(
text: 'Clear SuperProperties',
onPressed: () {
_mixpanel.clearSuperProperties();
},
),
),
const SizedBox(height: 20),
SizedBox(
height: 20,
),
SizedBox(
width: MediaQuery.of(context).size.width * 0.65,
width: defaultWidth,
child: MixpanelButton(
text: 'Register SuperProperties',
onPressed: () {
Expand All @@ -181,11 +166,9 @@ class _EventScreenState extends State<EventScreen> {
},
),
),
const SizedBox(height: 20),
SizedBox(
height: 20,
),
SizedBox(
width: MediaQuery.of(context).size.width * 0.65,
width: defaultWidth,
child: MixpanelButton(
text: 'Register SuperProperties Once',
onPressed: () {
Expand All @@ -194,23 +177,19 @@ class _EventScreenState extends State<EventScreen> {
},
),
),
const SizedBox(height: 20),
SizedBox(
height: 20,
),
SizedBox(
width: MediaQuery.of(context).size.width * 0.65,
width: defaultWidth,
child: MixpanelButton(
text: 'Unregister SuperProperty',
onPressed: () {
_mixpanel.unregisterSuperProperty("super property");
},
),
),
const SizedBox(height: 20),
SizedBox(
height: 20,
),
SizedBox(
width: MediaQuery.of(context).size.width * 0.65,
width: defaultWidth,
child: MixpanelButton(
text: 'Flush',
onPressed: () {
Expand Down
16 changes: 7 additions & 9 deletions example/lib/gdpr.dart
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ class _GDPRScreenState extends State<GDPRScreen> {

@override
Widget build(BuildContext context) {
final width = MediaQuery.of(context).size.width;
final defaultWidth = width * 0.65;
return Scaffold(
appBar: AppBar(
backgroundColor: Color(0xff4f44e0),
Expand All @@ -61,31 +63,27 @@ class _GDPRScreenState extends State<GDPRScreen> {
height: 40,
),
SizedBox(
width: MediaQuery.of(context).size.width * 0.65,
width: defaultWidth,
child: MixpanelButton(
text: 'Opt In',
onPressed: () {
_mixpanel.optInTracking();
},
),
),
const SizedBox(height: 20),
SizedBox(
height: 20,
),
SizedBox(
width: MediaQuery.of(context).size.width * 0.65,
width: defaultWidth,
child: MixpanelButton(
text: 'Opt Out',
onPressed: () {
_mixpanel.optOutTracking();
},
),
),
const SizedBox(height: 20),
SizedBox(
height: 20,
),
SizedBox(
width: MediaQuery.of(context).size.width * 0.65,
width: defaultWidth,
child: MixpanelButton(
text: 'Has opted out',
onPressed: () async {
Expand Down
Loading