ElevatedButton 是否在网络上正常工作?

Is ElevatedButton working correctly for the web?

我正在做我的第一个 Flutter 项目,我的目标是让我的应用程序在所有平台上运行(Android、iOS、Web)。

在使用 ElevatedButton 时,我的额头慢慢变红了。我无法让它在 Web 上运行。

这是 Android 中的样子:(正确)

这是它在网上的样子:(不正确)

这是我的主题:

theme: ThemeData(
  elevatedButtonTheme: ElevatedButtonThemeData(
    style: ElevatedButton.styleFrom(
      primary: Colors.black,
      onPrimary: Colors.yellowAccent,
      side: BorderSide(width: 2.5, color: Colors.yellowAccent),
      shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(6)),
      textStyle: TextStyle(
        fontSize: 15, fontWeight: FontWeight.w600
      ),
      elevation: 6,
      shadowColor: Colors.yellowAccent,
      padding:  EdgeInsets.all(8.0),
    ),
  ),
),

这是我的按钮:

Container(
  padding: EdgeInsets.all(8.0),
  child: ElevatedButton(
  child: Text("MY BUTTON"),
  onPressed: () => setState(() {
    _launched = _launchInBrowser('https://www.mywonderfulsite.com');
  }),
)),

这是ElevatedButton的“特性”还是可以用它来解决?

感谢建议。

我找到的唯一解决方案是放置固定宽度和高度的容器。像这样:

Container(
  width: 124.0,   // <-- Added this...
  height: 48.0,   // <--- ...and this.
  padding: EdgeInsets.all(8.0),
  child: ElevatedButton(
  child: Text("MY BUTTON"),
  onPressed: () => setState(() {
    _launched = _launchInBrowser('https://www.mywonderfulsite.com');
  }),
)),

希望它适用于所有平台和版本。我已经测试了最基本的。