flutter_custom_form_component 0.0.25 flutter_custom_form_component: ^0.0.25 copied to clipboard
Custom UI components supporting form on a page.
import 'package:flutter/material.dart';
import 'package:flutter_custom_form_component/widget/field/bank_card_number/widget.dart';
import 'package:flutter_custom_form_component/widget/field/date/224/ddmmyyyy.dart';
import 'package:flutter_custom_form_component/widget/field/money/widget.dart';
import 'package:flutter_custom_form_component/widget/field/name/widget.dart';
import 'package:flutter_custom_form_component/widget/field/phone_number/widget.dart';
import 'package:flutter_custom_form_component/widget/field/registration_number/widget.dart';
import 'package:flutter_custom_form_component/widget/page.dart';
/// Main example.
void main() {
runApp(const AppWidget());
}
/// Main app widget.
class AppWidget extends StatelessWidget {
const AppWidget({final Key? key}) : super(key: key);
@override
Widget build(final BuildContext context) => MaterialApp(
home: const OnePageWidget(),
theme: ThemeData(fontFamily: 'Circular Std'));
}
/// Main page widget.
class OnePageWidget extends StatelessWidget {
const OnePageWidget({final Key? key}) : super(key: key);
@override
Widget build(final BuildContext context) => page(Column(children: [
SizedBox(
child: DdMmYyyyFieldWidget(
/// Optional. It has default value.
hint: 'DD / MM / YYYY',
/// Optional. For your own validation logic.
valid: true,
/// Optional
onChanged: (final int? year, final int? month, final int? day) {
/// You can get the values here.
},
/// Optional. It has default value.
separator: ' / '),
/// Wrap the height.
height: 52.0,
),
const SizedBox(height: 20.0),
SizedBox(
child: MoneyFieldWidget(
/// Optional
hint: '\$ 0.0',
/// Optional. It has default value.
usingPeriodInThousand: false,
/// Optional
onChanged: (final dynamic value) {
/// You can get the values here.
},
/// Optional
symbol: '\$ '),
/// Wrap the height.
height: 52.0,
),
const SizedBox(height: 20.0),
SizedBox(
child: BankCardNumberFieldWidget(
/// Optional
hint: '0000 - 0000 - 0000 - 0000',
/// Optional
onChanged: (final dynamic value) {
/// You can get the values here.
},
/// Optional. It has default value.
separator: ' - '),
/// Wrap the height.
height: 52.0,
),
const SizedBox(height: 20.0),
SizedBox(
child: NameFieldWidget(
/// Optional
hint: 'Your name',
/// Optional
onChanged: (final dynamic value) {
/// You can get the values here.
}),
/// Wrap the height.
height: 52.0,
),
const SizedBox(height: 20.0),
SizedBox(
child: RegistrationNumberFieldWidget(
/// Optional
hint: '12.0000.123-752-86',
/// Optional
onChanged: (final dynamic value) {
/// You can get the values here.
}),
/// Wrap the height.
height: 52.0,
),
const SizedBox(height: 20.0),
SizedBox(
child: PhoneNumberFieldWidget(
/// Optional
hint: '081234567890',
/// Optional
onChanged: (final dynamic value) {
/// You can get the values here.
}),
/// Wrap the height.
height: 52.0,
)
]));
}