progress indicator if duration is not known

This commit is contained in:
poka 2023-04-15 23:48:44 +02:00
parent 29491fb800
commit 422aaefbac
22 changed files with 405 additions and 254 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

View File

@ -1,122 +1,122 @@
{
"images" : [
"images": [
{
"size" : "20x20",
"idiom" : "iphone",
"filename" : "Icon-App-20x20@2x.png",
"scale" : "2x"
"filename": "Icon-App-20x20@2x.png",
"idiom": "iphone",
"scale": "2x",
"size": "20x20"
},
{
"size" : "20x20",
"idiom" : "iphone",
"filename" : "Icon-App-20x20@3x.png",
"scale" : "3x"
"filename": "Icon-App-20x20@3x.png",
"idiom": "iphone",
"scale": "3x",
"size": "20x20"
},
{
"size" : "29x29",
"idiom" : "iphone",
"filename" : "Icon-App-29x29@1x.png",
"scale" : "1x"
"filename": "Icon-App-29x29@1x.png",
"idiom": "iphone",
"scale": "1x",
"size": "29x29"
},
{
"size" : "29x29",
"idiom" : "iphone",
"filename" : "Icon-App-29x29@2x.png",
"scale" : "2x"
"filename": "Icon-App-29x29@2x.png",
"idiom": "iphone",
"scale": "2x",
"size": "29x29"
},
{
"size" : "29x29",
"idiom" : "iphone",
"filename" : "Icon-App-29x29@3x.png",
"scale" : "3x"
"filename": "Icon-App-29x29@3x.png",
"idiom": "iphone",
"scale": "3x",
"size": "29x29"
},
{
"size" : "40x40",
"idiom" : "iphone",
"filename" : "Icon-App-40x40@2x.png",
"scale" : "2x"
"filename": "Icon-App-40x40@2x.png",
"idiom": "iphone",
"scale": "2x",
"size": "40x40"
},
{
"size" : "40x40",
"idiom" : "iphone",
"filename" : "Icon-App-40x40@3x.png",
"scale" : "3x"
"filename": "Icon-App-40x40@3x.png",
"idiom": "iphone",
"scale": "3x",
"size": "40x40"
},
{
"size" : "60x60",
"idiom" : "iphone",
"filename" : "Icon-App-60x60@2x.png",
"scale" : "2x"
"filename": "Icon-App-60x60@2x.png",
"idiom": "iphone",
"scale": "2x",
"size": "60x60"
},
{
"size" : "60x60",
"idiom" : "iphone",
"filename" : "Icon-App-60x60@3x.png",
"scale" : "3x"
"filename": "Icon-App-60x60@3x.png",
"idiom": "iphone",
"scale": "3x",
"size": "60x60"
},
{
"size" : "20x20",
"idiom" : "ipad",
"filename" : "Icon-App-20x20@1x.png",
"scale" : "1x"
"filename": "Icon-App-20x20@1x.png",
"idiom": "ipad",
"scale": "1x",
"size": "20x20"
},
{
"size" : "20x20",
"idiom" : "ipad",
"filename" : "Icon-App-20x20@2x.png",
"scale" : "2x"
"filename": "Icon-App-20x20@2x.png",
"idiom": "ipad",
"scale": "2x",
"size": "20x20"
},
{
"size" : "29x29",
"idiom" : "ipad",
"filename" : "Icon-App-29x29@1x.png",
"scale" : "1x"
"filename": "Icon-App-29x29@1x.png",
"idiom": "ipad",
"scale": "1x",
"size": "29x29"
},
{
"size" : "29x29",
"idiom" : "ipad",
"filename" : "Icon-App-29x29@2x.png",
"scale" : "2x"
"filename": "Icon-App-29x29@2x.png",
"idiom": "ipad",
"scale": "2x",
"size": "29x29"
},
{
"size" : "40x40",
"idiom" : "ipad",
"filename" : "Icon-App-40x40@1x.png",
"scale" : "1x"
"filename": "Icon-App-40x40@1x.png",
"idiom": "ipad",
"scale": "1x",
"size": "40x40"
},
{
"size" : "40x40",
"idiom" : "ipad",
"filename" : "Icon-App-40x40@2x.png",
"scale" : "2x"
"filename": "Icon-App-40x40@2x.png",
"idiom": "ipad",
"scale": "2x",
"size": "40x40"
},
{
"size" : "76x76",
"idiom" : "ipad",
"filename" : "Icon-App-76x76@1x.png",
"scale" : "1x"
"filename": "Icon-App-76x76@1x.png",
"idiom": "ipad",
"scale": "1x",
"size": "76x76"
},
{
"size" : "76x76",
"idiom" : "ipad",
"filename" : "Icon-App-76x76@2x.png",
"scale" : "2x"
"filename": "Icon-App-76x76@2x.png",
"idiom": "ipad",
"scale": "2x",
"size": "76x76"
},
{
"size" : "83.5x83.5",
"idiom" : "ipad",
"filename" : "Icon-App-83.5x83.5@2x.png",
"scale" : "2x"
"filename": "Icon-App-83.5x83.5@2x.png",
"idiom": "ipad",
"scale": "2x",
"size": "83.5x83.5"
},
{
"size" : "1024x1024",
"idiom" : "ios-marketing",
"filename" : "Icon-App-1024x1024@1x.png",
"scale" : "1x"
"filename": "Icon-App-1024x1024@1x.png",
"idiom": "ios-marketing",
"scale": "1x",
"size": "1024x1024"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
"info": {
"author": "icons_launcher",
"version": 1
}
}
}

View File

@ -1,6 +1,10 @@
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:logger/logger.dart';
TextStyle globalTextStyle = TextStyle(color: Colors.grey[350]);
const proxyHeader =
kDebugMode || !kIsWeb ? 'https://' : 'http://127.0.0.1:8080/';
// Logger
final log = Logger();

View File

@ -98,7 +98,7 @@ class HomeProvider with ChangeNotifier {
try {
final source = UrlSource(
"https://${invidiousUrl[1]}/latest_version?id=${track.id}&itag=140&local=true&listen=1");
"https://${invidiousUrl[3]}/latest_version?id=${track.id}&itag=140&local=true&listen=1");
print(source.url);
await player.play(source);
} catch (e) {

View File

@ -42,140 +42,135 @@ class _HomeScreenState extends State<HomeScreen> {
child: Stack(
children: <Widget>[
Scaffold(
body: RawScrollbar(
thumbColor: Colors.grey[600],
radius: const Radius.circular(20),
thickness: 12,
// thumbVisibility: true,
mainAxisMargin: 70,
child: SingleChildScrollView(
// controller: AdjustableScrollController(40),
child: Column(
children: <Widget>[
Container(
color: Colors.grey[900],
height: 50,
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
DropdownButton(
dropdownColor: Colors.grey[900],
value: radio,
style: TextStyle(
fontSize: 15, color: Colors.grey[300]),
underline: const SizedBox(),
iconSize: 22,
onChanged: (String? newRadio) {
setState(() {
radio = newRadio!;
});
},
items: hp.radioList),
const SizedBox(width: 50),
DropdownButton(
dropdownColor: Colors.grey[900],
value: hp.userPageNbr.toString(),
style: TextStyle(
fontSize: 15, color: Colors.grey[300]),
underline: const SizedBox(),
iconSize: 22,
onChanged: (String? newPageNumber) {
setState(() {
hp.userPageNbr =
int.parse(newPageNumber!);
});
},
items: hp.pageList),
]),
),
FutureBuilder<List<Track>>(
future: hp.getTracks(radio),
builder: (
BuildContext context,
AsyncSnapshot<List<Track>> snapshot,
) {
print(snapshot.connectionState);
if (snapshot.connectionState ==
ConnectionState.waiting) {
return Stack(children: [
Container(
height: 10000,
width: 10000,
color: const Color(0xFF121212)),
Center(
child: Column(children: [
const SizedBox(height: 20),
SizedBox(
height: 30,
width: 30,
child: CircularProgressIndicator(
color: Colors.amber[100],
),
),
]),
),
]);
} else if (snapshot.connectionState ==
ConnectionState.done) {
if (snapshot.hasError) {
return Stack(children: [
Container(
height: 10000,
width: 10000,
color: const Color(0xFF121212)),
Center(
child: Column(children: [
const SizedBox(height: 20),
Text(
'Error: ${snapshot.error}',
style: TextStyle(color: Colors.grey[500]),
),
]),
),
]);
} else if (snapshot.hasData) {
return Table(
columnWidths: {
0: const FlexColumnWidth(4),
1: const FlexColumnWidth(2),
2: const FlexColumnWidth(1),
},
defaultVerticalAlignment:
TableCellVerticalAlignment.middle,
children: snapshot.data!
.map(
(item) => _buildTableRow(item, context))
.toList()
..insert(
0,
_buildTableRow(
Track(
number: -1,
title: 'TITRE',
artiste: 'ARTISTE',
album: 'ALBUM',
id: 'URL'),
context),
),
);
} else {
return const Text('Empty data');
}
} else {
return Text('State: ${snapshot.connectionState}');
}
},
),
const SizedBox(height: 70)
],
body: SingleChildScrollView(
// controller: AdjustableScrollController(40),
child: Column(
children: <Widget>[
Container(
color: Colors.grey[900],
height: 50,
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
DropdownButton(
dropdownColor: Colors.grey[900],
value: radio,
style: TextStyle(
fontSize: 15, color: Colors.grey[300]),
underline: const SizedBox(),
iconSize: 22,
onChanged: (String? newRadio) {
setState(() {
radio = newRadio!;
});
},
items: hp.radioList),
const SizedBox(width: 50),
DropdownButton(
dropdownColor: Colors.grey[900],
value: hp.userPageNbr.toString(),
style: TextStyle(
fontSize: 15, color: Colors.grey[300]),
underline: const SizedBox(),
iconSize: 22,
onChanged: (String? newPageNumber) {
setState(() {
hp.userPageNbr = int.parse(newPageNumber!);
});
},
items: hp.pageList),
]),
),
)),
FutureBuilder<List<Track>>(
future: hp.getTracks(radio),
builder: (
BuildContext context,
AsyncSnapshot<List<Track>> snapshot,
) {
print(snapshot.connectionState);
if (snapshot.connectionState == ConnectionState.waiting) {
return Stack(children: [
Container(
height: 10000,
width: 10000,
color: const Color(0xFF121212)),
Center(
child: Column(children: [
const SizedBox(height: 20),
SizedBox(
height: 30,
width: 30,
child: CircularProgressIndicator(
color: Colors.amber[100],
),
),
]),
),
]);
} else if (snapshot.connectionState ==
ConnectionState.done) {
if (snapshot.hasError) {
return Stack(children: [
Container(
height: 10000,
width: 10000,
color: const Color(0xFF121212)),
Center(
child: Column(children: [
const SizedBox(height: 20),
Text(
'Error: ${snapshot.error}',
style: TextStyle(color: Colors.grey[500]),
),
]),
),
]);
} else if (snapshot.hasData) {
return Table(
columnWidths: {
0: const FlexColumnWidth(4),
1: const FlexColumnWidth(2),
2: const FlexColumnWidth(1),
},
defaultVerticalAlignment:
TableCellVerticalAlignment.middle,
children: snapshot.data!
.map((item) => _buildTableRow(item, context))
.toList()
..insert(
0,
_buildTableRow(
Track(
number: -1,
title: 'TITRE',
artiste: 'ARTISTE',
album: 'ALBUM',
id: 'URL'),
context),
),
);
} else {
return const Text('Empty data');
}
} else {
return Text('State: ${snapshot.connectionState}');
}
},
),
const SizedBox(height: 70)
],
),
),
),
Consumer<PlayerProvider>(builder: (context, playerProvider, _) {
TextEditingController trackTitle = TextEditingController();
TextEditingController trackArtiste = TextEditingController();
trackTitle.text = hp.currentTrack?.title ?? '';
trackArtiste.text = hp.currentTrack?.artiste ?? '';
// if ((hp.currentTrack?.duration?.inSeconds ?? -1) <= 0) {
// return const Text('attenddssss !!');
// }
return Miniplayer(
controller: controller,
backgroundColor: Colors.grey[900]!,
@ -305,38 +300,58 @@ class _HomeScreenState extends State<HomeScreen> {
TextStyle(color: Colors.grey[500], fontSize: 12),
),
const SizedBox(width: 3),
SliderTheme(
data: const SliderThemeData(
thumbShape:
RoundSliderThumbShape(enabledThumbRadius: 2),
overlayShape:
RoundSliderThumbShape(enabledThumbRadius: 5),
trackHeight: 2,
),
child: SizedBox(
width: 300,
child: Slider(
value: double.parse(hp
.currentTrack?.position?.inSeconds
.toString() ??
'0'),
max: double.parse(hp
.currentTrack?.duration?.inSeconds
.toString() ??
'2000'),
onChanged: (double value) {
if (hp.currentTrack?.position != null) {
hp.player.seek(
Duration(seconds: value.toInt()),
);
playerProvider.reload();
}
},
activeColor: Colors.grey[400],
inactiveColor: Colors.grey[700],
),
),
),
(hp.currentTrack?.duration?.inSeconds ?? -1) <= 0
? Column(
children: [
const SizedBox(width: 300),
hp.currentTrack?.title == null
? Text(
'Choisissez un titre',
style: TextStyle(
color: Colors.grey[500]),
)
: const SizedBox(
height: 15,
width: 15,
child: CircularProgressIndicator(
strokeWidth: 2,
color: Colors.orange,
),
),
],
)
: SliderTheme(
data: const SliderThemeData(
thumbShape: RoundSliderThumbShape(
enabledThumbRadius: 2),
overlayShape: RoundSliderThumbShape(
enabledThumbRadius: 5),
trackHeight: 2,
),
child: SizedBox(
width: 300,
child: Slider(
value: double.parse(hp
.currentTrack?.position?.inSeconds
.toString() ??
'0'),
max: double.parse(hp
.currentTrack?.duration?.inSeconds
.toString() ??
'2000'),
onChanged: (double value) {
if (hp.currentTrack?.position != null) {
hp.player.seek(
Duration(seconds: value.toInt()),
);
playerProvider.reload();
}
},
activeColor: Colors.grey[400],
inactiveColor: Colors.grey[700],
),
),
),
const SizedBox(width: 3),
Text(
timeFormat(hp.currentTrack?.duration ??

View File

@ -0,0 +1,14 @@
//
// Generated file. Do not edit.
//
import FlutterMacOS
import Foundation
import audioplayers_darwin
import path_provider_foundation
func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
AudioplayersDarwinPlugin.register(with: registry.registrar(forPlugin: "AudioplayersDarwinPlugin"))
PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin"))
}

View File

@ -0,0 +1,11 @@
// This is a generated file; do not edit or check into version control.
FLUTTER_ROOT=C:\Users\poka\dev\flutter
FLUTTER_APPLICATION_PATH=C:\Users\poka\dev\fipy
COCOAPODS_PARALLEL_CODE_SIGN=true
FLUTTER_BUILD_DIR=build
FLUTTER_BUILD_NAME=0.0.2
FLUTTER_BUILD_NUMBER=2
DART_OBFUSCATION=false
TRACK_WIDGET_CREATION=true
TREE_SHAKE_ICONS=false
PACKAGE_CONFIG=.dart_tool/package_config.json

View File

@ -0,0 +1,12 @@
#!/bin/sh
# This is a generated file; do not edit or check into version control.
export "FLUTTER_ROOT=C:\Users\poka\dev\flutter"
export "FLUTTER_APPLICATION_PATH=C:\Users\poka\dev\fipy"
export "COCOAPODS_PARALLEL_CODE_SIGN=true"
export "FLUTTER_BUILD_DIR=build"
export "FLUTTER_BUILD_NAME=0.0.2"
export "FLUTTER_BUILD_NUMBER=2"
export "DART_OBFUSCATION=false"
export "TRACK_WIDGET_CREATION=true"
export "TREE_SHAKE_ICONS=false"
export "PACKAGE_CONFIG=.dart_tool/package_config.json"

View File

@ -0,0 +1,68 @@
{
"images": [
{
"filename": "app_icon_16.png",
"idiom": "mac",
"scale": "1x",
"size": "16x16"
},
{
"filename": "app_icon_32.png",
"idiom": "mac",
"scale": "2x",
"size": "16x16"
},
{
"filename": "app_icon_32.png",
"idiom": "mac",
"scale": "1x",
"size": "32x32"
},
{
"filename": "app_icon_64.png",
"idiom": "mac",
"scale": "2x",
"size": "32x32"
},
{
"filename": "app_icon_128.png",
"idiom": "mac",
"scale": "1x",
"size": "128x128"
},
{
"filename": "app_icon_256.png",
"idiom": "mac",
"scale": "2x",
"size": "128x128"
},
{
"filename": "app_icon_256.png",
"idiom": "mac",
"scale": "1x",
"size": "256x256"
},
{
"filename": "app_icon_512.png",
"idiom": "mac",
"scale": "2x",
"size": "256x256"
},
{
"filename": "app_icon_512.png",
"idiom": "mac",
"scale": "1x",
"size": "512x512"
},
{
"filename": "app_icon_1024.png",
"idiom": "mac",
"scale": "2x",
"size": "512x512"
}
],
"info": {
"author": "icons_launcher",
"version": 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 137 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 396 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 871 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

View File

@ -36,13 +36,9 @@ Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{
[Files]
Source: "C:\Users\poka\dev\fipy\build\windows\runner\Release\{#MyAppExeName}"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Users\poka\dev\fipy\build\windows\runner\Release\dart_vlc_plugin.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Users\poka\dev\fipy\build\windows\runner\Release\flutter_windows.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Users\poka\dev\fipy\build\windows\runner\Release\libvlc.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Users\poka\dev\fipy\build\windows\runner\Release\libvlccore.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Users\poka\dev\fipy\build\windows\runner\Release\audioplayers_windows_plugin.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Users\poka\dev\fipy\build\windows\runner\Release\data\*"; DestDir: "{app}\data"; Flags: ignoreversion recursesubdirs createallsubdirs
Source: "C:\Users\poka\dev\fipy\build\windows\runner\Release\plugins\*"; DestDir: "{app}\plugins"; Flags: ignoreversion recursesubdirs createallsubdirs
; NOTE: Don't use "Flags: ignoreversion" on any shared system files
[Icons]

View File

@ -264,6 +264,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "2.0.1"
logger:
dependency: "direct main"
description:
name: logger
sha256: db2ff852ed77090ba9f62d3611e4208a3d11dfa35991a81ae724c113fcb3e3f7
url: "https://pub.dev"
source: hosted
version: "1.3.0"
matcher:
dependency: transitive
description:

View File

@ -2,7 +2,7 @@ name: fipy
description: Advanced FIP radio track explorer
publish_to: 'none' # Remove this line if you wish to publish to pub.dev
version: 0.0.2+1
version: 0.0.2+2
environment:
sdk: ">=2.16.2 <3.0.0"
@ -27,6 +27,7 @@ dependencies:
universal_io: ^2.0.4
# ffmpeg_cli: ^0.1.0
audioplayers: ^4.0.1
logger: ^1.3.0
# git:
# url: https://github.com/bluefireteam/audioplayers/tree/main/packages/audioplayers_linux
# ref: main
@ -36,15 +37,29 @@ dev_dependencies:
flutter_test:
sdk: flutter
flutter_lints: ^2.0.1
icons_launcher: ^2.0.5
icons_launcher: ^2.0.6
flutter_icons:
android: true
ios: true
# macos: true
windows: true
web: true
image_path: "assets/logo_green_dark.jpg"
icons_launcher:
image_path: 'assets/logo_green_dark.jpg'
platforms:
android:
enable: true
ios:
enable: true
windows:
enable: true
linux:
enable: true
macos:
enable: true
# flutter_icons:
# android: true
# ios: true
# # macos: true
# windows: true
# web: true
# image_path: "assets/logo_green_dark.jpg"
flutter:
uses-material-design: true

View File

@ -0,0 +1,8 @@
[Desktop Entry]
Name=Flutter Linux App
Comment=Flutter Linux launcher icon
Exec=app_icon
Icon=app_icon.png
Terminal=false
Type=Application
Categories=Entertainment;

BIN
snap/gui/app_icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 33 KiB

After

Width:  |  Height:  |  Size: 34 KiB