简体   繁体   English

Android Flutter:我需要在正文中设置“SingleChildScrollView”?

[英]Android Flutter : I need to set the 'SingleChildScrollView' in the body?

This is my code,I need to set the SingleChildScrollView in the body.I want to scroll the entire screen.这是我的代码,我需要在正文中设置SingleChildScrollView 。我想滚动整个屏幕。

 @override
 Widget build(BuildContext context) {

    return Scaffold(
      body: Form(
        key: _formKey,
        child: Container(
          child: Container(
            height: MediaQuery.of(context).size.height,
            width: MediaQuery.of(context).size.width,
            decoration: BoxDecoration(
                image: DecorationImage(
                    image: AssetImage("assets/images/login.jpg"),
                    fit: BoxFit.contain,
                    alignment: Alignment.topCenter)),
            child: SafeArea(
              child: Column(
                mainAxisAlignment: MainAxisAlignment.end,
                children: <Widget>[
                  SizedBox(height: 20),
                  Expanded(
                    child: Container(
                      padding: EdgeInsets.symmetric(horizontal: 40),
                      child: Row(
                        mainAxisAlignment: MainAxisAlignment.spaceBetween,
                        crossAxisAlignment: CrossAxisAlignment.start,
                        children: <Widget>[
                          IconButton(
                            icon: Icon(Icons.arrow_back,
                                color: Colors.white, size: 32),
                            onPressed: () {
                              Navigator.pop(context);
                            },
                          ),
                        ],
                      ),
                    ),
                  ),

You need to wrap you Form widget with singleChildScroll view您需要使用 singleChildScroll 视图包装您的 Form 小部件

Like below return Scaffold( body: SingleChildScrollView(child:Form( key: _formKey, child: Container( child: Container( height: MediaQuery.of(context).size.height, width: MediaQuery.of(context).size.width, decoration: BoxDecoration( image: DecorationImage( image: AssetImage("assets/images/login.jpg"), fit: BoxFit.contain, alignment: Alignment.topCenter)), child: SafeArea( child: Column( mainAxisAlignment: MainAxisAlignment.end, children: <Widget>[ SizedBox(height: 20), Expanded( child: Container( padding: EdgeInsets.symmetric(horizontal: 40), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, crossAxisAlignment: CrossAxisAlignment.start, children: <Widget>[ IconButton( icon: Icon(Icons.arrow_back, color: Colors.white, size: 32), onPressed: () { Navigator.pop(context); }, ), ], ), ), ), )像下面return Scaffold( body: SingleChildScrollView(child:Form( key: _formKey, child: Container( child: Container( height: MediaQuery.of(context).size.height, width: MediaQuery.of(context).size.width, decoration: BoxDecoration( image: DecorationImage( image: AssetImage("assets/images/login.jpg"), fit: BoxFit.contain, alignment: Alignment.topCenter)), child: SafeArea( child: Column( mainAxisAlignment: MainAxisAlignment.end, children: <Widget>[ SizedBox(height: 20), Expanded( child: Container( padding: EdgeInsets.symmetric(horizontal: 40), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, crossAxisAlignment: CrossAxisAlignment.start, children: <Widget>[ IconButton( icon: Icon(Icons.arrow_back, color: Colors.white, size: 32), onPressed: () { Navigator.pop(context); }, ), ], ), ), ), )

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Flutter - 我可以让 SingleChildScrollView 填充可用空间吗? - Flutter - can I make a SingleChildScrollView fill the available space? Flutter:SingleChildScrollView 内的 TabBarView - Flutter: TabBarView inside SingleChildScrollView 我需要某种用于Android的刚体碰撞检测引擎 - I need some sort of rigid body collision detection engine for Android 如何在 Flutter 中为 Android 设置初始路由? - How do I set the initialRoute for Android in Flutter? 我是否需要 Android Studio 来构建 flutter 应用程序? - Do I need to have Android Studio for building flutter apps? 如何在Android上设置HttpPut的正文? (不添加库) - How do I set the body of a HttpPut on Android? (without adding libraries) SingleChildScrollView高度到最大高度,图像背景在颤动 - SingleChildScrollView height to max height with image background in flutter 在 flutter 中的 singlechildscrollview 后,ModalBottomSheet 中的底部按钮不可见 - bottom button in ModalBottomSheet is not visible after singlechildscrollview in flutter 如何在flutter中使用SingleChildScrollView使listview滚动 - How to make listview scroll with SingleChildScrollView in flutter 我需要在正文中为 gmail 意图添加一个 href。 适用于 Android 4.3 但不适用于 6/7 - I need to add a href inside a body for a gmail intent. Works on Android 4.3 but not on 6/7
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM