如何删除屏幕底部和底部栏之间的底部空间?

时间:2020-08-15 17:06:06

标签: flutter flutter-layout flutter-dependencies flutter-web flutter-animation

enter image description here如何删除底部栏和屏幕底部之间的空白。我也尝试在底部容器中应用填充或边距,但不起作用。请帮我解决这个问题。 嘿,帮我,我担心这个错误。这花费了我大部分时间,但我无法解决。请帮助我。

它是我的代码

import 'dart:ui';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
import 'package:provider/provider.dart';
import 'package:grk_001/Provider/products.dart';

class ProductDetails extends StatelessWidget {
  static const String routename = 'ProductDetails';
  @override
  Widget build(BuildContext context) {
    final devicesize = MediaQuery.of(context).size;
    final Productid = ModalRoute.of(context).settings.arguments as String;
    final loadedproduct = Provider.of<Products>(
      context,
    ).findByid(Productid);

    return SafeArea(
      maintainBottomViewPadding: true,
      child: Scaffold(
        appBar: AppBar(
          title: Text(loadedproduct.title == null ? '' : loadedproduct.title),
        ),
        body: Container(
          margin: EdgeInsets.zero,
          padding: EdgeInsets.zero,
          child: Column(
            mainAxisAlignment: MainAxisAlignment.spaceBetween,
            children: <Widget>[
              SingleChildScrollView(
                child: Column(
                  children: <Widget>[
                    Container(
                      width: double.infinity,
                      height: 300,
                      child: Image.network(
                        loadedproduct.imageUrl,
                        fit: BoxFit.cover,
                      ),
                    ),
                    SizedBox(
                      height: 15.0,
                    ),
                    Text(
                      '₹${loadedproduct.price}',
                      style: TextStyle(fontSize: 30.0),
                    ),
                    SizedBox(
                      height: 10.0,
                    ),
                    Text(
                      loadedproduct.description,
                      softWrap: true,
                      textAlign: TextAlign.center,
                      style: TextStyle(fontSize: 20.0),
                    ),
                    Row(
                      children: <Widget>[
                        Expanded(
                          child: FlatButton.icon(
                              onPressed: () {},
                              icon: Icon(
                                Icons.arrow_drop_down,
                                color: Colors.pink,
                              ),
                              label: Text(
                                'Quantity',
                                style: TextStyle(color: Colors.pink),
                              )),
                        ),
                        Expanded(
                          child: FlatButton.icon(
                            onPressed: () {},
                            icon: Icon(
                              Icons.arrow_drop_down,
                              color: Colors.pink,
                            ),
                            label: Text(
                              'Color',
                              style: TextStyle(color: Colors.pink),
                            ),
                          ),
                        )
                      ],
                    )
                  ],
                ),
              ),
              Container(
                padding: EdgeInsets.zero,
                margin: EdgeInsets.zero,
                width: double.infinity,
                decoration: BoxDecoration(),
                child: Row(
                  children: <Widget>[
                    Expanded(
                      flex: 5,
                      child: FlatButton(
                        shape: RoundedRectangleBorder(
                          borderRadius: BorderRadius.circular(0.0),
                        ),
                        color: Colors.pink,
                        onPressed: () {},
                        child: Text('BUY NOW'),
                      ),
                    ),
                    Expanded(
                      flex: 1,
                      child: InkWell(
                        onTap: () {},
                        child: Container(
                          child: Icon(
                            Icons.favorite,
                            size: 37.0,
                            color: Colors.red,
                          ),
                        ),
                      ),
                    ),
                    Expanded(
                      flex: 1,
                      child: InkWell(
                        onTap: () {},
                        child: Container(
                          child: Icon(
                            Icons.shopping_cart,
                            size: 37.0,
                            color: Colors.red,
                          ),
                        ),
                      ),
                    ),
                  ],
                ),
              )
            ],
          ),
        ),
      ),
    );
  }
}

1 个答案:

答案 0 :(得分:1)

最后,找到您的问题。
问题在于您的“立即购买”按钮!它占据了额外的高度,因此可以从底部向上看到。
由于图标的大小为37,因此高度最好大于37。 为父级newArray = [ [{app: 'User', subpage: 'Dashboard', path: '/user/dashboard'}, {app: 'User', subpage: 'Profile', path: '/user/profile'}, {app: 'User', subpage: 'Settings', path: '/user/settings'}], [{app: 'Library', subpage: 'Dashboard', path: '/library/dashboard'}, {app: 'Library', subpage: 'Settings', path: '/library/settings'}], [{app: 'Material', subpage: 'Dashboard', path: '/material/dashboard'}] ] 和Button的Container设置它。
另外,记下Container中的crossAxisAlignment。 对您的“立即购买”按钮执行类似操作,

Row

希望这可以解决您的问题。