Button Simple

 import "package:flutter/material.dart";


void main()
{
runApp(const MyApp());
}

class MyApp extends StatelessWidget
{
const MyApp({super.key});

@override
Widget build(BuildContext context)
{
return MaterialApp(
title: "Hello Flutter",
debugShowCheckedModeBanner: false,
theme: ThemeData(
primarySwatch: Colors.deepPurple,
),
home: const FlutterApp(),
);
}
}

class FlutterApp extends StatelessWidget
{
const FlutterApp({super.key});

@override
Widget build(BuildContext context)
{
return Scaffold(
appBar: AppBar(
title: const Text("Button in Flutter",
style: TextStyle(fontWeight: FontWeight.bold),
),
centerTitle: true,
backgroundColor: Colors.grey,
),

/*body: TextButton(
child: const Text("Click Here!!"),
onPressed: (){
print("Text Button Tapped");
},
onLongPress: (){
print("LongPressed!!");
},
),*/

body: Center(
child: ElevatedButton(
style: ElevatedButton.styleFrom(
backgroundColor: Colors.blue,
fixedSize: const Size(350.0,50.0),
),
child: const Text("Click Here Button!!",
style: TextStyle(fontWeight: FontWeight.bold, color: Colors.white, fontSize: 20.0),
),
onPressed: (){
print("Elevated Button Tapped");
},
),
),

/*body: OutlinedButton(
child: const Text("Click on This!!"),
onPressed: (){
print("Outlined Button Tapped");
},
),*/

);
}
}

Comments

Popular posts from this blog

Pagination with Bloc Pattern in Flutter

ExpansionPanel with ExpansionPanelList with Complete Collapse Operation in Flutter

Pagination First Practical in Flutter