小编Vin*_*jan的帖子

“无法从构建环境中获取 Google 服务文件中的 GOOGLE_APP_ID”错误

我正在使用以下指南为我的项目设置开发和生产环境,该项目使用 flutter + firebase https://www.tengio.com/blog/multiple-firebase-environments-with-flutter/

我已经在 Firebase->dev 和 Firebase->prod 文件夹下设置了我各自的 GoogleService-Info.plist

我还在我的 Xcode Target->Build Phases 下添加了以下脚本(在编译源之前)

if [ "${CONFIGURATION}" == "Debug-prod" ] || [ "${CONFIGURATION}" == "Release-prod" ] || [ "${CONFIGURATION}" == "Release" ]; then
cp -r "${PROJECT_DIR}/Runner/Firebase/prod/GoogleService-Info.plist" "${PROJECT_DIR}/GoogleService-Info.plist"

echo "Production plist copied"

elif [ "${CONFIGURATION}" == "Debug-dev" ] || [ "${CONFIGURATION}" == "Release-dev" ] || [ "${CONFIGURATION}" == "Debug" ]; then

cp -r "${PROJECT_DIR}/Runner/Firebase/dev/GoogleService-Info.plist" "${PROJECT_DIR}/GoogleService-Info.plist"

echo "Development plist copied"
fi
Run Code Online (Sandbox Code Playgroud)

我试过了:

flutter run --flavor dev
Run Code Online (Sandbox Code Playgroud)

  • Flutter clean 然后运行 …

installation development-environment production-environment firebase flutter

9
推荐指数
1
解决办法
7495
查看次数

确定滚动部件的高度

我想确定“可滚动”小部件是否确实需要滚动。我最终想展示诸如“滚动查看更多”之类的内容。我该如何实现这一目标?

我可以结合使用 LayoutBuilder 和 ScrollController。但是,ScrollController 仅在发生任何事件后才给我 maxScrollExtent 和 minScrollExtent - 例如用户尝试滚动

我想在“构建”期间知道,以便我可以根据屏幕尺寸确定是否显示“滚动查看更多”

class _MyHomePageState extends State<MyHomePage> {
  int value = 0;
  String text = 'You have pushed the button 0 times\n';
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(widget.title),
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            Expanded(
              flex: 9,
              child: SingleChildScrollView(
                child: Text(text),
              ),
            ),
            Expanded(
              flex: 1,
                child: Text('Scroll for more')),
          ],
        ),
      ),
      floatingActionButton: FloatingActionButton(
        onPressed: () {
          setState(() {
            value += 1; …
Run Code Online (Sandbox Code Playgroud)

height scroll flutter

2
推荐指数
1
解决办法
6156
查看次数

GoogleService-Info.plist :是否复制捆绑资源

我使用 Flutter 风格(dev 和 prod),我各自的 GoogleServices-Info.plist 文件分别存在于 Firebase/dev Firebase/prod 文件夹中

我使用“构建阶段”脚本在构建时使用以下脚本将文件复制到 Runner/ 目录

if [ "${CONFIGURATION}" == "Debug-prod" ] || [ "${CONFIGURATION}" == "Release-prod" ] || [ "${CONFIGURATION}" == "Release" ]; then
cp -r "${PROJECT_DIR}/Firebase/prod/GoogleService-Info.plist" "${PROJECT_DIR}/Runner/GoogleService-Info.plist"

echo "Production plist copied"

elif [ "${CONFIGURATION}" == "Debug-dev" ] || [ "${CONFIGURATION}" == "Release-dev" ] || [ "${CONFIGURATION}" == "Debug" ]; then

cp -r "${PROJECT_DIR}/Firebase/dev/GoogleService-Info.plist" "${PROJECT_DIR}/Runner/GoogleService-Info.plist"

echo "Development plist copied"
fi
Run Code Online (Sandbox Code Playgroud)

一切正常,直到我尝试将 CI/CD 与 codemagic 一起使用。

(1) 首先我从 codemagic build 得到这个错误(但在本地工作正常)

错误:找不到构建输入文件:>'/Users/builder/clone/ios/Runner/GoogleService-Info.plist'

(2) …

xcode firebase flutter codemagic

2
推荐指数
1
解决办法
1720
查看次数