小编chr*_*788的帖子

底部导航栏粘在键盘顶部

最近 Flutter 的更新似乎改变了 BottomNavigationBar 的行为。以前,当键盘出现时,键盘会覆盖BottomNavigationBar。但是,现在,BottomNavigationBar 出现时会粘在键盘的顶部并且始终可见。

当键盘出现时,如何将BottomNavigationBar 设置为保留在键盘下方?

  bottomNavigationBar: new BottomNavigationBar(
      type: BottomNavigationBarType.fixed,
      fixedColor: Colors.blue,
      onTap: _navigationTapped,
      currentIndex: _pageIndex,
      items: [
        new BottomNavigationBarItem(icon: new Icon(Icons.apps), title: new Text("Manage")),
        new BottomNavigationBarItem(icon: new Icon(Icons.multiline_chart), title: new Text("A")),
        new BottomNavigationBarItem(icon: new Icon(Icons.check_box), title: new Text("B")),
        new BottomNavigationBarItem(icon: new Icon(Icons.person_add), title: new Text("C")),
        new BottomNavigationBarItem(icon: new Icon(Icons.border_color), title: new Text("D")),
      ]
  ),
Run Code Online (Sandbox Code Playgroud)

flutter flutter-layout

14
推荐指数
2
解决办法
5010
查看次数

Flutter DropdownButton与父Widgets颜色相同

我一直在研究玩具提醒应用程序,并希望为用户实现一个下拉菜单,以选择给定的时间间隔.

我已经加载了按钮,可以弹出正确的菜单点击它.问题是屏幕上按钮的外观.它与父Widget颜色相同,根本不显示所选项目的文本.

如何让下拉按钮具有白色背景和黑色文本?

这是一个截图:

下拉按钮颜色问题

以下是构建此视图的代码:

@override
Widget build(BuildContext context) {

return new Container(

  child: new Row(

    children: <Widget>[
      new Expanded(

        child: new Column(
          crossAxisAlignment: CrossAxisAlignment.stretch,
          children: <Widget>[

            _buildInformationRow(),
            _buildReminderRow(),

          ],
        )

      )
    ],

  )

  );
 }

