Flutter row not showing children in a non-material app

You need to wrap your container in a WidgetsApp or the more commonly used MaterialApp or CupertinoApp that builds upon WidgetsApp. These widgets provide the default configuration required for a flutter application. Like navigation behaviour and such, see this link for more info: https://api.flutter.dev/flutter/widgets/WidgetsApp/WidgetsApp.html

An working examples:

import 'package:flutter/material.dart';
//import 'package:flutter/cupertino.dart'; // If using CupertinoApp

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return WidgetsApp( // Alternatively replace with MaterialApp or CupertinoApp
      color: Colors.white,
      builder: (context, widget) {
        return Container(
            color: Colors.green,
            child: Row(
              children: <Widget>[
                Container(
                  width: 100,
                  height: 100,
                  color: Colors.red,
                ),
                Container(
                  width: 100,
                  height: 100,
                  color: Colors.blue,
                ),
              ],
            )
        );
      },
    );
  }
}

Hope this helps :-)


I ran your code and it raised the exception

Horizontal RenderFlex with multiple children has a null textDirection, so the layout order is undefined.

I added textDirection to Row and it ran as expected

enter image description here