0

for the project I need to code an application that does some certain things, I have taught myself how to use flutter and coded a big portion of the application already. However, I need some assistance in fixing some issues with the code. It's written in .dart Anyway here is my code:

import 'package:flutter/material.dart';

void main() {
  runApp(MyApp());
}

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  int _currentIndex = 0;

  @override
  Widget build(BuildContext context) {
    var map = new Card(
      child: new Column(
        children: <Widget>[
          new ListTile(
              leading: new Icon(
                Icons.place,
                color: Colors.redAccent,
                size: 56.0,
              ),
              title: new Text(
                "Map",
                style: TextStyle(fontWeight: FontWeight.bold),
              ),
              subtitle: new Text("Choose your base location!"),
              enabled: true,
              onLongPress: () => print("longpress"))
        ],
      ),
    );
    final mapbox = new Container(
      margin: new EdgeInsets.only(left: 10, right: 10, top: 10),
      child: new SizedBox(
        height: 80.0,
        child: map,
      ),
    );
    var players = new Card(
      child: new Column(
        children: <Widget>[
          new ListTile(
              leading: new Icon(
                Icons.supervised_user_circle,
                color: Colors.redAccent,
                size: 56.0,
              ),
              title: new Text(
                "Players",
                style: TextStyle(fontWeight: FontWeight.bold),
              ),
              subtitle: new Text("Loby of the connected players"),
              enabled: true,
              onLongPress: () => print("longpress"))
        ],
      ),
    );
    final playerbox = new Container(
      margin: new EdgeInsets.only(left: 10, right: 10, top: 10),
      child: SizedBox(
        height: 80.0,
        child: players,
      ),
    );
    var rounds = new Card(
      child: new Column(
        children: <Widget>[
          new ListTile(
              leading: new Icon(
                Icons.cached,
                color: Colors.redAccent,
                size: 56.0,
              ),
              title: new Text(
                "Rounds",
                style: TextStyle(fontWeight: FontWeight.bold),
              ),
              subtitle: new Text(
                  "Determine the number of rounds that the game will have"),
              enabled: true,
              onLongPress: () => print("longpress"))
        ],
      ),
    );
    final roundsbox = new Container(
      margin: new EdgeInsets.only(left: 10, right: 10, top: 10),
      child: SizedBox(
        height: 80.0,
        child: rounds,
      ),
    );
    var time = new Card(
      child: new Column(
        children: <Widget>[
          new ListTile(
              leading: new Icon(
                Icons.timer,
                color: Colors.redAccent,
                size: 56.0,
              ),
              title: new Text(
                "Duration",
                style: TextStyle(fontWeight: FontWeight.bold),
              ),
              subtitle: new Text("Determine the duration of each round"),
              enabled: true,
              onLongPress: () => print("longpress"))
        ],
      ),
    );
    final timebox = new Container(
      margin: new EdgeInsets.only(left: 10, right: 10, top: 10),
      child: SizedBox(
        height: 80.0,
        child: time,
      ),
    );

final startbutton =FlatButton(
  onPressed: () {},
  child: Text ("Start the game"),
  color: Colors.redAccent,
  );

    final home = new ListView(
      children: <Widget>[
        mapbox,
        playerbox,
        roundsbox,
        timebox,
      ],
    );

    final _pageoptions = [home, Text("connections"), Text("Settings")];

    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: Text("hide & seek"),
          centerTitle: true,
          backgroundColor: Colors.redAccent,
        ),
        bottomNavigationBar: BottomNavigationBar(
          currentIndex: _currentIndex,
          backgroundColor: Colors.redAccent,
          items: [
            BottomNavigationBarItem(
                icon: Icon(
                  Icons.home,
                  color: Colors.white,
                  size: 30.0,
                ),
                title: Text(
                  'Home',
                  style: TextStyle(color: Colors.white, fontWeight: FontWeight.bold),
                ),
                backgroundColor: Colors.redAccent),
            BottomNavigationBarItem(
                icon: Icon(
                  Icons.bluetooth,
                  color: Colors.white,
                  size: 30.0,
                ),
                title: Text(
                  'Bluetooth',
                  style: 
                  TextStyle(color: Colors.white, fontWeight: FontWeight.bold),
                ),
                backgroundColor: Colors.redAccent),
            BottomNavigationBarItem(
                icon: Icon(
                  Icons.settings,
                  color: Colors.white,
                  size: 30.0,
                ),
                title: Text(
                  'Settings',
                  style: TextStyle(color: Colors.white, fontWeight: FontWeight.bold),
                ),
                backgroundColor: Colors.redAccent),
          ],
          onTap: (index) {
            setState(() {
              _currentIndex = index;
            });
          },
        ),
        body: _pageoptions[_currentIndex],
        drawer: Drawer(
          child: Center(
            child: Column(
              mainAxisAlignment: MainAxisAlignment.center,
              children: <Widget>[
                const Text(
                  "this app was made by sekerlicay.",
                  style: TextStyle(fontWeight: FontWeight.bold),
                ),
              ],
            ),
          ),
        ),
        drawerEnableOpenDragGesture: true,
      ),
    );
  }
}

