Initial commit
This commit is contained in:
@@ -0,0 +1,54 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class SessionControls extends StatelessWidget {
|
||||
final bool isRunning;
|
||||
final bool isFinished;
|
||||
final VoidCallback onPause;
|
||||
final VoidCallback onPlay;
|
||||
final VoidCallback onNext;
|
||||
final VoidCallback onPrevious;
|
||||
|
||||
const SessionControls({
|
||||
super.key,
|
||||
required this.isRunning,
|
||||
required this.isFinished,
|
||||
required this.onPause,
|
||||
required this.onPlay,
|
||||
required this.onNext,
|
||||
required this.onPrevious,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
if (isFinished) {
|
||||
return ElevatedButton(
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
child: const Text('Finish Workout'),
|
||||
);
|
||||
}
|
||||
|
||||
return Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
IconButton.filledTonal(
|
||||
onPressed: onPrevious,
|
||||
icon: const Icon(Icons.skip_previous),
|
||||
iconSize: 32,
|
||||
),
|
||||
const SizedBox(width: 24),
|
||||
IconButton.filled(
|
||||
onPressed: isRunning ? onPause : onPlay,
|
||||
icon: Icon(isRunning ? Icons.pause : Icons.play_arrow),
|
||||
iconSize: 48,
|
||||
style: IconButton.styleFrom(padding: const EdgeInsets.all(16)),
|
||||
),
|
||||
const SizedBox(width: 24),
|
||||
IconButton.filledTonal(
|
||||
onPressed: onNext,
|
||||
icon: const Icon(Icons.skip_next),
|
||||
iconSize: 32,
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user