lite_forms 0.0.1
lite_forms: ^0.0.1 copied to clipboard
This packages dramatically simplifies working with forms still letting you use standard flutter decorations.
example/lib/main.dart
// ignore_for_file: depend_on_referenced_packages
import 'package:flutter/material.dart';
import 'package:lite_forms/base_form_fields/exports.dart';
import 'package:lite_forms/utils/controller_initializer.dart';
import 'package:lite_forms/utils/lite_forms_configuration.dart';
import 'start_page.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatefulWidget {
const MyApp({super.key});
@override
State<MyApp> createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
@override
void initState() {
const cornerRadius = 6.0;
const defaultBorder = OutlineInputBorder(
borderRadius: BorderRadius.only(
topLeft: Radius.circular(
cornerRadius,
),
topRight: Radius.circular(
cornerRadius,
),
bottomRight: Radius.circular(
cornerRadius,
),
bottomLeft: Radius.circular(
cornerRadius,
),
),
);
/// Must be called in the beginning.
/// Basically that's all you need
/// to start using Lite Forms
initializeLiteForms(
/// optional configuration which will be used as default
config: LiteFormsConfiguration(
defaultDateFormat: 'dd MMM, yyyy',
defaultTimeFormat: 'HH:mm',
dropSelectorSettings: const LiteDropSelectorSettings(
bottomLeftRadius: 20.0,
),
autovalidateMode: AutovalidateMode.onUserInteraction,
useAutogeneratedHints: true,
allowUnfocusOnTapOutside: true,
defaultTextEntryModalRouteSettings: TextEntryModalRouteSettings(
backgroundOpacity: .95,
),
lightTheme: LiteFormsTheme(
inputDecoration: InputDecoration(
filled: false,
errorStyle: const TextStyle(
fontSize: 16.0,
color: Colors.pink,
),
border: defaultBorder,
enabledBorder: defaultBorder.copyWith(
borderSide: const BorderSide(
width: .1,
),
),
focusedBorder: defaultBorder.copyWith(
borderSide: const BorderSide(
width: .1,
color: Colors.blue,
),
),
),
),
darkTheme: LiteFormsTheme(
inputDecoration: InputDecoration(
filled: false,
errorStyle: const TextStyle(
fontSize: 16.0,
color: Colors.orange,
),
border: defaultBorder,
enabledBorder: defaultBorder.copyWith(
borderSide: const BorderSide(
width: .1,
color: Colors.white,
),
),
focusedBorder: defaultBorder.copyWith(
borderSide: const BorderSide(
width: .2,
color: Colors.white,
),
),
),
),
),
);
super.initState();
}
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Lite Forms Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
),
darkTheme: ThemeData.dark(),
// themeMode: ThemeMode.dark,
home: const StartPage(),
);
}
}