瀏覽代碼

format code

Caijinglong 5 年之前
父節點
當前提交
56e81a2a38

+ 18
- 6
example/lib/main.dart 查看文件

@@ -88,7 +88,8 @@ class _MyHomePageState extends State<MyHomePage> with LoadingDelegate {
88 88
   }
89 89
 
90 90
   @override
91
-  Widget buildBigImageLoading(BuildContext context, AssetEntity entity, Color themeColor) {
91
+  Widget buildBigImageLoading(
92
+      BuildContext context, AssetEntity entity, Color themeColor) {
92 93
     return Center(
93 94
       child: Container(
94 95
         width: 50.0,
@@ -101,7 +102,8 @@ class _MyHomePageState extends State<MyHomePage> with LoadingDelegate {
101 102
   }
102 103
 
103 104
   @override
104
-  Widget buildPreviewLoading(BuildContext context, AssetEntity entity, Color themeColor) {
105
+  Widget buildPreviewLoading(
106
+      BuildContext context, AssetEntity entity, Color themeColor) {
105 107
     return Center(
106 108
       child: Container(
107 109
         width: 50.0,
@@ -123,9 +125,18 @@ class _MyHomePageState extends State<MyHomePage> with LoadingDelegate {
123 125
         child: SingleChildScrollView(
124 126
           child: Column(
125 127
             children: <Widget>[
126
-              IconTextButton(icon: Icons.photo, text: "photo", onTap: () => _pickAsset(PickType.onlyImage)),
127
-              IconTextButton(icon: Icons.videocam, text: "video", onTap: () => _pickAsset(PickType.onlyVideo)),
128
-              IconTextButton(icon: Icons.album, text: "all", onTap: () => _pickAsset(PickType.all)),
128
+              IconTextButton(
129
+                  icon: Icons.photo,
130
+                  text: "photo",
131
+                  onTap: () => _pickAsset(PickType.onlyImage)),
132
+              IconTextButton(
133
+                  icon: Icons.videocam,
134
+                  text: "video",
135
+                  onTap: () => _pickAsset(PickType.onlyVideo)),
136
+              IconTextButton(
137
+                  icon: Icons.album,
138
+                  text: "all",
139
+                  onTap: () => _pickAsset(PickType.all)),
129 140
               Text(
130 141
                 '$currentSelected',
131 142
                 textAlign: TextAlign.center,
@@ -148,7 +159,8 @@ class IconTextButton extends StatelessWidget {
148 159
   final String text;
149 160
   final Function onTap;
150 161
 
151
-  const IconTextButton({Key key, this.icon, this.text, this.onTap}) : super(key: key);
162
+  const IconTextButton({Key key, this.icon, this.text, this.onTap})
163
+      : super(key: key);
152 164
 
153 165
   @override
154 166
   Widget build(BuildContext context) {

+ 4
- 2
lib/photo.dart 查看文件

@@ -16,7 +16,8 @@ import 'package:photo_manager/photo_manager.dart';
16 16
 export 'package:photo/src/delegate/checkbox_builder_delegate.dart';
17 17
 export 'package:photo/src/delegate/loading_delegate.dart';
18 18
 export 'package:photo/src/delegate/sort_delegate.dart';
19
-export 'package:photo/src/provider/i18n_provider.dart' show I18NCustomProvider, I18nProvider, CNProvider, ENProvider;
19
+export 'package:photo/src/provider/i18n_provider.dart'
20
+    show I18NCustomProvider, I18nProvider, CNProvider, ENProvider;
20 21
 export 'package:photo/src/entity/options.dart' show PickType;
21 22
 export 'package:photo/src/delegate/badge_delegate.dart';
22 23
 
@@ -132,7 +133,8 @@ class PhotoPicker {
132 133
     return _openGalleryContentPage(context, options, provider);
133 134
   }
134 135
 
135
-  Future<List<AssetEntity>> _openGalleryContentPage(BuildContext context, Options options, I18nProvider provider) async {
136
+  Future<List<AssetEntity>> _openGalleryContentPage(
137
+      BuildContext context, Options options, I18nProvider provider) async {
136 138
     return Navigator.of(context).push(
137 139
       MaterialPageRoute(
138 140
         builder: (ctx) => PhotoApp(

+ 2
- 1
lib/src/delegate/sort_delegate.dart 查看文件

@@ -60,6 +60,7 @@ class CommonSortDelegate extends SortDelegate {
60 60
   }
61 61
 
62 62
   bool _isScreenShot(AssetPathEntity entity) {
63
-    return entity.name.toUpperCase() == "screenshots".toUpperCase() || entity.name.toUpperCase() == "screenshot".toUpperCase();
63
+    return entity.name.toUpperCase() == "screenshots".toUpperCase() ||
64
+        entity.name.toUpperCase() == "screenshot".toUpperCase();
64 65
   }
65 66
 }

+ 2
- 1
lib/src/provider/config_provider.dart 查看文件

@@ -18,5 +18,6 @@ class ConfigProvider extends InheritedWidget {
18 18
     return true;
19 19
   }
20 20
 
21
-  static ConfigProvider of(BuildContext context) => context.inheritFromWidgetOfExactType(ConfigProvider);
21
+  static ConfigProvider of(BuildContext context) =>
22
+      context.inheritFromWidgetOfExactType(ConfigProvider);
22 23
 }

+ 11
- 5
lib/src/ui/page/photo_main_page.dart 查看文件

@@ -28,7 +28,8 @@ class PhotoMainPage extends StatefulWidget {
28 28
   _PhotoMainPageState createState() => _PhotoMainPageState();
29 29
 }
30 30
 
31
-class _PhotoMainPageState extends State<PhotoMainPage> with SelectedProvider, GalleryListProvider {
31
+class _PhotoMainPageState extends State<PhotoMainPage>
32
+    with SelectedProvider, GalleryListProvider {
32 33
   Options get options => widget.options;
33 34
 
34 35
   I18nProvider get i18nProvider => ConfigProvider.of(context).provider;
@@ -95,7 +96,9 @@ class _PhotoMainPageState extends State<PhotoMainPage> with SelectedProvider, Ga
95 96
                 splashColor: Colors.transparent,
96 97
                 child: Text(
97 98
                   i18nProvider.getSureText(options, selectedCount),
98
-                  style: selectedCount == 0 ? textStyle.copyWith(color: options.disableColor) : textStyle,
99
+                  style: selectedCount == 0
100
+                      ? textStyle.copyWith(color: options.disableColor)
101
+                      : textStyle,
99 102
                 ),
100 103
                 onPressed: selectedCount == 0 ? null : sure,
101 104
               ),
@@ -483,7 +486,8 @@ class __BottomWidgetState extends State<_BottomWidget> {
483 486
                   height: 44.0,
484 487
                   alignment: Alignment.center,
485 488
                   child: Text(
486
-                    i18nProvider.getPreviewText(options, widget.selectedProvider),
489
+                    i18nProvider.getPreviewText(
490
+                        options, widget.selectedProvider),
487 491
                     style: textStyle,
488 492
                   ),
489 493
                   padding: textPadding,
@@ -539,7 +543,8 @@ class ImageItem extends StatelessWidget {
539 543
       future: entity.thumbDataWithSize(size, size),
540 544
       builder: (BuildContext context, AsyncSnapshot<Uint8List> snapshot) {
541 545
         var futureData = snapshot.data;
542
-        if (snapshot.connectionState == ConnectionState.done && futureData != null) {
546
+        if (snapshot.connectionState == ConnectionState.done &&
547
+            futureData != null) {
543 548
           ImageLruCache.setData(entity, size, futureData);
544 549
           return _buildImageItem(context, futureData);
545 550
         }
@@ -566,7 +571,8 @@ class ImageItem extends StatelessWidget {
566 571
       future: entity.videoDuration,
567 572
       builder: (ctx, snapshot) {
568 573
         if (snapshot.hasData && snapshot != null) {
569
-          var buildBadge = badgeDelegate?.buildBadge(context, entity.type, snapshot.data);
574
+          var buildBadge =
575
+              badgeDelegate?.buildBadge(context, entity.type, snapshot.data);
570 576
           if (buildBadge == null) {
571 577
             return Container();
572 578
           } else {