Everything expands to screenwidth inside a Listview. Can I change that?

You can use Align widget to align it’s child inside it’s parent. Simply wrap your list nodes (Card instances) inside a Align. import ‘package:flutter/material.dart’; //import ‘../../Library/Library.dart’; //import ‘../../Ui/ChatMessage.dart’; void main() { runApp( new MaterialApp( home: new ChatScreen(), ), ); } class ChatScreen extends StatefulWidget { @override State<StatefulWidget> createState() { return new ChatScreenState(); } } class …

Read more

Open flutter dialog after navigation

You can call the dialog from inside ‘initState()’ dalaying its appearance after the first frame has been drawn. @override void initState() { super.initState(); WidgetsBinding.instance.addPostFrameCallback((_) async { await showDialog<String>( context: context, builder: (BuildContext context) => new AlertDialog( title: new Text(“title”), content: new Text(“Message”), actions: <Widget>[ new FlatButton( child: new Text(“OK”), onPressed: () { Navigator.of(context).pop(); }, ), …

Read more

Horizontal listview not scrolling on web but scrolling on mobile

Flutter 2.5 Summary ScrollBehaviors now allow or disallow drag scrolling from specified PointerDeviceKinds. ScrollBehavior.dragDevices, by default, allows scrolling widgets to be dragged by all PointerDeviceKinds except for PointerDeviceKind.mouse. import ‘package:flutter/material.dart’; // Set ScrollBehavior for an entire application. MaterialApp( scrollBehavior: MyCustomScrollBehavior(), // … ); import ‘package:flutter/gestures.dart’; import ‘package:flutter/material.dart’; class MyCustomScrollBehavior extends MaterialScrollBehavior { // Override behavior …

Read more

Flutter remove border expansion tile

You can wrap it in a Theme widget and do like this: Theme( data: ThemeData().copyWith(dividerColor: Colors.transparent), child: ExpansionTile( or if you’re using custom theme settings, you can use Theme.of(context) instead of ThemeData() like this: Theme( data: Theme.of(context).copyWith(dividerColor: Colors.transparent), child: ExpansionTile(

Unable to add header for post method in dio in Flutter

Dio library key working perfectly fine in my case if we pass small case key value For example, Dio dio = new Dio(); dio.options.headers[‘content-Type’] = ‘application/json’; dio.options.headers[“authorization”] = “token ${token}”; response = await dio.post(url, data: data); make sure you write key in small case, that’s work for me.