import 'package:flutter/material.dart'; class KeyboardIndexProvider with ChangeNotifier { int curKeyboardIndex = -1; bool soundPlayMode = false; bool readOnly = true; init(bool bl) { soundPlayMode = bl; } changeSoundPlayMode(bool playmode) { soundPlayMode = playmode; notifyListeners(); } changeReadOnlyKey(bool emoji) { readOnly = emoji; notifyListeners(); } changeSelectIndex(int newIndex) { if (newIndex != curKeyboardIndex) { curKeyboardIndex = newIndex; if (newIndex != 0) { readOnly = true; }else{ readOnly = false; } print('设置当前键盘 $newIndex'); notifyListeners(); } } }