flutter width 100% code example

Example 1: set container height flutter 25% of screen

MediaQuery.of(context).size.height * 0.25

Example 2: flutter column min height screen sixe

import 'dart:math'; // for max function

// Add the following around your column
LayoutBuilder(
  builder: (BuildContext context, BoxConstraints constraints) {
    return SingleChildScrollView(
      child: ConstrainedBox(
        constraints: BoxConstraints.tightFor(height: max(500, constraints.maxHeight)),
        child: Column(), // your column
      ),
    );
  },
);

Example 3: flutter image size percentage

MediaQuery.of(context).size.width * 1

Tags:

Misc Example