Caijinglong 6 anni fa
parent
commit
0a16adb6e2

+ 1
- 1
lib/src/engine/lru_cache.dart Vedi File

@@ -11,7 +11,7 @@ class ImageLruCache {
11 11
   }
12 12
 
13 13
   static void setData(ImageEntity entity, int size, Uint8List list) {
14
-    _map.put(_ImageCacheEntity(entity,size), list);
14
+    _map.put(_ImageCacheEntity(entity, size), list);
15 15
   }
16 16
 }
17 17
 

+ 1
- 1
lib/src/provider/i18n_provider.dart Vedi File

@@ -16,7 +16,7 @@ abstract class I18nProvider {
16 16
 
17 17
   String getAllGalleryText(Options options);
18 18
 
19
-  String loadingText(){
19
+  String loadingText() {
20 20
     return "loading...";
21 21
   }
22 22
 

+ 1
- 2
lib/src/provider/selected_provider.dart Vedi File

@@ -34,12 +34,11 @@ abstract class SelectedProvider {
34 34
     var srcList = List.of(selectedList);
35 35
     selectedList.clear();
36 36
     srcList.forEach((entity) {
37
-      if (previewSelectedList.contains(entity)){
37
+      if (previewSelectedList.contains(entity)) {
38 38
         selectedList.add(entity);
39 39
       }
40 40
     });
41 41
   }
42 42
 
43
-
44 43
   void sure();
45 44
 }

+ 43
- 34
lib/src/ui/widget/check_box_copy.dart Vedi File

@@ -52,7 +52,7 @@ class Checkbox extends StatefulWidget {
52 52
     this.activeColor,
53 53
     this.checkColor,
54 54
     this.materialTapTargetSize,
55
-  }) : assert(tristate != null),
55
+  })  : assert(tristate != null),
56 56
         assert(tristate || value != null),
57 57
         super(key: key);
58 58
 
@@ -133,7 +133,8 @@ class _CheckboxState extends State<Checkbox> with TickerProviderStateMixin {
133 133
     Size size;
134 134
     switch (widget.materialTapTargetSize ?? themeData.materialTapTargetSize) {
135 135
       case MaterialTapTargetSize.padded:
136
-        size = const Size(2 * kRadialReactionRadius + 8.0, 2 * kRadialReactionRadius + 8.0);
136
+        size = const Size(
137
+            2 * kRadialReactionRadius + 8.0, 2 * kRadialReactionRadius + 8.0);
137 138
         break;
138 139
       case MaterialTapTargetSize.shrinkWrap:
139 140
         size = const Size(2 * kRadialReactionRadius, 2 * kRadialReactionRadius);
@@ -145,7 +146,9 @@ class _CheckboxState extends State<Checkbox> with TickerProviderStateMixin {
145 146
       tristate: widget.tristate,
146 147
       activeColor: widget.activeColor ?? themeData.toggleableActiveColor,
147 148
       checkColor: widget.checkColor ?? themeData.primaryColor,
148
-      inactiveColor: widget.onChanged != null ? themeData.unselectedWidgetColor : themeData.disabledColor,
149
+      inactiveColor: widget.onChanged != null
150
+          ? themeData.unselectedWidgetColor
151
+          : themeData.disabledColor,
149 152
       onChanged: widget.onChanged,
150 153
       additionalConstraints: additionalConstraints,
151 154
       vsync: this,
@@ -164,7 +167,7 @@ class _CheckboxRenderObjectWidget extends LeafRenderObjectWidget {
164 167
     @required this.onChanged,
165 168
     @required this.vsync,
166 169
     @required this.additionalConstraints,
167
-  }) : assert(tristate != null),
170
+  })  : assert(tristate != null),
168 171
         assert(tristate || value != null),
169 172
         assert(activeColor != null),
170 173
         assert(inactiveColor != null),
@@ -182,15 +185,15 @@ class _CheckboxRenderObjectWidget extends LeafRenderObjectWidget {
182 185
 
183 186
   @override
184 187
   _RenderCheckbox createRenderObject(BuildContext context) => _RenderCheckbox(
185
-    value: value,
186
-    tristate: tristate,
187
-    activeColor: activeColor,
188
-    checkColor: checkColor,
189
-    inactiveColor: inactiveColor,
190
-    onChanged: onChanged,
191
-    vsync: vsync,
192
-    additionalConstraints: additionalConstraints,
193
-  );
188
+        value: value,
189
+        tristate: tristate,
190
+        activeColor: activeColor,
191
+        checkColor: checkColor,
192
+        inactiveColor: inactiveColor,
193
+        onChanged: onChanged,
194
+        vsync: vsync,
195
+        additionalConstraints: additionalConstraints,
196
+      );
194 197
 
195 198
   @override
196 199
   void updateRenderObject(BuildContext context, _RenderCheckbox renderObject) {
@@ -220,17 +223,17 @@ class _RenderCheckbox extends RenderToggleable {
220 223
     BoxConstraints additionalConstraints,
221 224
     ValueChanged<bool> onChanged,
222 225
     @required TickerProvider vsync,
223
-  }): _oldValue = value,
224
-      checkColor = checkColor,
226
+  })  : _oldValue = value,
227
+        checkColor = checkColor,
225 228
         super(
226
-        value: value,
227
-        tristate: tristate,
228
-        activeColor: activeColor,
229
-        inactiveColor: inactiveColor,
230
-        onChanged: onChanged,
231
-        additionalConstraints: additionalConstraints,
232
-        vsync: vsync,
233
-      );
229
+          value: value,
230
+          tristate: tristate,
231
+          activeColor: activeColor,
232
+          inactiveColor: inactiveColor,
233
+          onChanged: onChanged,
234
+          additionalConstraints: additionalConstraints,
235
+          vsync: vsync,
236
+        );
234 237
 
