Browse Source

format code

Caijinglong 5 years ago
parent
commit
56e81a2a38

+ 18
- 6
example/lib/main.dart View File

88
   }
88
   }
89
 
89
 
90
   @override
90
   @override
91
-  Widget buildBigImageLoading(BuildContext context, AssetEntity entity, Color themeColor) {
91
+  Widget buildBigImageLoading(
92
+      BuildContext context, AssetEntity entity, Color themeColor) {
92
     return Center(
93
     return Center(
93
       child: Container(
94
       child: Container(
94
         width: 50.0,
95
         width: 50.0,
101
   }
102
   }
102
 
103
 
103
   @override
104
   @override
104
-  Widget buildPreviewLoading(BuildContext context, AssetEntity entity, Color themeColor) {
105
+  Widget buildPreviewLoading(
106
+      BuildContext context, AssetEntity entity, Color themeColor) {
105
     return Center(
107
     return Center(
106
       child: Container(
108
       child: Container(
107
         width: 50.0,
109
         width: 50.0,
123
         child: SingleChildScrollView(
125
         child: SingleChildScrollView(
124
           child: Column(
126
           child: Column(
125
             children: <Widget>[
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
               Text(
140
               Text(
130
                 '$currentSelected',
141
                 '$currentSelected',
131
                 textAlign: TextAlign.center,
142
                 textAlign: TextAlign.center,
148
   final String text;
159
   final String text;
149
   final Function onTap;
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
   @override
165
   @override
154
   Widget build(BuildContext context) {
166
   Widget build(BuildContext context) {

+ 4
- 2
lib/photo.dart View File

16
 export 'package:photo/src/delegate/checkbox_builder_delegate.dart';
16
 export 'package:photo/src/delegate/checkbox_builder_delegate.dart';
17
 export 'package:photo/src/delegate/loading_delegate.dart';
17
 export 'package:photo/src/delegate/loading_delegate.dart';
18
 export 'package:photo/src/delegate/sort_delegate.dart';
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
 export 'package:photo/src/entity/options.dart' show PickType;
21
 export 'package:photo/src/entity/options.dart' show PickType;
21
 export 'package:photo/src/delegate/badge_delegate.dart';
22
 export 'package:photo/src/delegate/badge_delegate.dart';
22
 
23
 
132
     return _openGalleryContentPage(context, options, provider);
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
     return Navigator.of(context).push(
138
     return Navigator.of(context).push(
137
       MaterialPageRoute(
139
       MaterialPageRoute(
138
         builder: (ctx) => PhotoApp(
140
         builder: (ctx) => PhotoApp(

+ 2
- 1
lib/src/delegate/sort_delegate.dart View File

60
   }
60
   }
61
 
61
 
62
   bool _isScreenShot(AssetPathEntity entity) {
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 View File

18
     return true;
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 View File

28
   _PhotoMainPageState createState() => _PhotoMainPageState();
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
   Options get options => widget.options;
33
   Options get options => widget.options;
33
 
34
 
34
   I18nProvider get i18nProvider => ConfigProvider.of(context).provider;
35
   I18nProvider get i18nProvider => ConfigProvider.of(context).provider;
95
                 splashColor: Colors.transparent,
96
                 splashColor: Colors.transparent,
96
                 child: Text(
97
                 child: Text(
97
                   i18nProvider.getSureText(options, selectedCount),
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
                 onPressed: selectedCount == 0 ? null : sure,
103
                 onPressed: selectedCount == 0 ? null : sure,
101
               ),
104
               ),
483
                   height: 44.0,
486
                   height: 44.0,
484
                   alignment: Alignment.center,
487
                   alignment: Alignment.center,
485
                   child: Text(
488
                   child: Text(
486
-                    i18nProvider.getPreviewText(options, widget.selectedProvider),
489
+                    i18nProvider.getPreviewText(
490
+                        options, widget.selectedProvider),
487
                     style: textStyle,
491
                     style: textStyle,
488
                   ),
492
                   ),
489
                   padding: textPadding,
493
                   padding: textPadding,
539
       future: entity.thumbDataWithSize(size, size),
543
       future: entity.thumbDataWithSize(size, size),
540
       builder: (BuildContext context, AsyncSnapshot<Uint8List> snapshot) {
544
       builder: (BuildContext context, AsyncSnapshot<Uint8List> snapshot) {
541
         var futureData = snapshot.data;
545
         var futureData = snapshot.data;
542
-        if (snapshot.connectionState == ConnectionState.done && futureData != null) {
546
+        if (snapshot.connectionState == ConnectionState.done &&
547
+            futureData != null) {
543
           ImageLruCache.setData(entity, size, futureData);
548
           ImageLruCache.setData(entity, size, futureData);
544
           return _buildImageItem(context, futureData);
549
           return _buildImageItem(context, futureData);
545
         }
550
         }
566
       future: entity.videoDuration,
571
       future: entity.videoDuration,
567
       builder: (ctx, snapshot) {
572
       builder: (ctx, snapshot) {
568
         if (snapshot.hasData && snapshot != null) {
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
           if (buildBadge == null) {
576
           if (buildBadge == null) {
571
             return Container();
577
             return Container();
572
           } else {
578
           } else {