Estoy trabajando en diseños de aleteo y estoy tratando de colocar el último contenedor exactamente como la barra de navegación inferior, en mi cuerpo utilicé columnas para configurar widgets y en el segundo último widget es la vista de lista. Quiero que la vista de lista llene la pantalla inferior hasta el último contenedor que actúa como barra inferior.

Pero mi último contenedor tiene mucho espacio en la parte inferior para solucionarlo.

class  _MyPersondataState extends State<Persondata> {

  double height;
  double width;
  final Color lightbluecolor = Color(0xFF3AB5FF);
  List<int> getListItems(){
    List<int> numberlist = List(10);
    numberlist[0] = 5700;
    numberlist[1] = 1200;
    numberlist[2] = 970;
    numberlist[3] = 1840;
    numberlist[4] = 2520;
    numberlist[5] = 5700;
    numberlist[6] = 6200;
    numberlist[7] = 4970;
    numberlist[8] = 6840;
    numberlist[9] = 7520;
    var items = numberlist;
    return items;
  }
  Widget getListView(){
    var listitems = getListItems();
    var listView = ListView.builder(
        itemCount: listitems.length,
        itemBuilder: (context, index){
          return ListTile(
            title: Text('Gross Salary'),
            trailing: Text(listitems[index].toString()),
          );
        }
    );
    return listView;
  }

  @override
  Widget build(BuildContext context) {
    width = MediaQuery.of(context).size.width;
    height = MediaQuery.of(context).size.height;
    return Scaffold(
      appBar: 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: Text(''),
      ),
      body: Container(
        margin: EdgeInsets.only(left:15.0,right: 15.0),
        color: Colors.white,
        width: width,
        alignment: Alignment.bottomCenter,
        child: Column(
          children: <Widget>[

            Text(
                'What a loss carryforward is',
              textDirection: TextDirection.ltr,
              style: TextStyle(
                decoration: TextDecoration.none,
                fontSize: 16.0,
                fontFamily: 'Roboto',
                fontWeight: FontWeight.w700,
                color: Colors.black,

              ),
            ),
            SizedBox(height: 8),
            Flexible(
             child: new Text(
                'If your costs exceeded your salary, then you will have loss for this tax year.'
                    ' You can carry this loss.'
                    ' This will reduce next year’s tax\n\n. '
                    '*How do i do that?*\n\n'
                    ' In order to make use of this, you must send a tax return to office.'
                    ' You do not have to worry.'
                    ' You will then receive acknowledgement from the office.\n\n'
                     ,
                textDirection: TextDirection.ltr,
                style: TextStyle(
                  decoration: TextDecoration.none,
                  height: 1.2,
                  fontSize: 14.0,
                  fontFamily: 'Roboto',
                  fontWeight: FontWeight.w400,


                ),
              ),
            ),
            SizedBox(height: 20),
            Align(
              alignment: Alignment.centerLeft,
              child: Text(
                'Your Taxes in detail',
                textDirection: TextDirection.ltr,
                style: TextStyle(
                  decoration: TextDecoration.none,
                  fontSize: 16.0,
                  fontFamily: 'Roboto',
                  fontWeight: FontWeight.w700,
                  color: Colors.black,

                ),
              ),
            ),

            SizedBox(height: 20),
            Align(
             alignment: Alignment.centerLeft,
             child:  Text(
                'Your income',
                textDirection: TextDirection.ltr,
                style: TextStyle(
                  decoration: TextDecoration.none,
                  fontSize: 15.0,
                  fontFamily: 'Roboto',
                  fontWeight: FontWeight.w700,
                  color: Colors.black,

                ),
              ),
            ),
            SizedBox(height: 6,),
            Expanded(

              child: getListView(),),

             Align(

               alignment: FractionalOffset.bottomCenter,
              child: Container(

                 color:Colors.amber,

                 margin: EdgeInsets.only(left:2.0,right: 2.0,bottom: 1.0, top: 24.0),
                 child: new Row(

                   children: <Widget>[

                     Column(
                       children: <Widget>[
                         Text(
                           "REFUND :",
                           textDirection: TextDirection.ltr,
                           textAlign: TextAlign.left,
                           style: TextStyle(
                             decoration: TextDecoration.none,
                             fontSize: 15.0,
                             fontFamily: 'Roboto',
                             fontWeight: FontWeight.w700,
                             color: Colors.black,

                           ),

                         ),
                         Text(
                           "0,00"+"$",
                           textDirection: TextDirection.ltr,
                           textAlign: TextAlign.left,
                           style: TextStyle(
                             decoration: TextDecoration.none,
                             fontSize: 20.0,
                             fontFamily: 'Roboto',
                             fontWeight: FontWeight.w700,
                             color: Colors.black,
                           ),

                         ),
                       ],

                     ),


                     Spacer(),
                     MaterialButton(
                       shape: RoundedRectangleBorder(borderRadius:BorderRadius.circular(12.0) ),
                       height: 50,
                       onPressed: (){
                         //      Navigator.push(context, MaterialPageRoute(builder: (context)=>Persondata()));
                         print("cilcked");
                       },
                       child: Text(
                         "Submit",
                         style: TextStyle(
                           decoration: TextDecoration.none,
                           fontSize: 15.0,
                           fontFamily: 'Roboto',
                           fontWeight: FontWeight.w700,
                           color: Colors.white,

                         ),
                       ),
                       color: lightbluecolor ,
                     ),



                   ],
                 ),
               ),
             ),





          ],
        ),


      ),

      // This trailing comma makes auto-formatting nicer for build methods.
    );
  }
}

Esta es la foto donde se muestra el espacio en blanco. reducir el espacio en blanco inferior

0
demitri kozlov 6 may. 2020 a las 20:38

2 respuestas

La mejor respuesta

Proporcione la altura deseada del último Contenedor y finalmente ajuste su viewView en Expandido.

    Expanded(
        child: ListView(
          children: <Widget>[]
         ),
        ),

      child:  Containter(
    height: x,

), //last one
     ),
0
Habib ur Rehman 6 may. 2020 a las 19:52

Proporcione la altura deseada de la vista de lista envolviéndola dentro de un contenedor y finalmente envuelva su último contenedor en Expandido. Aquí hay un ejemplo!

 Container(
    height: x,
    child: ListView(
      children: <Widget>[]
     ),
    ),
 Expanded(
  child: Align(
  alignment: Alignment.bottomCenter, 
    child: Containter(), //last one
 ),
),
0
Abbas 6 may. 2020 a las 18:10