Reputation: 1018
I get this curious error for following simple code:
The named parameter children isnt defined.
import 'package:flutter/material.dart';
class Test extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Welcome to Flutter'),
),
body: Center(
children: <Widget>[
Text('Hello World'),
RaisedButton(
onPressed: null,
child: const Text('Disabled Button'),
)
]),
);
}
}
Can anyone spot the mistake? I think I am blind... Best Regards.
Upvotes: 0
Views: 3081
Reputation: 103381
Center
doesn't accept children, only child (one widget), you can add a Column
inside your Center
Center(
child: Column(children: <Widget>[
Text('Hello World'),
RaisedButton(
onPressed: null,
child: const Text('Disabled Button'),
)
])
),
Upvotes: 2