Display Text Button in Flutter

Display Text Button in Flutter

A text button is a zero elevation button that commonly contains a text label in the center. It is a Material Design button.

A TextButton class is used to create a text button. By default, text button do not have background color and borders. The style parameter can be used to provide the style of button.

import 'package:flutter/material.dart';

void main() => runApp(const MaterialApp(home: MyApp()));

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

  State<MyApp> createState() => _MyAppState();

class _MyAppState extends State<MyApp> {
  Widget build(BuildContext context) {
    return Scaffold(
        appBar: AppBar(title: const Text('Text button')),
        body: Center(
            child: TextButton(
          style: TextButton.styleFrom(
            backgroundColor: Colors.black12,
            foregroundColor: Colors.indigo,
          onPressed: () {
          child: const Text('Add'),

Leave a Comment

Cancel reply

Your email address will not be published.