我正在用 flutter 编写代码以使用 Google 登录,但我第一手就遇到了这个错误

问题描述 投票:0回答:1

错误:

lib/Connection/inregistrare.dart:372:44: Error: Required named parameter 'label' must be provided.
                        ElevatedButton.icon(
                                           ^
../../../AppData/Local/flutter/packages/flutter/lib/src/material/elevated_button.dart:88:11: Context: Found this candidate, but the arguments don't match.
  factory ElevatedButton.icon({
          ^^^^
Target kernel_snapshot failed: Exception
 
 
FAILURE: Build failed with an exception.
 
* Where:
Script 'C:\Users\iduet\AppData\Local\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 1159
 
* What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
> Process 'command 'C:\Users\iduet\AppData\Local\flutter\bin\flutter.bat'' finished with non-zero exit value 1
 
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
* Get more help at https://help.gradle.org
 
BUILD FAILED in 3s
Running Gradle task 'assembleDebug'...                              4,5s
Exception: Gradle task assembleDebug failed with exit code 1

这里有一个粘贴箱,因为代码格式不正确

如果您发现我的代码有更多问题,请告诉我。

我已经看了 5 个教程,但我仍然无法让它工作 :(

android flutter dart google-signin
1个回答
0
投票

我猜你正在使用的小部件需要一个标签参数,但我不确定,如果你可以添加你正在使用的小部件,我可以提供帮助

编辑:

刚才看到贴箱,你在TextFormField的装饰里面给了labelStyle但是没有给label参数

所以您可以删除 labelStyle 或添加标签将解决此问题

请参考固定码

TextFormField(
                onFieldSubmitted: (value) {
                  setState(() {
                    _ChangeColor00();
                  });
                },
                focusNode: f1,
                onTap: _ChangeColor1,
                style: const TextStyle(fontSize: 17),
                obscureText: _vizibility,
                controller: _passwordValue0,
                // textAlign: TextAlign.start,
                decoration: InputDecoration(
                  suffixIcon: GestureDetector(
                    onTap: _toggleVizibility,
                    child: Icon(
                      _vizibility ? Icons.visibility_off : Icons.visibility,
                      color: culoare1,
                    ),
                  ),
                  label: Text('Something'), //<-- Here
                  labelStyle: const TextStyle(
                    color: Colors.white,
                  ),
                  prefixIcon: Icon(
                    Icons.lock,
                    color: culoare1,
                  ),
                  contentPadding: const EdgeInsets.all(13),
                  floatingLabelStyle: const TextStyle(fontSize: 12),
                  // filled: true,
                  // fillColor: Colors.white,
                  hintText: 'Password',
                  border: InputBorder.none,
                ),
              ),

label - 当输入框为空且没有焦点时,标签显示在输入框的顶部

labelStyle - 当标签位于输入字段顶部时用于 [InputDecoration.labelText] 的样式。

谢谢

© www.soinside.com 2019 - 2024. All rights reserved.