b24_widgets 0.0.9
b24_widgets: ^0.0.9 copied to clipboard
Flutter Package that include existing sample widgets
example/lib/main.dart
import 'package:b24_widgets/app/languages/translations.dart';
import 'package:b24_widgets/widgets/inputs/controller_text_input.dart';
import 'package:b24_widgets/widgets/others/date_picker.dart';
import 'package:flutter/material.dart';
import 'package:flutter_localizations/flutter_localizations.dart';
void main() async {
runApp(const MyApp());
WidgetsFlutterBinding.ensureInitialized();
await loadTranslations('km');
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple,
brightness: Brightness.light,
),
useMaterial3: true,
),
localizationsDelegates: GlobalMaterialLocalizations.delegates,
supportedLocales: const [
Locale('km', ''),
Locale('he', ''),
Locale('es', ''),
Locale('ru', ''),
Locale('ko', ''),
Locale('hi', ''),
],
home: const MyHomePage(title: 'Bill24 Reusable Widget'),
);
}
}
class MyHomePage extends StatefulWidget {
const MyHomePage({super.key, required this.title});
final String title;
@override
State<MyHomePage> createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
final GlobalKey<FormState> _formKey = GlobalKey<FormState>();
final TextEditingController _dateController = TextEditingController();
final List<DateTime?> _dialogCalendarPickerValue = [
DateTime.now(),
DateTime.now().add(const Duration(days: 3)),
];
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
backgroundColor: Theme.of(context).colorScheme.inversePrimary,
title: Text(widget.title),
),
body: Form(
key: _formKey,
child: Container(
padding: const EdgeInsets.all(10.0),
child: Column(
children: <Widget>[
const ExTextInput(
type: ExInputType.passwords,
isShowRuleValidate: false,
),
ExTextInput(
inputType: ExInputType.text,
controller: _dateController,
isRequired: false,
),
ExDatePicker(dialogSize: DialogSizeType.large),
ExDatePicker(
weekDayfull: true,
controller: _dateController,
dialogCalendarPickerValue: _dialogCalendarPickerValue,
labelText: 'Date range',
),
],
// children: [
// ExDateDropDownEx(),
// ],
// children: [
// Padding(
// padding: const EdgeInsets.symmetric(horizontal: 16.0),
// child: Row(children: [
// ExCheckBox(
// onTapCheck: () {
// showDialog(
// context: context,
// builder: (BuildContext context) {
// return AlertDialog(
// title: const Text('Checkbox'),
// content: const Text('You checked the checkbox.'),
// actions: [
// TextButton(
// onPressed: () {
// Navigator.of(context).pop();
// },
// child: const Text('OK'),
// ),
// ],
// );
// },
// );
// },
// onTapUncheck: () {
// print('uncheck');
// },
// ),
// const SizedBox(
// width: 10.0,
// ),
// const Text('Please click CheckBox!'),
// ]),
// ),
// itemGap,
// ControlTextInputS(
// type: InputTypeS.passwords,
// label: 'Password',
// hint: 'Enter Password',
// controller: _passowrd,
// isRequired: true,
// // confirmPassword: true,
// ),
// ControlTextInputS(
// type: InputTypeS.pin,
// label: 'Pin',
// hint: 'Enter Pin',
// controller: _email,
// isRequired: true,
// // externalValidator: (value) {
// // // External validation logic for password confirmation
// // if (value != _passowrd.text) {
// // return 'Passwords do not match';
// // }
// // return null;
// // },
// // isShowGuideValidate: false,
// // confirmPassword: true,
// ),
// itemGap,
// ControlTextInputS(
// type: InputTypeS.passwords,
// label: 'Confirm Password',
// hint: 'Enter Confirm Password',
// controller: _confirmPassword,
// isRequired: true,
// radiusSize: 5.0,
// controllerConfirm: _passowrd,
// sizeLabel: InputSizeTypeS.large,
// prefixIcon: const Icon(
// Icons.key,
// color: Colors.amber,
// ),
// confirmPassword: true,
// // externalValidator: (value) {
// // // External validation logic for password confirmation
// // if (value != _passowrd.text) {
// // return 'Passwords do not match';
// // }
// // return null;
// // },
// ),
// itemGap,
// // ExTextInput(
// // size: ExInputSizeType.small,
// // inputType: ExInputType.password,
// // controller: _txtPassword,
// // noBorder: true,
// // ),
// // itemGap,
// // ExTextInput(
// // size: ExInputSizeType.small,
// // suffixIcon: IconButton(icon: Icon(Icons.visibility),onPressed: () {
// // }, ),
// // inputType: ExInputType.password,
// // label: 'dfdf',
// // hintText: 'dfdf',
// // // controller: _txtPassword,
// // noBorder: false,
// // isRequired: true,
// // ),
// // itemGap,
// // SizedBox(
// // width: double.infinity,
// // height: 40,
// // child: ExLoadingButton(
// // const TextWidget('Loading Button'),
// // variant: ButtonVariant.filled,
// // paddingHorizone: 16,
// // onTap: () async {
// // Navigator.push(context, MaterialPageRoute(builder: (context) => const firstPage()));
// // },
// // ),
// // ),
// ],
)),
),
);
}
}