Flutter 颤振:颤振腹板中容器内的滚动条
我想在颤振web中的固定大小容器中添加一个滚动条,如下面的图片链接所示。有人能给我一些建议吗?我被困在这里了。我尝试过使用Flutter\u web\u滚动条查看单子滚动视图,但它不起作用。这是代码Flutter 颤振:颤振腹板中容器内的滚动条,flutter,flutter-web,Flutter,Flutter Web,我想在颤振web中的固定大小容器中添加一个滚动条,如下面的图片链接所示。有人能给我一些建议吗?我被困在这里了。我尝试过使用Flutter\u web\u滚动条查看单子滚动视图,但它不起作用。这是代码 Container( width: 300, child: SingleChildScrollView( scrollDirection: Axis.vertical,
Container(
width: 300,
child: SingleChildScrollView(
scrollDirection: Axis.vertical,
controller: _bcontroller,
child: Column(
children: [
Container(
width: 300,
child: Row(
children: [
Text(
'${eventList.length > 0 ? i['ShipName'] : ''}',
),
],
),
),
Container(
width: 300,
child: Row(
children: [
Text(
'${eventList.length > 0 ? i[getEventDesc()].toString() : ''}',
),
],
),
),
SizedBox(
height: 10,
),
],
),
),
)
使用滚动条小部件包装SingleChildScrollView
import 'package:flutter/material.dart';
final Color darkBlue = Color.fromARGB(255, 18, 32, 47);
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
theme: ThemeData.dark().copyWith(scaffoldBackgroundColor: darkBlue),
debugShowCheckedModeBanner: false,
home: Scaffold(
body: Center(
child: MyWidget(),
),
),
);
}
}
class MyWidget extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Container(
width: 300,
height: 200,
child: Scrollbar(
child: SingleChildScrollView(
scrollDirection: Axis.vertical,
child: Column(
children: [
Container(
width: 300,
height: 100,
child: Row(
children: [
Text(
'your variable',
),
],
),
),
Container(
width: 300,
height: 100,
child: Row(
children: [
Text(
'your variable',
),
],
),
),
SizedBox(
height: 10,
),
],
),),
),
);
}
}
谢谢,但我已经尝试了你的解决方案,它不工作我编辑代码,现在试试。容器高度必须小于总高度。