diff options
author | Scott Murray <scott.murray@konsulko.com> | 2023-12-31 16:24:51 -0500 |
---|---|---|
committer | Scott Murray <scott.murray@konsulko.com> | 2024-01-03 18:23:52 -0500 |
commit | 4742fde5c48726357cc8db06d237e9db6c3df608 (patch) | |
tree | dcca2b3e3c6cb3a4a46b7ae603f64fa9ce5a086c /lib/presentation/screens/media_player/widgets | |
parent | fcd868bd73d35bd79074f3425317152565aeb275 (diff) |
Initial radio implementation
Notable changes:
- Add radio gRPC API protobuf definitation and generated files.
- Reworked existing single gRPC APIs library to split it into
per-API libraries to avoid name collision issues.
- Add radio gRPC client class and associated radio state class
and RiverPod providers.
- Split media controls and play list table classes into media
player and radio specific versions to facilitate customization
and wiring up their appropriate backends in a straightforward
fashion. Some potential rationalization of styling widgets
may be done as a follow up to avoid some duplication.
- Added radio configuration and presets loading. The presets
will be populated with the contents of a radio-presets.yaml
file from the configured location, the default location is
the /etc/xdg/AGL/ics-homescreen directory.
- Implemented FM radio player against the radio gRPC API.
For the sake of expediency, no attempt has been made to make
the player able to handle AM band support.
- Reworked media page navigation state so that active player is
restored when coming back to the page. Logic has been added to
start/stop the radio on navigating to or leaving the FM radio
sub-page. This will potentially be reworked before CES to work
with the pause/stop button present on the other pages.
- Started pruning down global exports.dart a bit to remove files
only used in a specific page/hierarchy, starting with media.
Bug-AGL: SPEC-5029
Change-Id: I1ae0aca4a7a8218e69e4286c863f01509a1cccb7
Signed-off-by: Scott Murray <scott.murray@konsulko.com>
Diffstat (limited to 'lib/presentation/screens/media_player/widgets')
-rw-r--r-- | lib/presentation/screens/media_player/widgets/gradient_progress_indicator.dart | 88 | ||||
-rw-r--r-- | lib/presentation/screens/media_player/widgets/media_volume_bar.dart | 155 |
2 files changed, 0 insertions, 243 deletions
diff --git a/lib/presentation/screens/media_player/widgets/gradient_progress_indicator.dart b/lib/presentation/screens/media_player/widgets/gradient_progress_indicator.dart deleted file mode 100644 index 24aa244..0000000 --- a/lib/presentation/screens/media_player/widgets/gradient_progress_indicator.dart +++ /dev/null @@ -1,88 +0,0 @@ -import 'package:flutter_ics_homescreen/core/utils/helpers.dart'; -import 'package:flutter_ics_homescreen/export.dart'; - -class GradientProgressIndicator extends StatelessWidget { - ///it can be anything between 0 to 100 - final int percent; - final Gradient gradient; - final Color backgroundColor; - final double height; - final String type; - - const GradientProgressIndicator( - {required this.percent, - required this.gradient, - required this.backgroundColor, - Key? key, - this.height = 16, - required this.type}) - : super(key: key); - - @override - Widget build(BuildContext context) { - return Row( - children: [ - Flexible( - flex: percent, - fit: FlexFit.tight, - child: Container( - height: height, - margin: const EdgeInsets.all(1), - decoration: BoxDecoration( - border: Border.all( - color: AGLDemoColors.neonBlueColor.withOpacity(0.5), - width: 1), - gradient: gradient, - borderRadius: - BorderRadius.all(Radius.circular(type == "fm" ? 16 : 2)), - ), - alignment: Alignment.centerRight, - ), - ), - type == "media" - ? Container( - height: height, - width: 2, - color: Colors.white, - ) - : Container( - height: 64, - width: 64, - alignment: Alignment.center, - decoration: BoxDecoration( - shape: BoxShape.circle, - boxShadow: [ - Helpers.boxDropShadowRegular, - ], - color: AGLDemoColors.periwinkleColor), - child: Container( - height: 32, - width: 32, - decoration: BoxDecoration( - shape: BoxShape.circle, - boxShadow: [ - Helpers.boxDropShadowRegular, - ], - border: Border.all( - color: AGLDemoColors.neonBlueColor, width: 2), - color: AGLDemoColors.periwinkleColor), - ), - ), - Flexible( - fit: FlexFit.tight, - flex: 100 - percent, - child: Container( - decoration: BoxDecoration( - color: backgroundColor, - border: Border.all( - color: AGLDemoColors.neonBlueColor.withOpacity(0.5), - width: 1), - borderRadius: const BorderRadius.all(Radius.circular(2)), - ), - child: SizedBox(height: height), - ), - ), - ], - ); - } -} diff --git a/lib/presentation/screens/media_player/widgets/media_volume_bar.dart b/lib/presentation/screens/media_player/widgets/media_volume_bar.dart deleted file mode 100644 index dd59ee0..0000000 --- a/lib/presentation/screens/media_player/widgets/media_volume_bar.dart +++ /dev/null @@ -1,155 +0,0 @@ -import 'package:flutter_ics_homescreen/presentation/custom_icons/custom_icons.dart'; - -import '../../../../export.dart'; -import '../../settings/settings_screens/audio_settings/widget/slider_widgets.dart'; - -class CustomVolumeSlider extends ConsumerStatefulWidget { - const CustomVolumeSlider({ - super.key, - }); - - @override - CustomVolumeSliderState createState() => CustomVolumeSliderState(); -} - -class CustomVolumeSliderState extends ConsumerState<CustomVolumeSlider> { - void _increase() { - _currentVal += 10; - if (_currentVal > 100) { - _currentVal = 100; - } - setState(() { - ref.read(audioStateProvider.notifier).setVolume(_currentVal); - }); - } - - void _dercrease() { - _currentVal -= 10; - if (_currentVal < 0) { - _currentVal = 0; - } - setState(() { - ref.read(audioStateProvider.notifier).setVolume(_currentVal); - }); - } - - double _currentVal = 50; - @override - Widget build(BuildContext context) { - final volumeValue = - ref.watch(audioStateProvider.select((audio) => audio.volume)); - - return Column( - //crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Container( - decoration: const ShapeDecoration( - color: AGLDemoColors.buttonFillEnabledColor, - shape: StadiumBorder( - side: BorderSide( - color: Color(0xFF5477D4), - width: 0.5, - )), - ), - height: 160, - child: Row( - children: [ - Padding( - padding: const EdgeInsets.only(left: 20), - child: Material( - color: Colors.transparent, - child: InkWell( - customBorder: const CircleBorder(), - onTap: () { - _dercrease(); - }, - child: const Padding( - padding: EdgeInsets.all(8.0), - child: Icon( - CustomIcons.vol_min, - color: AGLDemoColors.periwinkleColor, - size: 60, - ))), - ), - ), - // Padding( - // padding: const EdgeInsets.only(left: 10.0), - // child: SizedBox( - // width: 50, - // child: IconButton( - // padding: EdgeInsets.zero, - // onPressed: () { - // _dercrease(); - // }, - // icon: const Icon( - // CustomIcons.vol_min, - // color: AGLDemoColors.periwinkleColor, - // size: 48, - // )), - // ), - // ), - Expanded( - child: SliderTheme( - data: SliderThemeData( - overlayShape: SliderComponentShape.noOverlay, - valueIndicatorShape: SliderComponentShape.noOverlay, - activeTickMarkColor: Colors.transparent, - inactiveTickMarkColor: Colors.transparent, - inactiveTrackColor: AGLDemoColors.backgroundInsetColor, - thumbShape: const PolygonSliderThumb( - sliderValue: 3, thumbRadius: 23), - //trackHeight: 5, - ), - child: Slider( - divisions: 10, - min: 0, - max: 100, - value: volumeValue.toDouble(), - onChanged: (newValue) { - ref.read(audioStateProvider.notifier).setVolume(newValue); - _currentVal = newValue; - }, - ), - ), - ), - Padding( - padding: const EdgeInsets.only(right: 20), - child: Material( - color: Colors.transparent, - child: InkWell( - customBorder: const CircleBorder(), - onTap: () { - _increase(); - }, - child: const Padding( - padding: EdgeInsets.all(8.0), - child: Icon( - CustomIcons.vol_max, - color: AGLDemoColors.periwinkleColor, - size: 60, - ))), - ), - ), - // Padding( - // padding: const EdgeInsets.only(right: 10.0), - // child: SizedBox( - // width: 60, - // child: IconButton( - // padding: EdgeInsets.zero, - // onPressed: () { - // _increase(); - // }, - // icon: const Icon( - // CustomIcons.vol_max, - // color: AGLDemoColors.periwinkleColor, - // size: 48, - // )), - // ), - // ), - ], - ), - ), - ], - ); - } -} |