3
answers
1
watching
182
views

Using Flutter and Visual Code.

For the 3rd time to whomever looks at this code. The tasklist1page isn't being shifted to the left. People from oneclass keep sending me this same code and it doesn't work. Has anyone actually tested this code on Visual Code? This is making me frustrated? Can someone fix that code below and use the  ``` before and after the code. So I can see it clearly.  Also please attach a screenshot when you reply back so I know you have tested it. Screenshot of the problem below the flutter code.

 

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({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
        textTheme: GoogleFonts.robotoCondensedTextTheme(),
      ),
      initialRoute: '/tasklist',
      routes: {
        '/tasklist': ((context) => Scaffold(
              appBar: AppBar(
                title: Container(
                  child: Align(
                    alignment: Alignment.centerLeft,
                    child: Text(
                      "Task List1 Page",
                    ),
                  ),
                ),
              ),
              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),
                ),
              ),
            )),
        '/tasklistdetails': ((context) =>
            const TaskListDetailsPage(title: "Task List Details Page"))
      },
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({Key? key, required this.title}) : super(key: key);

  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),
        ),
      ),
    );
  }
}

 

For unlimited access to Homework Help, a Homework+ subscription is required.

Unlock all answers

Get 1 free homework help answer.
Already have an account? Log in
Avatar image
Read by 1 person
Already have an account? Log in
Already have an account? Log in

Related questions

Weekly leaderboard

Start filling in the gaps now
Log in