小编Hit*_*goi的帖子

底部溢出30px

我通过使用新的Expanded()包装TextField来解决问题.当试图在textfield中搜索某些东西时,它显示我的底部溢出30px ..不好是我的代码请帮助我

 Widget build(BuildContext context) {
    return new Scaffold(
        body:
      Column(
        children: <Widget>[
          Row(
            mainAxisAlignment: MainAxisAlignment.spaceBetween,
            children: <Widget>[
              IconButton(icon: Icon(Icons.search), onPressed: () {
                setState(() {

                });
              }),
              new Flexible(
                child: new TextField(
                  onChanged: (String value) {
                    onchange(value);
                  },
                  maxLines: 1,
                  autocorrect: true,
//                  decoration: const InputDecoration(helperText: "Search"),
                  style: new TextStyle(fontSize: 10.0, color: Colors.black),
                ),
              ),
              _text != null ? IconButton(
                  icon: Icon(Icons.close), onPressed: (){
              }) : new Container(),

              IconButton(icon: Icon(Icons.bookmark_border), onPressed: () {}),
            ],
          ),
          new Expanded(
              child: FilstList(searchtext: _text,) …
Run Code Online (Sandbox Code Playgroud)

flutter flutter-layout

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

如何在flutter图像选择器中将图像添加到firestore

我想将照片添加到firestore.你能告诉我怎么做吗?

我正在使用图像选择器在我的颤动应用程序中选择照片.

我的代码如下

import 'package:flutter/material.dart';
import 'package:onlinecity/component/TextField/inputField.dart';



import 'package:onlinecity/component/Button/roundedButton.dart';
import 'package:onlinecity/component/Button/textButton.dart';
import 'style.dart';
import 'package:onlinecity/theme/style.dart';
import 'package:flutter/services.dart';
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:image_picker/image_picker.dart';
import 'dart:async';
import 'dart:io';

class AddOfferScreen extends StatefulWidget {


  @override
  AddOfferScreenState createState() => new AddOfferScreenState();
}

class AddOfferScreenState extends State<AddOfferScreen> {
  final GlobalKey<FormState> _formKey = new GlobalKey<FormState>();
  final GlobalKey<ScaffoldState> _scaffoldKey = new GlobalKey<ScaffoldState>();
  bool _autovalidate = false;
  String _productTitle;
  String _category;
  String _contactNumber;
  Future<File> _imageFile;

  void _onImageButtonPressed(ImageSource source) {
    setState(() {
      _imageFile = ImagePicker.pickImage(source: source);
    });
  }

  _onPressed() { …
Run Code Online (Sandbox Code Playgroud)

dart flutter google-cloud-firestore

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

我可以在 Firestore 搜索中过滤多个字段吗?

我在我的应用程序中使用 Firestore 数据库。
现在,是否可以在多个字段中搜索特定单词?

例如:想象一个像“cheesecake”这样的词。现在,我收集了 100 个文档,每个文档有 10 个不同的字段。在 Flutter 中,我可以过滤所有字段中的
单词,以便返回任何字段中包含单词“cheesecake”的文档吗?

dart firebase flutter google-cloud-firestore

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

如何检查 int 字段在 firebase 中是否存在

在此输入图像描述我有两个按钮,如果该字段存在,则它显示一个按钮,否则它显示用户其他按钮,其中我将提供将数据添加到我的数据库的功能...我正在使用云 Firebase ...如何检查该字段是否存在或不...下面是我的代码...

//如果分数不存在,它将显示一个凸起的按钮,以便您可以单击该按钮

//代码:

import 'dart:async';
import 'package:flutter/material.dart';
import 'package:cloud_firestore/cloud_firestore.dart';

BuildContext buildContext;
int filter = 0;
StreamSubscription<DocumentSnapshot> subscription;

class ScorePage extends StatelessWidget {

  final int score;
  ScorePage({Key key, @required this.score}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return new Scaffold(
        appBar: AppBar(
          title: new Text('Scroe Card'),
        ),
        body: new Center(
            child: new Column(
                crossAxisAlignment: CrossAxisAlignment.stretch,
                children: <Widget>[
                  new Padding(padding: EdgeInsets.all(30.0)),
                  new MaterialButton(
                    color: Colors.red,
                    onPressed: () {},
                    child: new Text(
                      "Reset Quiz",
                    ),
                  ),
                  new Flexible(
                      child: StreamBuilder( …
Run Code Online (Sandbox Code Playgroud)

flutter google-cloud-firestore

4
推荐指数
1
解决办法
3741
查看次数

Flutter:如何在一定数量的索引后在gridview下添加其他小部件

我正在使用 flutter gridview 项目,我想在一定数量的索引之后显示另一个小部件。

如何在 gridview 的每 6 个索引之后添加小部件

GridView.builder(shrinkWrap: true,gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 2,childAspectRatio: MediaQuery.of(context).size.width /
            (MediaQuery.of(context).size.width*0.9),),
            physics: NeverScrollableScrollPhysics(),


            itemCount: widget.dicovervehiclelist.length,
            itemBuilder: (BuildContext context, int index) {
              return vehicleview(
                  widget.dicovervehiclelist[index], context,widget.dicovervehiclelist.length,index);
            }),
Run Code Online (Sandbox Code Playgroud)

flutter

4
推荐指数
1
解决办法
3709
查看次数

初始高度为屏幕一半的底页,如果滚动,则高度增加到全屏

我在下面的代码中有一个底部表格,其中我将高度设置为300.0,但是当用户滚动时我想将高度增加到全屏..我该怎么做..请

void _showBottomSheet() {
    setState(() {
      _showPersBottomSheetCallBack = null;
    });

    _scaffoldKey.currentState
        .showBottomSheet((context) {
      return new Container(
        height: 300.0,
        color: Colors.greenAccent,
        child: new Center(
          child: new Text("Hi BottomSheet"),
        ),
      );
    })
        .closed
        .whenComplete(() {
      if (mounted) {
        setState(() {
          _showPersBottomSheetCallBack = _showBottomSheet;
        });
      }
    });
  }
Run Code Online (Sandbox Code Playgroud)

flutter flutter-layout

3
推荐指数
2
解决办法
2443
查看次数

Flutter:如何将pdf文件上传到firebase存储?

我正在开发 Flutter 应用程序,我想将 PDF 文件上传到 Firebase 存储,我使用 Documents_picker 选择文件,但无法将其上传到存储...请帮助我...我的代码如下

uploaddoc()async{


   dynamic docPaths;
   // Platform messages may fail, so we use a try/catch PlatformException.
   try {
     docPaths = await DocumentsPicker.pickDocuments;
     final Directory tempDir = Directory.systemTemp;
     final String fileName = "${Random().nextInt(10000)}.pdf";
     final File file = File('${tempDir.path}/$fileName');
     file.writeAsBytesSync(docPaths);

     final StorageReference ref = FirebaseStorage.instance.ref().child(fileName);
     final StorageUploadTask task = ref.putFile(file);
     final Uri downloadUrl = (await task.future).downloadUrl;
     _path = downloadUrl.toString();

     print(_path);
   } on PlatformException {

   }

   // If the widget was removed from the tree while …
Run Code Online (Sandbox Code Playgroud)

firebase flutter firebase-storage flutter-layout

0
推荐指数
1
解决办法
9920
查看次数