Skip to content

Commit

Permalink
➕ Use wechat_picker_library (fluttercandies#543)
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexV525 authored Feb 2, 2024
1 parent 16a9928 commit 9a8c4c1
Show file tree
Hide file tree
Showing 21 changed files with 27 additions and 418 deletions.
1 change: 0 additions & 1 deletion .github/workflows/runnable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,5 +75,4 @@ jobs:
- run: dart --version
- run: flutter --version
- run: flutter pub get
- run: sudo echo "y" | sudo $ANDROID_HOME/tools/bin/sdkmanager "ndk;21.4.7075529"
- run: cd example; flutter build apk --debug
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ that can be found in the LICENSE file. -->
> [!IMPORTANT]
> See the [Migration Guide](guides/migration_guide.md) for the details of breaking changes between versions.
## 9.0.0-dev.3

### Improvements

- Use `wechat_picker_library`.

## 9.0.0-dev.2

### Fixes
Expand Down
4 changes: 0 additions & 4 deletions lib/src/constants/constants.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,12 @@
// Use of this source code is governed by an Apache license that can be found
// in the LICENSE file.

import 'package:flutter/painting.dart';
import 'package:photo_manager/photo_manager.dart';

const String packageName = 'wechat_assets_picker';

const int defaultAssetsPerPage = 80;
const int defaultMaxAssetsCount = 9;

/// Default theme color from WeChat.
const Color defaultThemeColorWeChat = Color(0xff00bc56);

const ThumbnailSize defaultAssetGridPreviewSize = ThumbnailSize.square(200);
const ThumbnailSize defaultPathThumbnailSize = ThumbnailSize.square(80);
40 changes: 0 additions & 40 deletions lib/src/constants/extensions.dart

This file was deleted.

4 changes: 4 additions & 0 deletions lib/src/constants/typedefs.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ import 'dart:async';

import 'package:flutter/widgets.dart';
import 'package:photo_manager/photo_manager.dart' show PermissionState;
import 'package:provider/provider.dart';

/// {@nodoc}
typedef CNP<T extends ChangeNotifier?> = ChangeNotifierProvider<T>;

/// {@template wechat_assets_picker.LoadingIndicatorBuilder}
/// Build the loading indicator with the given [isAssetsEmpty].
Expand Down
8 changes: 2 additions & 6 deletions lib/src/delegates/asset_picker_builder_delegate.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,23 +14,19 @@ import 'package:flutter/services.dart';
import 'package:photo_manager/photo_manager.dart';
import 'package:photo_manager_image_provider/photo_manager_image_provider.dart';
import 'package:provider/provider.dart';
import 'package:wechat_picker_library/wechat_picker_library.dart';

import '../constants/constants.dart';
import '../constants/enums.dart';
import '../constants/extensions.dart';
import '../constants/typedefs.dart';
import '../delegates/asset_picker_text_delegate.dart';
import '../internal/singleton.dart';
import '../internals/singleton.dart';
import '../models/path_wrapper.dart';
import '../provider/asset_picker_provider.dart';
import '../widget/asset_picker.dart';
import '../widget/asset_picker_app_bar.dart';
import '../widget/asset_picker_viewer.dart';
import '../widget/builder/asset_entity_grid_item_builder.dart';
import '../widget/builder/value_listenable_builder_2.dart';
import '../widget/gaps.dart';
import '../widget/platform_progress_indicator.dart';
import '../widget/scale_text.dart';

/// The delegate to build the whole picker's components.
///
Expand Down
1 change: 1 addition & 0 deletions lib/src/delegates/asset_picker_delegate.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:photo_manager/photo_manager.dart';
import 'package:wechat_picker_library/wechat_picker_library.dart';

import '../constants/config.dart';
import '../constants/constants.dart';
Expand Down
6 changes: 2 additions & 4 deletions lib/src/delegates/asset_picker_viewer_builder_delegate.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,21 @@ import 'package:flutter/services.dart';
import 'package:photo_manager/photo_manager.dart';
import 'package:photo_manager_image_provider/photo_manager_image_provider.dart';
import 'package:provider/provider.dart';
import 'package:wechat_picker_library/wechat_picker_library.dart';

import '../constants/custom_scroll_physics.dart';
import '../constants/enums.dart';
import '../constants/extensions.dart';
import '../constants/typedefs.dart';
import '../delegates/asset_picker_text_delegate.dart';
import '../internal/singleton.dart';
import '../internals/singleton.dart';
import '../provider/asset_picker_provider.dart';
import '../provider/asset_picker_viewer_provider.dart';
import '../widget/asset_picker_app_bar.dart';
import '../widget/asset_picker_viewer.dart';
import '../widget/builder/audio_page_builder.dart';
import '../widget/builder/fade_image_builder.dart';
import '../widget/builder/image_page_builder.dart';
import '../widget/builder/value_listenable_builder_2.dart';
import '../widget/builder/video_page_builder.dart';
import '../widget/scale_text.dart';

abstract class AssetPickerViewerBuilderDelegate<Asset, Path> {
AssetPickerViewerBuilderDelegate({
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion lib/src/provider/asset_picker_provider.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import 'package:provider/provider.dart';

import '../constants/constants.dart';
import '../delegates/sort_path_delegate.dart';
import '../internal/singleton.dart';
import '../internals/singleton.dart';
import '../models/path_wrapper.dart';

/// Helps the assets picker to manage [Path]s and [Asset]s.
Expand Down
3 changes: 1 addition & 2 deletions lib/src/widget/asset_picker_app_bar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ import 'dart:ui' as ui;
import 'package:flutter/material.dart';
import 'package:flutter/semantics.dart';
import 'package:flutter/services.dart';

import '../constants/extensions.dart';
import 'package:wechat_picker_library/wechat_picker_library.dart';

/// A custom app bar.
/// 自定义的顶栏
Expand Down
4 changes: 2 additions & 2 deletions lib/src/widget/builder/asset_entity_grid_item_builder.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
import 'package:extended_image/extended_image.dart';
import 'package:flutter/material.dart';
import 'package:photo_manager_image_provider/photo_manager_image_provider.dart';
import 'package:wechat_picker_library/wechat_picker_library.dart';

import '../../internal/singleton.dart';
import '../../widget/scale_text.dart';
import '../../internals/singleton.dart';

class AssetEntityGridItemBuilder extends StatefulWidget {
const AssetEntityGridItemBuilder({
Expand Down
5 changes: 2 additions & 3 deletions lib/src/widget/builder/audio_page_builder.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,10 @@ import 'dart:async';
import 'package:flutter/material.dart';
import 'package:photo_manager/photo_manager.dart';
import 'package:video_player/video_player.dart';
import 'package:wechat_picker_library/wechat_picker_library.dart';

import '../../constants/constants.dart';
import '../../constants/extensions.dart';
import '../../internal/singleton.dart';
import '../scale_text.dart';
import '../../internals/singleton.dart';

class AudioPageBuilder extends StatefulWidget {
const AudioPageBuilder({super.key, required this.asset});
Expand Down
2 changes: 1 addition & 1 deletion lib/src/widget/builder/image_page_builder.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ import 'package:flutter/services.dart';
import 'package:photo_manager/photo_manager.dart';
import 'package:photo_manager_image_provider/photo_manager_image_provider.dart';
import 'package:video_player/video_player.dart';
import 'package:wechat_picker_library/wechat_picker_library.dart';

import '../../delegates/asset_picker_viewer_builder_delegate.dart';
import 'locally_available_builder.dart';

class ImagePageBuilder extends StatefulWidget {
const ImagePageBuilder({
Expand Down
135 changes: 0 additions & 135 deletions lib/src/widget/builder/locally_available_builder.dart

This file was deleted.

34 changes: 0 additions & 34 deletions lib/src/widget/builder/value_listenable_builder_2.dart

This file was deleted.

5 changes: 2 additions & 3 deletions lib/src/widget/builder/video_page_builder.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,11 @@ import 'dart:io';
import 'package:flutter/material.dart';
import 'package:photo_manager/photo_manager.dart';
import 'package:video_player/video_player.dart';
import 'package:wechat_picker_library/wechat_picker_library.dart';

import '../../constants/constants.dart';
import '../../delegates/asset_picker_viewer_builder_delegate.dart';
import '../../internal/singleton.dart';
import '../scale_text.dart';
import 'locally_available_builder.dart';
import '../../internals/singleton.dart';

class VideoPageBuilder extends StatefulWidget {
const VideoPageBuilder({
Expand Down
Loading

0 comments on commit 9a8c4c1

Please sign in to comment.