What I now want to do is to add everything that is inside ListView into a Container so that I can display these tabs along with some buttons that I will add underneath.enter image description here If I don't use Containers the buttons just become long (just like the tabs) which is not exactly what I want. In the end I want the home page to have two containers, one with the tabs and one with the buttons.

Thanks in advance, Berk

Share a link to this question (includes your user id)
| edit | | close | delete |

Your Answer

  • Links
  • Images
  • Styling/Headers
  • Lists
  • Blockquotes
  • Code
  • HTML
  • Advanced help

Images are exactly like links, but they have an exclamation point in front of them:

![a busy cat](https://cdn.sstatic.net/Sites/stackoverflow/Img/error-lolcat-problemz.jpg)
![two muppets][1]

 [1]: https://i.imgur.com/I5DFV.jpg "tooltip"

The word in square brackets is the alt text, which gets displayed if the browser can't show the image. Be sure to include meaningful alt text for screen-reading software.

Be sure to use text styling sparingly; only where it helps readability.

*This is italicized*, and so
is _this_.

**This is bold**, just like __this__.

You can ***combine*** them
if you ___really have to___.

To break your text into sections, you can use headers:

A Large Header
==============

Smaller Subheader
-----------------

Use hash marks if you need several levels of headers:

# Header 1 #
## Header 2 ##
### Header 3 ###

Both bulleted and numbered lists are possible:

- Use a minus sign for a bullet
+ Or plus sign
* Or an asterisk

1. Numbered lists are easy
2. Markdown keeps track of
   the numbers for you
7. So this will be item 3.
1. Lists in a list item:
    - Indented four spaces.
        * indented eight spaces.
    - Four spaces again.
2.  You can have multiple
    paragraphs in a list items.
 
    Just be sure to indent.
> Create a blockquote by
> prepending “>” to each line.
>
> Other formatting also works here, e.g.
>
> 1. Lists or
> 2. Headings:
>
> ## Quoted Heading ##

You can even put blockquotes in blockquotes:

> A standard blockquote is indented
> > A nested blockquote is indented more
> > > > You can nest to any depth.

To create code blocks or other preformatted text, indent by four spaces or surround with groups of backticks:

    This will be displayed in a monospaced font. The first four spaces
    will be stripped off, but all other whitespace will be preserved.

```
Markdown and HTML are turned off in code blocks:
<i>This is not italic</i>, and [this is not a link](https://example.com)
```

To create not a block, but an inline code span, use backticks:

The `$` character is just a shortcut for `window.jQuery`.

If you want to have a preformatted block within a list, indent by eight spaces:

1. This is normal text.
2. So is this, but now follows a code block:
 
        Skip a line and indent eight spaces.
        That's four spaces for the list
        and four to trigger the code block.

If you need to do something that Markdown can't handle, use HTML. Note that we only support a very strict subset of HTML!

Strikethrough humor is <strike>funny</strike>.

Markdown is smart enough not to mangle your span-level HTML:

<b>Markdown works *fine* in here.</b>

Block-level HTML elements have a few restrictions:

  1. They must be separated from surrounding text by blank lines.
  2. The begin and end tags of the outermost block element must not be indented.
  3. Markdown can't be used within HTML blocks.

<pre>
    You can <em>not</em> use Markdown in here.
</pre>

Browse other questions tagged or ask your own question.