This section uses s.Disposenotifier (context).maintainInfo obtained on the subclass of AutoDisposeNotifier is always in English. What can I do #3666
wangzhipeng-vicky
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
My project uses flutter_localizations and intl for internationalization, however
The information obtained through S.Disposenotifier (context).maintainInfo in the subclass of AutoDisposeNotifier is always in English, which I cannot obtain in Chinese even though my phone system is Chinese. How do you solve this problem? This is my code
`import 'package:flutter/cupertino.dart';
import 'package:indonesia_qs_management/vm/store_manage.dart';
import 'package:v_components/v_components.dart';
import '../../generated/l10n.dart';
/// FileName tabpage_notifier
///
/// @author ThinkPad
/// @Date 2024/7/17 15:36
///
/// @description 老铁 写下你的备注哦
class TabState {
final List tabTitle;//详情的
final List listTabTitle;//list的 怕一个模块的详情里把list的影响了
bool isNeedRefresh = false;
TabState({
required this.tabTitle,
required this.listTabTitle,
});
TabState.initial() : tabTitle = [],listTabTitle=[];
TabState copyWith({
List? tabTitleArr,
List? listTabTitleArr,
bool? isNeedRefresh,
}) {
return TabState(
tabTitle: tabTitleArr ?? tabTitle,
listTabTitle: listTabTitleArr ?? listTabTitle,
isNeedRefresh: isNeedRefresh ?? this.isNeedRefresh,
);
}
}
class CommonTabNotifier extends AutoDisposeNotifier with PageMixins {
@OverRide
TabState build() {
return TabState.initial();
}
set isNeedRefresh(int code) {
state = state.copyWith(isNeedRefresh: !state.isNeedRefresh);
}
set tabTitle(List tabTitle) {
state = state.copyWith(tabTitleArr: tabTitle);
}
set listTabTitle(List tabTitle) {
state = state.copyWith(listTabTitleArr: tabTitle);
}
// 维修详情
initWXDetailTabs(BuildContext context){
state=state.copyWith(tabTitleArr: [
S.of(context).maintainInfo(""),
S.of(context).repairGroup(S.of(context).scheme),
S.of(context).maintainName+ S.of(context).event,
]);
}
// 租赁详情
initLeaseDetailTabs(BuildContext context){
state=state.copyWith(tabTitleArr: [
S.of(context).leaseDispatch,
S.of(context).applyOrderEvent,
]);
}
// 出车单详情
initVehicleInvoiceDetailTabs(BuildContext context){
state=state.copyWith(tabTitleArr: [
S.of(context).leaseDispatch,
S.of(context).vehicleInvoiceEvent,
]);
}
// 镍矿转运计划列表
initNickelOrePlanTabs(BuildContext context){
state=state.copyWith(listTabTitleArr: [
S.of(context).tab_all(""),
S.of(context).tab_ddd(""),
S.of(context).tab_in_execution(""),
S.of(context).tab_finished(""),
]);
}
}`
Beta Was this translation helpful? Give feedback.
All reactions