getxify_utils 1.0.0
getxify_utils: ^1.0.0 copied to clipboard
getxify_utils is built for faster and cleaner development. It provides lots of extension methods on Widget, String, List and Map.
import 'package:flutter/material.dart';
import 'package:getxify_utils/getxify_utils.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(title: const Text('Getxify Utils')),
body: Center(
child: Column(
spacing: 12,
children: [
Row(
spacing: 12,
mainAxisAlignment: MainAxisAlignment.center,
children: [
FxButton(
type: BtnType.solid,
onPressed: () {},
text: 'abc',
size: BtnSize.tiny,
),
FxButton(
type: BtnType.solid,
onPressed: () {},
text: 'abc',
size: BtnSize.small,
),
FxButton(
type: BtnType.solid,
onPressed: () {},
text: 'abc',
color: FxColor.primary,
),
FxButton(
type: BtnType.solid,
onPressed: () {},
text: 'abc',
size: BtnSize.medium,
),
FxButton(
type: BtnType.solid,
onPressed: () {},
text: 'abc',
size: BtnSize.large,
),
],
),
Row(
spacing: 12,
mainAxisAlignment: MainAxisAlignment.center,
children: [
FxButton(
type: BtnType.solid,
onPressed: () {},
icon: Icons.person,
size: BtnSize.tiny,
),
FxButton(
type: BtnType.solid,
onPressed: () {},
icon: Icons.person,
size: BtnSize.small,
),
FxButton(
type: BtnType.solid,
onPressed: () {},
icon: Icons.person,
),
FxButton(
type: BtnType.solid,
onPressed: () {},
icon: Icons.person,
size: BtnSize.medium,
),
FxButton(
type: BtnType.solid,
onPressed: () {},
icon: Icons.person,
size: BtnSize.large,
),
],
),
FxTextFormField(
label: "Name",
hintText: "Name",
border: true,
maxLines: 5,
),
FxTextFormField(isRequired: false),
GetxifyCheckbox(),
GetxifyRadio(),
GetxifySwitch(),
],
),
),
),
);
}
}
class GetxifyCheckbox extends StatefulWidget {
const GetxifyCheckbox({super.key});
@override
State<GetxifyCheckbox> createState() => _GetxifyCheckboxState();
}
class _GetxifyCheckboxState extends State<GetxifyCheckbox> {
bool _isChecked = false;
@override
Widget build(BuildContext context) {
return FxCheckbox(
value: _isChecked,
onChanged: (v) => setState(() {
_isChecked = v;
}),
);
}
}
class GetxifyRadio extends StatefulWidget {
const GetxifyRadio({super.key});
@override
State<GetxifyRadio> createState() => _GetxifyRadioState();
}
class _GetxifyRadioState extends State<GetxifyRadio> {
String name = "male";
@override
Widget build(BuildContext context) {
return Row(
spacing: 12,
mainAxisAlignment: MainAxisAlignment.center,
children: [
FxRadio(
groupValue: name, // The currently selected value
value: "male", // Unique value for this radio button
onChanged: (value) => setState(() {
name = value; // Update the selected value
}),
),
FxRadio(
groupValue: name, // The currently selected value
value: "female", // Unique value for this radio button
onChanged: (value) => setState(() {
name = value; // Update the selected value
}),
),
],
);
}
}
class GetxifySwitch extends StatefulWidget {
const GetxifySwitch({super.key});
@override
State<GetxifySwitch> createState() => _GetxifySwitchState();
}
class _GetxifySwitchState extends State<GetxifySwitch> {
bool _isChecked = false;
@override
Widget build(BuildContext context) {
return FxSwitch(
value: _isChecked,
onChanged: (v) => setState(() {
_isChecked = v;
}),
);
}
}