2
answers
1
watching
263
views
dragon2020Lv1
19 Mar 2023
When I paste my flutter code in here and than post it as a question the format is screwed up. Therefore it's hard to understand it. Currently when I paste it in here looks ok. But once it gets posted it becomes messy and the codes are out of alignment hard to read them.
Is there a way to format in this website so that it is easier to read them.
Same thing with the answers that I get.
import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:todolist/pages/tasklist/tasklist.dart';
import 'package:todolist/pages/tasklistdetails/tasklistdetails.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
textTheme: GoogleFonts.robotoCondensedTextTheme(),
),
initialRoute: '/tasklist',
routes: {
'/tasklist': ((context) =>
const TaskListPage(title:"Task List1 Page")),
'/tasklistdetails': ((context) =>
const TaskListDetailsPage(title: "Task List Details Page"))
});
}
}
class MyHomePage extends StatefulWidget {
const MyHomePage({super.key, required this.title});
final String title;
@override
State<MyHomePage> createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(widget.title),
),
body: const Text('Task list page'),
floatingActionButton: Theme(
data: Theme.of(context).copyWith(splashColor: Colors.amber),
child: FloatingActionButton(
onPressed: () =>{Navigator.pop(context)},
tooltip: 'Increment',
child: const Icon(Icons.add),
),
), // This trailing comma makes auto-formatting nicer for build methods.
);
}
}
When I paste my flutter code in here and than post it as a question the format is screwed up. Therefore it's hard to understand it. Currently when I paste it in here looks ok. But once it gets posted it becomes messy and the codes are out of alignment hard to read them.
Is there a way to format in this website so that it is easier to read them.
Same thing with the answers that I get.
import 'package:flutter/material.dart'; import 'package:google_fonts/google_fonts.dart';
import 'package:todolist/pages/tasklist/tasklist.dart'; import 'package:todolist/pages/tasklistdetails/tasklistdetails.dart';
void main() { runApp(const MyApp()); }
class MyApp extends StatelessWidget { const MyApp({super.key});
@override Widget build(BuildContext context) { return MaterialApp( title: 'Flutter Demo', theme: ThemeData( primarySwatch: Colors.blue, textTheme: GoogleFonts.robotoCondensedTextTheme(), ), initialRoute: '/tasklist', routes: { '/tasklist': ((context) => const TaskListPage(title:"Task List1 Page")), '/tasklistdetails': ((context) => const TaskListDetailsPage(title: "Task List Details Page")) }); } }
class MyHomePage extends StatefulWidget { const MyHomePage({super.key, required this.title}); final String title; @override State<MyHomePage> createState() => _MyHomePageState(); }
class _MyHomePageState extends State<MyHomePage> { @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: Text(widget.title), ), body: const Text('Task list page'), floatingActionButton: Theme( data: Theme.of(context).copyWith(splashColor: Colors.amber), child: FloatingActionButton( onPressed: () =>{Navigator.pop(context)}, tooltip: 'Increment', child: const Icon(Icons.add), ), ), // This trailing comma makes auto-formatting nicer for build methods. ); } }
19 Mar 2023
Read by 1 person
sweetyjalan7Lv2
19 Mar 2023
Already have an account? Log in