l10n support

hmxc
小赖 4 years ago
parent 08f86b30ae
commit 49991ff863

1
.gitattributes vendored

@ -0,0 +1 @@
*.arb diff

@ -0,0 +1,4 @@
arb-dir: lib/l10n
template-arb-file: app_zh.arb
output-localization-file: app_localizations.dart
output-class: S

@ -1,3 +1,3 @@
class AppValues {
static const String plotName = '人才公寓智慧小区';
}
// class AppValues {
// static const String plotName = '人才公寓智慧小区';
// }

@ -0,0 +1,10 @@
{
"appName": "智慧社区",
"@appName":{
"description": "应用名称"
},
"tempPlotName": "人才公寓智慧小区",
"@tempPlotName":{
"description": "临时使用的小区名称"
}
}

@ -17,6 +17,7 @@ import 'package:akuCommunity/provider/cart.dart';
import 'package:akuCommunity/provider/sign_up_provider.dart';
import 'package:akuCommunity/provider/user_provider.dart';
import 'package:akuCommunity/utils/developer_util.dart';
import 'package:akuCommunity/utils/headers.dart';
void main() async {
WidgetsFlutterBinding.ensureInitialized();
@ -87,17 +88,18 @@ class _MyAppState extends State<MyApp> {
designSize: Size(750, 1334),
allowFontScaling: true,
builder: () => GetMaterialApp(
title: '智慧社区',
onGenerateTitle: (context) => S.of(context).appName,
debugShowCheckedModeBanner: false,
theme: AppTheme.theme,
home: SplashPage(),
//
localizationsDelegates: [
S.delegate,
GlobalMaterialLocalizations.delegate,
GlobalWidgetsLocalizations.delegate,
GlobalCupertinoLocalizations.delegate,
],
supportedLocales: [const Locale('zh', 'CH')],
supportedLocales: [const Locale('zh')],
locale: Locale('zh'),
builder: BotToastInit(),
navigatorObservers: [BotToastNavigatorObserver()],

@ -1,13 +1,12 @@
import 'package:akuCommunity/constants/app_values.dart';
import 'package:akuCommunity/provider/app_provider.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_icons/flutter_icons.dart';
import 'package:get/get.dart';
import 'package:provider/provider.dart';
import 'package:qr_flutter/qr_flutter.dart';
import 'package:akuCommunity/base/base_style.dart';
import 'package:akuCommunity/model/manager/article_QR_code_model.dart';
import 'package:akuCommunity/utils/headers.dart';
import 'package:akuCommunity/widget/bee_scaffold.dart';
@ -25,7 +24,7 @@ class DetoCodePage extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Text(
AppValues.plotName,
S.of(Get.context).tempPlotName,
style: TextStyle(fontSize: 40.sp, color: Color(0xffffffff)),
),
SizedBox(height: 10.w),

@ -109,7 +109,7 @@ class _DetoCreatePageState extends State<DetoCreatePage> {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
AppValues.plotName,
S.of(context).tempPlotName,
style: TextStyle(
fontWeight: FontWeight.w600,
fontSize: 32.sp,

@ -1,4 +1,5 @@
import 'package:akuCommunity/constants/app_values.dart';
import 'package:akuCommunity/utils/headers.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
@ -40,7 +41,7 @@ class _AnimateAppBarState extends State<AnimateAppBar> {
Widget build(BuildContext context) {
final appProvider = Provider.of<AppProvider>(context);
return AppBar(
title: Text(AppValues.plotName),
title: Text( S.of(context).tempPlotName),
backgroundColor: _bgColor,
leading: Container(
margin: EdgeInsets.only(left: 32.w),

@ -82,7 +82,14 @@ class _LifePayPageState extends State<LifePayPage> {
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
AppValues.plotName.text.black.size(32.sp).bold.make(),
S
.of(context)
.tempPlotName
.text
.black
.size(32.sp)
.bold
.make(),
10.w.heightBox,
appProvider.selectedHouse.roomName.text.black
.size(32.sp)

@ -94,7 +94,7 @@ class _LifePayDetailPageState extends State<LifePayDetailPage> {
children: [
model.name.text.black.size(30.sp).bold.make(),
Spacer(),
'${AppValues.plotName} ${userProvider.currentHouse}'
'${S.of(context).tempPlotName} ${userProvider.currentHouse}'
.text
.color(ktextSubColor)
.size(24.sp)

@ -87,7 +87,10 @@ class _MyHousePageState extends State<MyHousePage> {
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
AppValues.plotName.text
S
.of(context)
.tempPlotName
.text
.size(24.sp)
.color(ktextSubColor)
.bold

@ -4,6 +4,7 @@ import 'package:akuCommunity/constants/app_values.dart';
import 'package:akuCommunity/provider/app_provider.dart';
import 'package:akuCommunity/ui/profile/house/house_owners_page.dart';
import 'package:akuCommunity/ui/profile/house/pick_my_house_page.dart';
import 'package:akuCommunity/utils/headers.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
@ -221,7 +222,7 @@ class _AddFixedSubmitPageState extends State<AddFixedSubmitPage> {
body: ListView(
children: [
_buildHouseCard(
AppValues.plotName,
S.of(context).tempPlotName,
appProvider.selectedHouse.roomName,
),
_getType(),

@ -306,7 +306,7 @@ class _VisitorAccessPageState extends State<VisitorAccessPage> {
child: Column(
children: [
_buildHouseCard(
AppValues.plotName,
S.of(context).tempPlotName,
appProvider.selectedHouse.roomName,
),
_input('访客姓名', '请输入访客姓名', _userName),

@ -145,7 +145,7 @@ class _NewAdvicePageState extends State<NewAdvicePage> {
width: 60.w,
),
40.wb,
'${AppValues.plotName}\n${appProvider.selectedHouse.roomName}'
'${S.of(context).tempPlotName}\n${appProvider.selectedHouse.roomName}'
.text
.size(32.sp)
.black

@ -36,7 +36,7 @@ class CarManageCard extends StatelessWidget {
),
),
Text(
AppValues.plotName,
S.of(context).tempPlotName,
style: Theme.of(context)
.textTheme
.subtitle2

@ -36,7 +36,7 @@ class CarparkingCard extends StatelessWidget {
),
),
Text(
AppValues.plotName,
S.of(context).tempPlotName,
style: Theme.of(context)
.textTheme
.subtitle2

@ -171,7 +171,7 @@ class _AddHousePageState extends State<AddHousePage> {
_renderTile(
title: '小区名称',
item: _renderPicker(
text: AppValues.plotName,
text: S.of(context).tempPlotName,
hintText: '请选择小区',
//
// TODO

@ -109,7 +109,7 @@ class HouseCard extends StatelessWidget {
),
),
onPressed: () {
Get.to(()=>PickMyHousePage());
Get.to(() => PickMyHousePage());
},
shape: RoundedRectangleBorder(
borderRadius:
@ -119,7 +119,7 @@ class HouseCard extends StatelessWidget {
),
12.hb,
Text(
AppValues.plotName,
S.of(context).tempPlotName,
style: Theme.of(context).textTheme.headline3,
),
10.hb,

@ -196,7 +196,7 @@ class _HouseCard extends StatelessWidget {
mainAxisSize: MainAxisSize.min,
children: [
Text(
AppValues.plotName,
S.of(context).tempPlotName,
style: Theme.of(context).textTheme.subtitle1.copyWith(
color:
highlight ? Color(0xFFFF8200) : Color(0xFF333333),

@ -3,3 +3,4 @@ export 'package:akuCommunity/extensions/num_ext.dart';
export 'package:akuCommunity/extensions/widget_list_ext.dart';
export 'package:velocity_x/velocity_x.dart';
export 'package:akuCommunity/const/resource.dart';
export 'package:flutter_gen/gen_l10n/app_localizations.dart';

@ -416,7 +416,7 @@ packages:
source: hosted
version: "4.4.2"
intl:
dependency: transitive
dependency: "direct main"
description:
name: intl
url: "https://pub.flutter-io.cn"

@ -12,6 +12,7 @@ dependencies:
sdk: flutter
flutter_localizations:
sdk: flutter
intl: ^0.17.0
permission_handler: ^6.1.1
package_info: ^2.0.0
provider: ^5.0.0
@ -75,6 +76,7 @@ dev_dependencies:
flutter:
uses-material-design: true
generate: true
assets:
- assets/

Loading…
Cancel
Save