我有一个父 StatefulWidget 和子 StatefulWidget。goToPreviousItem我想从子窗口小部件调用父窗口小部件的函数。
家长班
class Parent extends StatefulWidget {
@override
_ParentState createState() => _ParentState();
}
class _ParentState extends State<Parent> {
String item = 0;
@override
Widget build(BuildContext context) {
return ChildClass();
}
goToPreviousItem(value){
setState(() {item = value});
}
}
Run Code Online (Sandbox Code Playgroud)
儿童班
class Child extends StatefulWidget {
@override
_ChildState createState() => _ChildState();
}
class _ChildState extends State<Child> {
@override
Widget build(BuildContext context) {
return Container(
child: FlatButton(
color: Color(0XFFEFEFEF),
textColor: primaryColor,
disabledColor: Colors.grey,
disabledTextColor: Colors.black,
padding: EdgeInsets.symmetric(
vertical: 15.0, …Run Code Online (Sandbox Code Playgroud) 我尝试使用 flutterfire 命令行工具将 firebase 添加到我的 flutter 项目中。我正在使用 firebase 的 Google 身份验证服务并调用SignIn函数,它给出以下错误。ios文件夹中有GoogleService-Info.plist文件。
Unhandled Exception: PlatformException(missing-config, GoogleService-Info.plist file not found and clientId was not provided programmatically., null, null)
#0 StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:607:7)
#1 MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:167:18)
<asynchronous suspension>
#2 GoogleSignInPlatform.initWithParams (package:google_sign_in_platform_interface/google_sign_in_platform_interface.dart:98:5)
<asynchronous suspension>
#3 GoogleSignIn._callMethod (package:google_sign_in/google_sign_in.dart:267:5)
<asynchronous suspension>
#4 GoogleSignIn.signIn.isCanceled (package:google_sign_in/google_sign_in.dart:402:5)
Run Code Online (Sandbox Code Playgroud) 我刚刚开始flutter web,我想使用勇敢的浏览器来调试我的 Flutter 应用程序,而不是 chrome 或 edge。
当我使用flutter devices命令时,它给出了以下结果。
No devices detected.
Run "flutter emulators" to list and start any available device emulators.
Run Code Online (Sandbox Code Playgroud)
我通过使用网络服务器提供的链接来使用勇敢,但它不支持hot reload.
那么,如何使用 flutter web 配置 chrome 或 edge 以外的浏览器以获得完整的功能。
我在尝试接受迂腐模型时遇到此错误。经过一段时间的调试后,我相信问题出在接受上CodeCreate
悬垂模型
class BaseCode(BaseModel):
index: Optional[int] = Field(None)
email: EmailStr
gen_time: datetime
expire_time: datetime
class CodeCreate(BaseCode):
code: int
used_time: Optional[datetime] = Field(None)
class Config:
orm_mode = True
class Message(BaseModel):
message: str
Run Code Online (Sandbox Code Playgroud)
代码 ORM
class Code(Base):
__tablename__ = 'code'
index = Column(Integer, primary_key=True, autoincrement=True)
code = Column(Integer)
email = Column(String, ForeignKey('user.email'))
gen_time = Column(DateTime)
expire_time = Column(DateTime)
used_time = Column(DateTime, nullable=True)
Run Code Online (Sandbox Code Playgroud)
处理程序
@app.post('/verify-code', response_model=schemas.Message, responses={404: {"model": schemas.Message}, 406: {"model": schemas.Message}})
async def verify_code(code: schemas.CodeCreate, response: Response, device_name: str = Body(..., …Run Code Online (Sandbox Code Playgroud) 我最近添加的 quick_actions 插件在调试模式下工作正常,但在发布模式下显示空白屏幕。
在日志中发现了这些问题。
[ERROR:flutter/lib/ui/ui_dart_state.cc(177)] Unhandled Exception: MissingPluginException(No implementation found for method getLaunchAction on channel plugins.flutter.io/quick_actions)
#0 MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:157)
<asynchronous suspension>
#1 QuickActions.initialize (package:quick_actions/quick_actions.dart:68)
[ERROR:flutter/lib/ui/ui_dart_state.cc(177)] Unhandled Exception: MissingPluginException(No implementation found for method setShortcutItems on channel plugins.flutter.io/quick_actions)
#0 MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:157)
Run Code Online (Sandbox Code Playgroud) flutter ×4
dart ×2
flutter-web ×2
fastapi ×1
firebase ×1
ios ×1
pydantic ×1
python ×1
quickaction ×1