Skip to content

Commit

Permalink
updated pluging
Browse files Browse the repository at this point in the history
  • Loading branch information
Sheikh Haziq committed Jan 3, 2025
1 parent 7e53dbc commit 37e9480
Show file tree
Hide file tree
Showing 9 changed files with 269 additions and 211 deletions.
3 changes: 3 additions & 0 deletions android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@
<meta-data
android:name="flutterEmbedding"
android:value="2" />
<meta-data
android:name="io.flutter.embedding.android.EnableImpeller"
android:value="false" />
</application>
<!-- Required to query activities that can process text, see:
https://developer.android.com/training/package-visibility and
Expand Down
2 changes: 1 addition & 1 deletion lib/app_config.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
AppConfig appConfig = AppConfig(version: 33, codeName: '2.0.8');
AppConfig appConfig = AppConfig(version: 34, codeName: '2.0.9');

class AppConfig {
int version;
Expand Down
14 changes: 9 additions & 5 deletions lib/screens/home_screen/section_item.dart
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,14 @@ class _SectionItemState extends State<SectionItem> {
super.dispose();
}

loadMoreItems(){
if(widget.section['continuation']!=null){
loadMoreItems() {
if (widget.section['continuation'] != null) {
setState(() {
loadingMore = true;
});
GetIt.I<YTMusic>().getMoreItems(continuation: widget.section['continuation']).then((value) {
GetIt.I<YTMusic>()
.getMoreItems(continuation: widget.section['continuation'])
.then((value) {
setState(() {
widget.section['contents'].addAll(value['items']);
widget.section['continuation'] = value['continuation'];
Expand Down Expand Up @@ -179,8 +181,10 @@ class _SectionItemState extends State<SectionItem> {
items: widget.section['contents'],
controller: horizontalScrollController,
),
if(loadingMore)const AdaptiveProgressRing(),
if(widget.section['continuation']!=null && !loadingMore) AdaptiveButton(onPressed: loadMoreItems, child:const Text("Load More"))
if (loadingMore) const AdaptiveProgressRing(),
if (widget.section['continuation'] != null && !loadingMore)
AdaptiveButton(
onPressed: loadMoreItems, child: const Text("Load More"))
],
);
}
Expand Down
31 changes: 6 additions & 25 deletions lib/screens/saved_screen/downloading_screen.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

import 'package:cached_network_image/cached_network_image.dart';
import 'package:expandable_text/expandable_text.dart';
import 'package:flutter/material.dart';
Expand Down Expand Up @@ -28,15 +27,13 @@ class DownloadingScreen extends StatelessWidget {
valueListenable: GetIt.I<DownloadManager>().downloads,
builder: (context, allSongs, snapshot) {
List songs = allSongs
.where((song) =>
['DOWNLOADING'].contains(song['status']))
.where((song) => ['DOWNLOADING'].contains(song['status']))
.toList();
return Column(
children: [
...songs.indexed.map<Widget>((indexedSong) {
int index = indexedSong.$1;
return DownloadingSongTile(
songs: songs, index: index);
return DownloadingSongTile(songs: songs, index: index);
})
],
);
Expand All @@ -61,10 +58,8 @@ class DownloadingSongTile extends StatelessWidget {
double height =
(song['aspectRatio'] != null ? 50 / song['aspectRatio'] : 50)
.toDouble();

return AdaptiveListTile(


title: Text(song['title'] ?? "", maxLines: 1),
leading: ClipRRect(
borderRadius: BorderRadius.circular(3),
Expand All @@ -77,11 +72,11 @@ class DownloadingSongTile extends StatelessWidget {
),
),
subtitle: LinearProgressIndicator(
value: (song['progress'] ?? 0)/100,
value: (song['progress'] ?? 0) / 100,
color: Theme.of(context).primaryColor,
backgroundColor: Theme.of(context).colorScheme.onSurface.withOpacity(0.3),
backgroundColor:
Theme.of(context).colorScheme.onSurface.withOpacity(0.3),
),

trailing: song['status'] == 'DELETED'
? IconButton(
onPressed: () async {
Expand All @@ -100,18 +95,4 @@ class DownloadingSongTile extends StatelessWidget {
: null,
);
}

String _buildSubtitle(Map item) {
List sub = [];
if (sub.isEmpty && item['artists'] != null) {
for (Map artist in item['artists']) {
sub.add(artist['name']);
}
}
if (sub.isEmpty && item['album'] != null) {
sub.add(item['album']['name']);
}
String s = sub.join(' · ');
return item['subtitle'] ?? s;
}
}
1 change: 1 addition & 0 deletions lib/services/custom_audio_stream.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ class CustomAudioStream extends StreamAudioSource {

@override
Future<StreamAudioResponse> request([int? start, int? end]) async {
print(videoId);
StreamManifest manifest =
await ytExplode.videos.streamsClient.getManifest(videoId);

Expand Down
3 changes: 0 additions & 3 deletions lib/services/stream_client.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,6 @@ class AudioStreamClient {
'upgrade-insecure-requests': '1',
};

// Existing methods...

// New method to fetch audio stream with optional byte range
Stream<List<int>> getAudioStream(streamInfo,
{required int start, required int end}) =>
_getStream(streamInfo, streamClient: this, start: start, end: end);
Expand Down
4 changes: 2 additions & 2 deletions lib/utils/adaptive_widgets/text_field.dart
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,11 @@ class AdaptiveTextField extends StatelessWidget {
autofocus: autofocus,
maxLines: maxLines,
textInputAction: textInputAction,
decoration: BoxDecoration(
decoration: WidgetStatePropertyAll(BoxDecoration(
color: fillColor,
borderRadius: borderRadius,
border: borderWidth > 0 ? Border.all(width: borderWidth) : null,
),
)),
);
}
return TextField(
Expand Down
Loading

0 comments on commit 37e9480

Please sign in to comment.