Update audio player version + wip translation for play, pause buttons

This commit is contained in:
Fransolet Thomas 2023-01-17 18:09:09 +01:00
parent 09ae80266b
commit 8d6a0696b8
6 changed files with 79 additions and 78 deletions

View File

@ -1,10 +1,10 @@
# This is a generated file; do not edit or check into version control.
audioplayers=C:\\Users\\thoma\\AppData\\Local\\Pub\\Cache\\hosted\\pub.dartlang.org\\audioplayers-1.1.1\\
audioplayers_android=C:\\Users\\thoma\\AppData\\Local\\Pub\\Cache\\hosted\\pub.dartlang.org\\audioplayers_android-1.1.1\\
audioplayers_darwin=C:\\Users\\thoma\\AppData\\Local\\Pub\\Cache\\hosted\\pub.dartlang.org\\audioplayers_darwin-1.0.3\\
audioplayers_linux=C:\\Users\\thoma\\AppData\\Local\\Pub\\Cache\\hosted\\pub.dartlang.org\\audioplayers_linux-1.0.1\\
audioplayers_web=C:\\Users\\thoma\\AppData\\Local\\Pub\\Cache\\hosted\\pub.dartlang.org\\audioplayers_web-2.0.1\\
audioplayers_windows=C:\\Users\\thoma\\AppData\\Local\\Pub\\Cache\\hosted\\pub.dartlang.org\\audioplayers_windows-1.1.0\\
audioplayers=C:\\Users\\thoma\\AppData\\Local\\Pub\\Cache\\hosted\\pub.dartlang.org\\audioplayers-2.0.0\\
audioplayers_android=C:\\Users\\thoma\\AppData\\Local\\Pub\\Cache\\hosted\\pub.dartlang.org\\audioplayers_android-1.1.4\\
audioplayers_darwin=C:\\Users\\thoma\\AppData\\Local\\Pub\\Cache\\hosted\\pub.dartlang.org\\audioplayers_darwin-2.0.0\\
audioplayers_linux=C:\\Users\\thoma\\AppData\\Local\\Pub\\Cache\\hosted\\pub.dartlang.org\\audioplayers_linux-1.0.3\\
audioplayers_web=C:\\Users\\thoma\\AppData\\Local\\Pub\\Cache\\hosted\\pub.dartlang.org\\audioplayers_web-2.1.1\\
audioplayers_windows=C:\\Users\\thoma\\AppData\\Local\\Pub\\Cache\\hosted\\pub.dartlang.org\\audioplayers_windows-1.1.2\\
path_provider=C:\\Users\\thoma\\AppData\\Local\\Pub\\Cache\\hosted\\pub.dartlang.org\\path_provider-2.0.11\\
path_provider_android=C:\\Users\\thoma\\AppData\\Local\\Pub\\Cache\\hosted\\pub.dartlang.org\\path_provider_android-2.0.20\\
path_provider_ios=C:\\Users\\thoma\\AppData\\Local\\Pub\\Cache\\hosted\\pub.dartlang.org\\path_provider_ios-2.0.11\\

View File

