// SPDX-License-Identifier: Apache-2.0 import 'package:flutter/widgets.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:musicplayer/class.dart'; import 'package:musicplayer/music_methods/modeClass.dart'; final PositionProvider = StateNotifierProvider(((ref) => Position())); class Position extends StateNotifier{ Position() : super(Duration(seconds: 0)); void update(value) async{ state = value; } } final CurrentSongProvider = StateNotifierProvider(((ref) => Current())); class Current extends StateNotifier{ Current() : super(currentval); static final CurrentSong currentval = CurrentSong(title: 'title', artist: 'unknown', duration: '0min 0sec',isPlaying: false, time: '0'); void update({ String? title, String? artist, String? duration, bool? isPlaying, String? time}){ state = state.copyWith(title: title, artist: artist, duration: duration, isPlaying: isPlaying,time: time); } } final VolumeProvider = StateNotifierProvider(((ref) => Volume())); class Volume extends StateNotifier{ Volume() : super(70); void update(int val){ state = val; } } final Modeprovider = StateNotifierProvider(((ref) => mode())); class mode extends StateNotifier{ mode() : super(intial_value); static final Mode intial_value = Mode(isRepeat: true, isSingle : false, prev: true); void update({bool? isSingle, bool? isRepeat, bool? prev}){ state = state.copyWith(isRepeat : isRepeat, isSingle : isSingle,prev: prev); } } final currIndexProvider = StateNotifierProvider(((ref) => Index())); class Index extends StateNotifier{ Index() : super(0); void update(int val){ state = val; } }