MiniController tap handling

This commit is contained in:
gianlucaparadise 2022-01-14 06:22:22 +01:00
parent 2fc3f95889
commit 23f70dd444
3 changed files with 28 additions and 18 deletions

View file

@ -150,7 +150,6 @@ I used this project to test the capabilities of the following technologies:
* CC in Expanded Controls (iOS)
* Expanded Controls cosmetics (ad in progress bar, full screen, progress bar handle)
* Handle mini-player
* Handle queue
* Handle progress seek
* Understand if it is better to refactor using streams instead of listeners

View file

@ -177,6 +177,7 @@ class _MyAppState extends State<MyApp> {
padding: const EdgeInsets.symmetric(vertical: 8.0),
child: MiniController(
castFramework: castFramework,
onControllerTapped: _openExpandedControls,
),
),
],

View file

@ -8,9 +8,15 @@ import 'MiniControllerPlayPauseButton.dart';
class MiniController extends StatelessWidget {
final FlutterCastFramework castFramework;
/// This is called when the mini controller is tapped and the tap is not
/// handled by the controller. Generally, you want to open the expanded controls
/// on this callback.
final VoidCallback? onControllerTapped;
const MiniController({
Key? key,
required this.castFramework,
this.onControllerTapped,
}) : super(key: key);
Widget _getControls(MediaStatus? status) {
@ -38,24 +44,28 @@ class MiniController extends StatelessWidget {
status: status,
);
return SizedBox(
height: 60,
child: Row(
children: [
thumbnail,
Container(width: 12),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.center,
children: [
title,
subtitle,
],
return InkWell(
onTap: onControllerTapped,
child: SizedBox(
height: 60,
child: Row(
children: [
thumbnail,
Container(width: 12),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.center,
children: [
title,
subtitle,
],
),
),
),
playPauseButton,
],
// ),
playPauseButton,
],
),
),
);
}