apptomate_custom_radio_button 0.0.1
apptomate_custom_radio_button: ^0.0.1 copied to clipboard
A customizable radio button widget for Flutter that allows you to define custom icons, colors, and text styles.
example/lib/main.dart
import 'package:apptomate_custom_radio_button/apptomate_custom_radio_button.dart';
import 'package:flutter/material.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
theme: ThemeData(
colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
useMaterial3: true,
),
home: MyHomePage(),
);
}
}
class MyHomePage extends StatefulWidget {
@override
_CustomRadioButtonExampleState createState() =>
_CustomRadioButtonExampleState();
}
class _CustomRadioButtonExampleState extends State<MyHomePage> {
String selectedOption = "Option 1";
@override
Widget build(BuildContext context) {
return Scaffold(
body: SafeArea(
child: Center(
child: Padding(
padding: const EdgeInsets.all(16.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
CustomRadioButton(
label: "Option 1",
value: "Option 1",
size: 24,
groupValue: selectedOption,
activeColor: Colors.black,
onChanged: (value) {
setState(() {
selectedOption = value;
});
},
),
Padding(
padding: const EdgeInsets.symmetric(vertical: 16.0),
child: CustomRadioButton(
label: "Option 2",
activeColor: Colors.black,
value: "Option 2",
groupValue: selectedOption,
onChanged: (value) {
setState(() {
selectedOption = value;
});
},
),
),
CustomRadioButton(
label: "Option 3",
value: "Option 3",
activeColor: Colors.black,
groupValue: selectedOption,
onChanged: (value) {
setState(() {
selectedOption = value;
});
},
),
],
),
),
),
),
);
}
}