Flutter自问自答

  • 问:屏幕中有两个可滑动布局叠加时滑动报错

    • 答:添加 controll:ScrollControll() 属性
  • 问:依赖包冲突了

    • 答:dependency_overrides:强制使用某个版本
  • ShapeBorder

    • RoundedRectangleBorder 圆角
  • 升级依赖

    • flutter pub upgrade
  • 跳入到外部浏览器

    • url_launcher包
  • google字体包

    • google_fonts
  • 中间弹窗

    • showDialog
  • 底部菜单

    • showBottomSheet
  • 自定义导航动画和背景

    • PageRouteBuild
  • 让小部件以动画形式偏移原来的位置

    • Hero
  • 界面跳转方式
    1.设定路由声明 routes: <String, WidgetBuilder>{ '/a': (context) => const MyWidget(), '/b': (context) => const MyWidget2(), }, 跳转:Navigator.of(context).pushNamed('/a'); 2.直接跳转 Navigator.push(context, MaterialPageRoute(builder: (context) => const MyWidget()));

  • 如果Column中包裹了ListView报错,将ListView用Expanded包裹起来

  • 让ListView能自适应高度并且设置最大高度后可滑动
    ConstrainedBox( constraints: BoxConstraints(maxHeight: media.size.height / 3 - 85), child: ListView.builder( shrinkWrap: true, physics: const AlwaysScrollableScrollPhysics(), // 确保可滚动 itemCount: data.length, itemBuilder: (context, index) { VoiceModel model = data[index]; return VoiceCell<AppDoorbellNotiSoundState>(model, index); }, ), ),

posted @ 2022-10-19 17:38  呢哇哦比较  阅读(34)  评论(0)    收藏  举报