TransWikia.com

Flutter: Is there a way to add a floating action button inside a container?

Stack Overflow Asked by Ashwin on December 16, 2020

Is there a way to add a floating action button inside a container? Or at least achieve a similar effect?

class HomeScreen extends StatefulWidget {
  @override
  _HomeScreenState createState() => _HomeScreenState();
}

class _HomeScreenState extends State<HomeScreen> {
  @override
  Widget build(BuildContext context) {
    return Container(
      child: Padding(
        child: Column(
          children: <Widget>[
            Text('Hello'),
            SizedBox(height: 30),
            Expanded(
              child: Container(
                child: TaskList(),
              ),
            )
          ],
        ),
      ),
    );
  }
}

Ps. I can’t use scaffold for a few reasons so don’t suggest that.

One Answer

Yes, you can utilize child property of Container

Container (
    child: FloatingActionButton()
)

Answered by Hamza on December 16, 2020

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP