发布于 4年前

Flutter 撑满剩余高度

import 'package:flutter/material.dart';

class TestPage extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Material(
        child: Container(
      child: Column(
        children: <Widget>[
          Container(
            height: 100.0,
            width: MediaQuery.of(context).size.width,
            color: Colors.red,
            child: Text('我占用 100 的高度'),
          ),
          Expanded(
            child: Container(
              width: MediaQuery.of(context).size.width,
              color: Colors.blue,
              child: Text('我将撑满剩余高度'),
            ),
          )
        ],
      ),
    ));
  }
}
©2020 edoou.com   京ICP备16001874号-3