如何解决颤抖的可滚动页面
我不熟悉dart语言,并且想知道如何使页面滚动。 这是我要滚动的代码页之一:
class Second extends StatelessWidget {
@override
Widget build(BuildContext context) {
return DraggableScrollableSheet(
builder: (context,scrollController) {
return SingleChildScrollView(
controller: scrollController,child: Scaffold(
backgroundColor: const Color(0xffffffff),body: Stack(
children: <Widget>[
Transform.translate(
offset: Offset(30.0,296.0),child:
Container(
width: 315.0,height: 287.0,decoration: BoxDecoration(
borderRadius: BorderRadius.circular(37.0),image: DecorationImage(
image: const AssetImage('assets/images/right.png'),fit: BoxFit.fill,)
),),],);
}
);
}
}
请注意,这不是完整的代码,因为代码很长。 我尝试使用Draggable Scrollable Sheet,当我运行代码时,我只能看到黑屏。 有人能帮我吗? 在此先感谢:)
解决方法
在Flutter中滚动内容的最简单方法是使用ListView小部件。 尝试这样的事情:
Widget build(BuildContext context) {
return Scaffold(
body: ListView(
children: [
Column(
children: [
Container(
height: 2000,child: Text('This container exceeds most screens'),),Text('End of container.'),],);
,
您可以使用SingleChildScrollview或Listview进行滚动,让我知道它是否对您有用
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: const Color(0xffffffff),appBar: AppBar(
title: Text(""),body: SingleChildScrollView(
child: Column(
children: [
Stack(
children: <Widget>[
Transform.translate(
offset: Offset(30.0,296.0),child: Container(
width: 315.0,height: 287.0,decoration: BoxDecoration(
borderRadius: BorderRadius.circular(37.0),image: DecorationImage(
image: const
AssetImage('assets/images/right.png'),fit: BoxFit.fill,)),));
}
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。