Skip to content

Commit d40d2a8

Browse files
committed
* format
Signed-off-by: Alex Yackers <7115964+yackers@users.noreply.github.com>
1 parent 02ab62b commit d40d2a8

6 files changed

Lines changed: 102 additions & 44 deletions

File tree

example/lib/src/ui/widgets/method_action_button.dart

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,26 +21,34 @@ class MethodActionButton extends StatelessWidget {
2121

2222
Widget _descriptionWidget(BuildContext context) => Container(
2323
padding: const EdgeInsets.symmetric(horizontal: 4, vertical: 2),
24-
child: Row(crossAxisAlignment: CrossAxisAlignment.start, mainAxisSize: MainAxisSize.min, children: [
25-
Flexible(child: description!),
26-
]),
24+
child: Row(
25+
crossAxisAlignment: CrossAxisAlignment.start,
26+
mainAxisSize: MainAxisSize.min,
27+
children: [
28+
Flexible(child: description!),
29+
]),
2730
);
2831

29-
Widget _iconButton(BuildContext context, {VoidCallback? onPress}) => IconButton(
32+
Widget _iconButton(BuildContext context, {VoidCallback? onPress}) =>
33+
IconButton(
3034
onPressed: onPress,
3135
icon: Icon(iconButton),
3236
visualDensity: VisualDensity.compact,
3337
color: iconColor,
3438
);
3539

36-
Widget _elevateButton(BuildContext context, {VoidCallback? onPress}) => ElevatedButton(
40+
Widget _elevateButton(BuildContext context, {VoidCallback? onPress}) =>
41+
ElevatedButton(
3742
onPressed: onPress,
3843
style: ElevatedButton.styleFrom(
39-
foregroundColor:
40-
description != null ? Theme.of(context).colorScheme.onSecondaryContainer : Theme.of(context).primaryColor,
44+
foregroundColor: description != null
45+
? Theme.of(context).colorScheme.onSecondaryContainer
46+
: Theme.of(context).primaryColor,
4147
backgroundColor: description != null
4248
? Theme.of(context).colorScheme.secondaryContainer
43-
: Theme.of(context).primaryColorDark.withAlpha((255.0 * 0.1).round()),
49+
: Theme.of(context)
50+
.primaryColorDark
51+
.withAlpha((255.0 * 0.1).round()),
4452
visualDensity: VisualDensity.compact,
4553
padding: EdgeInsets.symmetric(horizontal: 5, vertical: 0),
4654
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(5)),
@@ -60,8 +68,10 @@ class MethodActionButton extends StatelessWidget {
6068
Widget _buttonWidget(BuildContext context) => ValueListenableBuilder<bool>(
6169
valueListenable: isProcessing,
6270
builder: (context, processing, child) => iconButton != null
63-
? _iconButton(context, onPress: processing || !active ? null : _onPressed)
64-
: _elevateButton(context, onPress: processing || !active ? null : _onPressed),
71+
? _iconButton(context,
72+
onPress: processing || !active ? null : _onPressed)
73+
: _elevateButton(context,
74+
onPress: processing || !active ? null : _onPressed),
6575
);
6676

6777
@override

example/lib/src/ui/widgets/method_api_widget.dart

Lines changed: 32 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,12 @@ class MethodApiEntry {
77
final String? result;
88
final bool isResultOk;
99

10-
MethodApiEntry({this.name, this.title, this.subTitle, this.result, this.isResultOk = true});
10+
MethodApiEntry(
11+
{this.name,
12+
this.title,
13+
this.subTitle,
14+
this.result,
15+
this.isResultOk = true});
1116
}
1217

1318
class MethodApiWidget extends StatelessWidget {
@@ -20,20 +25,26 @@ class MethodApiWidget extends StatelessWidget {
2025

2126
Widget _nameWidget(BuildContext context) => entry.name != null
2227
? Container(
23-
decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.circular(5)),
28+
decoration: BoxDecoration(
29+
color: Colors.white, borderRadius: BorderRadius.circular(5)),
2430
margin: const EdgeInsets.symmetric(vertical: 2),
2531
padding: const EdgeInsets.symmetric(horizontal: 4, vertical: 2),
26-
child: Row(crossAxisAlignment: CrossAxisAlignment.start, mainAxisSize: MainAxisSize.min, children: [
27-
Icon(Icons.code, color: Colors.black, size: Theme.of(context).textTheme.bodyMedium?.fontSize),
28-
SizedBox(width: 5),
29-
Flexible(
30-
child: SelectableText(entry.name!,
31-
style: Theme.of(context).textTheme.bodySmall?.copyWith(
32-
color: Colors.red[700],
33-
fontSize: 11,
34-
)),
35-
),
36-
]),
32+
child: Row(
33+
crossAxisAlignment: CrossAxisAlignment.start,
34+
mainAxisSize: MainAxisSize.min,
35+
children: [
36+
Icon(Icons.code,
37+
color: Colors.black,
38+
size: Theme.of(context).textTheme.bodyMedium?.fontSize),
39+
SizedBox(width: 5),
40+
Flexible(
41+
child: SelectableText(entry.name!,
42+
style: Theme.of(context).textTheme.bodySmall?.copyWith(
43+
color: Colors.red[700],
44+
fontSize: 11,
45+
)),
46+
),
47+
]),
3748
)
3849
: SizedBox.shrink();
3950

@@ -61,7 +72,11 @@ class MethodApiWidget extends StatelessWidget {
6172
? Row(crossAxisAlignment: CrossAxisAlignment.start, children: [
6273
Expanded(
6374
child: Text(entry.subTitle!,
64-
style: Theme.of(context).textTheme.bodySmall?.copyWith(color: Colors.white70), softWrap: true)),
75+
style: Theme.of(context)
76+
.textTheme
77+
.bodySmall
78+
?.copyWith(color: Colors.white70),
79+
softWrap: true)),
6580
])
6681
: SizedBox.shrink();
6782

@@ -86,7 +101,9 @@ class MethodApiWidget extends StatelessWidget {
86101
color: _resultSuccess ? Colors.white70 : Colors.red,
87102
fontSize: 11,
88103
fontStyle: FontStyle.italic,
89-
fontWeight: _resultSuccess ? FontWeight.normal : FontWeight.bold,
104+
fontWeight: _resultSuccess
105+
? FontWeight.normal
106+
: FontWeight.bold,
90107
height: 1.2,
91108
),
92109
softWrap: true))

example/lib/src/ui/widgets/param_chips_selector.dart

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,14 @@ class _ParamChipsSelectorState extends State<ParamChipsSelector> {
8383
crossAxisAlignment: WrapCrossAlignment.center,
8484
children: [
8585
SelectableText(_paramNameText,
86-
style: TextStyle(color: Colors.red[700], fontSize: 11, fontStyle: FontStyle.italic, height: 1.2)),
87-
Text(':', style: TextStyle(color: Colors.black, fontSize: 11, height: 1.2)),
86+
style: TextStyle(
87+
color: Colors.red[700],
88+
fontSize: 11,
89+
fontStyle: FontStyle.italic,
90+
height: 1.2)),
91+
Text(':',
92+
style:
93+
TextStyle(color: Colors.black, fontSize: 11, height: 1.2)),
8894
],
8995
),
9096
);
@@ -102,7 +108,8 @@ class _ParamChipsSelectorState extends State<ParamChipsSelector> {
102108
padding: const EdgeInsets.symmetric(horizontal: 5, vertical: 2),
103109
margin: const EdgeInsets.only(bottom: 5, right: 5),
104110
child: SelectableText('${widget.selected}',
105-
style: TextStyle(color: Colors.white, fontSize: 12, height: 1.2)),
111+
style: TextStyle(
112+
color: Colors.white, fontSize: 12, height: 1.2)),
106113
),
107114
),
108115
])
@@ -111,7 +118,8 @@ class _ParamChipsSelectorState extends State<ParamChipsSelector> {
111118
Widget get _clearAction => IconButton(
112119
icon: Icon(Icons.clear_all),
113120
color: widget.selected.isNotEmpty ? Colors.red[700] : null,
114-
onPressed: widget.selected.isNotEmpty ? () => widget.onUpdate([]) : null,
121+
onPressed:
122+
widget.selected.isNotEmpty ? () => widget.onUpdate([]) : null,
115123
tooltip: widget.clearTooltip ?? 'Clear All',
116124
);
117125

@@ -123,10 +131,12 @@ class _ParamChipsSelectorState extends State<ParamChipsSelector> {
123131
);
124132

125133
@override
126-
Widget build(BuildContext context) => Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
134+
Widget build(BuildContext context) =>
135+
Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
127136
ExpansionTile(
128137
controller: _controller,
129-
title: Text(widget.title, style: TextStyle(fontSize: 14, height: 1.2)),
138+
title:
139+
Text(widget.title, style: TextStyle(fontSize: 14, height: 1.2)),
130140
subtitle: widget.subTitle,
131141
trailing: widget.action != null ? _actionWidget : _clearAction,
132142
dense: true,
@@ -138,7 +148,10 @@ class _ParamChipsSelectorState extends State<ParamChipsSelector> {
138148
expandedCrossAxisAlignment: CrossAxisAlignment.start,
139149
tilePadding: EdgeInsets.zero,
140150
initiallyExpanded: widget.isExpanded,
141-
children: [Wrap(spacing: 5, runSpacing: 0, children: _chips), SizedBox(height: 5)],
151+
children: [
152+
Wrap(spacing: 5, runSpacing: 0, children: _chips),
153+
SizedBox(height: 5)
154+
],
142155
),
143156
_paramResult,
144157
]);