@ -1 +1 @@
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"audioplayers_darwin","path":"C:\\\\Users\\\\thoma\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dartlang.org\\\\audioplayers_darwin-1.0.3\\\\","native_build":true,"dependencies":[]},{"name":"path_provider_ios","path":"C:\\\\Users\\\\thoma\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dartlang.org\\\\path_provider_ios-2.0.11\\\\","native_build":true,"dependencies":[]},{"name":"qr_code_scanner","path":"C:\\\\Users\\\\thoma\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dartlang.org\\\\qr_code_scanner-1.0.1\\\\","native_build":true,"dependencies":[]},{"name":"sqflite","path":"C:\\\\Users\\\\thoma\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dartlang.org\\\\sqflite-2.0.3+1\\\\","native_build":true,"dependencies":[]}],"android":[{"name":"audioplayers_android","path":"C:\\\\Users\\\\thoma\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dartlang.org\\\\audioplayers_android-1.1.1\\\\","native_build":true,"dependencies":[]},{"name":"path_provider_android","path":"C:\\\\Users\\\\thoma\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dartlang.org\\\\path_provider_android-2.0.20\\\\","native_build":true,"dependencies":[]},{"name":"qr_code_scanner","path":"C:\\\\Users\\\\thoma\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dartlang.org\\\\qr_code_scanner-1.0.1\\\\","native_build":true,"dependencies":[]},{"name":"sqflite","path":"C:\\\\Users\\\\thoma\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dartlang.org\\\\sqflite-2.0.3+1\\\\","native_build":true,"dependencies":[]}],"macos":[{"name":"audioplayers_darwin","path":"C:\\\\Users\\\\thoma\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dartlang.org\\\\audioplayers_darwin-1.0.3\\\\","native_build":true,"dependencies":[]},{"name":"path_provider_macos","path":"C:\\\\Users\\\\thoma\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dartlang.org\\\\path_provider_macos-2.0.6\\\\","native_build":true,"dependencies":[]},{"name":"sqflite","path":"C:\\\\Users\\\\thoma\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dartlang.org\\\\sqflite-2.0.3+1\\\\","native_build":true,"dependencies":[]}],"linux":[{"name":"audioplayers_linux","path":"C:\\\\Users\\\\thoma\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dartlang.org\\\\audioplayers_linux-1.0.1\\\\","native_build":true,"dependencies":[]},{"name":"path_provider_linux","path":"C:\\\\Users\\\\thoma\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dartlang.org\\\\path_provider_linux-2.1.7\\\\","native_build":false,"dependencies":[]}],"windows":[{"name":"audioplayers_windows","path":"C:\\\\Users\\\\thoma\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dartlang.org\\\\audioplayers_windows-1.1.0\\\\","native_build":true,"dependencies":[]},{"name":"path_provider_windows","path":"C:\\\\Users\\\\thoma\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dartlang.org\\\\path_provider_windows-2.1.3\\\\","native_build":false,"dependencies":[]}],"web":[{"name":"audioplayers_web","path":"C:\\\\Users\\\\thoma\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dartlang.org\\\\audioplayers_web-2.0.1\\\\","dependencies":[]}]},"dependencyGraph":[{"name":"audioplayers","dependencies":["audioplayers_android","audioplayers_darwin","audioplayers_linux","audioplayers_web","audioplayers_windows","path_provider"]},{"name":"audioplayers_android","dependencies":[]},{"name":"audioplayers_darwin","dependencies":[]},{"name":"audioplayers_linux","dependencies":[]},{"name":"audioplayers_web","dependencies":[]},{"name":"audioplayers_windows","dependencies":[]},{"name":"path_provider","dependencies":["path_provider_android","path_provider_ios","path_provider_linux","path_provider_macos","path_provider_windows"]},{"name":"path_provider_android","dependencies":[]},{"name":"path_provider_ios","dependencies":[]},{"name":"path_provider_linux","dependencies":[]},{"name":"path_provider_macos","dependencies":[]},{"name":"path_provider_windows","dependencies":[]},{"name":"qr_code_scanner","dependencies":[]},{"name":"sqflite","dependencies":[]}],"date_created":"2022-12-27 21:59:06.196293","version":"3.3.10"}
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"audioplayers_darwin","path":"C:\\\\Users\\\\thoma\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dartlang.org\\\\audioplayers_darwin-2.0.0\\\\","native_build":true,"dependencies":[]},{"name":"path_provider_ios","path":"C:\\\\Users\\\\thoma\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dartlang.org\\\\path_provider_ios-2.0.11\\\\","native_build":true,"dependencies":[]},{"name":"qr_code_scanner","path":"C:\\\\Users\\\\thoma\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dartlang.org\\\\qr_code_scanner-1.0.1\\\\","native_build":true,"dependencies":[]},{"name":"sqflite","path":"C:\\\\Users\\\\thoma\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dartlang.org\\\\sqflite-2.0.3+1\\\\","native_build":true,"dependencies":[]}],"android":[{"name":"audioplayers_android","path":"C:\\\\Users\\\\thoma\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dartlang.org\\\\audioplayers_android-1.1.4\\\\","native_build":true,"dependencies":[]},{"name":"path_provider_android","path":"C:\\\\Users\\\\thoma\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dartlang.org\\\\path_provider_android-2.0.20\\\\","native_build":true,"dependencies":[]},{"name":"qr_code_scanner","path":"C:\\\\Users\\\\thoma\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dartlang.org\\\\qr_code_scanner-1.0.1\\\\","native_build":true,"dependencies":[]},{"name":"sqflite","path":"C:\\\\Users\\\\thoma\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dartlang.org\\\\sqflite-2.0.3+1\\\\","native_build":true,"dependencies":[]}],"macos":[{"name":"audioplayers_darwin","path":"C:\\\\Users\\\\thoma\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dartlang.org\\\\audioplayers_darwin-2.0.0\\\\","native_build":true,"dependencies":[]},{"name":"path_provider_macos","path":"C:\\\\Users\\\\thoma\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dartlang.org\\\\path_provider_macos-2.0.6\\\\","native_build":true,"dependencies":[]},{"name":"sqflite","path":"C:\\\\Users\\\\thoma\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dartlang.org\\\\sqflite-2.0.3+1\\\\","native_build":true,"dependencies":[]}],"linux":[{"name":"audioplayers_linux","path":"C:\\\\Users\\\\thoma\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dartlang.org\\\\audioplayers_linux-1.0.3\\\\","native_build":true,"dependencies":[]},{"name":"path_provider_linux","path":"C:\\\\Users\\\\thoma\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dartlang.org\\\\path_provider_linux-2.1.7\\\\","native_build":false,"dependencies":[]}],"windows":[{"name":"audioplayers_windows","path":"C:\\\\Users\\\\thoma\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dartlang.org\\\\audioplayers_windows-1.1.2\\\\","native_build":true,"dependencies":[]},{"name":"path_provider_windows","path":"C:\\\\Users\\\\thoma\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dartlang.org\\\\path_provider_windows-2.1.3\\\\","native_build":false,"dependencies":[]}],"web":[{"name":"audioplayers_web","path":"C:\\\\Users\\\\thoma\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dartlang.org\\\\audioplayers_web-2.1.1\\\\","dependencies":[]}]},"dependencyGraph":[{"name":"audioplayers","dependencies":["audioplayers_android","audioplayers_darwin","audioplayers_linux","audioplayers_web","audioplayers_windows","path_provider"]},{"name":"audioplayers_android","dependencies":[]},{"name":"audioplayers_darwin","dependencies":[]},{"name":"audioplayers_linux","dependencies":[]},{"name":"audioplayers_web","dependencies":[]},{"name":"audioplayers_windows","dependencies":[]},{"name":"path_provider","dependencies":["path_provider_android","path_provider_ios","path_provider_linux","path_provider_macos","path_provider_windows"]},{"name":"path_provider_android","dependencies":[]},{"name":"path_provider_ios","dependencies":[]},{"name":"path_provider_linux","dependencies":[]},{"name":"path_provider_macos","dependencies":[]},{"name":"path_provider_windows","dependencies":[]},{"name":"qr_code_scanner","dependencies":[]},{"name":"sqflite","dependencies":[]}],"date_created":"2023-01-17 18:00:15.546861","version":"3.3.10"}

