Flutter 小结

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(),
    );

  • 2
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值