languages

A collection of programs made with different programming languages.
git clone git://evanalba.com/languages
Log | Files | Refs

my_button.dart (824B)


      1 import 'package:flutter/material.dart';
      2 
      3 class MyButton extends StatelessWidget {
      4   final Function()? onTap;
      5   final String text;
      6 
      7   const MyButton({super.key, required this.onTap, required this.text});
      8 
      9   @override
     10   Widget build(BuildContext context) {
     11     return GestureDetector(
     12       onTap: onTap,
     13       child: Container(
     14         padding: const EdgeInsets.all(25),
     15         margin: const EdgeInsets.symmetric(horizontal: 25),
     16         decoration: BoxDecoration(
     17           color: Colors.black,
     18           borderRadius: BorderRadius.circular(8),
     19         ),
     20         child: Center(
     21           child: Text(
     22             text,
     23             style: const TextStyle(
     24               color: Colors.white,
     25               fontWeight: FontWeight.bold,
     26               fontSize: 16,
     27             ),
     28           ),
     29         ),
     30       ),
     31     );
     32   }
     33 }