为什么我的浮动操作按钮没有在我创建的屏幕上浮动>

问题描述 投票:-2回答:1

您好,请再次帮助我,我的浮动操作按钮不会显示在我放置的所有元素上,而是在页面底部。创建项目时,我检查了颤振的样板,但其位置正确,但我不会正确放置。

注意:我对此进行了搜索,但发现了StackExtended,但我不完全知道将它们放在哪里。谢谢!

这是我的代码:

import 'package:flutter/material.dart';
import 'package:vmembershipofficial/Widgets/afterintroducing.dart';
import 'package:vmembershipofficial/Widgets/discount_carousel.dart';
import 'package:vmembershipofficial/Widgets/header_carousel.dart';
import 'package:vmembershipofficial/Widgets/introducing_vmembership.dart';

class NavHome extends StatefulWidget {
  // static final String id = 'homepage';
  NavHome({Key key}) : super(key: key);

  @override
  _NavHomeState createState() => _NavHomeState();
}

class _NavHomeState extends State<NavHome> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
          body: Container(
        child: ListView(
          children: <Widget>[
            Padding(
              padding: EdgeInsets.symmetric(horizontal: 30.0, vertical: 10.0),
              child: Text(
                "Explore V!",
                style: TextStyle(fontWeight: FontWeight.w600, fontSize: 20.0),
              ),
            ),
            SizedBox(height: 5.0),
            HeaderCarousel(),
            SizedBox(height: 30.0),
            Padding(
              padding: EdgeInsets.symmetric(horizontal: 30.0, vertical: 10.0),
              child: Text(
                "Discount",
                style: TextStyle(fontWeight: FontWeight.w600, fontSize: 20.0),
              ),
            ),
            Padding(
              padding: EdgeInsets.symmetric(horizontal: 30.0, vertical: 5.0),
              child: Text(
                "Lorem ipsum dolor sit amet, consectetuer adipiscing elit.",
                style: TextStyle(fontSize: 12.0),
              ),
            ),
            DiscountCarousel(),
            SizedBox(height: 30.0),
            Padding(
              padding: EdgeInsets.symmetric(horizontal: 30.0, vertical: 10.0),
              child: Text(
                "Introducing V Membership Plus",
                style: TextStyle(fontSize: 20.0, fontWeight: FontWeight.w600),
              ),
            ),
            Padding(
              padding: EdgeInsets.symmetric(horizontal: 30.0, vertical: 4.0),
              child: Text(
                "Lorem ipsum dolor sit amet, consectetuer adipiscing elit.",
                style: TextStyle(fontSize: 12.0),
              ),
            ),
            VmembershipPlus(),
            SizedBox(height: 30.0),
            Padding(
              padding: EdgeInsets.symmetric(horizontal: 30.0, vertical: 10.0),
              child: Text(
                "Lorem Ipsum",
                style: TextStyle(fontSize: 20.0, fontWeight: FontWeight.w600),
              ),
            ),
            Padding(
              padding: EdgeInsets.symmetric(horizontal: 30.0, vertical: 4.0),
              child: Text(
                "Lorem ipsum dolor sit amet, consectetuer adipiscing elit.",
                style: TextStyle(fontSize: 12.0),
              ),
            ),
            SizedBox(
              height: 10.0,
            ),
            AfterIntroducing(),
            SizedBox(
              height: 10.0,
            ),
            Padding(
              padding: const EdgeInsets.symmetric(horizontal: 30.0),
              child: FlatButton(
                padding: EdgeInsets.all(15.0),
                color: Colors.blue,
                textColor: Colors.white,
                onPressed: () {},
                child: Text(
                  "LOREM IPSUM",
                  style: TextStyle(fontSize: 15.0, fontWeight: FontWeight.w600),
                ),
              ),
            ),
            SizedBox(
              height: 50.0,
            ),
            FloatingActionButton(
              child: Icon(Icons.add),
              onPressed: () {},
            )
          ],
        ),
      ),
    );
  }
}
android flutter flutter-layout flutter-dependencies
1个回答
0
投票

FloatActionButton应该放在支架中相同级别的应用程序栏或主体中:

© www.soinside.com 2019 - 2024. All rights reserved.