From 3a6ac8868583a286c28f3d3de8b9a42ac52c5ba5 Mon Sep 17 00:00:00 2001 From: Daniel Ponte Date: Wed, 14 Aug 2024 09:26:28 -0400 Subject: [PATCH] safearea --- lib/controller/play.dart | 1 + lib/views/login.dart | 32 +++++++++++++++++--------------- lib/views/radio.dart | 5 +++-- pubspec.lock | 2 +- pubspec.yaml | 1 + 5 files changed, 23 insertions(+), 18 deletions(-) diff --git a/lib/controller/play.dart b/lib/controller/play.dart index 3207326..eb7f6ab 100644 --- a/lib/controller/play.dart +++ b/lib/controller/play.dart @@ -7,6 +7,7 @@ class Player { final player = AudioPlayer(); Player(); Future play(Call call) { + // TODO make a queue return player.play(BytesSource(Uint8List.fromList(call.audio))); } } diff --git a/lib/views/login.dart b/lib/views/login.dart index 75da807..114b9aa 100644 --- a/lib/views/login.dart +++ b/lib/views/login.dart @@ -95,21 +95,23 @@ class _LoginState extends State { userController.text, passwordController.text) .then((result) { - if (result == true && mounted) { - Navigator.pushReplacement( - context, - PageRouteBuilder( - pageBuilder: (context, animation, - secondaryAnimation) => - const CallsHome(), - transitionsBuilder: (context, animation, - secondaryAnimation, child) { - return child; - }, - transitionDuration: - const Duration(milliseconds: 0), - ), - ); + if (result == true) { + if (context.mounted) { + Navigator.pushReplacement( + context, + PageRouteBuilder( + pageBuilder: (context, animation, + secondaryAnimation) => + const CallsHome(), + transitionsBuilder: (context, animation, + secondaryAnimation, child) { + return child; + }, + transitionDuration: + const Duration(milliseconds: 0), + ), + ); + } } }); } else { diff --git a/lib/views/radio.dart b/lib/views/radio.dart index 40416ef..070dcbb 100644 --- a/lib/views/radio.dart +++ b/lib/views/radio.dart @@ -14,7 +14,8 @@ class MainRadio extends StatefulWidget { class _MainRadioState extends State { @override Widget build(BuildContext context) { - return const Scaffold( + return const SafeArea( + child: Scaffold( body: Center( child: SizedBox( width: 500.0, @@ -27,6 +28,6 @@ class _MainRadioState extends State { ], )), ), - ); + )); } } diff --git a/pubspec.lock b/pubspec.lock index 2ea478d..903227a 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -34,7 +34,7 @@ packages: source: hosted version: "5.0.2" audioplayers_linux: - dependency: transitive + dependency: "direct main" description: name: audioplayers_linux sha256: "60787e73fefc4d2e0b9c02c69885402177e818e4e27ef087074cf27c02246c9e" diff --git a/pubspec.yaml b/pubspec.yaml index 4fb0728..ac00848 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -43,6 +43,7 @@ dependencies: audioplayers: ^5.2.1 flutter_secure_storage: ^9.2.2 http: ^1.2.2 + audioplayers_linux: ^3.1.0 dev_dependencies: flutter_test: