Skip to content

Commit

Permalink
Merge branch 'redesign' of https://github.com/jmshrv/finamp into rede…
Browse files Browse the repository at this point in the history
…sign-song-menu

# Conflicts:
#	lib/components/AlbumScreen/song_menu.dart
#	lib/l10n/app_en.arb
  • Loading branch information
Komodo5197 committed Mar 31, 2024
2 parents 0e4836e + 549d50e commit cc72e3a
Show file tree
Hide file tree
Showing 33 changed files with 327 additions and 296 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import 'package:finamp/components/Buttons/cta_medium.dart';
import 'package:finamp/components/global_snackbar.dart';
import 'package:finamp/models/finamp_models.dart';
import 'package:finamp/services/queue_service.dart';
import 'package:finamp/services/feedback_helper.dart';
import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'package:flutter_tabler_icons/flutter_tabler_icons.dart';
Expand Down Expand Up @@ -257,7 +258,7 @@ class AlbumScreenContentFlexibleSpaceBar extends StatelessWidget {
enableFeedback: true,
icon: const Icon(TablerIcons.dots_vertical),
onOpened: () =>
Vibrate.feedback(FeedbackType.light),
FeedbackHelper.feedback(FeedbackType.light),
itemBuilder: (context) {
final queueService =
GetIt.instance<QueueService>();
Expand Down Expand Up @@ -341,7 +342,7 @@ class AlbumScreenContentFlexibleSpaceBar extends StatelessWidget {
enableFeedback: true,
icon: const Icon(TablerIcons.dots_vertical),
onOpened: () =>
Vibrate.feedback(FeedbackType.light),
FeedbackHelper.feedback(FeedbackType.light),
itemBuilder: (context) {
final queueService =
GetIt.instance<QueueService>();
Expand Down
13 changes: 7 additions & 6 deletions lib/components/AlbumScreen/song_menu.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import 'package:finamp/screens/artist_screen.dart';
import 'package:finamp/screens/blurred_player_screen_background.dart';
import 'package:finamp/services/music_player_background_task.dart';
import 'package:finamp/services/queue_service.dart';
import 'package:finamp/services/feedback_helper.dart';
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
Expand Down Expand Up @@ -45,7 +46,7 @@ Future<void> showModalSongMenu({
final canGoToArtist = (item.artistItems?.isNotEmpty ?? false);
final canGoToGenre = (item.genreItems?.isNotEmpty ?? false);

Vibrate.feedback(FeedbackType.impact);
FeedbackHelper.feedback(FeedbackType.impact);

await showModalBottomSheet(
context: context,
Expand Down Expand Up @@ -140,7 +141,7 @@ class _SongMenuState extends State<SongMenu> {
final isOffline = FinampSettingsHelper.finampSettings.isOffline;

if (isOffline) {
Vibrate.feedback(FeedbackType.error);
FeedbackHelper.feedback(FeedbackType.error);
GlobalSnackbar.message((context) =>
AppLocalizations.of(context)!.notAvailableInOfflineMode);
return;
Expand All @@ -149,7 +150,7 @@ class _SongMenuState extends State<SongMenu> {
final currentTrack = _queueService.getCurrentTrack();
if (isBaseItemInQueueItem(widget.item, currentTrack)) {
await setFavourite(currentTrack!, context);
Vibrate.feedback(FeedbackType.success);
FeedbackHelper.feedback(FeedbackType.success);
return;
}

Expand All @@ -159,7 +160,7 @@ class _SongMenuState extends State<SongMenu> {
setState(() {
widget.item.userData!.isFavorite = !widget.item.userData!.isFavorite;
});
Vibrate.feedback(FeedbackType.success);
FeedbackHelper.feedback(FeedbackType.success);

// Since we flipped the favourite state already, we can use the flipped
// state to decide which API call to make
Expand All @@ -176,7 +177,7 @@ class _SongMenuState extends State<SongMenu> {
setState(() {
widget.item.userData!.isFavorite = !widget.item.userData!.isFavorite;
});
Vibrate.feedback(FeedbackType.error);
FeedbackHelper.feedback(FeedbackType.error);
GlobalSnackbar.error(e);
}
}
Expand Down Expand Up @@ -997,7 +998,7 @@ class PlaybackAction extends StatelessWidget {
],
),
onPressed: () {
Vibrate.feedback(FeedbackType.success);
FeedbackHelper.feedback(FeedbackType.success);
onPressed();
},
visualDensity: VisualDensity.compact,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import 'package:finamp/models/finamp_models.dart';
import 'package:finamp/services/jellyfin_api.dart';
import 'package:finamp/services/jellyfin_api_helper.dart';
import 'package:finamp/services/queue_service.dart';
import 'package:finamp/services/feedback_helper.dart';
import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'package:flutter_tabler_icons/flutter_tabler_icons.dart';
Expand Down Expand Up @@ -352,7 +353,7 @@ class ArtistScreenContentFlexibleSpaceBar extends StatelessWidget {
enableFeedback: true,
// icon: const Icon(TablerIcons.dots_vertical),
onOpened: () =>
Vibrate.feedback(FeedbackType.light),
FeedbackHelper.feedback(FeedbackType.light),
itemBuilder: (context) {
final queueService =
GetIt.instance<QueueService>();
Expand Down Expand Up @@ -469,7 +470,7 @@ class ArtistScreenContentFlexibleSpaceBar extends StatelessWidget {
enableFeedback: true,
// icon: const Icon(TablerIcons.dots_vertical),
onOpened: () =>
Vibrate.feedback(FeedbackType.light),
FeedbackHelper.feedback(FeedbackType.light),
itemBuilder: (context) {
final queueService =
GetIt.instance<QueueService>();
Expand Down
3 changes: 2 additions & 1 deletion lib/components/Buttons/cta_large.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@


import 'package:finamp/color_schemes.g.dart';
import 'package:finamp/services/feedback_helper.dart';
import 'package:flutter/material.dart';
import 'package:flutter_vibrate/flutter_vibrate.dart';

Expand All @@ -15,7 +16,7 @@ class CTALarge extends StatelessWidget {
Widget build(BuildContext context) {
return ElevatedButton(
onPressed: () {
Vibrate.feedback(FeedbackType.selection);
FeedbackHelper.feedback(FeedbackType.selection);
onPressed();
},
style: ButtonStyle(
Expand Down
3 changes: 2 additions & 1 deletion lib/components/Buttons/cta_medium.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import 'package:finamp/color_schemes.g.dart';
import 'package:finamp/services/feedback_helper.dart';
import 'package:flutter/material.dart';
import 'package:flutter_vibrate/flutter_vibrate.dart';

Expand All @@ -25,7 +26,7 @@ class CTAMedium extends StatelessWidget {

return ElevatedButton(
onPressed: () {
Vibrate.feedback(FeedbackType.selection);
FeedbackHelper.feedback(FeedbackType.selection);
onPressed();
},
style: ButtonStyle(
Expand Down
47 changes: 29 additions & 18 deletions lib/components/Buttons/simple_button.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,42 @@
import 'package:finamp/color_schemes.g.dart';
import 'package:flutter/material.dart';

enum IconPosition {
start,
end,
}

class SimpleButton extends StatelessWidget {
final String text;
final IconData icon;
final IconPosition? iconPosition;
final double iconSize;
final Color? iconColor;
final void Function() onPressed;

const SimpleButton({super.key, required this.text, required this.icon, required this.onPressed});
const SimpleButton({super.key, required this.text, required this.icon, required this.onPressed, this.iconPosition = IconPosition.start, this.iconSize = 20.0, this.iconColor});

@override
Widget build(BuildContext context) {

final contents = [
Icon(
icon,
size: iconSize,
color: iconColor,
weight: 1.5,
),
const SizedBox(width: 6,),
Text(
text,
style: TextStyle(
color: Theme.of(context).textTheme.bodyMedium!.color!,
fontSize: 14,
fontWeight: FontWeight.normal,
),
),
];

return TextButton(
onPressed: onPressed,
style: ButtonStyle(
Expand All @@ -29,23 +56,7 @@ class SimpleButton extends StatelessWidget {
),
child: Wrap(
crossAxisAlignment: WrapCrossAlignment.center,
children: [
Icon(
icon,
size: 20,
color: jellyfinBlueColor,
weight: 1.5,
),
const SizedBox(width: 6,),
Text(
text,
style: TextStyle(
color: Theme.of(context).textTheme.bodyMedium!.color!,
fontSize: 14,
fontWeight: FontWeight.normal,
),
),
],
children: iconPosition == IconPosition.start ? contents : contents.reversed.toList(),
),
);
}
Expand Down
25 changes: 25 additions & 0 deletions lib/components/InteractionSettingsScreen/disable_vibration.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'package:hive/hive.dart';

import '../../models/finamp_models.dart';
import '../../services/finamp_settings_helper.dart';

class DisableVibrationSelector extends StatelessWidget {
const DisableVibrationSelector({Key? key}) : super(key: key);

@override
Widget build(BuildContext context) {
return ValueListenableBuilder<Box<FinampSettings>>(
valueListenable: FinampSettingsHelper.finampSettingsListener,
builder: (_, box, __) {
return SwitchListTile.adaptive(
title: Text(AppLocalizations.of(context)!.enableVibration),
subtitle: Text(AppLocalizations.of(context)!.enableVibrationSubtitle),
value: FinampSettingsHelper.finampSettings.enableVibration,
onChanged: (value) => FinampSettingsHelper.setEnableVibration(value),
);
},
);
}
}
5 changes: 3 additions & 2 deletions lib/components/MusicScreen/alphabet_item_list.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import 'dart:async';

import 'package:finamp/models/jellyfin_models.dart';
import 'package:finamp/services/feedback_helper.dart';
import 'package:flutter/material.dart';
import 'package:flutter_vibrate/flutter_vibrate.dart';

Expand Down Expand Up @@ -134,7 +135,7 @@ class _AlphabetListState extends State<AlphabetList> {
_toBeSelected = alphabet[
(position.dy / _letterHeight).floor().clamp(0, alphabet.length - 1)];
if (previousToBeSelected != _toBeSelected) {
Vibrate.feedback(FeedbackType.light);
FeedbackHelper.feedback(FeedbackType.light);
}
}

Expand All @@ -144,7 +145,7 @@ class _AlphabetListState extends State<AlphabetList> {
});
}
if (state == Drag.end && _toBeSelected != null) {
Vibrate.feedback(FeedbackType.selection);
FeedbackHelper.feedback(FeedbackType.selection);
widget.callback(_toBeSelected ?? _currentSelected ?? '');
}

Expand Down
11 changes: 4 additions & 7 deletions lib/components/MusicScreen/music_screen_tab_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import 'dart:math';

import 'package:collection/collection.dart';
import 'package:finamp/services/finamp_user_helper.dart';
import 'package:finamp/services/jellyfin_api.dart';
import 'package:flutter/material.dart';
import 'package:get_it/get_it.dart';
import 'package:hive/hive.dart';
Expand Down Expand Up @@ -309,7 +310,8 @@ class _MusicScreenTabViewState extends State<MusicScreenTabView>
settings.tabSortOrder[widget.tabContentType],
settings.onlyShowFullyDownloaded,
widget.view?.id,
settings.isOffline);
settings.isOffline,
settings.tabOrder,);
if (refreshHash == null) {
refreshHash = newRefreshHash;
} else if (refreshHash != newRefreshHash) {
Expand Down Expand Up @@ -357,12 +359,7 @@ class _MusicScreenTabViewState extends State<MusicScreenTabView>
newPageProgressIndicatorBuilder: (_) =>
const NewPageProgressIndicator(),
),
separatorBuilder: (context, index) => SizedBox(
height: widget.tabContentType == TabContentType.artists ||
widget.tabContentType == TabContentType.genres
? 16.0
: 0.0,
),
separatorBuilder: (context, index) => const SizedBox.shrink(),
)
: PagedGridView(
pagingController: _pagingController,
Expand Down
7 changes: 4 additions & 3 deletions lib/components/PlayerScreen/player_buttons.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import 'package:finamp/components/PlayerScreen/player_buttons_repeating.dart';
import 'package:finamp/services/queue_service.dart';
import 'package:finamp/components/PlayerScreen/player_buttons_shuffle.dart';
import 'package:finamp/services/feedback_helper.dart';
import 'package:flutter/material.dart';
import 'package:flutter_tabler_icons/flutter_tabler_icons.dart';
import 'package:flutter_vibrate/flutter_vibrate.dart';
Expand Down Expand Up @@ -33,7 +34,7 @@ class PlayerButtons extends StatelessWidget {
icon: const Icon(TablerIcons.player_skip_back),
onPressed: playbackState != null
? () async {
Vibrate.feedback(FeedbackType.light);
FeedbackHelper.feedback(FeedbackType.light);
await audioHandler.skipToPrevious();
}
: null,
Expand All @@ -44,7 +45,7 @@ class PlayerButtons extends StatelessWidget {
borderRadius: BorderRadius.circular(16),
onTap: playbackState != null
? () async {
Vibrate.feedback(FeedbackType.light);
FeedbackHelper.feedback(FeedbackType.light);
if (playbackState.playing) {
await audioHandler.pause();
} else {
Expand All @@ -62,7 +63,7 @@ class PlayerButtons extends StatelessWidget {
icon: const Icon(TablerIcons.player_skip_forward),
onPressed: playbackState != null
? () async {
Vibrate.feedback(FeedbackType.light);
FeedbackHelper.feedback(FeedbackType.light);
await audioHandler.skipToNext();
}
: null,
Expand Down
3 changes: 2 additions & 1 deletion lib/components/PlayerScreen/player_buttons_more.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import 'package:finamp/models/jellyfin_models.dart';
import 'package:finamp/screens/add_to_playlist_screen.dart';
import 'package:finamp/services/music_player_background_task.dart';
import 'package:finamp/services/player_screen_theme_provider.dart';
import 'package:finamp/services/feedback_helper.dart';
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:flutter_tabler_icons/flutter_tabler_icons.dart';
Expand Down Expand Up @@ -35,7 +36,7 @@ class PlayerButtonsMore extends ConsumerWidget {
),
child: GestureDetector(
onLongPress: () {
Vibrate.feedback(FeedbackType.medium);
FeedbackHelper.feedback(FeedbackType.medium);
Navigator.of(context).pushNamed(
AddToPlaylistScreen.routeName,
arguments: item!.id);
Expand Down
3 changes: 2 additions & 1 deletion lib/components/PlayerScreen/player_buttons_repeating.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import 'package:finamp/services/media_state_stream.dart';
import 'package:finamp/services/music_player_background_task.dart';
import 'package:finamp/services/queue_service.dart';
import 'package:finamp/services/player_screen_theme_provider.dart';
import 'package:finamp/services/feedback_helper.dart';
import 'package:flutter/material.dart';
import 'package:flutter_tabler_icons/flutter_tabler_icons.dart';
import 'package:flutter_vibrate/flutter_vibrate.dart';
Expand All @@ -24,7 +25,7 @@ class PlayerButtonsRepeating extends StatelessWidget {
builder: (BuildContext context, AsyncSnapshot<dynamic> snapshot) {
return IconButton(
onPressed: () async {
Vibrate.feedback(FeedbackType.light);
FeedbackHelper.feedback(FeedbackType.light);
queueService.toggleLoopMode();
},
icon: _getRepeatingIcon(
Expand Down
3 changes: 2 additions & 1 deletion lib/components/PlayerScreen/player_buttons_shuffle.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import 'package:finamp/models/finamp_models.dart';
import 'package:finamp/services/media_state_stream.dart';
import 'package:finamp/services/music_player_background_task.dart';
import 'package:finamp/services/queue_service.dart';
import 'package:finamp/services/feedback_helper.dart';
import 'package:flutter/material.dart';
import 'package:flutter_tabler_icons/flutter_tabler_icons.dart';
import 'package:flutter_vibrate/flutter_vibrate.dart';
Expand All @@ -21,7 +22,7 @@ class PlayerButtonsShuffle extends StatelessWidget {
builder: (BuildContext context, AsyncSnapshot<dynamic> snapshot) {
return IconButton(
onPressed: () async {
Vibrate.feedback(FeedbackType.light);
FeedbackHelper.feedback(FeedbackType.light);
_queueService.togglePlaybackOrder();
},
icon: Icon(
Expand Down
Loading

0 comments on commit cc72e3a

Please sign in to comment.