0

I have a flutter apllication. In my loging component, I want to separate bottom half of the UI into 4 parts as in the following image

enter image description here

So far, I have implemented upto the Login button. What I don't understand is how to seperate the rest of the UI as in the image. After separating, I should be able to add an image to each separated cell.

How can I achieve this? Thank you for your kind help!

My Implementation upto Login button:-

import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:bank_app/screens/AccountSummary.dart';

class Login extends StatelessWidget{

  Widget _inputField(String title, Color border) {
    return TextField(
      decoration: InputDecoration(
        hintText: title,
        hintStyle: TextStyle(color: border),
        enabledBorder: UnderlineInputBorder(
          borderSide: BorderSide(color: border),
        ),
        focusedBorder: UnderlineInputBorder(
          borderSide: BorderSide(color: border),
        ),
        border: UnderlineInputBorder(
          borderSide: BorderSide(color: border),
        ),
      ),
    );
  }

  Widget _buttons(name, BuildContext context){
    return Center(
        child: ButtonBar(
          mainAxisSize: MainAxisSize.min,
          children: <Widget>[
            ButtonTheme(
                minWidth: 200,
                child:RaisedButton(
                  child: new Text(name),
                  shape: RoundedRectangleBorder(
                      borderRadius: BorderRadius.circular(100),
                      side: BorderSide(color: Colors.white)
                  ),
                  color: Colors.white,
                  textColor: Colors.red,
                  onPressed: (){Navigator.push(context, MaterialPageRoute(builder: (context) => AccountSummary()));},
                )
            ),
          ],
        )
    );
  }

  @override
  Widget build(BuildContext context) {
    // TODO: implement build
    return Scaffold(
        backgroundColor: Colors.red,
        appBar: PreferredSize(
          preferredSize: Size.fromHeight(150.0),
          child: AppBar(
            // Here we take the value from the MyHomePage object that was created by
            // the App.build method, and use it to set our appbar title.
            title: Image.asset("assets/logo.png", fit: BoxFit.cover, ),
            centerTitle: true,
          ),
        ),
      body: Container(
          margin: const EdgeInsets.only(top: 10),
          padding: EdgeInsets.symmetric(horizontal: 20),
          child: SingleChildScrollView(
              child: Column(
                mainAxisAlignment: MainAxisAlignment.center,
                crossAxisAlignment: CrossAxisAlignment.center,

                children: [
                  Container(
                    margin: const EdgeInsets.only(left: 25, top: 50, right: 25),
                    child:_inputField('UserName', Colors.white),
                  ),
                  Container(
                    margin: const EdgeInsets.only(left: 25, top: 10, right: 25),
                    child: _inputField('Password', Colors.white),
                  ),
                  Container(
                    margin: const EdgeInsets.only( top: 15),
                    child: Text('Forgot Password?', style: TextStyle(color: Colors.white),),
                  ),
                  Container(
                    margin: const EdgeInsets.only( top: 25),
                    child: _buttons('Login', context),
                  ),
                ],
              )
          )
      ),
    );
  }

}
nvoigt
  • 75,013
  • 26
  • 93
  • 142

2 Answers2

1

You can use a Divider like this:

Column(
    children: <Widget>[
      Container(
        height: 100,
        color: Colors.red,
      ),
      Divider(
        height: 50,
        thickness: 5,
      ),
      Container(
        height: 100,
        color: Colors.blue,
      ),
    ],
  )

example

Amon C
  • 1,710
  • 9
  • 17
1

Better to use GridView in this situation. Tutorial for your reference: https://youtu.be/wsPGFdrtj-U

theCaptainXgod
  • 223
  • 1
  • 7