Skip to content

Commit

Permalink
Update Audio rendering
Browse files Browse the repository at this point in the history
  • Loading branch information
ppupha committed Oct 23, 2024
1 parent 5a025d4 commit 933448a
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 6 deletions.
11 changes: 5 additions & 6 deletions lib/nft_rendering/audio_rendering_widget.dart
Original file line number Diff line number Diff line change
@@ -1,22 +1,21 @@
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;
final Widget loadingWidget;
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,
Expand Down
7 changes: 7 additions & 0 deletions lib/screen/account/test_artwork_screen.dart
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -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(
Expand Down
7 changes: 7 additions & 0 deletions lib/screen/detail/preview_detail/preview_detail_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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,
Expand Down
9 changes: 9 additions & 0 deletions lib/view/feralfile_artwork_preview_widget.dart
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -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(
Expand Down
7 changes: 7 additions & 0 deletions lib/view/john_gerrard_live_performance.dart
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -99,6 +100,12 @@ class _JohnGerrardLivePerformanceWidgetState
previewURL: previewUrl,
),
);
case RenderingType.audio:
renderingWidget = Center(
child: AudioNFTRenderingWidget(
previewURL: previewUrl,
),
);
default:
renderingWidget = Center(
child: WebviewNFTRenderingWidget(
Expand Down

0 comments on commit 933448a

Please sign in to comment.