Skip to content

Commit 9dba37b

Browse files
authored
Big reformat (#43)
* Reformat everything since it seems like formatting has changed significantly * Run format again after pub get * Revert example_module formatting, we should fix CI so that this gets pub-get-ed properly * update example.md
1 parent cab7433 commit 9dba37b

19 files changed

Lines changed: 502 additions & 431 deletions

‎example/example.md‎

Lines changed: 198 additions & 183 deletions
Large diffs are not rendered by default.

‎example/lib/capture_status.dart‎

Lines changed: 39 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,7 @@ import 'package:fullstory_flutter/fs.dart';
55
// and creates a FSStatusListener to be notified when a session starts
66

77
class CaptureStatus extends StatefulWidget {
8-
const CaptureStatus({
9-
super.key,
10-
});
8+
const CaptureStatus({super.key});
119

1210
@override
1311
State<CaptureStatus> createState() => _CaptureStatusState();
@@ -25,16 +23,20 @@ class _CaptureStatusState extends State<CaptureStatus> with FSStatusListener {
2523
super.initState();
2624

2725
// grab the current session URL & ID in case it has already started
28-
FS.currentSessionURL().then((url) => setState(() {
29-
if (url != null) {
30-
// if there is a url, we know the session started
31-
this.url = url;
32-
status = "Started";
33-
}
34-
}));
35-
FS.currentSession.then((id) => setState(() {
36-
this.id = id ?? "";
37-
}));
26+
FS.currentSessionURL().then(
27+
(url) => setState(() {
28+
if (url != null) {
29+
// if there is a url, we know the session started
30+
this.url = url;
31+
status = "Started";
32+
}
33+
}),
34+
);
35+
FS.currentSession.then(
36+
(id) => setState(() {
37+
this.id = id ?? "";
38+
}),
39+
);
3840

3941
// set the status listener to handle future changes
4042
FS.addStatusListener(this);
@@ -53,9 +55,11 @@ class _CaptureStatusState extends State<CaptureStatus> with FSStatusListener {
5355
setState(() {
5456
status = "Started";
5557
this.url = url;
56-
FS.currentSession.then((id) => setState(() {
57-
this.id = id ?? "";
58-
}));
58+
FS.currentSession.then(
59+
(id) => setState(() {
60+
this.id = id ?? "";
61+
}),
62+
);
5963
});
6064
}
6165
// Other events (session ended, disabled, error, etc.) are not currently supported, but may be added in a future version of the library
@@ -67,24 +71,28 @@ class _CaptureStatusState extends State<CaptureStatus> with FSStatusListener {
6771
Wrap(
6872
children: [
6973
TextButton(
70-
onPressed: () {
71-
FS.shutdown();
72-
// manually do this one since only the iOS SDK has a callback for it
73-
setState(() {
74-
status = "Shutdown";
75-
url = "";
76-
id = "";
77-
});
78-
},
79-
child: const Text("Shutdown")),
74+
onPressed: () {
75+
FS.shutdown();
76+
// manually do this one since only the iOS SDK has a callback for it
77+
setState(() {
78+
status = "Shutdown";
79+
url = "";
80+
id = "";
81+
});
82+
},
83+
child: const Text("Shutdown"),
84+
),
8085
const TextButton(onPressed: FS.restart, child: Text("Restart")),
8186
TextButton(
82-
onPressed: () {
83-
FS.currentSessionURL(now: true).then((url) => setState(() {
87+
onPressed: () {
88+
FS.currentSessionURL(now: true).then(
89+
(url) => setState(() {
8490
urlNow = url ?? "";
85-
}));
86-
},
87-
child: const Text("Update Timestamped URL"))
91+
}),
92+
);
93+
},
94+
child: const Text("Update Timestamped URL"),
95+
),
8896
],
8997
),
9098
SelectableText("Status: $status\nURL: $url\nNow: $urlNow\nID: $id"),

‎example/lib/events.dart‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,7 @@ import 'package:fullstory_flutter/fs.dart';
55
// These will show up in the event list on the right side of session replays
66

77
class Events extends StatelessWidget {
8-
const Events({
9-
super.key,
10-
});
8+
const Events({super.key});
119

1210
@override
1311
Widget build(BuildContext context) {
@@ -50,7 +48,7 @@ class Events extends StatelessWidget {
5048
],
5149
}),
5250
child: const Text('Order Completed event'),
53-
)
51+
),
5452
],
5553
);
5654
}

