|
@@ -1,3 +1,4 @@
|
|
1
|
+import 'dart:async';
|
1
|
2
|
import 'dart:typed_data';
|
2
|
3
|
|
3
|
4
|
import 'package:flutter/material.dart';
|
|
@@ -25,8 +26,7 @@ class PhotoMainPage extends StatefulWidget {
|
25
|
26
|
_PhotoMainPageState createState() => _PhotoMainPageState();
|
26
|
27
|
}
|
27
|
28
|
|
28
|
|
-class _PhotoMainPageState extends State<PhotoMainPage>
|
29
|
|
- with SelectedProvider, GalleryListProvider {
|
|
29
|
+class _PhotoMainPageState extends State<PhotoMainPage> with SelectedProvider, GalleryListProvider {
|
30
|
30
|
Options get options => ConfigProvider.of(context).options;
|
31
|
31
|
|
32
|
32
|
I18nProvider get i18nProvider => ConfigProvider.of(context).provider;
|
|
@@ -58,7 +58,6 @@ class _PhotoMainPageState extends State<PhotoMainPage>
|
58
|
58
|
@override
|
59
|
59
|
void initState() {
|
60
|
60
|
super.initState();
|
61
|
|
- AssetPathEntity.all.name = i18nProvider.getAllGalleryText(options);
|
62
|
61
|
_refreshList();
|
63
|
62
|
scaffoldKey = GlobalKey();
|
64
|
63
|
scrollController = ScrollController();
|
|
@@ -94,9 +93,7 @@ class _PhotoMainPageState extends State<PhotoMainPage>
|
94
|
93
|
splashColor: Colors.transparent,
|
95
|
94
|
child: Text(
|
96
|
95
|
i18nProvider.getSureText(options, selectedCount),
|
97
|
|
- style: selectedCount == 0
|
98
|
|
- ? textStyle.copyWith(color: options.disableColor)
|
99
|
|
- : textStyle,
|
|
96
|
+ style: selectedCount == 0 ? textStyle.copyWith(color: options.disableColor) : textStyle,
|
100
|
97
|
),
|
101
|
98
|
onPressed: selectedCount == 0 ? null : sure,
|
102
|
99
|
),
|
|
@@ -153,7 +150,7 @@ class _PhotoMainPageState extends State<PhotoMainPage>
|
153
|
150
|
);
|
154
|
151
|
}
|
155
|
152
|
|
156
|
|
- void _refreshList() async {
|
|
153
|
+ Future<void> _refreshList() async {
|
157
|
154
|
var pathList = await PhotoManager.getAssetPathList();
|
158
|
155
|
|
159
|
156
|
options.sortDelegate.sort(pathList);
|
|
@@ -162,6 +159,7 @@ class _PhotoMainPageState extends State<PhotoMainPage>
|
162
|
159
|
galleryPathList.addAll(pathList);
|
163
|
160
|
|
164
|
161
|
var imageList = await currentPath.assetList;
|
|
162
|
+ AssetPathEntity.all.name = i18nProvider.getAllGalleryText(options);
|
165
|
163
|
this.list.clear();
|
166
|
164
|
this.list.addAll(imageList);
|
167
|
165
|
setState(() {
|
|
@@ -461,8 +459,7 @@ class __BottomWidgetState extends State<_BottomWidget> {
|
461
|
459
|
height: 44.0,
|
462
|
460
|
alignment: Alignment.center,
|
463
|
461
|
child: Text(
|
464
|
|
- i18nProvider.getPreviewText(
|
465
|
|
- options, widget.selectedProvider),
|
|
462
|
+ i18nProvider.getPreviewText(options, widget.selectedProvider),
|
466
|
463
|
style: textStyle,
|
467
|
464
|
),
|
468
|
465
|
padding: textPadding,
|
|
@@ -518,8 +515,7 @@ class ImageItem extends StatelessWidget {
|
518
|
515
|
future: entity.thumbDataWithSize(size, size),
|
519
|
516
|
builder: (BuildContext context, AsyncSnapshot<Uint8List> snapshot) {
|
520
|
517
|
var futureData = snapshot.data;
|
521
|
|
- if (snapshot.connectionState == ConnectionState.done &&
|
522
|
|
- futureData != null) {
|
|
518
|
+ if (snapshot.connectionState == ConnectionState.done && futureData != null) {
|
523
|
519
|
ImageLruCache.setData(entity, size, futureData);
|
524
|
520
|
return _buildImageItem(context, futureData);
|
525
|
521
|
}
|
|
@@ -546,8 +542,7 @@ class ImageItem extends StatelessWidget {
|
546
|
542
|
future: entity.videoDuration,
|
547
|
543
|
builder: (ctx, snapshot) {
|
548
|
544
|
if (snapshot.hasData && snapshot != null) {
|
549
|
|
- var buildBadge =
|
550
|
|
- badgeDelegate?.buildBadge(context, entity.type, snapshot.data);
|
|
545
|
+ var buildBadge = badgeDelegate?.buildBadge(context, entity.type, snapshot.data);
|
551
|
546
|
if (buildBadge == null) {
|
552
|
547
|
return Container();
|
553
|
548
|
} else {
|