1. If you're running pod install manually, make sure flutter pub get is executed first"
cd 到工程的iOS目录执行以下命令:flutter packages get
2. 空安全运行:
flutter run --no-sound-null-safety
3.创建Flutter项目时指定语言:
flutter create -i objc -a java
4.Tabbar
class MyApp extends StatelessWidget {
MyApp({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false, // debug 图标
home: Tabs(),
theme: ThemeData(primarySwatch: Colors.lightBlue),
);
}
}
class _TabsState extends State<Tabs> {
int _current = 0;
List pageList = [Home(), Product(), Discover(), MinePage()];
@override
Widget build(BuildContext context) {
return Scaffold(
body: this.pageList[this._current],
bottomNavigationBar: BottomNavigationBar(
iconSize: 40,
currentIndex: this._current,
type: BottomNavigationBarType.fixed,
onTap: (value) {
setState(() {
this._current = value;
});
},
items: [
BottomNavigationBarItem(icon: Icon(Icons.home), label: '首页'),
BottomNavigationBarItem(icon: Icon(Icons.catching_pokemon), label: '项目'),
BottomNavigationBarItem(icon: Icon(Icons.badge_sharp), label: '发现'),
BottomNavigationBarItem(icon: Icon(Icons.settings), label: '设置'),
],
),
);
}
}
5 Navigation导航
return Scaffold(
appBar: AppBar(
title: Text('标题'),
),
body: Container(),
);