import 'package:flutter/material.dart'; class HelloRect extends StatelessWidget { final String text; HelloRect({this.text}); @override Widget build(BuildContext context) { return Container( color: Colors.purple, width: 200, height: 200, margin: EdgeInsets.all(16), child: Center(child: Text(text)), ); } } void main() => runApp(MyApp()); class MyApp extends StatelessWidget { @override Widget build(BuildContext context) { return new MaterialApp( title: 'Startup Name Generator', home: Scaffold( body: Center( child: HelloRect(text: 'Hi') ) ) ); } }