mirror of
https://github.com/KRTirtho/spotube.git
synced 2025-09-13 07:55:18 +00:00
chore: fix analyzer issues
This commit is contained in:
parent
883783b769
commit
930539ca48
@ -16,7 +16,6 @@ class TokenLoginForm extends HookConsumerWidget {
|
|||||||
Widget build(BuildContext context, ref) {
|
Widget build(BuildContext context, ref) {
|
||||||
final authenticationNotifier = ref.watch(authenticationProvider.notifier);
|
final authenticationNotifier = ref.watch(authenticationProvider.notifier);
|
||||||
final directCodeController = useTextEditingController();
|
final directCodeController = useTextEditingController();
|
||||||
final mounted = useIsMounted();
|
|
||||||
|
|
||||||
final isLoading = useState(false);
|
final isLoading = useState(false);
|
||||||
|
|
||||||
@ -57,7 +56,7 @@ class TokenLoginForm extends HookConsumerWidget {
|
|||||||
await AuthenticationCredentials.fromCookie(
|
await AuthenticationCredentials.fromCookie(
|
||||||
cookieHeader),
|
cookieHeader),
|
||||||
);
|
);
|
||||||
if (mounted()) {
|
if (context.mounted) {
|
||||||
onDone?.call();
|
onDone?.call();
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
|
@ -20,8 +20,6 @@ class Waypoint extends HookWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final isMounted = useIsMounted();
|
|
||||||
|
|
||||||
useEffect(() {
|
useEffect(() {
|
||||||
if (isGrid) {
|
if (isGrid) {
|
||||||
return null;
|
return null;
|
||||||
@ -32,19 +30,19 @@ class Waypoint extends HookWidget {
|
|||||||
|
|
||||||
// scrollController fetches the next paginated data when the current
|
// scrollController fetches the next paginated data when the current
|
||||||
// position of the user on the screen has surpassed
|
// position of the user on the screen has surpassed
|
||||||
if (controller.position.pixels >= nextPageTrigger && isMounted()) {
|
if (controller.position.pixels >= nextPageTrigger && context.mounted) {
|
||||||
await onTouchEdge?.call();
|
await onTouchEdge?.call();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||||
if (controller.hasClients && isMounted()) {
|
if (controller.hasClients && context.mounted) {
|
||||||
listener();
|
listener();
|
||||||
controller.addListener(listener);
|
controller.addListener(listener);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return () => controller.removeListener(listener);
|
return () => controller.removeListener(listener);
|
||||||
}, [controller, onTouchEdge, isMounted]);
|
}, [controller, onTouchEdge]);
|
||||||
|
|
||||||
if (isGrid) {
|
if (isGrid) {
|
||||||
return VisibilityDetector(
|
return VisibilityDetector(
|
||||||
|
@ -7,7 +7,7 @@ import 'package:spotube/components/library/user_local_tracks.dart';
|
|||||||
import 'package:spotube/hooks/utils/use_async_effect.dart';
|
import 'package:spotube/hooks/utils/use_async_effect.dart';
|
||||||
|
|
||||||
void useGetStoragePermissions(WidgetRef ref) {
|
void useGetStoragePermissions(WidgetRef ref) {
|
||||||
final isMounted = useIsMounted();
|
final context = useContext();
|
||||||
|
|
||||||
useAsyncEffect(
|
useAsyncEffect(
|
||||||
() async {
|
() async {
|
||||||
@ -25,11 +25,11 @@ void useGetStoragePermissions(WidgetRef ref) {
|
|||||||
|
|
||||||
if (hasNoStoragePerm) {
|
if (hasNoStoragePerm) {
|
||||||
await Permission.storage.request();
|
await Permission.storage.request();
|
||||||
if (isMounted()) ref.invalidate(localTracksProvider);
|
if (context.mounted) ref.invalidate(localTracksProvider);
|
||||||
}
|
}
|
||||||
if (hasNoAudioPerm) {
|
if (hasNoAudioPerm) {
|
||||||
await Permission.audio.request();
|
await Permission.audio.request();
|
||||||
if (isMounted()) ref.invalidate(localTracksProvider);
|
if (context.mounted) ref.invalidate(localTracksProvider);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
null,
|
null,
|
||||||
|
@ -14,7 +14,6 @@ PaletteColor usePaletteColor(String imageUrl, WidgetRef ref) {
|
|||||||
final context = useContext();
|
final context = useContext();
|
||||||
final theme = Theme.of(context);
|
final theme = Theme.of(context);
|
||||||
final paletteColor = ref.watch(_paletteColorState);
|
final paletteColor = ref.watch(_paletteColorState);
|
||||||
final mounted = useIsMounted();
|
|
||||||
|
|
||||||
useEffect(() {
|
useEffect(() {
|
||||||
WidgetsBinding.instance.addPostFrameCallback((timeStamp) async {
|
WidgetsBinding.instance.addPostFrameCallback((timeStamp) async {
|
||||||
@ -25,7 +24,7 @@ PaletteColor usePaletteColor(String imageUrl, WidgetRef ref) {
|
|||||||
width: 50,
|
width: 50,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
if (!mounted()) return;
|
if (!context.mounted) return;
|
||||||
final color = theme.brightness == Brightness.light
|
final color = theme.brightness == Brightness.light
|
||||||
? palette.lightMutedColor ?? palette.lightVibrantColor
|
? palette.lightMutedColor ?? palette.lightVibrantColor
|
||||||
: palette.darkMutedColor ?? palette.darkVibrantColor;
|
: palette.darkMutedColor ?? palette.darkVibrantColor;
|
||||||
@ -41,7 +40,7 @@ PaletteColor usePaletteColor(String imageUrl, WidgetRef ref) {
|
|||||||
|
|
||||||
PaletteGenerator usePaletteGenerator(String imageUrl) {
|
PaletteGenerator usePaletteGenerator(String imageUrl) {
|
||||||
final palette = useState(PaletteGenerator.fromColors([]));
|
final palette = useState(PaletteGenerator.fromColors([]));
|
||||||
final mounted = useIsMounted();
|
final context = useContext();
|
||||||
|
|
||||||
useEffect(() {
|
useEffect(() {
|
||||||
WidgetsBinding.instance.addPostFrameCallback((timeStamp) async {
|
WidgetsBinding.instance.addPostFrameCallback((timeStamp) async {
|
||||||
@ -52,7 +51,7 @@ PaletteGenerator usePaletteGenerator(String imageUrl) {
|
|||||||
width: 50,
|
width: 50,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
if (!mounted()) return;
|
if (!context.mounted) return;
|
||||||
|
|
||||||
palette.value = newPalette;
|
palette.value = newPalette;
|
||||||
});
|
});
|
||||||
|
@ -38,7 +38,6 @@ class RootApp extends HookConsumerWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context, ref) {
|
Widget build(BuildContext context, ref) {
|
||||||
final isMounted = useIsMounted();
|
|
||||||
final showingDialogCompleter = useRef(Completer()..complete());
|
final showingDialogCompleter = useRef(Completer()..complete());
|
||||||
final downloader = ref.watch(downloadManagerProvider);
|
final downloader = ref.watch(downloadManagerProvider);
|
||||||
final scaffoldMessenger = ScaffoldMessenger.of(context);
|
final scaffoldMessenger = ScaffoldMessenger.of(context);
|
||||||
@ -129,7 +128,7 @@ class RootApp extends HookConsumerWidget {
|
|||||||
|
|
||||||
useEffect(() {
|
useEffect(() {
|
||||||
downloader.onFileExists = (track) async {
|
downloader.onFileExists = (track) async {
|
||||||
if (!isMounted()) return false;
|
if (!context.mounted) return false;
|
||||||
|
|
||||||
if (!showingDialogCompleter.value.isCompleted) {
|
if (!showingDialogCompleter.value.isCompleted) {
|
||||||
await showingDialogCompleter.value.future;
|
await showingDialogCompleter.value.future;
|
||||||
|
Loading…
Reference in New Issue
Block a user