example/lib/src/ui/widgets/picker_param_limit.dart

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ class PickerParamLimitWidget extends StatelessWidget {
2727
final Function(bool) setLimitResultRestart;
2828
final VoidCallback resetLimit;
2929

30-
String get _properTitle => limit > 1 ? 'Maximum items to pick: $limit' : 'Single Selection';
30+
String get _properTitle =>
31+
limit > 1 ? 'Maximum items to pick: $limit' : 'Single Selection';
3132

3233
String get _properSubtitle {
3334
//1. Check if limit > 1
@@ -60,13 +61,20 @@ class PickerParamLimitWidget extends StatelessWidget {
6061
crossAxisAlignment: WrapCrossAlignment.center,
6162
children: [
6263
SelectableText(_paramNameText,
63-
style: TextStyle(color: Colors.red[700], fontSize: 11, fontStyle: FontStyle.italic, height: 1.2)),
64-
Text(':', style: TextStyle(color: Colors.black, fontSize: 11, height: 1.2)),
64+
style: TextStyle(
65+
color: Colors.red[700],
66+
fontSize: 11,
67+
fontStyle: FontStyle.italic,
68+
height: 1.2)),
69+
Text(':',
70+
style:
71+
TextStyle(color: Colors.black, fontSize: 11, height: 1.2)),
6572
],
6673
),
6774
);
6875

