UI Guides for build methods crosses over code when using auto-formatting
I am learning flutter following the Udemy course of Angela Yu. I may be mistaken but I think there are some errors with code formatting and "UI Guides for build methods".
UI guide-lines are crossing over the code in some sections which makes them unusable. I think the guides are very useful and they worked great until this point but I had to turn them off and noticed the instructor Angela Yu has them also turned off. Maybe room for improvement?
This is also my first time writing up an issue post on Github, please be kind :)
Steps to Reproduce
- Launch Android Studio Flutter Project on a Macbook Pro 13" Late 2015 running native scaling.
- Edit the main.dart file (code below).
- Save to auto-format file.
- Formatting error visible between lines 15-20.
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
backgroundColor: Colors.teal,
body: SafeArea(
child: Column(
//mainAxisAlignment: MainAxisAlignment.spaceEvenly,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
CircleAvatar(
radius: 50.0,
backgroundImage: AssetImage(
'images/WP_Daft_Punk-2560x1440_00000.jpg') //backgroundColor: Colors.deepOrange,
),
Text('Name Surname',
style: TextStyle(
color: Colors.white,
fontWeight: FontWeight.bold,
fontSize: 40.0,
fontFamily: 'Pacifico')),
Text('NOOB PROGRAMMER',
style: TextStyle(
color: Colors.teal.shade100,
fontFamily: 'SourceSansPro',
fontWeight: FontWeight.bold,
fontSize: 20.0,
letterSpacing: 2.0,
))
],
)),
),
);
}
}
Version info
[✓] Flutter (Channel stable, v1.12.13+hotfix.5, on Mac OS X 10.15.2 19C57, locale en-GB) • Flutter version 1.12.13+hotfix.5 at /Users/godvader_mac/development/flutter • Framework revision 27321ebbad (2 weeks ago), 2019-12-10 18:15:01 -0800 • Engine revision 2994f7e1e6 • Dart version 2.7.0
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2) • Android SDK at /Users/godvader_mac/Library/Android/sdk • Android NDK location not configured (optional; useful for native profiling support) • Platform android-29, build-tools 29.0.2 • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405) • All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 11.3) • Xcode at /Applications/Xcode.app/Contents/Developer • Xcode 11.3, Build version 11C29 • CocoaPods version 1.8.4
[✓] Android Studio (version 3.5) • Android Studio at /Applications/Android Studio.app/Contents • Flutter plugin version 42.1.1 • Dart plugin version 191.8593 • Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)
[✓] Connected device (1 available) • iPhone 11 Pro Max • 1B120351-C4EE-4916-A714-F2FF7C821CF9 • ios • com.apple.CoreSimulator.SimRuntime.iOS-13-3 (simulator)
• No issues found!
Thanks for the report!
@jacob314: is this a known issue?
Another example:
import 'package:flutter/material.dart';
void main() => runApp(Application());
class Application extends StatelessWidget {
@override
Widget build(BuildContext context) => MaterialApp(
home: Scaffold(
appBar: AppBar(
title: Text("The Application!"),
centerTitle: true,
),
));
}

// cc @devoncarew
I believe this will resolve itself if you add the trailing comma between the last two parenthesis. @jacob314 - is this WAI or something we should account for even if trailing commas are not always present?
The dart formatter has been fixed so this is no longer an issue. In addition, @helin24 added some fixes to the indent guides so they don't overlap with text as much. Not sure if they fixed this case but when I run the last example intentionally avoiding running the formatter I see the following which isn't great but at least isn't distracting:

I believe this will resolve itself if you add the trailing comma between the last two parenthesis.
Yeah, that's right. So what about making formatter insert this trailing comma?