我正在尝试使用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) 我尝试了几种不同的方法,但我无法让它发挥作用。我想要实现的布局非常简单,在原生 Android 中实现起来轻而易举:
我尝试使用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) 我开始使用颤振。这看起来很不错也很容易,但是在错误方面没有太多资源。无论如何,经过长时间的思考、检查和即兴创作,我开始在网上搜索答案,嗯,没有。所以我想问你们所有人,也许有人能够向我解释为什么我会收到这个错误,它意味着什么以及如何摆脱它。
哦,在我深入探讨之前,我可能应该提到我正在使用 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) 当 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) 我想要一个位于整个应用程序顶部的小部件。当我尝试使用Overlay.of(context).insert叠加层执行此操作时,在替换该路线后稍后会消失。有没有一种方法可以让我的应用程序顶部有一个小部件,即使屏幕稍后弹出?
我试图从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等,但他们没有工作.
我正在尝试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) 在 Flutter 1.22 中,我们收到了一个OutlinedButton用于替换的新小部件,OutlineButton但我们如何才能真正使其边框变圆?borderSide并且shape属性不再可用。
我刚开始学习Flutter,我用GridView开发了一个应用程序.GridView项目是卡.默认卡片形状为矩形,半径为4.
我知道Card Widget有shape属性,它需要ShapeBorder类.但我无法找到如何使用ShapeBorder类并在GridView中自定义我的卡.
提前致谢.
flutter ×10
flutter-layout ×10
dart ×5
android ×1
default ×1
flutter-bloc ×1
image ×1
listview ×1
textfield ×1