Solution: Greeting Text

In this lesson, you'll explore the solution to the "Greeting Text" challenge.

Solution: Greeting text

This lesson contains the solution for the “Greetings Text” challenge.

Solution #1: Greeting in your language

I chose to replace the greeting text for the otherGreeting variable with the Hindi language. Tapping on the “refresh” icon toggles between englishGreeting and greeting in Hindi.

//SOLUTION #1: Replace with your string
String otherGreeting = "नमस्ते !";

Solution #2: Make the greeting bold

  child: Text(
            displayText,

            //SOLUTION #2: Making Text Bold
            style: TextStyle(fontSize: 24, fontWeight: FontWeight.bold),
          ),
        ),

Solution #3: Make the font bigger

Make the fontSize double to 48 logical pixels. Set fontWeight property to FontWeight.normal to apply the normal weight.

  child: Text(
            displayText,
        
            //SOLUTION #3: Making Font Bigger
            style: TextStyle(fontSize: 48, fontWeight: FontWeight.normal),
          ),
        ),

Get hands-on with 1200+ tech skills courses.