Widget _buildInformationRow() {

return new Container(
  padding: const EdgeInsets.all(10.0),
  child: new Row(

    children: <Widget>[

      new Column(
        children: <Widget>[

          new Container(
            padding: const EdgeInsets.all(10.0),
            child: new Text(
              "This app can remind you to do stuff\non a regular basis",
                style: new TextStyle(
                  color: Colors.white,
                  fontSize: 18.0, …
Run Code Online (Sandbox Code Playgroud)

colors drop-down-menu flutter

5
推荐指数
3
解决办法
7102
查看次数

Reading State of a Stateful Widget

I've been slowly building an app with Flutter and am struggling to work under the StatefulWidget/State paradigm.

I am used to being able to read or alter the state of some UI component from other classes and do not quite understand how to do this in Flutter. For example, right now I am working to build a ListView that contains CheckBoxListTiles. I would like to, from another class, go through and read the state of each of the checkboxes in …

dart flutter

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

键盘将 TextFields 推离屏幕

我一直在处理 Flutter 中一个我无法弄清楚的奇怪情况。

问题是,当我尝试在任何类型的可滚动小部件中使用任何类型的 TextField 时,当我点击 TextField 以使键盘出现时,键盘会将 TextField 推离屏幕。Scaffold 中的一切都是空白。

我不能确切地说发生了什么,但有时似乎键盘将可滚动视图的内容向上推过视图,但其他时候似乎似乎有一个巨大的白色框连接到顶部覆盖上下文的键盘。我做了几次实验,但我无法确定确切的行为。

需要明确的是,我尝试过使用 SingleChildScrollView 和 ListView。行为是一样的。

我已经通读了整个线程并尝试了解决方法但没有成功:https : //github.com/flutter/flutter/issues/10826

我也试过使用这个解决方法:https : //gist.github.com/collinjackson/50172e3547e959cba77e2938f2fe5ff5

但是,我只是不确定我是否遇到了与这些线程完全相同的问题。

这是一个演示问题的代码片段和一些屏幕截图。我只是在做一些明显错误的事情吗?

class MakeEntryView extends StatefulWidget {

   @override
   State<StatefulWidget> createState() => new MakeEntryState();

}

class MakeEntryState extends State<MakeEntryView> {

  @override
  Widget build(BuildContext context) {
    return new Scaffold(
      body: new SingleChildScrollView(
      child: new Container(
        child: new Column(
          children: <Widget>[
            new TextField(),
            new TextField(),
            new TextField(),
            new TextField(),
            new TextField(),
            new TextField(),
            new TextField(),
          ],
        ),
      ),
    ) …
Run Code Online (Sandbox Code Playgroud)

flutter

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

Clojure视频数据性能问题

我正在编写一些代码来生成和处理大量的视频数据.起初我打算只处理随机数据.

我的技术是将像素视为R,G,B,A整数值的映射,将视频帧视为这些像素映射的矢量,并将视频随时间视为像素映射的这些矢量矢量.我已经编写了三个可靠地执行此操作的函数,但在缩放时会遇到性能问题.

(defn generateFrameOfRandomVideoData
  "Generates a frame of video data which is a vector of maps of pixel values."
  [num-pixels-in-frame]
  (loop [num-pixels-in-frame num-pixels-in-frame
     pixels-added 0
     frame '[]]
(if (> num-pixels-in-frame pixels-added)
 (recur num-pixels-in-frame
        (inc pixels-added) 
        (conj frame (assoc '{} 
                           :r (rand-int 256)
                           :g (rand-int 256)
                           :b (rand-int 256)
                           :a (rand-int 256))))
 frame)))

(defn generateRandomVideoData
   "Generates a vector of frames of video data."
   [number-of-frames frame-height frame-width]
   (loop [number-of-frames number-of-frames
     frame-height frame-height
     frame-width frame-width
     frames '[]]
(if (> number-of-frames (count frames))
 (recur …
Run Code Online (Sandbox Code Playgroud)

jvm clojure video-processing

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

将 32 位整数拆分为 4 个 8 位整数

我正在使用 Java 处理视频数据,并希望将四个 8 位整数存储在 32 位整数中。换句话说,我想将 0 到 255 之间的 R、G、B 和 A 值打包到一个 32 位整数中。

我该怎么办:

  1. 创建 4 个从 0 到 255 的整数值并将它们存储在 32 位整数中?

  2. 从 32 位整数中解包 4 个 8 位整数值?

谢谢!

java video video-processing

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

Flutter中的Dart Futures麻烦:失败的断言:第146行:'&lt;optimized out&gt;':不正确

我正在为我的应用程序构建用户身份验证模块,并且遇到了一些异步代码的麻烦。

首先,这是引发的错误:

E / flutter(17162):[错误:flutter / shell / common / shell.cc(188)] Dart错误:未处理的异常:E / flutter(17162):'dart:async / future_impl.dart':断言失败:行146:“已优化”:不正确。E / flutter(17162):#0 _AssertionError._doThrowNew(dart:core / runtime / liberrors_patch.dart:40:39)E / flutter(17162):#1 _AssertionError._throwNew(dart:core / runtime / liberrors_patch.dart: 36:5)E / flutter(17162):#2 _FutureListener.handleError(dart:async / future_impl.dart:146:14)E / flutter(17162):#3 Future._propagateToListeners.handleError(dart:async / future_impl。 dart:654:47)E / flutter(17162):#4 Future._propagateToListeners(dart:async / future_impl.dart:675:24)E / flutter(17162):#5 Future._completeError(dart:async / future_impl。 dart:494:5)E / flutter(17162):#6 _SyncCompleter。_completeError(dart:async / future_impl.dart:55:12)E / flutter(17162):#7 _Completer.completeError(dart:async / future_impl.dart:27:5)E / flutter(17162):#8 _AsyncAwaitCompleter。 completeError(dart:async / runtime / libasync_patch.dart:40:18)E / flutter(17162):#9 FirebaseAuth.signInWithEmailAndPassword(package:firebase_auth / firebase_auth.dart)E / flutter(17162):E / flutter(17162) …

asynchronous async-await dart flutter

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

实现PreferredSizeWidget用作Appbar

我正在尝试构建一个可用于标识列表视图中的两列的组件。我希望能够将该标题栏实现为Scaffold中的appbar,以便可以在Scaffold的主体部分中实现ListView。我想这样做是因为我想在我的整个应用程序中多次使用此模式,并且不希望每次都实施粗略的标题栏。

因为AppBar组件所需的全部是PreferredSizeWidget的实现,所以我认为这应该非常简单:

import 'package:flutter/material.dart';

class ListTitleBar extends StatefulWidget implements PreferredSizeWidget {

  final String _left;
  final String _right;

  ListTitleBar(this._left, this._right);

  @override
  State<StatefulWidget> createState() => new ListTitleBarState(_left, _right);

  @override
  Size get preferredSize {
    new Size.fromHeight(20.0);
  }

}

class ListTitleBarState extends State<ListTitleBar> {

  String _leftTitle;
  String _rightTitle;

  ListTitleBarState(this._leftTitle, this._rightTitle);

  @override
  Widget build(BuildContext context) {

return new Container(

  decoration: new BoxDecoration(
    color: Colors.redAccent,
    border: new Border.all(color: Colors.black),
  ),

  child: new Row(
    mainAxisAlignment: MainAxisAlignment.spaceEvenly,
    children: <Widget>[

      ///Left Column Title
      new Column(
        children: <Widget>[
          new Container( …
Run Code Online (Sandbox Code Playgroud)

flutter

2
推荐指数
1
解决办法
3448
查看次数

White Box Obscures View When Keyboard Appears

For some reason after updating flutter, one of the sections of my app has been broken. I have a list of text form widgets set in a SingleChildScrollView. Whenever I press one of the text forms, the keyboard appears and an empty white box pushes itself up into the field of view, obscuring the text entry boxes.

在此输入图像描述

After having some trouble with text entry in a list view before I followed the advice of this link: https://www.didierboelens.com/2018/04/hint-4-ensure-a-textfield-or-textformfield-is-visible-in-the-viewport-when-has-the-focus/

It effectively solved …

flutter flutter-layout

2
推荐指数
1
解决办法
1600
查看次数

在Clojure中将整数中的所有32位获取为字符串格式

我需要将 Clojure 中的 Integer 的所有 32 位都转换为 String 格式。

当前:(整数/toBinaryString 10)->“1010”

所需:(整数/toBinaryString 10)->“0000000000001010”

我怎样才能轻松有效地做到这一点?

clojure

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