DefaultTextStyle Widget

Project Preview

  • Interested in seeing the live demo? Click here to explore.
  • Want to view the source code? Visit the project on GitHub.

Code Snippet

import 'package:flutter/material.dart';

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

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text("DefaultTextStyle Widget"),
      ),
      body: const Column(
        mainAxisAlignment: MainAxisAlignment.center,
        children: [
          Text('Flutter Mapp'),
          DefaultTextStyle(
            style: TextStyle(
              fontSize: 36,
              color: Colors.blue,
            ),
            child: Center(
              child: Column(
                children: [
                  Text('Flutter Mapp'),
                  Text(
                    'Flutter Mapp',
                    style: TextStyle(fontSize: 24),
                  ),
                  Text(
                    'Flutter Mapp',
                    style: TextStyle(color: Colors.red),
                  ),
                ],
              ),
            ),
          )
        ],
      ),
    );
  }
}