Advertisement
rajath_pai

ninja9 ElevatedButton.icon

Jul 30th, 2021
1,197
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Dart 1.11 KB | None | 0 0
  1. import 'package:flutter/material.dart';
  2.  
  3. void main() => runApp(MaterialApp(
  4.       home: Home(),
  5.     ));
  6.  
  7. class Home extends StatelessWidget {
  8.   @override
  9.   Widget build(BuildContext context) {
  10.     return Scaffold(
  11.       appBar: AppBar(
  12.         title: Text(
  13.           'App bar',
  14.           style: TextStyle(color: Colors.white),
  15.         ),
  16.         centerTitle: true,
  17.         backgroundColor: Colors.red,
  18.       ),
  19.       //read about elevated button => https://stackoverflow.com/questions/66835173/how-to-change-background-color-of-elevated-button-in-flutter-from-function
  20.       body: Center(
  21.         child: ElevatedButton.icon(
  22.           icon: Icon(
  23.             Icons.mail,
  24.             size: 24.0,
  25.           ),
  26.           label: Text('Send Mail'),
  27.           onPressed: () {
  28.             print('Pressed');
  29.           },
  30.           style : ElevatedButton.styleFrom(
  31.             primary : Colors.amber,
  32.           ),
  33.         ),
  34.       ),
  35.       floatingActionButton: FloatingActionButton(
  36.         child: Text('click me'),
  37.         onPressed: null,
  38.         backgroundColor: Colors.red,
  39.       ),
  40.     );
  41.   }
  42. }
  43.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement