Calling a method with Provider.of(context) inside of dispose() method cause “Looking up a deactivated widget’s ancestor is unsafe.”

It seems like you are trying to close something which is defined in your AppProvider class. If AppProvider class is extending ChangeNotifier, the change notifier class provides dispose method, you can override it and then call the close function inside the AppProvider class only.

How do I set the initial page of PageView in Flutter?

PageController constructor has named parameter initialPage. You can use it, just create the controller somewhere outside of build function: class MyApp extends StatefulWidget { @override _MyAppState createState() => _MyAppState(); } class _MyAppState extends State<MyApp> { PageController controller; @override void initState() { super.initState(); controller = PageController(initialPage: 3); } @override void dispose() { controller.dispose(); super.dispose(); } @override … Read more

Expand The App bar in Flutter to Allow Multi-Line Title?

This is not implemented yet. However you can achieve similar results by using SliverAppBar designed for CustomScrollView. Bear in mind that this is not optimal though. As it required hard coding the size of the icons and stuff. Due to FlexibleSpacebar not having width constraint. import ‘package:flutter/material.dart’; import ‘package:cloud_firestore/cloud_firestore.dart’; import ‘package:flutter_project/materialSheet.dart’; void main() => runApp(new … Read more

How to make flutter card auto adjust its height depend on content

The problem comes from SliverGridDelegateWithFixedCrossAxisCount: Creates grid layouts with a fixed number of tiles in the cross axis This delegate creates grids with equally sized and spaced tiles. I recommend you to use flutter_staggered_grid_view: and to give up to AspectRatio widget. More about tiles here. body: StaggeredGridView.countBuilder( crossAxisCount: 2, itemCount: 6, itemBuilder: (BuildContext context, int … Read more

Flutter: Clip a Column or Row to prevent overflow

Wrap widget solves your problem. If there is not enough space to fit the child in a Column or Row, you can use Wrap. You can use alignment, directionality and spacing properties to customize it. Here is the simple example: class WrapExample extends StatelessWidget { @override Widget build(BuildContext context) { return SizedBox( width: 200, height: … Read more

How to add the widgets dynamically to column in Flutter?

If you have the comments data already, simply create a List, then pass it to the children property of the Column. Something like: var commentWidgets = List<Widget>(); for (var comment in comments) { commentWidgets.Add(Text(comment.text)); // TODO: Whatever layout you need for each widget. } … new Expanded( child: new ListView( shrinkWrap: true, children: <Widget>[ // … Read more