Saturday, January 14, 2023

Create Elevated Button Class of Stateless

 

Create ElevatedButton Class


import 'package:flutter/material.dart';

class MainButton extends StatelessWidget{

  final String text;
  final Function() onPressed;
  final Color color;

  const MainButton({Key? key,
  required this.text,
  required this.onPressed,
  required this.color
  }) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return ElevatedButton(
      style: ElevatedButton.styleFrom(
        primary: color,
      ),
      child: Text(text),
      onPressed: onPressed,
      );
  }
}

No comments:

Post a Comment

Featured post

Compress Image With Show File Size & Resolution in Flutter

 Compress Image With Show File Size & Resolution  1.Multiple File Image Compress with file Size import 'dart:io' ; import 'p...

LightBlog