小编Ant*_*ina的帖子

AnimatedContainer 调整高度中的溢出警告

例子

使用 CupertinoPicker,我希望它使用 AnimatedContainer 将动画显示在文本输入下方的视图中,但是当它变得可见时,我会收到溢出警告。从我所见,您无法调整 CupertinoPicker 的大小,只能调整它的父级。

有更好的解决方案吗?

Column(
    children: <Widget>[
        buildTextField(
            field: 'limit',
            label: 'How Many Guests?',
            controller: TextEditingController(
                text: eventModel.event['limit']),
            onTap: () {
                showPicker.value = !showPicker.value;
            },
        ),
            AnimatedContainer(
            height: showPicker.value ? 150 : 0,
            duration: Duration(milliseconds: 150),
            child: showPicker.value
                ? CupertinoPicker(
                    backgroundColor: Colors.transparent,
                    itemExtent: 40,
                    children: List<Widget>.generate(
                        98,
                        (index) => Center(
                            child: Text(
                                '${index + 2}',
                                style: TextStyle(
                                    color: Colors.black,
                                    fontSize: 16),
                            ),
                            ),
                    ),
                    onSelectedItemChanged: (item) {
                        print((item + 2).toString());
                    },
                    )
                : null,
        ),
    ] …
Run Code Online (Sandbox Code Playgroud)

flutter flutter-layout flutter-animation

7
推荐指数
2
解决办法
4159
查看次数

如何扩展 Express.Application 的类型以提供 app.locals 的类型

在我们的应用程序中,我们向 app.locals 添加了很多配置对象,这些对象在我们的中间件中使用。

const app = Express();
app.locals = {
  someConfig: config
}
Run Code Online (Sandbox Code Playgroud)

目前,我们为 Request 对象提供了自定义类型,可以正常工作

declare namespace Express {
  export interface Request {
    featureFlags?: FeatureFlag;
  }
}
Run Code Online (Sandbox Code Playgroud)

我知道locals来自 Express.Application 所以我尝试了这个,但它不起作用。

declare namespace Express {
  export interface Application {
    locals: {
      someConfig: config;
    };
  }

  export interface Request {
    featureFlags?: FeatureFlag;
  }
}
Run Code Online (Sandbox Code Playgroud)

有人成功将类型添加到 app.locals 吗?

express typescript

6
推荐指数
1
解决办法
865
查看次数