小编Shr*_*rma的帖子

错误:在搜索路径中找不到包含文件“Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig”(在目标“Runner”中)

我的颤振项目无法在 ios 设备上运行。我试过下面的命令sudo gem install cocoapods

颤动运行:

Warning: CocoaPods not installed. Skipping pod install.
  CocoaPods is used to retrieve the iOS and macOS platform side's plugin code that responds to your plugin usage on the Dart side.
  Without CocoaPods, plugins will not work on iOS or macOS.
To install:
  sudo gem install cocoapods
  pod setup



Running Xcode build...                                                  
                                                   
Xcode build done.                                            4.3s
Failed to build iOS app
Error output from Xcode build:
?
    ** BUILD FAILED **


Xcode's …
Run Code Online (Sandbox Code Playgroud)

xcode ios dart cocoapods flutter

35
推荐指数
7
解决办法
4万
查看次数

为什么我们在 dart 代码中使用 dispose() 方法?

我们为什么要使用dispose()方法?我对此有点困惑。如果我们不使用它会出现什么问题,使用它有什么好处?

@override
  void dispose() {
    // TODO: implement dispose
    super.dispose();
  }
Run Code Online (Sandbox Code Playgroud)

dart flutter

32
推荐指数
6
解决办法
3万
查看次数

如何解决此错误“尝试在 Xcode 中用您的签名 ID 替换‘com.example’:打开 ios/Runner.xcworkspace”

我创建了一个与 firebase 相关的颤振项目。它在 android 设备上运行良好,但在第一次尝试在 ios 设备上运行时出错。

flutter run命令输出下方:

在此处输入图片说明

ios dart flutter

16
推荐指数
1
解决办法
4242
查看次数

如何使用带有颤动的关闭图标设计自定义对话框?

我有一个对话框的图像,并尝试设计与图像下方相同的图像。

在此处输入图片说明

我试过了,但它与图像上方不同,我只想在右上角设置十字按钮,就像图像上方一样。我使用了堆栈,并Positionedtop:0.0right:0.0