‎example/lib/identity.dart‎

Lines changed: 77 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -16,80 +16,85 @@ class _IdentityState extends State<Identity> {
1616

1717
@override
1818
Widget build(BuildContext context) {
19-
return Column(children: [
20-
TextField(
21-
decoration: const InputDecoration(
22-
border: OutlineInputBorder(),
23-
hintText: 'displayName',
24-
),
25-
onChanged: (value) => setState(() {
26-
displayName = value;
27-
}),
28-
// allow the keyboard to be hidden - why is this not the default behavior?
29-
onTapOutside: (event) => FocusManager.instance.primaryFocus?.unfocus(),
30-
),
31-
TextField(
32-
decoration: const InputDecoration(
33-
border: OutlineInputBorder(),
34-
hintText: 'email',
35-
),
36-
onChanged: (value) => setState(() {
37-
email = value;
38-
}),
39-
onTapOutside: (event) => FocusManager.instance.primaryFocus?.unfocus(),
40-
),
41-
TextField(
42-
decoration: const InputDecoration(
43-
border: OutlineInputBorder(),
44-
hintText: 'uid',
45-
),
46-
onChanged: (value) => setState(() {
47-
uid = value;
48-
}),
49-
onTapOutside: (event) => FocusManager.instance.primaryFocus?.unfocus(),
50-
),
51-
Wrap(
52-
children: [
53-
TextButton(
54-
child: const Text('Identify'),
55-
onPressed: () {
56-
FS.identify(uid);
57-
},
58-
),
59-
TextButton(
60-
child: const Text('Identify w/ userVars'),
61-
onPressed: () {
62-
FS.identify(uid, {
63-
// email and displayName are used by Fullstory, everything else is arbitrary
64-
'source': 'identify',
65-
'when': DateTime.now().toString(),
66-
'displayName': displayName,
67-
'email': email,
68-
'extraInfo': 'foo'
69-
});
70-
},
19+
return Column(
20+
children: [
21+
TextField(
22+
decoration: const InputDecoration(
23+
border: OutlineInputBorder(),
24+
hintText: 'displayName',
7125
),
72-
TextButton(
73-
child: const Text('setUserVars'),
74-
onPressed: () {
75-
FS.setUserVars({
76-
// ditto above: email and displayName are used by Fullstory, everything else is arbitrary
77-
'source': 'setUserVars',
78-
'when': DateTime.now().toString(),
79-
'displayName': displayName,
80-
'email': email,
81-
'membershipLevel': 'bar'
82-
});
83-
},
26+
onChanged: (value) => setState(() {
27+
displayName = value;
28+
}),
29+
// allow the keyboard to be hidden - why is this not the default behavior?
30+
onTapOutside: (event) =>
31+
FocusManager.instance.primaryFocus?.unfocus(),
32+
),
33+
TextField(
34+
decoration: const InputDecoration(
35+
border: OutlineInputBorder(),
36+
hintText: 'email',
8437
),
85-
TextButton(
86-
child: const Text('Anonymize'),
87-
onPressed: () {
88-
FS.anonymize();
89-
},
38+
onChanged: (value) => setState(() {
39+
email = value;
40+
}),
41+
onTapOutside: (event) =>
42+
FocusManager.instance.primaryFocus?.unfocus(),
43+
),
44+
TextField(
45+
decoration: const InputDecoration(
46+
border: OutlineInputBorder(),
47+
hintText: 'uid',
9048
),
91-
],
92-
),
93-
]);
49+
onChanged: (value) => setState(() {
50+
uid = value;
51+
}),
52+
onTapOutside: (event) =>
53+
FocusManager.instance.primaryFocus?.unfocus(),
54+
),
55+
Wrap(
56+
children: [
57+
TextButton(
58+
child: const Text('Identify'),
59+
onPressed: () {
60+
FS.identify(uid);
61+
},
62+
),
63+
TextButton(
64+
child: const Text('Identify w/ userVars'),
65+
onPressed: () {
66+
FS.identify(uid, {
67+
// email and displayName are used by Fullstory, everything else is arbitrary
68+
'source': 'identify',
69+
'when': DateTime.now().toString(),
70+
'displayName': displayName,
71+
'email': email,
72+
'extraInfo': 'foo',
73+
});
74+
},
75+
),
76+
TextButton(
77+
child: const Text('setUserVars'),
78+
onPressed: () {
79+
FS.setUserVars({
80+
// ditto above: email and displayName are used by Fullstory, everything else is arbitrary
81+
'source': 'setUserVars',
82+
'when': DateTime.now().toString(),
83+
'displayName': displayName,
84+
'email': email,
85+
'membershipLevel': 'bar',
86+
});
87+
},
88+
),
89+
TextButton(
90+
child: const Text('Anonymize'),
91+
onPressed: () {
92+
FS.anonymize();
93+
},
94+
),
95+
],
96+
),
97+
],
98+
);
9499
}
95100
}

‎example/lib/log.dart‎

Lines changed: 32 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -18,35 +18,41 @@ class _LogState extends State<Log> {
1818

1919
@override
2020
Widget build(BuildContext context) {
21-
return Column(children: [
22-
TextField(
23-
decoration: const InputDecoration(
24-
border: OutlineInputBorder(),
25-
hintText: 'Log message...',
26-
),
27-
onChanged: (value) => message = value,
28-
// allow the keyboard to be hidden - why is this not the default behavior?
29-
onTapOutside: (event) => FocusManager.instance.primaryFocus?.unfocus(),
30-
),
31-
Row(
32-
children: [
33-
const Text("Level:"),
34-
DropdownMenu(
35-
dropdownMenuEntries: FSLogLevel.values
36-
.map<DropdownMenuEntry<FSLogLevel>>((FSLogLevel level) {
37-
return DropdownMenuEntry<FSLogLevel>(
38-
value: level, label: level.name);
39-
}).toList(),
40-
initialSelection: level,
41-
onSelected: (value) => level = value!,
21+
return Column(
22+
children: [
23+
TextField(
24+
decoration: const InputDecoration(
25+
border: OutlineInputBorder(),
26+
hintText: 'Log message...',
4227
),
43-
TextButton(
28+
onChanged: (value) => message = value,
29+
// allow the keyboard to be hidden - why is this not the default behavior?
30+
onTapOutside: (event) =>
31+
FocusManager.instance.primaryFocus?.unfocus(),
32+
),
33+
Row(
34+
children: [
35+
const Text("Level:"),
36+
DropdownMenu(
37+
dropdownMenuEntries: FSLogLevel.values
38+
.map<DropdownMenuEntry<FSLogLevel>>((FSLogLevel level) {
39+
return DropdownMenuEntry<FSLogLevel>(
40+
value: level,
41+
label: level.name,
42+
);
43+
}).toList(),
44+
initialSelection: level,
45+
onSelected: (value) => level = value!,
46+
),
47+
TextButton(
4448
onPressed: () {
4549
FS.log(message: message, level: level);
4650
},
47-
child: const Text('Log'))
48-
],
49-
),
50-
]);
51+
child: const Text('Log'),
52+
),
53+
],
54+
),
55+
],
56+
);
5157
}
5258
}

0 commit comments

Comments
 (0)