RenderFlex 底部溢出了 676 像素。在 SingleChildScrollView 中
\nWidget dashboard(context){\n return AnimatedPositioned(\n duration: duration,\n top:0,\n bottom:0,\n left:isCollapsed ? 0 : 0.6 * screenWidth,\n right:isCollapsed ? 0 : -0.2 * screenWidth,\n child: ScaleTransition(\n scale: _scaleAnimation,\n child: Material(\n animationDuration: duration ,\n borderRadius: BorderRadius.all(\n Radius.circular(40),\n ),\n elevation: 8,\n color:backgroundColor,\n child: Column(\n crossAxisAlignment: CrossAxisAlignment.start,\n children: <Widget>[\n Container(\n padding: const EdgeInsets.only(left: 16, right: 16, top: 48),\n child: Row(\n mainAxisAlignment: MainAxisAlignment.spaceBetween,\n mainAxisSize: MainAxisSize.max,\n children:[\n InkWell(\n child: Icon(\n Icons.menu,\n color: Colors.white\n ),\n onTap: (){\n setState(() {\n if(isCollapsed)\n _controller.forward();\n …Run Code Online (Sandbox Code Playgroud) 我对 ReorderableListView 有一些问题。
我想从拖动的项目中删除背景(参见图片1 )。我尝试在 ReorderableListView 周围添加主题小部件以解决此问题。它可以工作,但现在我的卡片侧面边框较浅(参见图2)您也可以在DarPad中尝试这个问题
您知道如何解决它吗?
这是我的代码:
Expanded(
child: Theme(
data: ThemeData(canvasColor: Colors.transparent),
child: ReorderableListView(
padding: const EdgeInsets.fromLTRB(16.0, 0.0, 16.0, 16.0),
children: <Widget>[
for (final items in homeButtons)
Card(
key: ValueKey(items),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10.0)),
child: Container(
clipBehavior: Clip.antiAlias,
alignment: Alignment.center,
height: 50.0,
width: double.infinity,
decoration: BoxDecoration(
gradient: const LinearGradient(
colors: [
Color(0xFF3b474f),
Color(0xFF232b32),
],
stops: [0, 1],
begin: AlignmentDirectional(1, -1),
end: AlignmentDirectional(-1, 1),
),
borderRadius: BorderRadius.circular(10),
),
child: ListTile(
title: …Run Code Online (Sandbox Code Playgroud) 我正在使用 flutter 将图像上传到SQL 服务器,但出现错误:
类型“Null”不是“函数结果”的“文件”类型的子类型
这是我初始化文件的方式:
late File _image;
final picker=ImagePicker();
Future choiceImage() async{
var pickedImage= await picker.getImage(source: ImageSource.gallery);
setState(() {
_image=File(pickedImage!.path);
});
}
Future choice2Image() async{
var pickedImage= await picker.getImage(source: ImageSource.camera);
setState(() {
_image=File(pickedImage!.path);
});
}
Run Code Online (Sandbox Code Playgroud)
并通过以下方式获取此图像:
var pic =await http.MultipartFile.fromPath("image", _image.path);
Run Code Online (Sandbox Code Playgroud)
不知道是什么问题?
flutter flutter Listview -> Container \'width\' 不起作用?
\n/示例/\n\xe3\x85\xa1\xe3\x85\xa1\xe3\x85\xa1\xe3\x85\xa1\xe3\x85\xa1\xe3\x85\xa1\xe3\x85\xa1\xe3\ x85\xa1\xe3\x85\xa1\xe3\x85\xa1\xe3\x85\xa1\xe3\x85\xa1
\nscaffold \nbody : ListView\nchildren : [\n Container (\n width: 100, // Not Working \n height: 100, // Ok\n color: Colors.red.\n ),\n]\nRun Code Online (Sandbox Code Playgroud)\n!!! 但 !!!
\nscaffold \nbody : ListView\nchildren : [\n Stack(\n children : [\n Container (\n width: 100, // OK\n height: 100, // Ok\n color: Colors.red.\n ),\n ]\nRun Code Online (Sandbox Code Playgroud)\n为什么 ??
\n\n这是代码,任何人都可以帮助我:
Theme(
data: theme,
child: ListTileTheme(
contentPadding: EdgeInsets.all(0),
dense: true,
child: ExpansionTile(
title: Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
GFCheckbox(
inactiveBgColor: kColorPrimaryDark,
inactiveBorderColor: Colors.white,
customBgColor: kColorPrimaryDark,
size: 15,
activeIcon: const Icon(
Icons.check,
size: 15,
color: Colors.white,
),
activeBgColor: kColorPrimaryDark,
onChanged: (value) {
setState(() {
isChecked = value;
});
},
value: isChecked,
inactiveIcon: null,
),
SizedBox(
width: 5,
),
textWidget(color: Colors.white, size: 12, text: root.title),
],
),
key: PageStorageKey<DataList>(root),
children: root.children.map(_buildTiles).toList(),
),
),
);
Run Code Online (Sandbox Code Playgroud) 现在我可以一次选择一项,但我想选择多项。我找到了一些用于多重选择的包,但想在不使用任何包的情况下实现。
int? selectedIndex;
final List<String> _wordName = [
"Engaged in my Life",
"Feel Alive",
"Happy",
"Love my Life",
];
GridView.builder(
scrollDirection: Axis.vertical,
gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 2,
crossAxisSpacing: 3,
mainAxisSpacing: 2,
childAspectRatio: (16 / 8),
),
itemCount: _wordName.length,
itemBuilder: (context, index) {
return GestureDetector(
onTap: () {
setState(() {
print("now selected ===>>> $index");
selectedIndex = index;
showButton = true;
});
},
child: Container(
margin: EdgeInsets.all(10),
decoration: BoxDecoration(
color: selectedIndex == index
? Color(0xffDEB988).withOpacity(0.2)
: Color(0xffF4F4F6).withOpacity(0.5),
borderRadius: BorderRadius.circular(5.0),
border: Border.all(
color: …Run Code Online (Sandbox Code Playgroud)