fidooo_ui 0.0.35 fidooo_ui: ^0.0.35 copied to clipboard
A package to use fidooo ltda ui library
import 'package:fidooo_ui/constants/colors.dart';
import 'package:fidooo_ui/constants/size_constants.dart';
import 'package:fidooo_ui/custom_widgets/custom_button.dart';
import 'package:fidooo_ui/custom_widgets/custom_container.dart';
import 'package:fidooo_ui/custom_widgets/custom_suggested_text.dart';
import 'package:fidooo_ui/custom_widgets/custom_text.dart';
import 'package:fidooo_ui/custom_widgets/custom_text_field.dart';
import 'package:fidooo_ui/custom_widgets/custom_text_field_calendar.dart';
import 'package:flutter/material.dart';
import 'package:intl/intl.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Fidooo UI',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: const HomePage(),
);
}
}
class HomePage extends StatefulWidget {
const HomePage({Key? key}) : super(key: key);
@override
State<HomePage> createState() => _HomePageState();
}
class _HomePageState extends State<HomePage> {
final textController = TextEditingController();
final textController1 = TextEditingController();
final textController2 = TextEditingController();
final dateController1 = TextEditingController();
DateTime selectedDate = DateTime.now();
@override
Widget build(BuildContext context) {
return Scaffold(
body: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
FRaisedButton(child: const Text("Hola"), onPressed: () {}),
const SizedBox(height: SizeConstants.margin),
const FContainer(
color: FColors.apieBusiness,
borderRadius: 5,
child: Text("Fidooo dev"),
),
const SizedBox(height: SizeConstants.margin),
const FText("Hola, como estas <b>Bold</b> dev"),
const SizedBox(height: SizeConstants.margin),
const FText(
"Hola, como estas <c>Custom Style</c> dev <c1>Custom Style1</c11> dev",
customStyle: TextStyle(fontSize: 25, color: FColors.apieBusiness),
customStyle1: TextStyle(fontSize: 18, fontStyle: FontStyle.italic)),
const SizedBox(height: SizeConstants.margin),
FTextField(
textStyle: const TextStyle(color: Colors.white),
textinputType: TextInputType.multiline,
title: 'Prueba',
controller: TextEditingController(),
maxLines: 3,
minLines: 2,
),
const SizedBox(height: SizeConstants.margin),
FCustomTextFieldCalendar(
title: 'Fecha',
showCalendar: true,
minDate: DateTime(1900),
maxDate: DateTime(2030),
controller: dateController1,
initialDate: selectedDate,
onChanged: (value) {
final splits = value.split('/');
if (splits.length == 3 && splits[2].length == 4) {
setState(() {
selectedDate = DateFormat('dd/MM/yyyy').parse(value);
});
}
},
onSelectionChanged: (_) {
dateController1.text = _.value.toString();
dateController1.text = formatDate(dateController1.text);
setState(() {
selectedDate =
DateFormat('dd/MM/yyyy').parse(dateController1.text);
});
},
),
const SizedBox(height: SizeConstants.margin),
FSuggestDropDown(
controller: textController,
title: 'Prueba',
suggests: const ['Prueba1', 'Prueba2']),
FSuggestDropDown(
controller: textController1,
title: 'Prueba2',
suggests: const ['Prueba5', 'Prueba6']),
FSuggestDropDown(
controller: textController2,
title: 'Prueba3',
suggests: const ['Prueba55', 'Prueba66', 'Prueba77', 'Prueba88']),
const SizedBox(height: 200),
],
));
}
String formatDate(String inputDate) {
DateTime dateTime = DateTime.parse(inputDate);
String formattedDate = "${dateTime.day.toString().padLeft(2, '0')}/"
"${dateTime.month.toString().padLeft(2, '0')}/"
"${dateTime.year.toString()}";
return formattedDate;
}
}