Build: Styled Text Screen
This screen shows a text widget with custom styling including font size, color, and weight.
Target UI
------------------------- | | | Hello, Flutter! | | | -------------------------
------------------------- | | | Hello, Flutter! | | | -------------------------
import 'package:flutter/material.dart'; class StyledTextScreen extends StatelessWidget { @override Widget build(BuildContext context) { return Scaffold( body: Center( // TODO: Add your Text widget here with styling ), ); } }
import 'package:flutter/material.dart'; class StyledTextScreen extends StatelessWidget { @override Widget build(BuildContext context) { return Scaffold( body: Center( child: Text( 'Hello, Flutter!', style: TextStyle( fontSize: 24, color: Colors.blue, fontWeight: FontWeight.bold, ), ), ), ); } }
We use a Text widget to show the string 'Hello, Flutter!'. The TextStyle sets the font size to 24, color to blue, and makes the text bold by setting fontWeight to FontWeight.bold. The Center widget centers the text horizontally and vertically on the screen.
------------------------- | | | Hello, Flutter! | | | -------------------------
Text widget do in Flutter?Text widget?Text( 'Hello Flutter', style: TextStyle(fontWeight: FontWeight.bold, fontSize: 20), textAlign: TextAlign.center, )
Text( 'Welcome', style: TextStyle(fontSize: '20'), )
Text widget code correctly achieves this?Pass the test and this pattern moves unknown