69-
Widget get _paramResult => Row(crossAxisAlignment: CrossAxisAlignment.start, children: [
76+
Widget get _paramResult =>
77+
Row(crossAxisAlignment: CrossAxisAlignment.start, children: [
7078
_paramNameWidget,
7179
SizedBox(width: 5),
7280
Expanded(
@@ -77,7 +85,9 @@ class PickerParamLimitWidget extends StatelessWidget {
7785
),
7886
padding: const EdgeInsets.symmetric(horizontal: 5, vertical: 2),
7987
margin: const EdgeInsets.only(bottom: 5, right: 5),
80-
child: SelectableText(_paramResultText, style: TextStyle(color: Colors.white, fontSize: 12, height: 1.2)),
88+
child: SelectableText(_paramResultText,
89+
style:
90+
TextStyle(color: Colors.white, fontSize: 12, height: 1.2)),
8191
),
8292
),
8393
]);
@@ -94,10 +104,13 @@ class PickerParamLimitWidget extends StatelessWidget {
94104
}
95105

96106
@override
97-
Widget build(BuildContext context) => Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
107+
Widget build(BuildContext context) =>
108+
Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
98109
ExpansionTile(
99-
title: Text(_properTitle, style: TextStyle(fontSize: 14, height: 1.2)),
100-
subtitle: Text(_properSubtitle, style: TextStyle(fontSize: 11, height: 1.2)),
110+
title:
111+
Text(_properTitle, style: TextStyle(fontSize: 14, height: 1.2)),
112+
subtitle: Text(_properSubtitle,
113+
style: TextStyle(fontSize: 11, height: 1.2)),
101114
trailing: IconButton(
102115
icon: Icon(Icons.clear_all),
103116
color: !_isDisabled ? Colors.red[700] : null,

example/lib/src/ui/widgets/result_box.dart

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,13 @@ class ResultBox extends StatelessWidget {
99
final List<Widget> children;
1010
final VoidCallback? onClear;
1111

12-
factory ResultBox.fromMethods(List<MethodApiEntry> methods, {Widget? header, VoidCallback? onClear}) => ResultBox(
12+
factory ResultBox.fromMethods(List<MethodApiEntry> methods,
13+
{Widget? header, VoidCallback? onClear}) =>
14+
ResultBox(
1315
onClear: onClear,
14-
children: [header, ...methods.map((m) => MethodApiWidget(m))].nonNulls.toList(),
16+
children: [header, ...methods.map((m) => MethodApiWidget(m))]
17+
.nonNulls
18+
.toList(),
1519
);
1620

1721
List<Widget> _defaultList() => <Widget>[

example/lib/src/ui/widgets/result_box_stream.dart

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,9 @@ class _ResultBoxStreamState extends State<ResultBoxStream> {
130130
controller: _listScrollController,
131131
primary: false,
132132
itemCount: _streamResult.isEmpty ? 1 : _streamResult.length,
133-
itemBuilder: (context, index) =>
134-
_streamResult.isEmpty ? _defaultListItem : _resizableWidget(_streamResult[index]),
133+
itemBuilder: (context, index) => _streamResult.isEmpty
134+
? _defaultListItem
135+
: _resizableWidget(_streamResult[index]),
135136
),
136137
),
137138
),

0 commit comments

Comments
 (0)