ActionChip Class

 import "package:flutter/material.dart";


void main()
{
runApp(MyApp());
}
class MyApp extends StatelessWidget
{
MyApp({super.key});

@override
Widget build(BuildContext context) {
return MaterialApp(
title: "ActionChip Class",
debugShowCheckedModeBanner: false,
theme: ThemeData(
primarySwatch: Colors.grey,
),
home: ActionChipDemo(),
);
}
}
class ActionChipDemo extends StatefulWidget
{
ActionChipDemo({super.key});
@override
State<ActionChipDemo> createState()
{
return ActionChipDemoState();
}
}
class ActionChipDemoState extends State<ActionChipDemo>
{
bool favourite = false;

@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text("ActionChip Class"),
centerTitle: true,
backgroundColor: Colors.grey,
),
body: Center(
child: ActionChip(
avatar: Icon(favourite ? Icons.favorite : Icons.favorite_border),
label: const Text("Add to Favourite"),
onPressed: () {
setState(() {
favourite = !favourite;
},);
},
),
),
);
}
}

Comments

Popular posts from this blog

Second GET API Calling with Bloc simple Example in Flutter

Stack Container Scrollable Card widget UI with Custom Widget

Pagination with Bloc Pattern in Flutter