如何在Flutter中增加SingleScrollChildView的大小?

问题描述

我正在制作一个页面可以滚动的应用程序。我使用SingleChildScrollView来滚动页面。我需要向其中添加更多的东西,但是当我这样做时,由于高度有限,这会导致错误。

有人可以帮助我扩展SingleChildScrollView的大小,以便我完成我的应用程序吗? 运行代码时,我在电话仿真器上看到一个空白屏幕。我认为这是因为我超出了页面大小,并且对如何在Flutter中增加SingleScrollChildView的大小感到困惑。

这是整个代码:

import 'package:flutter/material.dart';
import 'package:xdflutter/Component61.dart';
import './Component31.dart';
import './Component22.dart';
import './Component21.dart';
import './start.dart';
import 'package:adobe_xd/page_link.dart';
import 'package:flutter_svg/flutter_svg.dart';

class iPhoneXXS11Pro2 extends StatelessWidget {
  iPhoneXXS11Pro2({
    Key key,}) : super(key: key);
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: const Color(0xffffffff),body: SingleChildScrollView(
        child: Column(
        children: <Widget>[
          Transform.translate(
            offset: Offset(0.0,290.0),child:
                // Adobe XD layer: 'right' (shape)
                Container(
              width: 315.0,height: 287.0,decoration: BoxDecoration(
                borderRadius: BorderRadius.circular(50.0),image: DecorationImage(
                  image: const AssetImage('assets/images/right.png'),fit: BoxFit.fill,),Transform.translate(
            offset: Offset(0.0,-275.0),child: SizedBox(
              width: 434.0,child: Text(
                'What you should know \nbefore you begin? ',style: TextStyle(
                  fontFamily: 'Corbel',fontSize: 36,color: const Color(0xff000000),fontWeight: FontWeight.w700,textAlign: TextAlign.center,-260.0),child: SizedBox(
              width: 348.0,height: 108.0,child: Component31(),Transform.translate(
            offset: Offset(-0.5,-376.5),child: SvgPicture.string(
              _svg_kr65u6,allowDrawingOutsideViewBox: true,-370.0),child: SizedBox(
              width: 166.0,child: Text(
                'R:Right',fontSize: 42,decoration: TextDecoration.underline,15.0),child:
                // Adobe XD layer: 'left' (shape)
                Container(
              width: 307.0,height: 278.0,image: DecorationImage(
                  image: const AssetImage('assets/images/left.png'),-320.0),child: SizedBox(
              width: 130.0,child: Text(
                'L:Left',50.0),child:
                // Adobe XD layer: 'face' (shape)
                Container(
              width: 312.0,height: 289.0,decoration: BoxDecoration(
                borderRadius: BorderRadius.circular(54.0),image: DecorationImage(
                  image: const AssetImage('assets/images/face.png'),-300.0),child: SizedBox(
              width: 142.0,child: Text(
                'F:Face',90.0),child: Container(
              width: 314.0,height: 298.0,image: DecorationImage(
                  image: const AssetImage('assets/images/back.png'),-270.0),child: SizedBox(
              width: 173.0,child: Text(
                'B: Back ',130.0),height: 300.0,image: DecorationImage(
                  image: const AssetImage('assets/images/upper.png'),-230.0),child: SizedBox(
              width: 192.0,child: Text(
                'U: Upper',165.0),child: Container(
              width: 310.0,height: 296.0,image: DecorationImage(
                  image: const AssetImage('assets/images/down.png'),-190.0),child: SizedBox(
              width: 187.0,child: Text(
                'D: Down',145.0),child: SizedBox(
              width: 329.0,child: Text(
                'R2: Right twice',160.0),child: Container(
              width: 312.0,height: 294.0,image: DecorationImage(
                  image: const AssetImage('assets/images/r2.png'),Transform.translate(
            offset: Offset(0.5,170.0),child: SizedBox(
              width: 442.0,height: 0.0,child: Component22(),185.0),child: SizedBox(
              width: 408.0,child: Text(
                'Counter-clockwise \nrotations',380.0),200.0),child: SizedBox(
              width: 500.0,height: 200.0,child: Component61(),260.0),//        THIS IS IF I NEED TO ADD LINE BELOW SLICE TURNS
            ),190.0),child: SizedBox(
              width: 238.0,child: Text(
                'Slice turns ',280.0),height: 303.0,image: DecorationImage(
                  image: const AssetImage('assets/images/m_anti.png'),-80.0),child: SizedBox(
              width: 226.0,child: Text(
                'M: Middle ',new Expanded(
              child: (SingleChildScrollView(
                child: Column(
                  children: <Widget>[
                    Transform.translate(
                      offset: Offset(0.0,100.0),child: Container(
                        width: 304.0,height: 297.0,decoration: BoxDecoration(
                          borderRadius: BorderRadius.circular(50.0),image: DecorationImage(
                            image: const AssetImage('assets/images/m.png'),],)
              )
          ),250.0),child: Container(
              width: 304.0,image: DecorationImage(
                  image: const AssetImage('assets/images/m.png'),Transform.translate(
            offset: Offset(18.8,3751.0),child: SizedBox(
              width: 338.0,child: Text(
                'M\': Middle anti-\nclockwise ',Transform.translate(
            offset: Offset(-33.5,4618.5),Transform.translate(
            offset: Offset(35.5,100.5),child: SizedBox(
              width: 305.0,Transform.translate(
            offset: Offset(51.0,child: SizedBox(
              width: 273.0,height: 56.0,child: Component21(),Transform.translate(
            offset: Offset(91.0,child: PageLink(
              links: [
                PageLinkInfo(
                  transition: LinkTransition.Fade,ease: Curves.easeOut,duration: 0.3,pageBuilder: () => start(),child: SizedBox(
                width: 193.0,height: 43.0,child: Text(
                  'Begin learning! ',style: TextStyle(
                    fontFamily: 'Corbel',fontSize: 28,color: const Color(0xffffffff),textAlign: TextAlign.right,);
  }
}

const String _svg_kr65u6 =
    '<svg viewBox="-33.5 113.5 442.0 121.0" ><path transform="translate(-33.5,113.5)" d="M 442 0 L 0 0" fill="none" stroke="#707070" stroke-width="3" stroke-miterlimit="4" stroke-linecap="butt" /><path transform="translate(-33.5,234.5)" d="M 442 0 L 0 0" fill="none" stroke="#707070" stroke-width="3" stroke-miterlimit="4" stroke-linecap="butt" /></svg>';

谢谢!

解决方法

您可以通过以下方式进行操作。

<div class = "container">
    <div class = "row text-center">
      <h3>
        Can't Make a Decison
      </h3>
      <h5>
        Click the buttons for meal ideas
      </h5>
      <input type = "button" id="breakfast" value="Breakfast ?" onclick="GetValue();"/>
      <button class = "button primary" id="lunch">Lunch ?</button>
       <button class = "button primary" id="dinner">Dinner ?</button>
      <p id="message" ></p>
  </div>
</div>

如果您需要另一个滚动视图,则将一列作为滚动视图的子级,然后在其中再次为另一个滚动视图设置该代码。

相关问答

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