标签: flutter-layout

垂直分隔线未显示

我正在尝试使用VerticalDivider小部件来分隔Row. 这里是全身。

在此处输入图片说明

排:

Row(
  children: <Widget>[
    Text('420 Posts', style: TextStyle(color: Color(0xff666666)),),
    VerticalDivider(
      thickness: 2,
      width: 20,
      color: Colors.black,
    ),
    Text('420 Posts', style: TextStyle(color: Color(0xff666666)),)
  ],
),
Run Code Online (Sandbox Code Playgroud)

flutter flutter-layout

28
推荐指数
2
解决办法
8572
查看次数

列内的可滚动容器

我尝试了几种不同的方法,但我无法让它发挥作用。我想要实现的布局非常简单,在原生 Android 中实现起来轻而易举:

  • 顶部固定容器(蓝色)
  • 下面的可滚动容器(红色)。ListView 在我的情况下不起作用。

我尝试使用SingleChildScrollView,但它似乎在Column. 也许我做错了什么,或者我没有使用正确的小部件......

我的结果:

在此处输入图片说明

Scaffold(
  body: Column(
    children: <Widget>[
      Container(
        height: 100.0,
        color: Colors.blue,
      ),
      SingleChildScrollView(
        child: Container(
          color: Colors.red,
          padding: EdgeInsets.all(20.0),
          child: Column(
            children: <Widget>[
              Text('Red container should be scrollable'),
              Container(
                width: double.infinity,
                height: 700.0,
                padding: EdgeInsets.all(10.0),
                color: Colors.white.withOpacity(0.7),
                child: Text('I will have a column here'),
              )
            ],
          ),
        ),
      ),
    ],
  ),
)
Run Code Online (Sandbox Code Playgroud)

listview dart flutter flutter-layout

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

Flutter 错误:每个子元素都必须恰好布置一次。关于建筑布局

我开始使用颤振。这看起来很不错也很容易,但是在错误方面没有太多资源。无论如何,经过长时间的思考、检查和即兴创作,我开始在网上搜索答案,嗯,没有。所以我想问你们所有人,也许有人能够向我解释为什么我会收到这个错误,它意味着什么以及如何摆脱它。

哦,在我深入探讨之前,我可能应该提到我正在使用 flutter_bloc。

好的,所以我有这样的代码:

class Settings extends StatelessWidget {
  final _formKey = GlobalKey<FormState>();
  @override
  Widget build(BuildContext context) {
    return new Scaffold(
      appBar: new AppBar(
          title: new Text("SomeApp",style: TextStyle(color: Colors.white)),
          automaticallyImplyLeading: false,
          backgroundColor: myBlue.shade50,

          actions: <Widget>[
            IconButton(
              icon: new Icon(FontAwesomeIcons.download,color:  Colors.white),
              onPressed: () {
                Navigator.push(
                  context,
                  MaterialPageRoute(builder: (context) => DownloadView()),
                );
              },
            ),
            IconButton(
              icon: new Icon(FontAwesomeIcons.chevronCircleLeft,color:  Colors.white),
              onPressed: () {
                Navigator.push(
                  context,
                  MaterialPageRoute(builder: (context) => MainWindow()),
                );
              },
            ),]
      ),
      body: Container(
        padding: EdgeInsets.symmetric(vertical: 16),
        alignment: Alignment.center,
        child: new BlocBuilder<SettingsBloc, …
Run Code Online (Sandbox Code Playgroud)

android flutter flutter-layout flutter-bloc

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

如何更新颤振TextField的高度和宽度?

如何在Flutter中自定义TextField布局的高度和宽度?

flutter flutter-layout

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

改变FLUTTER中TextFormField的默认边框颜色

当 TextFormField 未激活时,无法更改默认边框颜色。当 TextFormField 未激活时,它会显示 DarkGrey-Border 颜色。那么,如何改变它。

在此处输入图片说明

Theme(
              data: new ThemeData(
                primaryColor: Colors.red,
                primaryColorDark: Colors.black,
              ),
              child: TextFormField(
                decoration: new InputDecoration(
                  labelText: "Enter Email",
                  fillColor: Colors.white,
                  border: new OutlineInputBorder(
                    borderRadius: new BorderRadius.circular(25.0),
                    borderSide: new BorderSide(),
                  ),
                  //fillColor: Colors.green
                ),
                validator: (val) {
                  if (val.length == 0) {
                    return "Email cannot be empty";
                  } else {
                    return null;
                  }
                },
                keyboardType: TextInputType.emailAddress,
                style: new TextStyle(
                  fontFamily: "Poppins",
                ),
              ),
            ),
Run Code Online (Sandbox Code Playgroud)

default textfield dart flutter flutter-layout

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

如何在颤振应用程序顶部覆盖小部件?

我想要一个位于整个应用程序顶部的小部件。当我尝试使用Overlay.of(context).insert叠加层执行此操作时,在替换该路线后稍后会消失。有没有一种方法可以让我的应用程序顶部有一个小部件,即使屏幕稍后弹出?

flutter flutter-layout

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

Flutter Network Image不适合圆形头像

我试图从api中检索一堆图像.我希望图像以圆形形式显示,所以我使用CircleAvatarWidget,但我一直在以方形格式获取图像.这是图像的屏幕截图

在此输入图像描述

这是我正在使用的代码

ListTile(leading: CircleAvatar(child: Image.network("${snapshot.data.hitsList[index].previewUrl}",fit: BoxFit.scaleDown,)),),
Run Code Online (Sandbox Code Playgroud)

我tryied使用的所有属性BoxFit一样cover,contain,fitWidth,fitHeight等,但他们没有工作.

image dart flutter flutter-layout

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

类型 'Future&lt;dynamic&gt;' 不是类型 '() =&gt; void' 的子类型

我正在尝试Text单击打开一个 URL 。为此,我使用InkWell如下所示:

Row(
    mainAxisAlignment: MainAxisAlignment.spaceBetween,
    children: <Widget>[
       Text('${blogModel.timeElapsed} ago'),
       InkWell(
          child: Text('Read'),
          onTap: launchURL(blogModel.url),
       )
     ],
  )
Run Code Online (Sandbox Code Playgroud)

使用这个我收到以下错误:

???????? Exception caught by widgets library ???????????????????????????????????????????????????????
The following assertion was thrown building BlogTileWidget(dirty):
type 'Future<dynamic>' is not a subtype of type '() => void'

Either the assertion indicates an error in the framework itself, or we should provide substantially more information in this error message to help you determine and fix the underlying cause.
In either …
Run Code Online (Sandbox Code Playgroud)

dart flutter flutter-layout

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

如何在 Flutter 中的新 OutlinedButton 小部件上实现圆角?

在 Flutter 1.22 中,我们收到了一个OutlinedButton用于替换的新小部件,OutlineButton但我们如何才能真正使其边框变圆?borderSide并且shape属性不再可用。

dart flutter flutter-layout

24
推荐指数
2
解决办法
5620
查看次数

自定义卡形状颤振SDK

我刚开始学习Flutter,我用GridView开发了一个应用程序.GridView项目是卡.默认卡片形状为矩形,半径为4.

我知道Card Widget有shape属性,它需要ShapeBorder类.但我无法找到如何使用ShapeBorder类并在GridView中自定义我的卡.

提前致谢.

flutter flutter-layout

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