diff --git a/lib/nft_rendering/audio_rendering_widget.dart b/lib/nft_rendering/audio_rendering_widget.dart index d36b222e2..a83da6ee2 100644 --- a/lib/nft_rendering/audio_rendering_widget.dart +++ b/lib/nft_rendering/audio_rendering_widget.dart @@ -1,13 +1,12 @@ import 'dart:async'; import 'package:audio_session/audio_session.dart'; +import 'package:autonomy_flutter/nft_rendering/nft_error_widget.dart'; +import 'package:autonomy_flutter/nft_rendering/nft_loading_widget.dart'; import 'package:autonomy_flutter/nft_rendering/nft_rendering_widget.dart'; import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; -import 'package:just_audio/just_audio.dart'; - -class AudioNFTRenderingWidget extends NFTRenderingWidget { - final String? previewURL; +import 'package:just_audio/just_audional String? previewURL; final String? thumbnailURL; final bool isMute; final Function({int? time})? onLoaded; @@ -15,8 +14,8 @@ class AudioNFTRenderingWidget extends NFTRenderingWidget { final Widget errorWidget; const AudioNFTRenderingWidget({ - required this.loadingWidget, - required this.errorWidget, + this.loadingWidget = const LoadingWidget(), + this.errorWidget = const NFTErrorWidget(), super.key, this.previewURL, this.thumbnailURL, diff --git a/lib/screen/account/test_artwork_screen.dart b/lib/screen/account/test_artwork_screen.dart index dadaf0b33..b9a363b9c 100644 --- a/lib/screen/account/test_artwork_screen.dart +++ b/lib/screen/account/test_artwork_screen.dart @@ -1,3 +1,4 @@ +import 'package:autonomy_flutter/nft_rendering/audio_rendering_widget.dart'; import 'package:autonomy_flutter/nft_rendering/gif_rendering_widget.dart'; import 'package:autonomy_flutter/nft_rendering/image_rendering_widget.dart'; import 'package:autonomy_flutter/nft_rendering/nft_rendering_widget.dart'; @@ -135,6 +136,12 @@ class _TestArtworkScreenState extends State<TestArtworkScreen> { previewURL: previewURL, ), ); + case RenderingType.audio: + renderingWidget = Center( + child: AudioNFTRenderingWidget( + previewURL: previewURL, + ), + ); default: renderingWidget = Center( child: WebviewNFTRenderingWidget( diff --git a/lib/screen/detail/preview_detail/preview_detail_widget.dart b/lib/screen/detail/preview_detail/preview_detail_widget.dart index d749d200e..5809397a0 100644 --- a/lib/screen/detail/preview_detail/preview_detail_widget.dart +++ b/lib/screen/detail/preview_detail/preview_detail_widget.dart @@ -7,6 +7,7 @@ import 'package:autonomy_flutter/common/injector.dart'; import 'package:autonomy_flutter/main.dart'; +import 'package:autonomy_flutter/nft_rendering/audio_rendering_widget.dart'; import 'package:autonomy_flutter/nft_rendering/gif_rendering_widget.dart'; import 'package:autonomy_flutter/nft_rendering/image_rendering_widget.dart'; import 'package:autonomy_flutter/nft_rendering/nft_rendering_widget.dart'; @@ -183,6 +184,12 @@ class ArtworkPreviewWidgetState extends State<ArtworkPreviewWidget> return Center( child: _currentRenderingWidget, ); + case RenderingType.audio: + _currentRenderingWidget = AudioNFTRenderingWidget( + key: _artworkKey, + previewURL: previewURL, + isMute: widget.isMute, + ); default: _currentRenderingWidget = WebviewNFTRenderingWidget( key: _artworkKey, diff --git a/lib/view/feralfile_artwork_preview_widget.dart b/lib/view/feralfile_artwork_preview_widget.dart index 3aa3b75f0..227db5f9e 100644 --- a/lib/view/feralfile_artwork_preview_widget.dart +++ b/lib/view/feralfile_artwork_preview_widget.dart @@ -1,5 +1,6 @@ import 'package:autonomy_flutter/main.dart'; import 'package:autonomy_flutter/model/ff_artwork.dart'; +import 'package:autonomy_flutter/nft_rendering/audio_rendering_widget.dart'; import 'package:autonomy_flutter/nft_rendering/gif_rendering_widget.dart'; import 'package:autonomy_flutter/nft_rendering/image_rendering_widget.dart'; import 'package:autonomy_flutter/nft_rendering/nft_rendering_widget.dart'; @@ -124,6 +125,14 @@ class _FeralfileArtworkPreviewWidgetState previewURL: previewUrl, ), ); + case RenderingType.audio: + return Center( + child: AudioNFTRenderingWidget( + previewURL: previewUrl, + thumbnailURL: thumbnailUrl, + isMute: widget.payload.isMute, + ), + ); default: return Center( child: WebviewNFTRenderingWidget( diff --git a/lib/view/john_gerrard_live_performance.dart b/lib/view/john_gerrard_live_performance.dart index 1f36e5fbe..ff0bfd403 100644 --- a/lib/view/john_gerrard_live_performance.dart +++ b/lib/view/john_gerrard_live_performance.dart @@ -1,5 +1,6 @@ import 'package:autonomy_flutter/main.dart'; import 'package:autonomy_flutter/model/ff_exhibition.dart'; +import 'package:autonomy_flutter/nft_rendering/audio_rendering_widget.dart'; import 'package:autonomy_flutter/nft_rendering/gif_rendering_widget.dart'; import 'package:autonomy_flutter/nft_rendering/image_rendering_widget.dart'; import 'package:autonomy_flutter/nft_rendering/nft_rendering_widget.dart'; @@ -99,6 +100,12 @@ class _JohnGerrardLivePerformanceWidgetState previewURL: previewUrl, ), ); + case RenderingType.audio: + renderingWidget = Center( + child: AudioNFTRenderingWidget( + previewURL: previewUrl, + ), + ); default: renderingWidget = Center( child: WebviewNFTRenderingWidget(