selectMedia static method

Future<List<Uint8List>?> selectMedia(
  1. dynamic context, {
  2. String? titleText = '',
  3. String? completeText = 'done',
  4. String? selectAlbumText = '',
  5. int? crossAxisCount = 4,
  6. int? maxLength = 2,
  7. double? aspectRatio = 1.0 / 1.91,
  8. double? previewHeight = 300,
  9. double? previewShowingRatio = 1 / 3,
  10. Color? backgroundColor = Colors.grey,
  11. Color? tagColor = Colors.yellow,
  12. Color? tagTextColor = Colors.black,
  13. Color? textColor = Colors.white,
  14. Widget? loadingWidget = const Center(child: CircularProgressIndicator()),
  15. Widget? actionLoadingWidget = const Center(child: CircularProgressIndicator()),
})

Implementation

static Future<List<Uint8List>?> selectMedia(
  context, {
  String? titleText = '',
  String? completeText = 'done',
  String? selectAlbumText = '',
  int? crossAxisCount = 4,
  int? maxLength = 2,
  double? aspectRatio = 1.0 / 1.91,
  double? previewHeight = 300,
  double? previewShowingRatio = 1 / 3,
  Color? backgroundColor = Colors.grey,
  Color? tagColor = Colors.yellow,
  Color? tagTextColor = Colors.black,
  Color? textColor = Colors.white,
  Widget? loadingWidget = const Center(
    child: CircularProgressIndicator(),
  ),
  Widget? actionLoadingWidget = const Center(
    child: CircularProgressIndicator(),
  ),
}) async {
  assert(maxLength! > 0);
  assert(crossAxisCount! > 0);
  assert(aspectRatio! > 0);
  assert(previewHeight! >= 0);
  assert(previewShowingRatio! >= 0);

  return await Navigator.of(context, rootNavigator: true)
      .push(MaterialPageRoute(
          builder: (context) => _SelectMediaPage(
                titleText!,
                completeText!,
                selectAlbumText!,
                crossAxisCount!,
                maxLength!,
                aspectRatio!,
                previewHeight!,
                previewShowingRatio!,
                backgroundColor!,
                tagColor!,
                tagTextColor!,
                textColor!,
                loadingWidget!,
                actionLoadingWidget!,
                key: UniqueKey(),
              )));
}