Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
1.0 kB
2
Indexable
Never
import 'package:flutter/material.dart';

class RoundedButton extends StatelessWidget {


  final String name;
  final Color? bgColor;
  final Icon? icon;
  final TextStyle? textStyle;
  final VoidCallback? callback;


  RoundedButton({
    required this.name,
    this.bgColor=Colors.blue,
    this.icon,
    this.textStyle,
    this.callback
}
);

  @override
  Widget build(BuildContext context) {
    return ElevatedButton(onPressed: (){
      callback!();

    }, child:  icon!=null ?
    Row(
      children: [
        icon!,
        Text('name',style: textStyle,)
      ],
    ):
    Text('name',style: textStyle,),
    style: ElevatedButton.styleFrom(
    backgroundColor: bgColor,
    shadowColor: bgColor,
        shape: RoundedRectangleBorder(
        borderRadius: BorderRadius.only(
          topLeft: Radius.circular(11),
          bottomRight: Radius.circular(11),
          bottomLeft: Radius.circular(11),
          topRight: Radius.circular(11)
        )
    )
    ),
    );
  }
}