235 238
   bool _oldValue;
236 239
 
@@ -238,8 +241,7 @@ class _RenderCheckbox extends RenderToggleable {
238 241
 
239 242
   @override
240 243
   set value(bool newValue) {
241
-    if (newValue == value)
242
-      return;
244
+    if (newValue == value) return;
243 245
     _oldValue = value;
244 246
     super.value = newValue;
245 247
   }
@@ -257,7 +259,8 @@ class _RenderCheckbox extends RenderToggleable {
257 259
   RRect _outerRectAt(Offset origin, double t) {
258 260
     final double inset = 1.0 - (t - 0.5).abs() * 2.0;
259 261
     final double size = _kEdgeSize - inset * _kStrokeWidth;
260
-    final Rect rect = Rect.fromLTWH(origin.dx + inset, origin.dy + inset, size, size);
262
+    final Rect rect =
263
+        Rect.fromLTWH(origin.dx + inset, origin.dy + inset, size, size);
261 264
     return RRect.fromRectAndRadius(rect, _kEdgeRadius);
262 265
   }
263 266
 
@@ -267,7 +270,9 @@ class _RenderCheckbox extends RenderToggleable {
267 270
     // As t goes from 0.0 to 0.25, animate from the inactiveColor to activeColor.
268 271
     return onChanged == null
269 272
         ? inactiveColor
270
-        : (t >= 0.25 ? activeColor : Color.lerp(inactiveColor, activeColor, t * 4.0));
273
+        : (t >= 0.25
274
+            ? activeColor
275
+            : Color.lerp(inactiveColor, activeColor, t * 4.0));
271 276
   }
272 277
 
273 278
   // White stroke used to paint the check and dash.
@@ -282,7 +287,8 @@ class _RenderCheckbox extends RenderToggleable {
282 287
     assert(t >= 0.0 && t <= 0.5);
283 288
     final double size = outer.width;
284 289
     // As t goes from 0.0 to 1.0, gradually fill the outer RRect.
285
-    final RRect inner = outer.deflate(math.min(size / 2.0, _kStrokeWidth + size * t));
290
+    final RRect inner =
291
+        outer.deflate(math.min(size / 2.0, _kStrokeWidth + size * t));
286 292
     canvas.drawDRRect(outer, inner, paint);
287 293
   }
288 294
 
@@ -326,11 +332,13 @@ class _RenderCheckbox extends RenderToggleable {
326 332
     final Canvas canvas = context.canvas;
327 333
     paintRadialReaction(canvas, offset, size.center(Offset.zero));
328 334
 
329
-    final Offset origin = offset + (size / 2.0 - const Size.square(_kEdgeSize) / 2.0);
335
+    final Offset origin =
336
+        offset + (size / 2.0 - const Size.square(_kEdgeSize) / 2.0);
330 337
     final AnimationStatus status = position.status;
331
-    final double tNormalized = status == AnimationStatus.forward || status == AnimationStatus.completed
332
-        ? position.value
333
-        : 1.0 - position.value;
338
+    final double tNormalized =
339
+        status == AnimationStatus.forward || status == AnimationStatus.completed
340
+            ? position.value
341
+            : 1.0 - position.value;
334 342
 
335 343
     // Four cases: false to null, false to true, null to false, true to false
336 344
     if (_oldValue == false || value == false) {
@@ -350,9 +358,10 @@ class _RenderCheckbox extends RenderToggleable {
350 358
         else
351 359
           _drawCheck(canvas, origin, tShrink, paint);
352 360
       }
353
-    } else { // Two cases: null to true, true to null
361
+    } else {
362
+      // Two cases: null to true, true to null
354 363
       final RRect outer = _outerRectAt(origin, 1.0);
355
-      final Paint paint = Paint() ..color = _colorAt(1.0);
364
+      final Paint paint = Paint()..color = _colorAt(1.0);
356 365
       canvas.drawRRect(outer, paint);
357 366
 
358 367
       _initStrokePaint(paint);

+ 7
- 3
lib/src/ui/widget/check_tile_copy.dart Vedi File

@@ -2,7 +2,7 @@
2 2
 // Use of this source code is governed by a BSD-style license that can be
3 3
 // found in the LICENSE file.
4 4
 
5
-import 'package:flutter/material.dart' hide Checkbox,CheckboxListTile;
5
+import 'package:flutter/material.dart' hide Checkbox, CheckboxListTile;
6 6
 
7 7
 import 'package:photo/src/ui/widget/check_box_copy.dart';
8 8
 
@@ -86,7 +86,7 @@ class CheckboxListTile extends StatelessWidget {
86 86
     this.secondary,
87 87
     this.selected = false,
88 88
     this.controlAffinity = ListTileControlAffinity.platform,
89
-  }) : assert(value != null),
89
+  })  : assert(value != null),
90 90
         assert(isThreeLine != null),
91 91
         assert(!isThreeLine || subtitle != null),
92 92
         assert(selected != null),
@@ -199,7 +199,11 @@ class CheckboxListTile extends StatelessWidget {
199 199
           isThreeLine: isThreeLine,
200 200
           dense: dense,
201 201
           enabled: onChanged != null,
202
-          onTap: onChanged != null ? () { onChanged(!value); } : null,
202
+          onTap: onChanged != null
203
+              ? () {
204
+                  onChanged(!value);
205
+                }
206
+              : null,
203 207
           selected: selected,
204 208
         ),
205 209
       ),