Skip to content

Commit 6c562b7

Browse files
authored
chore: format example (#892)
1 parent 926a09c commit 6c562b7

File tree

12 files changed

+314
-407
lines changed

12 files changed

+314
-407
lines changed

.github/workflows/build.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
3232
uses: actions/checkout@v4
3333
- uses: ./.github/actions/setup-flutter
3434
- name: Dart Format Check
35-
run: dart format lib/ test/ --set-exit-if-changed
35+
run: dart format . --set-exit-if-changed
3636

3737
import-sorter-check:
3838
name: Import Sorter Check

example/analysis_options.yaml

Lines changed: 19 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -27,33 +27,30 @@
2727
include: package:flutter_lints/flutter.yaml
2828

2929
analyzer:
30-
#
31-
# Enforce stricter type-checking
32-
# https://dart.dev/guides/language/analysis-options#enabling-additional-type-checks
33-
# https://dash-overflow.net/articles/getting_started/#step-3-disabling-_implicit-dynamic_--_implicit-cast_
34-
#
35-
36-
#
37-
# exclude protobuf files
38-
#
30+
errors:
31+
constant_identifier_names: ignore
32+
no_wildcard_variable_uses: ignore
33+
use_super_parameters: ignore
34+
35+
# Exclude protobuf files
3936
exclude:
40-
- '**/*.pb.dart'
41-
- '**/*.pbenum.dart'
42-
- '**/*.pbjson.dart'
43-
- '**/*.pbserver.dart'
37+
- "**/*.pb.dart"
38+
- "**/*.pbenum.dart"
39+
- "**/*.pbjson.dart"
40+
- "**/*.pbserver.dart"
4441

4542
linter:
4643
rules:
47-
#
48-
# Additional recommended rules
49-
#
44+
# Preference of the SDK
5045
prefer_single_quotes: true
46+
prefer_final_locals: true
5147
unnecessary_brace_in_string_interps: false
48+
avoid_print: true
49+
50+
# Enforce this for correct async logic
5251
unawaited_futures: true
52+
discarded_futures: true
5353

54-
#
55-
# Turn off avoid_print for example projects
56-
#
57-
avoid_print: false
58-
depend_on_referenced_packages: false
59-
use_build_context_synchronously: false
54+
formatter:
55+
page_width: 120
56+
trailing_commas: preserve

example/lib/exts.dart

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,7 @@ extension LKExampleExt on BuildContext {
2424
context: this,
2525
builder: (ctx) => AlertDialog(
2626
title: const Text('Play Audio'),
27-
content: const Text(
28-
'You need to manually activate audio PlayBack for iOS Safari !'),
27+
content: const Text('You need to manually activate audio PlayBack for iOS Safari !'),
2928
actions: [
3029
TextButton(
3130
onPressed: () => Navigator.pop(ctx, false),
@@ -43,8 +42,7 @@ extension LKExampleExt on BuildContext {
4342
context: this,
4443
builder: (ctx) => AlertDialog(
4544
title: const Text('UnPublish'),
46-
content:
47-
const Text('Would you like to un-publish your Camera & Mic ?'),
45+
content: const Text('Would you like to un-publish your Camera & Mic ?'),
4846
actions: [
4947
TextButton(
5048
onPressed: () => Navigator.pop(ctx, false),
@@ -126,8 +124,7 @@ extension LKExampleExt on BuildContext {
126124
context: this,
127125
builder: (ctx) => AlertDialog(
128126
title: const Text('Send data'),
129-
content: const Text(
130-
'This will send a sample data to all participants in the room'),
127+
content: const Text('This will send a sample data to all participants in the room'),
131128
actions: [
132129
TextButton(
133130
onPressed: () => Navigator.pop(ctx, false),
@@ -155,14 +152,11 @@ extension LKExampleExt on BuildContext {
155152
),
156153
);
157154

158-
Future<bool?> showRecordingStatusChangedDialog(bool isActiveRecording) =>
159-
showDialog<bool>(
155+
Future<bool?> showRecordingStatusChangedDialog(bool isActiveRecording) => showDialog<bool>(
160156
context: this,
161157
builder: (ctx) => AlertDialog(
162158
title: const Text('Room recording reminder'),
163-
content: Text(isActiveRecording
164-
? 'Room recording is active.'
165-
: 'Room recording is stoped.'),
159+
content: Text(isActiveRecording ? 'Room recording is active.' : 'Room recording is stoped.'),
166160
actions: [
167161
TextButton(
168162
onPressed: () => Navigator.pop(ctx, true),
@@ -176,8 +170,7 @@ extension LKExampleExt on BuildContext {
176170
context: this,
177171
builder: (ctx) => AlertDialog(
178172
title: const Text('Allow subscription'),
179-
content: const Text(
180-
'Allow all participants to subscribe tracks published by local participant?'),
173+
content: const Text('Allow all participants to subscribe tracks published by local participant?'),
181174
actions: [
182175
TextButton(
183176
onPressed: () => Navigator.pop(ctx, false),
@@ -191,8 +184,7 @@ extension LKExampleExt on BuildContext {
191184
),
192185
);
193186

194-
Future<SimulateScenarioResult?> showSimulateScenarioDialog() =>
195-
showDialog<SimulateScenarioResult>(
187+
Future<SimulateScenarioResult?> showSimulateScenarioDialog() => showDialog<SimulateScenarioResult>(
196188
context: this,
197189
builder: (ctx) => SimpleDialog(
198190
title: const Text('Simulate Scenario'),

example/lib/pages/connect.dart

Lines changed: 32 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,8 @@ class _ConnectPageState extends State<ConnectPage> {
8181
// Read saved URL and Token
8282
Future<void> _readPrefs() async {
8383
final prefs = await SharedPreferences.getInstance();
84-
_uriCtrl.text = const bool.hasEnvironment('URL')
85-
? const String.fromEnvironment('URL')
86-
: prefs.getString(_storeKeyUri) ?? '';
84+
_uriCtrl.text =
85+
const bool.hasEnvironment('URL') ? const String.fromEnvironment('URL') : prefs.getString(_storeKeyUri) ?? '';
8786
_tokenCtrl.text = const bool.hasEnvironment('TOKEN')
8887
? const String.fromEnvironment('TOKEN')
8988
: prefs.getString(_storeKeyToken) ?? '';
@@ -142,8 +141,7 @@ class _ConnectPageState extends State<ConnectPage> {
142141
adaptiveStream: _adaptiveStream,
143142
dynacast: _dynacast,
144143
preferredCodec: _preferredCodec,
145-
enableBackupVideoCodec:
146-
['VP9', 'AV1'].contains(_preferredCodec),
144+
enableBackupVideoCodec: ['VP9', 'AV1'].contains(_preferredCodec),
147145
),
148146
)),
149147
);
@@ -302,43 +300,35 @@ class _ConnectPageState extends State<ConnectPage> {
302300
if (_multiCodec)
303301
Padding(
304302
padding: const EdgeInsets.only(bottom: 5),
305-
child: Row(
306-
mainAxisAlignment: MainAxisAlignment.spaceBetween,
307-
children: [
308-
const Text('Preferred Codec:'),
309-
DropdownButton<String>(
310-
value: _preferredCodec,
311-
icon: const Icon(
312-
Icons.arrow_drop_down,
313-
color: Colors.blue,
314-
),
315-
elevation: 16,
316-
style: const TextStyle(color: Colors.blue),
317-
underline: Container(
318-
height: 2,
319-
color: Colors.blueAccent,
320-
),
321-
onChanged: (String? value) {
322-
// This is called when the user selects an item.
323-
setState(() {
324-
_preferredCodec = value!;
325-
});
326-
},
327-
items: [
328-
'Preferred Codec',
329-
'AV1',
330-
'VP9',
331-
'VP8',
332-
'H264',
333-
'H265'
334-
].map<DropdownMenuItem<String>>((String value) {
335-
return DropdownMenuItem<String>(
336-
value: value,
337-
child: Text(value),
338-
);
339-
}).toList(),
340-
)
341-
])),
303+
child: Row(mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [
304+
const Text('Preferred Codec:'),
305+
DropdownButton<String>(
306+
value: _preferredCodec,
307+
icon: const Icon(
308+
Icons.arrow_drop_down,
309+
color: Colors.blue,
310+
),
311+
elevation: 16,
312+
style: const TextStyle(color: Colors.blue),
313+
underline: Container(
314+
height: 2,
315+
color: Colors.blueAccent,
316+
),
317+
onChanged: (String? value) {
318+
// This is called when the user selects an item.
319+
setState(() {
320+
_preferredCodec = value!;
321+
});
322+
},
323+
items: ['Preferred Codec', 'AV1', 'VP9', 'VP8', 'H264', 'H265']
324+
.map<DropdownMenuItem<String>>((String value) {
325+
return DropdownMenuItem<String>(
326+
value: value,
327+
child: Text(value),
328+
);
329+
}).toList(),
330+
)
331+
])),
342332
ElevatedButton(
343333
onPressed: _busy ? null : () => _connect(context),
344334
child: Row(

0 commit comments

Comments
 (0)