代码:

 customDialogBox(BuildContext context) {
    return showDialog(
        context: context,
        builder: (BuildContext context) {
          return AlertDialog(
            backgroundColor: Colors.red,
            shape: RoundedRectangleBorder(
              borderRadius: BorderRadius.all(Radius.circular(32.0))),
            contentPadding: EdgeInsets.only(top: 10.0),
            content: Stack(
              children: <Widget>[
                Container(
              width: MediaQuery.of(context).size.width,
              child: Column(
                mainAxisAlignment: MainAxisAlignment.center,
                crossAxisAlignment: CrossAxisAlignment.stretch,
                mainAxisSize: MainAxisSize.min,
                children: <Widget>[
                  SizedBox(
                    height: 20.0,
                  ),
                  Center(
                    child: Padding(
                      padding: const EdgeInsets.all(10.0),
                      child: new Text("Sorry please try \n again tomorrow", style:TextStyle(fontSize: 30.0,color: Colors.white)),
                    )//
                  ),

                  SizedBox(
                    height: 20.0,
                    width: 5.0,
                  ),
                  Divider(
                    color: Colors.grey, …
Run Code Online (Sandbox Code Playgroud)

dart flutter flutter-layout

14
推荐指数
1
解决办法
1万
查看次数

如何解决颤动中小部件的溢出问题?

我有一个问题的图像溢出了 17 个像素。&我无法解决它?首先,我做了什么..!!!

我拿了一个Row()小部件并用Container()& 包裹起来,其中Row()包含了两个Expanded()小部件。一个用于 TextField(),另一个用于CountryPickerDropdown()

在此输入图像描述

我使用过country_pickers插件

代码:

 new Container(
                          width: MediaQuery.of(context).size.width,
                          padding: const EdgeInsets.only(left: 10.0),
                        decoration: BoxDecoration(
                          borderRadius: BorderRadius.all(Radius.circular(5.0)),
                          border: Border.all(color: Colors.blue)
                        ),  
                        child: Row(
                          children: <Widget>[
                            Expanded(
                              child: CountryPickerDropdown(
                                initialValue: 'in',

                                itemBuilder: _buildDropdownItem,
                                onValuePicked: (Country country) {

                                  isCountryCodeSelected=true;
                                  print("${country.name}");
                                  print("${country.phoneCode}");
                                  print("${country.isoCode}");
                                  print("+${country.phoneCode}(${country.isoCode})");
                                 setState(() {
                                  countryCode= country.phoneCode;
                                });
                                },
                              ),
                            ),
                            Expanded(
                              child: TextField(
                              keyboardType: TextInputType.phone,
                              decoration: InputDecoration(
                                border: InputBorder.none, 
                                hintText: "Telephone Number", 
                              ),

                              onChanged: (value){ …
Run Code Online (Sandbox Code Playgroud)

overflow dart flutter flutter-layout

7
推荐指数
1
解决办法
3万
查看次数

如何解决错误:未为 flutter 中的类“TextTheme”定义 getter“body1”?

我的 flutter 应用程序无法在2.5.0-5.3.prebeta 版本上运行。之后我搜索了它,然后需要升级我的 flutter sdk,因此已升级到最新的 beta 版本 2.6.0-5.2.pre,但仍然出现错误。\nplace_picker-0.9.19-nullsafety插件的错误。并且无法解决它。

\n

错误日志:

\n
../../../../Workspace/flutter/.pub-cache/hosted/pub.dartlang.org/place_picker-0.9.19-nullsafety/lib/widgets/rich_suggestion.dart:35:89: Error: The getter \'body1\' isn\'t defined for the class \'TextTheme\'.\n - \'TextTheme\' is from \'package:flutter/src/material/text_theme.dart\' (\'../../../../Workspace/flutter/packages/flutter/lib/src/material/text_theme.dart\').\nTry correcting the name to the name of an existing getter, or defining a getter or field named \'body1\'.\n      TextSpan(text: boldText, style: style.copyWith(color: Theme.of(context).textTheme.body1!.color)),\n                                                                                        ^^^^^\n../../../../Workspace/flutter/.pub-cache/hosted/pub.dartlang.org/place_picker-0.9.19-nullsafety/lib/widgets/search_input.dart:60:65: Error: The getter \'body1\' isn\'t defined for the class \'TextTheme\'.\n - \'TextTheme\' is from \'package:flutter/src/material/text_theme.dart\' (\'../../../../Workspace/flutter/packages/flutter/lib/src/material/text_theme.dart\').\nTry correcting the name to the name …
Run Code Online (Sandbox Code Playgroud)

dart flutter flutter-dependencies

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

如何检查输入的电话号码是否有效?

我正在尝试检查输入的电话号码是否有效。意思是,如果我输入了世界上不存在的错误号码,那么它会向我显示内容为“请输入有效号码”的祝酒词

 Expanded(
   child: TextField(
     keyboardType: TextInputType.phone,
     decoration: InputDecoration(
       border: InputBorder.none, 
       hintText: "Phone Number", 
     ),
     onChanged: (value){
      setState(() {
        phoneValue=value; 
      });
     //String telNo = value==null?("+91" + value) :null;
     print("phoneNumbe:$phoneNo");
     this.phoneNo = isCountryCodeSelected ? "+" + countryCode + value : "+91" + value ;
     print("phoneNo="+phoneNo);
    },
   ),
 )
Run Code Online (Sandbox Code Playgroud)

dart flutter

6
推荐指数
4
解决办法
3万
查看次数

模块映射文件'/Users/"my_flutter_project_path"/ios/Pods/Headers/Private/openssl_grpc/BoringSSL-GRPC.modulemap'未找到?

我正在尝试在真实设备上通过 xcode 运行我的 flutter 项目。但是收到此错误 module map file '/Users/"my_flutter_project_path"/ios/Pods/Headers/Private/openssl_grpc/BoringSSL-GRPC.modulemap' not found

我浏览了这个错误并获得了this_gitHub_issue_solution并遵循了它但无法获得解决方案。

xcode dart flutter

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

Flutter 中如何获取、设置、更新和删除云 Firestore 中的数据?

我尝试了一些代码但得到了一个例外。

我得到的例外: java.lang.IllegalArgumentException: Invalid document reference. Document references must have an even number of segments, but Users has 1

我搜索了一下,根据这个,文档引用必须有偶数个段,如:集合 - 文档 - 集合 - 文档 - 集合 - 文档

从 Firestore 获取数据的查询:

String getIsNewUSer;
Firestore.instance.collection('Users').document(uid).get().then((DocumentSnapshot document){
       print("document_build:$document");
        setState(() {
         getIsNewUSer=document['IsNewUser'];
         print("getIsNewUSe:$getIsNewUSer");
        });

    });

Run Code Online (Sandbox Code Playgroud)

查询将数据更新到 Firestore:

Firestore.instance
            .collection('Users')
            .document(uid)
            .updateData({
              "IsNewUser":"1"
            }).then((result){
              print("new USer true");
            }).catchError((onError){
             print("onError");
            });
Run Code Online (Sandbox Code Playgroud)

我的这些代码行超出了异常。

初始状态:

 void initState()  {
    super.initState();
    this.uid = '';

FirebaseAuth.instance.currentUser().then((val){
      setState(() {
      this.uid= val.uid; 
       print("uid_init: $uid");
      });
   });

} …
Run Code Online (Sandbox Code Playgroud)

dart firebase flutter google-cloud-firestore

5
推荐指数
2
解决办法
2万
查看次数

如何使用 flutter 显示 TimeOfDay 中的 AM 或 PM 格式的时间?

我使用ShowTimePickerclass 根据我的意愿选择时间,但想在 PM 或 AM 中显示,Text例如 9:00 AM、10:00 PM。

表示采用 12 小时格式。

代码 :

import 'package:flutter/material.dart';



class ShowTimePickerDemo extends StatefulWidget {
  @override
  _ShowTimePickerDemoState createState() => _ShowTimePickerDemoState();
}

class _ShowTimePickerDemoState extends State<ShowTimePickerDemo> {
  TimeOfDay pickedTime = TimeOfDay.now();

  Future<Null> _selectTime(BuildContext context) async {
    final TimeOfDay response = await showTimePicker(
      context: context,
      initialTime: pickedTime,
    );
    if (response != null && response != pickedTime) {
      setState(() {
        pickedTime = response;
      });
    }
  } 

  @override
  Widget build(BuildContext context) {
    return Scaffold( …
Run Code Online (Sandbox Code Playgroud)

time dart flutter

3
推荐指数
1
解决办法
1万
查看次数