Flutter:未定义命名参数 'textAlign'

Flutter :The named parameter 'textAlign' isn't defined

class Home extends StatelessWidget {
 @override
 Widget build(BuildContext context) {
 return Scaffold(
    appBar: AppBar(),
    drawer: Drawer(),
    body: Text(
      "Home page ,Omar OS ",
      style: TextStyle(
          fontSize: 30,
          color: Colors.red,
          fontWeight: FontWeight.bold,
          fontStyle: FontStyle.italic),
    ),
    textAlign: TextAlign.center);
  }
}

错误:

No named parameter with the name 'textAlign'.
lib/main.dart:30
        textAlign: TextAlign.center);
        ^^^^^^^^^
/C:/flutter/packages/flutter/lib/src/material/scaffold.dart:1470:9: Context: Found this candidate, but the arguments don't match.
  const Scaffold({

textAlign 参数属于 Text 小部件,但您已在 Scaffold 上定义了它。这应该有效:

class Home extends StatelessWidget {
 @override
 Widget build(BuildContext context) {
 return Scaffold(
    appBar: AppBar(),
    drawer: Drawer(),
    body: Text(
      "Home page ,Omar OS ",
      style: TextStyle(
          fontSize: 30,
          color: Colors.red,
          fontWeight: FontWeight.bold,
          fontStyle: FontStyle.italic),
      textAlign: TextAlign.center
    ),
    );
  }
}
  class Home extends StatelessWidget {
    @override
    Widget build(BuildContext context) {
      return Scaffold(
          appBar: AppBar(),
          drawer: Drawer(),
          body: Text(
            "Home page ,Omar OS ",
            style: TextStyle(
                fontSize: 30,
                color: Colors.red,
                fontWeight: FontWeight.bold,
                fontStyle: FontStyle.italic),
              textAlign: TextAlign.center),
          );
          
    }
  }