View File

@ -2,10 +2,12 @@ import 'dart:typed_data';
import 'package:audioplayers/audioplayers.dart';
import 'package:flutter/material.dart';
import 'package:mymuseum_visitapp/Helpers/translationHelper.dart';
import 'package:mymuseum_visitapp/app_context.dart';
import 'package:mymuseum_visitapp/constants.dart';
import 'package:provider/provider.dart';
class AudioPlayerContainer extends StatefulWidget {
const AudioPlayerContainer({Key? key, required this.audioBytes, required this.isAuto}) : super(key: key);
@ -80,68 +82,58 @@ class _AudioPlayerContainerState extends State<AudioPlayerContainer> {
final appContext = Provider.of<AppContext>(context);
return Container(
child: Column(
children: [
Container(
child: Text(currentpostlabel, style: TextStyle(fontSize: 25),),
),
Container(
child: Wrap(
spacing: 10,
children: [
ElevatedButton.icon(
style: ElevatedButton.styleFrom(
primary: kMainColor, // Background color
),
onPressed: () async {
print(isplaying);
print(audioplayed);
if(!isplaying && !audioplayed){
player.play(BytesSource(audiobytes));
setState(() {
isplaying = true;
audioplayed = true;
});
}else if(audioplayed && !isplaying){
player.resume();
setState(() {
isplaying = true;
audioplayed = true;
});
}else{
player.pause();
setState(() {
isplaying = false;
});
}
},
icon: Icon(isplaying?Icons.pause:Icons.play_arrow),
label:Text(isplaying?"Pause":"Play")
return Column(
children: [
Text(currentpostlabel, style: const TextStyle(fontSize: 25)),
Wrap(
spacing: 10,
children: [
ElevatedButton.icon(
style: ElevatedButton.styleFrom(
backgroundColor: kSecondColor, // Background color
),
ElevatedButton.icon(
style: ElevatedButton.styleFrom(
primary: kMainColor, // Background color
),
onPressed: () async {
player.stop();
setState(() {
isplaying = false;
audioplayed = false;
currentpostlabel = "00:00";
});
},
icon: Icon(Icons.stop),
label:Text("Stop")
),
],
onPressed: () async {
if(!isplaying && !audioplayed){
player.play(BytesSource(audiobytes));
setState(() {
isplaying = true;
audioplayed = true;
});
}else if(audioplayed && !isplaying){
player.resume();
setState(() {
isplaying = true;
audioplayed = true;
});
}else{
player.pause();
setState(() {
isplaying = false;
});
}
},
icon: Icon(isplaying?Icons.pause:Icons.play_arrow),
label:Text(isplaying?TranslationHelper.getFromLocale("pause", appContext):TranslationHelper.getFromLocale("play", appContext))
),
)
],
),
ElevatedButton.icon(
style: ElevatedButton.styleFrom(
backgroundColor: kSecondColor, // Background color
),
onPressed: () async {
player.stop();
setState(() {
isplaying = false;
audioplayed = false;
currentpostlabel = "00:00";
});
},
icon: const Icon(Icons.stop),
label: Text(TranslationHelper.getFromLocale("stop", appContext))
),
],
)
],
);
}
}

View File

@ -9,7 +9,10 @@ List<Translation> translations = [
"languageNotSupported": "Cette visite ne prend pas en charge votre langue",
"downloadConfiguration": "Chargement de la visite en cours...",
"noInternet": "Aucune connexion internet détectée",
"search": "Rechercher"
"search": "Rechercher",
"play": "Lecture",
"pause": "Pause",
"stop": "Arrêt"
}),
Translation(language: "EN", data: {
"visitTitle": "List of tours",
@ -19,7 +22,10 @@ List<Translation> translations = [
"languageNotSupported": "This tour doesn't support your language",
"downloadConfiguration": "Loading tour...",
"noInternet": "No internet connection detected",
"search": "Search"
"search": "Search",
"play": "Play",
"pause": "Pause",
"stop": "Stop"
}),
Translation(language: "DE", data: {
"visitTitle": "Liste der Touren",
@ -29,7 +35,10 @@ List<Translation> translations = [
"languageNotSupported": "Diese Tour unterstützt Ihre Sprache nicht",
"downloadConfiguration": "Tour laden...",
"noInternet": "Keine Internetverbindung erkannt",
"search": "Suche"
"search": "Suche",
"play": "",
"pause": "",
"stop": ""
}),
Translation(language: "NL", data: {
"visitTitle": "Lijst met rondleidingen",

View File

@ -42,49 +42,49 @@ packages:
name: audioplayers
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.1"
version: "2.0.0"
audioplayers_android:
dependency: transitive
description:
name: audioplayers_android
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.1"
version: "1.1.4"
audioplayers_darwin:
dependency: transitive
description:
name: audioplayers_darwin
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.3"
version: "2.0.0"
audioplayers_linux:
dependency: transitive
description:
name: audioplayers_linux
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.1"
version: "1.0.3"
audioplayers_platform_interface:
dependency: transitive
description:
name: audioplayers_platform_interface
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.0"
version: "3.0.0"
audioplayers_web:
dependency: transitive
description:
name: audioplayers_web
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.1"
version: "2.1.1"
audioplayers_windows:
dependency: transitive
description:
name: audioplayers_windows
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.0"
version: "1.1.2"
auto_size_text:
dependency: "direct main"
description:

View File

@ -43,7 +43,7 @@ dependencies:
photo_view: ^0.14.0
intl: ^0.17.0
flutter_launcher_icons: ^0.10.0
audioplayers: ^1.1.1
audioplayers: ^2.0.0
manager_api:
path: manager_api