| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576 |
- import 'dart:convert';
- import 'dart:typed_data';
- import 'package:easy_localization/easy_localization.dart';
- import 'package:flutter/material.dart';
- import 'package:telnow_mobile_new/src/utils/U.dart';
- class UserModule with ChangeNotifier {
- static String _serialNumber = '';
- static Map<String, dynamic> _user = {};
- static Map<String, dynamic> _profile = {};
- static bool _reset = false;
- static bool _dnd = false;
- static bool _servantDisplay = false;
- static bool _houseKeeping = false;
- static String _text = 'req_group'.tr();
- String serialNumber() => _serialNumber;
- Map<String, dynamic> user() => _user;
- Map<String, dynamic> profile() => _profile;
- bool resetData() => _reset;
- bool dndStatus() => _dnd;
- bool servantDisplay() => _servantDisplay;
- bool houseKeeping() => _houseKeeping;
- String textnya() => _text;
- void setList(list) {
- _user = list;
- notifyListeners();
- }
- void setProfile(list) {
- if(list != null){
- _profile = jsonDecode(list);
- }
- else{
- _profile = {};
- }
- notifyListeners();
- }
- void setResetData(val) {
- _reset = val;
- notifyListeners();
- }
- void setDndStatus(val) {
- _dnd = val;
- notifyListeners();
- }
- void setHouseKeeping(val) {
- _houseKeeping = val;
- notifyListeners();
- }
- void setSerialNum(number) {
- _serialNumber = number;
- notifyListeners();
- }
- void setServantDisplay(val) {
- _servantDisplay = val;
- notifyListeners();
- }
- void setText(val) {
- _text = val;
- notifyListeners();
- }
- void reset(){
- _serialNumber = '';
- _text = 'req_group'.tr();
- _user = {};
- _profile = {};
- _reset = false;
- _servantDisplay = false;
- }
- }
- //------------------------------------------------------------------------------
- class ReqGroupModule with ChangeNotifier {
- static List _data = [];
- static bool _isLoad = false;
- static bool _stopLoad = false;
- List data() => _data;
- bool isLoad() => _isLoad;
- bool stopLoad() => _stopLoad;
- void setData(value) {_data = value; notifyListeners();}
- void clearData() {_data.clear(); notifyListeners();}
- void setIsLoad(value) {_isLoad = value; notifyListeners();}
- void setStopLoad(value) {_stopLoad = value; notifyListeners();}
- void reset(){
- _data = [];
- _isLoad = false;
- _stopLoad = false;
- }
- }
- class RequestModule with ChangeNotifier {
- static List _data = [];
- static bool _isLoad = false;
- static bool _stopLoad = false;
- static bool _isEmpty = false;
- static String _placeholder = '';
- static String _keyword = '';
- List data() => _data;
- bool isLoad() => _isLoad;
- bool stopLoad() => _stopLoad;
- bool isEmpty() => _isEmpty;
- String placeholder() => _placeholder;
- String keyword() => _keyword;
- void setData(value) {_data = value; notifyListeners();}
- void clearData() {_data.clear(); notifyListeners();}
- void setIsLoad(value) {_isLoad = value; notifyListeners();}
- void setStopLoad(value) {_stopLoad = value; notifyListeners();}
- void setEmpty(value) {_isEmpty = value; notifyListeners();}
- void setPlaceholder(value) {_placeholder = value; notifyListeners();}
- void setKeyword(value) {_keyword = value; notifyListeners();}
- void reset(){
- _data = [];
- _isLoad = false;
- _stopLoad = false;
- _isEmpty = false;
- _placeholder = '';
- _keyword = '';
- }
- }
- class ServiceModule with ChangeNotifier {
- static String _scoopeName = '-';
- static dynamic _scoopeValue;
- static List _scoope = [];
- static bool _initialized = false;
- static List _data = [];
- static List _quickAct = [];
- static List _messages = [];
- static bool _isLoaded = false;
- static bool _stopLoad = false;
- static bool _hideQuickAct = false;
- static bool _unreadMessage = false;
- static bool _expand = false;
- static int _count = 0;
- static List? _topMenu;
- static List? _reqGroup;
- static List _offer = [];
- static List _banner = [];
- static String _contactCenter = '';
- String scoopeName() => _scoopeName;
- dynamic scoopeValue() => _scoopeValue;
- List scoope() => _scoope;
- bool initialized() => _initialized;
- List data() => _data;
- List quickAct() => _quickAct;
- List messages() => _messages;
- bool isLoaded() => _isLoaded;
- bool stopLoad() => _stopLoad;
- bool hideQuickAct() => _hideQuickAct;
- bool unreadMessage() => _unreadMessage;
- bool expand() => _expand;
- int count() => _count;
- List? topMenu() => _topMenu;
- List? reqGroup() => _reqGroup;
- List specialOffer() => _offer;
- List banner() => _banner;
- String contactCenter() => _contactCenter;
- void setInitialized(value) {
- _initialized = value;
- notifyListeners();
- }
- void setContactCenter(value) {
- _contactCenter = value;
- notifyListeners();
- }
- void setScoopeName(value) {
- _scoopeName = value;
- notifyListeners();
- }
- void setScoopeValue(value) {
- _scoopeValue = value;
- notifyListeners();
- }
- void setScoope(value) {
- _scoope = value;
- notifyListeners();
- }
- bool checkScoope(value) {
- return _scoopeValue == value;
- }
- int getScoopeLength(){
- return _scoope.length;
- }
- void setTopMenu(value) {
- _topMenu = value;
- notifyListeners();
- }
- void setReqGroup(value) {
- _reqGroup = value;
- notifyListeners();
- }
- void setSpecialOffer(value) {
- _offer = value;
- notifyListeners();
- }
- void setBanner(value) {
- _banner = value;
- notifyListeners();
- }
- void setData(value) {
- _data = value;
- notifyListeners();
- }
- int getDataLength() {
- return _data.length;
- }
- void setQuickAct(value) {
- _quickAct = value;
- notifyListeners();
- }
- void setMessage(value) {
- _messages = value;
- notifyListeners();
- }
- void setIsLoaded(value) {
- _isLoaded = value;
- notifyListeners();
- }
- void setStopLoad(value) {
- _stopLoad = value;
- notifyListeners();
- }
- void setHideQuickAct(value) {
- _hideQuickAct = value;
- notifyListeners();
- }
- void setUnreadMessage(value) {
- _unreadMessage = value;
- notifyListeners();
- }
- void setCount(value) {
- _count = value;
- notifyListeners();
- }
- void setExpand(value) {
- _expand = value;
- notifyListeners();
- }
- void reset(){
- _scoopeName = '-';
- _scoopeValue = null;
- _scoope = [];
- _initialized = false;
- _data = [];
- _quickAct = [];
- _messages = [];
- _isLoaded = false;
- _stopLoad = false;
- _hideQuickAct = false;
- _unreadMessage = false;
- _expand = false;
- _count = 0;
- _topMenu = null;
- _reqGroup = null;
- _offer = [];
- _banner = [];
- }
- }
- //------------------------------------------------------------------------------
- class HistoryModule with ChangeNotifier {
- static int _page = 0;
- static bool _isLoadHistory = false;
- static bool _stopLoadHistory = false;
- static bool _multiSelectMode = false;
- static bool _setLoading = false;
- static List _selectedIndexes = [];
- static List _activeForum = [];
- static List _data = [];
- static List _pendingData = [];
- static int _pressAttention = 0;
- static int _selectedFilter = 1;
- List dataMisi() => _data;
- List dataPending() => _pendingData;
- int pressAttention() => _pressAttention;
- int selectedFilter() => _selectedFilter;
- int page() => _page;
- bool isLoadHistory() => _isLoadHistory;
- bool stopLoadHistory() => _stopLoadHistory;
- bool multiSelectMode() => _multiSelectMode;
- bool setLoading() => _setLoading;
- List selectedIndexes() => _selectedIndexes;
- List activeForum() => _activeForum;
- void addSelectedIndexes(i) {
- _selectedIndexes.add(i);
- notifyListeners();
- }
- void removeSelectedIndexes(i) {
- _selectedIndexes.remove(i);
- notifyListeners();
- }
- void setSelectedIndexes(value) {
- _selectedIndexes = value;
- notifyListeners();
- }
- void setPressAttention(value) {
- _pressAttention = value;
- notifyListeners();
- }
- void setSelectedFilter(value) {
- _selectedFilter = value;
- notifyListeners();
- }
- void setPage(value) {
- _page = value;
- notifyListeners();
- }
- void addPage() {
- _page++;
- notifyListeners();
- }
- void setLoadHistory(value) {
- _isLoadHistory = value;
- notifyListeners();
- }
- void setStopLoadHistory(value) {
- _stopLoadHistory = value;
- notifyListeners();
- }
- void setMultiSelectMode(value) {
- _multiSelectMode = value;
- notifyListeners();
- }
- void setSetLoading(value) {
- _setLoading = value;
- notifyListeners();
- }
- void setMisi(list) {
- _data.addAll(list);
- notifyListeners();
- }
- void clearMisi() {
- _data.clear();
- notifyListeners();
- }
- void setPendingData(list) {
- _pendingData = list;
- notifyListeners();
- }
- void setActiveForum(list) {
- _activeForum = list;
- notifyListeners();
- }
- bool checkPressAttention(value){
- return _pressAttention == value;
- }
- int getMisiLength(){
- return _data.length;
- }
- void setSatisfaction(index, rate) {
- _data[index]['satisfactionRate'] = rate;
- notifyListeners();
- }
- void cancelMisi(index) {
- _data.removeAt(index);
- notifyListeners();
- }
- void setForumFalse(index) {
- _data[index]['_hasForum'] = false;
- notifyListeners();
- }
- void reset(){
- _page = 0;
- _isLoadHistory = false;
- _stopLoadHistory = false;
- _multiSelectMode = false;
- _setLoading = false;
- _data = [];
- _pendingData = [];
- _pressAttention = 0;
- _selectedFilter = 1;
- _selectedIndexes = [];
- _activeForum = [];
- }
- }
- //------------------------------------------------------------------------------
- class CreateSerModule with ChangeNotifier{
- int _locationType = 1;
- Uint8List? _image;
- bool _sendLater = false;
- bool _setLoadingEffect = false;
- int _others = 0;
- List _suggestion = [];
- List<Uint8List> _images = [];
- String _defaultLocation = '';
- int locationType() => _locationType;
- int others() => _others;
- Uint8List? image() => _image;
- bool sendLater() => _sendLater;
- bool setLoadingEffect() => _setLoadingEffect;
- List suggestion() => _suggestion;
- List<Uint8List> images() => _images;
- String defaultLocation() => _defaultLocation;
- void setLocationType(value) {
- _locationType = value;
- notifyListeners();
- }
- void setOthers(value) {
- _others = value;
- notifyListeners();
- }
- void setImage(value) {
- _image = value;
- notifyListeners();
- }
- void setSendLater(value) {
- _sendLater = value;
- notifyListeners();
- }
- void setSetLoadingEffect(value) {
- _setLoadingEffect = value;
- notifyListeners();
- }
- void setSuggestion(value) {
- _suggestion = value;
- notifyListeners();
- }
- void setImages(Uint8List value) {
- _images.add(value);
- notifyListeners();
- }
- void removeImages(int index) {
- _images.removeAt(index);
- notifyListeners();
- }
- void setDefaultLocation(value) {
- _defaultLocation = value;
- notifyListeners();
- }
- void reset(){
- _locationType = 1;
- _others = 0;
- _image = null;
- _images = [];
- _sendLater = false;
- _setLoadingEffect = false;
- _suggestion = [];
- _defaultLocation = '';
- }
- }
- //------------------------------------------------------------------------------
- class MessageModule with ChangeNotifier{
- Map<String, dynamic> _user = {};
- List _data = [];
- bool _firstLoad = false;
- bool _isAfterLoad = false;
- List _forum = [];
- int _selectedTab = 0;
- Map<String, dynamic> user() => _user;
- List data() => _data;
- bool firstLoad() => _firstLoad;
- bool isAfterLoad() => _isAfterLoad;
- List forum() => _forum;
- int activeTab() => _selectedTab;
- void setUser(value) {
- _user = value;
- notifyListeners();
- }
- void setData(value) {
- _data = value;
- notifyListeners();
- }
- void setFirstLoad(value) {
- _firstLoad = value;
- notifyListeners();
- }
- void setAfterLoad(value) {
- _isAfterLoad = value;
- notifyListeners();
- }
- void reset(){
- _user = {};
- _data = [];
- _firstLoad = false;
- _isAfterLoad = false;
- _forum = [];
- _selectedTab = 0;
- }
- void setForum(val){
- _forum = val;
- notifyListeners();
- }
- void setActiveTab(val){
- // print("setActiveTab($val)");
- _selectedTab = val;
- notifyListeners();
- }
- }
|