75 lines
2.5 KiB
Dart
75 lines
2.5 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'AppDrawer.dart';
|
|
|
|
class ButtonPage extends StatefulWidget {
|
|
const ButtonPage({super.key});
|
|
|
|
@override
|
|
State<StatefulWidget> createState() => _ButtonPageState();
|
|
}
|
|
|
|
class _ButtonPageState extends State<ButtonPage> {
|
|
|
|
// final List<Map<String, dynamic>> buttons = [
|
|
// {'title': 'ElevatedButton', 'widget': ElevatedButton(onPressed: () {}, child: Text('Elevated'))},
|
|
// {'title': 'TextButton', 'widget': TextButton(onPressed: () {}, child: Text('Text'))},
|
|
// {'title': 'OutlinedButton', 'widget': OutlinedButton(onPressed: () {}, child: Text('Outlined'))},
|
|
// {'title': 'IconButton', 'widget': IconButton(onPressed: () {}, icon: Icon(Icons.favorite))},
|
|
// {'title': 'FloatingActionButton', 'widget': FloatingActionButton(onPressed: () {}, child: Icon(Icons.add))},
|
|
// {'title': 'ElevatedButton.icon', 'widget': ElevatedButton.icon(onPressed: () {}, icon: Icon(Icons.send), label: Text('Send'))},
|
|
// {'title': 'TextButton.icon', 'widget': TextButton.icon(onPressed: () {}, icon: Icon(Icons.download), label: Text('Download'))},
|
|
// {'title': 'OutlinedButton.icon', 'widget': OutlinedButton.icon(onPressed: () {}, icon: Icon(Icons.share), label: Text('Share'))},
|
|
// {'title': 'Disabled Button', 'widget': ElevatedButton(onPressed: null, child: Text('Disabled'))},
|
|
// {'title': 'Custom Styled Button', 'widget': ElevatedButton(
|
|
// onPressed: () {},
|
|
// style: ElevatedButton.styleFrom(backgroundColor: Colors.red, foregroundColor: Colors.white),
|
|
// child: Text('Custom'),
|
|
// )},
|
|
// ];
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Scaffold(
|
|
appBar: AppBar(
|
|
title: Text('Button Examples'),
|
|
),
|
|
drawer: AppDrawer(),
|
|
body: Column(
|
|
children: [
|
|
|
|
// Create ElevatedButton
|
|
SizedBox(
|
|
width: double.infinity, //make the width of button equal to the widht of screen
|
|
child: ElevatedButton(
|
|
onPressed: (){
|
|
print('Elevated Button pressed');
|
|
},
|
|
child: Text('Text'),
|
|
),
|
|
),
|
|
|
|
SizedBox(height: 20),
|
|
|
|
// Create the text Button
|
|
SizedBox(
|
|
width: double.infinity,
|
|
child: TextButton(
|
|
onPressed: (){
|
|
print('Text button is pressed');
|
|
},
|
|
child: Text('This is a text button'),
|
|
),
|
|
),
|
|
|
|
SizedBox(height: 20),
|
|
|
|
//
|
|
|
|
|
|
|
|
|
|
],
|
|
),
|
|
);
|
|
}
|
|
} |