Skip to content

Commit e559abc

Browse files
style: apply new dart format
1 parent 9a98c90 commit e559abc

File tree

2 files changed

+64
-68
lines changed

2 files changed

+64
-68
lines changed

example/lib/main.dart

Lines changed: 30 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -56,25 +56,22 @@ class MyHomePageState extends State<MyHomePage> {
5656
),
5757
),
5858
],
59-
customTypeViewerBuilder:
60-
(children) => Row(
61-
mainAxisAlignment: MainAxisAlignment.end,
62-
children: children,
63-
),
59+
customTypeViewerBuilder: (children) => Row(
60+
mainAxisAlignment: MainAxisAlignment.end,
61+
children: children,
62+
),
6463
onFileLoading: (val) {
6564
debugPrint(val.toString());
6665
},
67-
customFileViewerBuilder:
68-
_useCustomFileViewer
69-
? (files, filesSetter) =>
70-
customFileViewerBuilder(files ?? [], (newValue) {})
71-
: null,
72-
onDefaultViewerItemTap:
73-
_useCustomFileViewer
74-
? null
75-
: (PlatformFile file, int index) {
76-
debugPrint(file.name);
77-
},
66+
customFileViewerBuilder: _useCustomFileViewer
67+
? (files, filesSetter) =>
68+
customFileViewerBuilder(files ?? [], (newValue) {})
69+
: null,
70+
onDefaultViewerItemTap: _useCustomFileViewer
71+
? null
72+
: (PlatformFile file, int index) {
73+
debugPrint(file.name);
74+
},
7875
),
7976
const SizedBox(height: 20),
8077
Row(
@@ -121,22 +118,22 @@ class MyHomePageState extends State<MyHomePage> {
121118
return files.isEmpty
122119
? const Center(child: Text('No files'))
123120
: ListView.separated(
124-
shrinkWrap: true,
125-
itemBuilder: (context, index) {
126-
return ListTile(
127-
title: Text(files[index].name),
128-
trailing: IconButton(
129-
icon: const Icon(Icons.delete),
130-
onPressed: () {
131-
files.removeAt(index);
132-
setter.call([...files]);
133-
},
134-
),
135-
);
136-
},
137-
separatorBuilder:
138-
(context, index) => const Divider(color: Colors.blueAccent),
139-
itemCount: files.length,
140-
);
121+
shrinkWrap: true,
122+
itemBuilder: (context, index) {
123+
return ListTile(
124+
title: Text(files[index].name),
125+
trailing: IconButton(
126+
icon: const Icon(Icons.delete),
127+
onPressed: () {
128+
files.removeAt(index);
129+
setter.call([...files]);
130+
},
131+
),
132+
);
133+
},
134+
separatorBuilder: (context, index) =>
135+
const Divider(color: Colors.blueAccent),
136+
itemCount: files.length,
137+
);
141138
}
142139
}

lib/src/form_builder_file_picker.dart

Lines changed: 34 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -123,35 +123,34 @@ class FormBuilderFilePicker
123123

124124
return InputDecorator(
125125
decoration: state.decoration.copyWith(
126-
counterText:
127-
maxFiles != null
128-
? '${state._files.length} / $maxFiles'
129-
: null,
126+
counterText: maxFiles != null
127+
? '${state._files.length} / $maxFiles'
128+
: null,
130129
),
131130
child: Column(
132131
children: <Widget>[
133132
customTypeViewerBuilder != null
134133
? customTypeViewerBuilder(
135-
state.getTypeSelectorActions(typeSelectors, field),
136-
)
134+
state.getTypeSelectorActions(typeSelectors, field),
135+
)
137136
: Row(
138-
mainAxisAlignment: MainAxisAlignment.spaceBetween,
139-
children: state.getTypeSelectorActions(
140-
typeSelectors,
141-
field,
137+
mainAxisAlignment: MainAxisAlignment.spaceBetween,
138+
children: state.getTypeSelectorActions(
139+
typeSelectors,
140+
field,
141+
),
142142
),
143-
),
144143
const SizedBox(height: 3),
145144
customFileViewerBuilder != null
146145
? customFileViewerBuilder.call(
147-
state._files,
148-
(files) => state._setFiles(files ?? [], field),
149-
)
146+
state._files,
147+
(files) => state._setFiles(files ?? [], field),
148+
)
150149
: state.defaultFileViewer(
151-
state._files,
152-
(files) => state._setFiles(files ?? [], field),
153-
onDefaultViewerItemTap,
154-
),
150+
state._files,
151+
(files) => state._setFiles(files ?? [], field),
152+
onDefaultViewerItemTap,
153+
),
155154
],
156155
),
157156
);
@@ -279,27 +278,27 @@ class _FormBuilderFilePickerState
279278
alignment: Alignment.center,
280279
child:
281280
(imageFileExts.contains(
282-
files[index].extension!.toLowerCase(),
283-
) &&
284-
widget.previewImages)
285-
? widget.withData
286-
? Image.memory(
281+
files[index].extension!.toLowerCase(),
282+
) &&
283+
widget.previewImages)
284+
? widget.withData
285+
? Image.memory(
287286
files[index].bytes!,
288287
fit: BoxFit.cover,
289288
)
290-
: Image.file(
289+
: Image.file(
291290
File(files[index].path!),
292291
fit: BoxFit.cover,
293292
)
294-
: Container(
295-
alignment: Alignment.center,
296-
color: theme.primaryColor,
297-
child: Icon(
298-
getIconData(files[index].extension!),
299-
color: Colors.white,
300-
size: 56,
301-
),
293+
: Container(
294+
alignment: Alignment.center,
295+
color: theme.primaryColor,
296+
child: Icon(
297+
getIconData(files[index].extension!),
298+
color: Colors.white,
299+
size: 56,
302300
),
301+
),
303302
),
304303
),
305304
Container(
@@ -357,9 +356,9 @@ class _FormBuilderFilePickerState
357356
(typeSelector) => InkWell(
358357
onTap:
359358
enabled &&
360-
(null == _remainingItemCount || _remainingItemCount! > 0)
361-
? () => pickFiles(field, typeSelector.type)
362-
: null,
359+
(null == _remainingItemCount || _remainingItemCount! > 0)
360+
? () => pickFiles(field, typeSelector.type)
361+
: null,
363362
child: typeSelector.selector,
364363
),
365364
),

0 commit comments

Comments
 (0)