void main() => runApp(MyApp()); class MyApp extends StatelessWidget { const MyApp({Key? key}) : super(key: key); @override Widget build(BuildContext context) { return MaterialApp(home: MyScaffold()); } } class MyScaffold extends StatelessWidget { const MyScaffold({Key? key}) : super(key: key); @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar(title: Text('Title')), body: Center(child: Text('Hello World')), floatingActionButton: FloatingActionButton( onPressed: () => print('Button pressed'), child: Icon(Icons.add), ), ); } }