DEV Community

realNameHidden
realNameHidden

Posted on • Edited on

flutter text widget example

For Explanation watch the video :


import 'package:flutter/material.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: const TextWidget(),
    );
  }
}

class TextWidget extends StatelessWidget {
  const TextWidget({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('Text Widget'),
      ),
      body: Container(
        child: Text(
          'Hi, How Are you?',
          style: TextStyle(
            fontSize: 40,
            color: Colors.red,
            fontWeight: FontWeight.bold,
            fontStyle: FontStyle.italic,
            letterSpacing: 3,
            wordSpacing: 10,
            backgroundColor: Colors.amber,
          ),
        ),
      ),
    );
  }
}

Enter fullscreen mode Exit fullscreen mode

Top comments (0)