颤抖的可滚动页面

问题描述

我不熟悉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,)),));
  }

相关问答

依赖报错 idea导入项目后依赖报错,解决方案:https://blog....
错误1:代码生成器依赖和mybatis依赖冲突 启动项目时报错如下...
错误1:gradle项目控制台输出为乱码 # 解决方案:https://bl...
错误还原:在查询的过程中,传入的workType为0时,该条件不起...
报错如下,gcc版本太低 ^ server.c:5346:31: 错误:‘struct...