forked from fluttercandies/flutter_wechat_assets_picker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
single_assets_page.dart
59 lines (50 loc) · 2.01 KB
/
single_assets_page.dart
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
// Copyright 2019 The FlutterCandies author. All rights reserved.
// Use of this source code is governed by an Apache license that can be found
// in the LICENSE file.
import 'dart:io';
import 'package:flutter/material.dart';
import 'package:wechat_assets_picker/wechat_assets_picker.dart'
show AssetEntity;
import '../constants/picker_method.dart';
import 'page_mixin.dart';
class SingleAssetPage extends StatefulWidget {
const SingleAssetPage({super.key});
@override
State<SingleAssetPage> createState() => _SingleAssetPageState();
}
class _SingleAssetPageState extends State<SingleAssetPage>
with AutomaticKeepAliveClientMixin, ExamplePageMixin {
@override
String get noticeText => 'lib/pages/single_assets_page.dart';
@override
int get maxAssetsCount => 1;
/// Check each method's source code for more details.
@override
List<PickMethod> pickMethods(BuildContext context) {
return <PickMethod>[
PickMethod.common(context, maxAssetsCount),
PickMethod.image(context, maxAssetsCount),
PickMethod.video(context, maxAssetsCount),
PickMethod.audio(context, maxAssetsCount),
if (Platform.isIOS || Platform.isMacOS)
PickMethod.livePhoto(context, maxAssetsCount),
PickMethod.camera(
context: context,
maxAssetsCount: maxAssetsCount,
handleResult: (BuildContext context, AssetEntity result) =>
Navigator.maybeOf(context)?.pop(<AssetEntity>[result]),
),
PickMethod.cameraAndStay(context, maxAssetsCount),
PickMethod.changeLanguages(context, maxAssetsCount),
PickMethod.threeItemsGrid(context, maxAssetsCount),
PickMethod.prependItem(context, maxAssetsCount),
PickMethod.customFilterOptions(context, maxAssetsCount),
PickMethod.preventGIFPicked(context, maxAssetsCount),
PickMethod.noPreview(context, maxAssetsCount),
PickMethod.customizableTheme(context, maxAssetsCount),
PickMethod.pathNameBuilder(context, maxAssetsCount),
];
}
@override
bool get wantKeepAlive => true;
}