flutter-不同平台配置、国际化、抽屉效果
ios的启动图,正常配置就行,要是出现启动图白色闪现一下,不要犹豫,跳过他,你用真机试一下大概率没有这个问题,如果有另当别论。
HomeRequest.RequestBannerList().then((e){
print(json.encode(e));
setState(() {
for (var json in e){
_bannerList.add(HomeBannerModel.fromJson(json));
}
});
});
指针类型内的具体数据是不是一样?
SingleChildScrollview
container中包含List 会要求Container有固定高度,解决方案如下
shrinkWrap: 内容有多高,listView就多高,d但是会多一些padding,记得自己去掉
scrollview不想滚动:设置physics为NeverScrollableScrollPhysics
CircleAvatar:圆形
抽屉效果:请查看以下代码
Scaffold(
// appBar: buildMJYNavBar("接龙你画我猜"),
appBar: AppBar(
title: Text("你画我猜"),
leading: Builder(
builder: (ctx) {
return IconButton(
icon: const Icon(Icons.build),
onPressed: () {
Scaffold.of(ctx).openDrawer();
},
tooltip: MaterialLocalizations.of(context).openAppDrawerTooltip,
);
},
),
),
body: const MJYContentBody(),
drawer: Container(
width: 100,
child: Drawer(),
),
);
国际化
environment:
sdk: ">=2.12.0 <3.0.0"
# Dependencies specify other packages that your package needs in order to work.
# To automatically upgrade your package dependencies to the latest versions
# consider running `flutter pub upgrade --major-versions`. Alternatively,
# dependencies can be manually updated by changing the version numbers below to
# the latest version available on pub.dev. To see which dependencies have newer
# versions available, run `flutter pub outdated`.
dependencies:
flutter:
sdk: flutter
flutter_localizations:
sdk: flutter
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^1.0.2
flutter_swiper_view: ^1.1.8
dio: ^4.0.6
provider: ^6.0.4
event_bus: ^2.0.0
ios程序需要修改info.plist 文件
方案2.arb资源包
<string,dynamic>转换成想要的类型:
map.map((key,value){
return MapEntry(key,value.cast<String,String>());
})