Skip to content

Commit 71aef1d

Browse files
chore: update example app
1 parent 29d7a96 commit 71aef1d

File tree

7 files changed

+41
-65
lines changed

7 files changed

+41
-65
lines changed

example/lib/src/app_routes.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ final appRoutes = {
1313
BugReportingPage.screenName: (BuildContext context) =>
1414
const BugReportingPage(),
1515
ComplexPage.screenName: (BuildContext context) => const ComplexPage(),
16-
SessionReplayPage.screenName: (BuildContext context) => const SessionReplayPage(),
16+
SessionReplayPage.screenName: (BuildContext context) =>
17+
const SessionReplayPage(),
1718
TopTabBarScreen.route: (BuildContext context) => const TopTabBarScreen(),
1819

1920
ApmPage.screenName: (BuildContext context) => const ApmPage(),

example/lib/src/components/network_content.dart

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,8 @@ class _NetworkContentState extends State<NetworkContent> {
2929
const Text("W3C Header Section"),
3030
InstabugButton(
3131
text: 'Send Request With Custom traceparent header',
32-
onPressed: () =>
33-
_sendRequestToUrl(endpointUrlController.text,
34-
headers: {"traceparent": "Custom traceparent header"}),
32+
onPressed: () => _sendRequestToUrl(endpointUrlController.text,
33+
headers: {"traceparent": "Custom traceparent header"}),
3534
),
3635
InstabugButton(
3736
text: 'Send Request Without Custom traceparent header',
@@ -45,7 +44,6 @@ class _NetworkContentState extends State<NetworkContent> {
4544
});
4645
},
4746
),
48-
4947
InstabugButton(
5048
text: 'omitLog',
5149
onPressed: () {
@@ -54,7 +52,6 @@ class _NetworkContentState extends State<NetworkContent> {
5452
});
5553
},
5654
),
57-
5855
InstabugButton(
5956
text: 'obfuscateLogWithException',
6057
onPressed: () {
@@ -65,7 +62,6 @@ class _NetworkContentState extends State<NetworkContent> {
6562
});
6663
},
6764
),
68-
6965
InstabugButton(
7066
text: 'omitLogWithException',
7167
onPressed: () {
@@ -82,9 +78,7 @@ class _NetworkContentState extends State<NetworkContent> {
8278

8379
void _sendRequestToUrl(String text, {Map<String, String>? headers}) async {
8480
try {
85-
String url = text
86-
.trim()
87-
.isEmpty ? widget.defaultRequestUrl : text;
81+
String url = text.trim().isEmpty ? widget.defaultRequestUrl : text;
8882
final response = await http.get(Uri.parse(url), headers: headers);
8983

9084
// Handle the response here

example/lib/src/components/non_fatal_crashes_content.dart

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -55,28 +55,24 @@ class _NonFatalCrashesContentState extends State<NonFatalCrashesContent> {
5555
InstabugButton(
5656
text: 'Throw ArgumentError',
5757
key: const Key('non_fatal_argument_exception'),
58-
5958
onPressed: () =>
6059
throwHandledException(ArgumentError('This is an ArgumentError.')),
6160
),
6261
InstabugButton(
6362
text: 'Throw RangeError',
6463
key: const Key('non_fatal_range_exception'),
65-
6664
onPressed: () => throwHandledException(
6765
RangeError.range(5, 0, 3, 'Index out of range')),
6866
),
6967
InstabugButton(
7068
text: 'Throw FormatException',
7169
key: const Key('non_fatal_format_exception'),
72-
7370
onPressed: () =>
7471
throwHandledException(UnsupportedError('Invalid format.')),
7572
),
7673
InstabugButton(
7774
text: 'Throw NoSuchMethodError',
7875
key: const Key('non_fatal_no_such_method_exception'),
79-
8076
onPressed: () {
8177
dynamic obj;
8278
throwHandledException(obj.methodThatDoesNotExist());
@@ -85,7 +81,6 @@ class _NonFatalCrashesContentState extends State<NonFatalCrashesContent> {
8581
const InstabugButton(
8682
text: 'Throw Handled Native Exception',
8783
key: Key('non_fatal_native_exception'),
88-
8984
onPressed:
9085
InstabugFlutterExampleMethodChannel.sendNativeNonFatalCrash,
9186
),
@@ -113,9 +108,8 @@ class _NonFatalCrashesContentState extends State<NonFatalCrashesContent> {
113108
Expanded(
114109
child: InstabugTextField(
115110
label: "User Attribute key",
116-
key: const Key("non_fatal_user_attribute_key_textfield"),
117-
118-
controller: crashUserAttributeKeyController,
111+
key: const Key("non_fatal_user_attribute_key_textfield"),
112+
controller: crashUserAttributeKeyController,
119113
validator: (value) {
120114
if (crashUserAttributeValueController.text.isNotEmpty) {
121115
if (value?.trim().isNotEmpty == true) return null;
@@ -128,9 +122,8 @@ class _NonFatalCrashesContentState extends State<NonFatalCrashesContent> {
128122
Expanded(
129123
child: InstabugTextField(
130124
label: "User Attribute Value",
131-
key: const Key("non_fatal_user_attribute_value_textfield"),
132-
133-
controller: crashUserAttributeValueController,
125+
key: const Key("non_fatal_user_attribute_value_textfield"),
126+
controller: crashUserAttributeValueController,
134127
validator: (value) {
135128
if (crashUserAttributeKeyController.text.isNotEmpty) {
136129
if (value?.trim().isNotEmpty == true) return null;
@@ -147,9 +140,9 @@ class _NonFatalCrashesContentState extends State<NonFatalCrashesContent> {
147140
Expanded(
148141
child: InstabugTextField(
149142
label: "Fingerprint",
150-
key: const Key("non_fatal_user_attribute_fingerprint_textfield"),
151-
152-
controller: crashfingerPrintController,
143+
key: const Key(
144+
"non_fatal_user_attribute_fingerprint_textfield"),
145+
controller: crashfingerPrintController,
153146
)),
154147
],
155148
),
@@ -161,7 +154,6 @@ class _NonFatalCrashesContentState extends State<NonFatalCrashesContent> {
161154
flex: 5,
162155
child: DropdownButtonHideUnderline(
163156
key: const Key("non_fatal_crash_level_dropdown"),
164-
165157
child:
166158
DropdownButtonFormField<NonFatalExceptionLevel>(
167159
value: crashType,

example/lib/src/screens/bug_reporting.dart

Lines changed: 17 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,11 @@ class BugReportingPage extends StatefulWidget {
1010
}
1111

1212
class _BugReportingPageState extends State<BugReportingPage> {
13-
List<ReportType> reportTypes = [ReportType.bug,ReportType.feedback,ReportType.question];
13+
List<ReportType> reportTypes = [
14+
ReportType.bug,
15+
ReportType.feedback,
16+
ReportType.question
17+
];
1418
List<InvocationOption> invocationOptions = [];
1519

1620
final disclaimerTextController = TextEditingController();
@@ -63,9 +67,7 @@ class _BugReportingPageState extends State<BugReportingPage> {
6367
} else {
6468
reportTypes.add(reportType);
6569
}
66-
setState(() {
67-
68-
});
70+
setState(() {});
6971
BugReporting.setReportTypes(reportTypes);
7072
}
7173

@@ -106,6 +108,7 @@ class _BugReportingPageState extends State<BugReportingPage> {
106108
);
107109
});
108110
}
111+
109112
void setOnDismissCallbackWithException() {
110113
BugReporting.setOnDismissCallback((dismissType, reportType) {
111114
throw Exception("Test crash from dismiss callback");
@@ -323,7 +326,6 @@ class _BugReportingPageState extends State<BugReportingPage> {
323326
title: const Text("Screenshot"),
324327
subtitle: const Text('Enable attachment for screenShot'),
325328
key: const Key('attachment_option_screenshot'),
326-
327329
),
328330
CheckboxListTile(
329331
value: attachmentsOptionsExtraScreenshot,
@@ -332,12 +334,10 @@ class _BugReportingPageState extends State<BugReportingPage> {
332334
attachmentsOptionsExtraScreenshot = value ?? false;
333335
});
334336
addAttachmentOptions();
335-
336337
},
337338
title: const Text("Extra Screenshot"),
338339
subtitle: const Text('Enable attachment for extra screenShot'),
339340
key: const Key('attachment_option_extra_screenshot'),
340-
341341
),
342342
CheckboxListTile(
343343
value: attachmentsOptionsGalleryImage,
@@ -346,12 +346,10 @@ class _BugReportingPageState extends State<BugReportingPage> {
346346
attachmentsOptionsGalleryImage = value ?? false;
347347
});
348348
addAttachmentOptions();
349-
350349
},
351350
title: const Text("Gallery"),
352351
subtitle: const Text('Enable attachment for gallery'),
353352
key: const Key('attachment_option_gallery'),
354-
355353
),
356354
CheckboxListTile(
357355
value: attachmentsOptionsScreenRecording,
@@ -360,43 +358,43 @@ class _BugReportingPageState extends State<BugReportingPage> {
360358
attachmentsOptionsScreenRecording = value ?? false;
361359
});
362360
addAttachmentOptions();
363-
364361
},
365362
title: const Text("Screen Recording"),
366363
subtitle: const Text('Enable attachment for screen Recording'),
367364
key: const Key('attachment_option_screen_recording'),
368-
369365
),
370366
],
371367
),
372368
const SectionTitle('Bug reporting type'),
373-
374369
ButtonBar(
375370
mainAxisSize: MainAxisSize.min,
376371
alignment: MainAxisAlignment.start,
377372
children: <Widget>[
378373
ElevatedButton(
379374
key: const Key('bug_report_type_bug'),
380375
style: ElevatedButton.styleFrom(
381-
backgroundColor: reportTypes.contains(ReportType.bug)?Colors.grey.shade400:null
382-
),
376+
backgroundColor: reportTypes.contains(ReportType.bug)
377+
? Colors.grey.shade400
378+
: null),
383379
onPressed: () => toggleReportType(ReportType.bug),
384380
child: const Text('Bug'),
385381
),
386382
ElevatedButton(
387383
key: const Key('bug_report_type_feedback'),
388384
onPressed: () => toggleReportType(ReportType.feedback),
389385
style: ElevatedButton.styleFrom(
390-
backgroundColor: reportTypes.contains(ReportType.feedback)?Colors.grey.shade400:null
391-
),
386+
backgroundColor: reportTypes.contains(ReportType.feedback)
387+
? Colors.grey.shade400
388+
: null),
392389
child: const Text('Feedback'),
393390
),
394391
ElevatedButton(
395392
key: const Key('bug_report_type_question'),
396393
onPressed: () => toggleReportType(ReportType.question),
397394
style: ElevatedButton.styleFrom(
398-
backgroundColor: reportTypes.contains(ReportType.question)?Colors.grey.shade400:null
399-
),
395+
backgroundColor: reportTypes.contains(ReportType.question)
396+
? Colors.grey.shade400
397+
: null),
400398
child: const Text('Question'),
401399
),
402400
],
@@ -419,7 +417,6 @@ class _BugReportingPageState extends State<BugReportingPage> {
419417
onPressed: () => setDisclaimerText,
420418
child: const Text('set disclaimer text'),
421419
),
422-
423420
const SectionTitle('Extended Bug Reporting'),
424421
ButtonBar(
425422
mainAxisSize: MainAxisSize.min,
@@ -462,14 +459,13 @@ class _BugReportingPageState extends State<BugReportingPage> {
462459
onPressed: setOnInvoiceCallback,
463460
text: 'Set On Invoice Callback',
464461
),
465-
466462
InstabugButton(
467463
onPressed: setOnDismissCallbackWithException,
468464
text: 'Set On Dismiss Callback with Exception',
469465
),
470466
InstabugButton(
471467
onPressed: setOnInvokeCallbackWithException,
472-
text: 'Set On Invoice Callback with Exception' ,
468+
text: 'Set On Invoice Callback with Exception',
473469
),
474470
], // This trailing comma makes auto-formatting nicer for build methods.
475471
);

example/lib/src/screens/my_home_page.dart

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,6 @@ class _MyHomePageState extends State<MyHomePage> {
333333
InstabugButton(
334334
onPressed: _navigateToSessionReplay,
335335
text: 'Session Replay',
336-
337336
),
338337
const SectionTitle('Sessions Replay'),
339338
InstabugButton(
@@ -380,9 +379,7 @@ class _MyHomePageState extends State<MyHomePage> {
380379
onPressed: () => removeAllFeatureFlags(),
381380
text: 'RemoveAllFeatureFlags',
382381
),
383-
384382
const SectionTitle('Set User Attribute'),
385-
386383
Form(
387384
key: _formUserAttributeKey,
388385
child: Column(
@@ -412,7 +409,9 @@ class _MyHomePageState extends State<MyHomePage> {
412409
)),
413410
],
414411
),
415-
const SizedBox(height: 8,),
412+
const SizedBox(
413+
height: 8,
414+
),
416415
InstabugButton(
417416
text: 'Set User attribute',
418417
key: const Key('set_user_data_btn'),
@@ -428,11 +427,14 @@ class _MyHomePageState extends State<MyHomePage> {
428427
key: const Key('remove_user_data_btn'),
429428
onPressed: () {
430429
if (_formUserAttributeKey.currentState?.validate() == true) {
431-
Instabug.removeUserAttribute(userAttributeKeyController.text);
430+
Instabug.removeUserAttribute(
431+
userAttributeKeyController.text);
432432
}
433433
},
434434
),
435-
const SizedBox(height: 10,),
435+
const SizedBox(
436+
height: 10,
437+
),
436438
const SectionTitle('Log'),
437439
Padding(
438440
padding: const EdgeInsets.symmetric(horizontal: 20),
@@ -451,7 +453,6 @@ class _MyHomePageState extends State<MyHomePage> {
451453
Expanded(
452454
child: InstabugButton(
453455
margin: const EdgeInsets.symmetric(horizontal: 2),
454-
455456
key: const ValueKey('log_hello_error_btn'),
456457
onPressed: () {
457458
InstabugLog.logError("hello Error");
@@ -462,7 +463,6 @@ class _MyHomePageState extends State<MyHomePage> {
462463
Expanded(
463464
child: InstabugButton(
464465
margin: const EdgeInsets.symmetric(horizontal: 2),
465-
466466
key: const ValueKey('hello_warning_btn'),
467467
onPressed: () {
468468
InstabugLog.logWarn("hello Warning");
@@ -480,7 +480,6 @@ class _MyHomePageState extends State<MyHomePage> {
480480
Expanded(
481481
child: InstabugButton(
482482
margin: const EdgeInsets.symmetric(horizontal: 2),
483-
484483
key: const ValueKey('log_hello_info_btn'),
485484
onPressed: () {
486485
InstabugLog.logInfo("hello Info");
@@ -491,19 +490,16 @@ class _MyHomePageState extends State<MyHomePage> {
491490
Expanded(
492491
child: InstabugButton(
493492
margin: const EdgeInsets.symmetric(horizontal: 2),
494-
495493
key: const ValueKey('log_hello_verbose_btn'),
496494
onPressed: () {
497495
InstabugLog.logVerbose("hello Verbose");
498496
},
499497
text: 'Log Hello Verbose',
500498
),
501499
),
502-
503500
Expanded(
504501
child: InstabugButton(
505502
margin: const EdgeInsets.symmetric(horizontal: 2),
506-
507503
key: const ValueKey('clear_logs_btn'),
508504
onPressed: () {
509505
InstabugLog.clearAllLogs();
@@ -514,7 +510,6 @@ class _MyHomePageState extends State<MyHomePage> {
514510
],
515511
),
516512
),
517-
518513
],
519514
),
520515
),

0 commit comments

Comments
 (0)