152 lines
5.9 KiB
Dart
152 lines
5.9 KiB
Dart
import 'package:easy_debounce/easy_debounce.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter/scheduler.dart';
|
|
import 'package:flutter/services.dart';
|
|
import 'package:google_fonts/google_fonts.dart';
|
|
import 'package:hub/components/atomic_components/shared_components_atoms/appbar.dart';
|
|
import 'package:hub/components/atomic_components/shared_components_atoms/custom_datepicker.dart';
|
|
import 'package:hub/components/atomic_components/shared_components_atoms/custom_input.dart';
|
|
import 'package:hub/components/atomic_components/shared_components_atoms/tabview.dart';
|
|
|
|
import 'package:hub/flutter_flow/flutter_flow_icon_button.dart';
|
|
import 'package:hub/flutter_flow/flutter_flow_model.dart';
|
|
import 'package:hub/flutter_flow/flutter_flow_theme.dart';
|
|
import 'package:hub/flutter_flow/flutter_flow_util.dart';
|
|
import 'package:hub/flutter_flow/flutter_flow_widgets.dart';
|
|
import 'package:hub/flutter_flow/internationalization.dart';
|
|
import 'package:hub/flutter_flow/nav/nav.dart';
|
|
import 'package:hub/flutter_flow/upload_data.dart';
|
|
import 'package:hub/pages/pets_page/pets_page_model.dart';
|
|
|
|
class PetsPageWidget extends StatefulWidget {
|
|
PetsPageWidget({super.key});
|
|
|
|
@override
|
|
State<PetsPageWidget> createState() => _PetsPageWidgetState();
|
|
}
|
|
|
|
class _PetsPageWidgetState extends State<PetsPageWidget>
|
|
with SingleTickerProviderStateMixin {
|
|
late PetsPageModel _model;
|
|
|
|
@override
|
|
void initState() {
|
|
super.initState();
|
|
_model = PetsPageModel();
|
|
_model.tabBarController = TabController(length: 2, vsync: this);
|
|
}
|
|
|
|
@override
|
|
void dispose() {
|
|
_model.tabBarController.dispose();
|
|
super.dispose();
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Scaffold(
|
|
appBar: appBarPets(context),
|
|
body: tabViewPets(context, _model, _model.tabBarController));
|
|
}
|
|
}
|
|
|
|
PreferredSizeWidget appBarPets(BuildContext context) {
|
|
return AppBarUtil(title: 'Pets', onBackButtonPressed: () => context.pop());
|
|
}
|
|
|
|
Widget tabViewPets(BuildContext context, PetsPageModel _model, controller) {
|
|
return TabViewUtil(
|
|
context: context,
|
|
model: _model,
|
|
labelTab1: 'Cadastrar',
|
|
labelTab2: 'Consultar',
|
|
controller: controller,
|
|
widget1: formAddPets(context),
|
|
widget2: Center(child: Text('Consultar')),
|
|
);
|
|
}
|
|
|
|
Widget formAddPets(BuildContext context) {
|
|
return SingleChildScrollView(
|
|
child: Column(
|
|
mainAxisSize: MainAxisSize.max,
|
|
children: [
|
|
Align(
|
|
alignment: const AlignmentDirectional(-1.0, 0.0),
|
|
child: Padding(
|
|
padding: const EdgeInsetsDirectional.fromSTEB(24.0, 20, 0.0, 15),
|
|
child: Text(
|
|
FFLocalizations.of(context).getVariableText(
|
|
ptText: 'Preencha o formulário com os dados do seu Pet',
|
|
enText: 'Fill out the form with your Pet\'s data',
|
|
),
|
|
textAlign: TextAlign.start,
|
|
style: FlutterFlowTheme.of(context).bodyMedium.override(
|
|
fontFamily: FlutterFlowTheme.of(context).bodyMediumFamily,
|
|
letterSpacing: 0.0,
|
|
useGoogleFonts: GoogleFonts.asMap().containsKey(
|
|
FlutterFlowTheme.of(context).bodyMediumFamily),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
Form(
|
|
autovalidateMode: AutovalidateMode.onUserInteraction,
|
|
child: Column(
|
|
mainAxisSize: MainAxisSize.max,
|
|
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
|
children: [
|
|
CustomInputUtil(
|
|
labelText: FFLocalizations.of(context)
|
|
.getVariableText(ptText: 'Nome', enText: 'Name'),
|
|
hintText: FFLocalizations.of(context)
|
|
.getVariableText(ptText: 'Nome', enText: 'Name'),
|
|
suffixIcon: Icons.person,
|
|
haveMaxLength: true,
|
|
maxLength: 80,
|
|
),
|
|
CustomInputUtil(
|
|
labelText: FFLocalizations.of(context)
|
|
.getVariableText(ptText: 'Espécie', enText: 'Species'),
|
|
hintText: FFLocalizations.of(context)
|
|
.getVariableText(ptText: 'Espécie', enText: 'Species'),
|
|
suffixIcon: Icons.pest_control,
|
|
haveMaxLength: false,
|
|
),
|
|
CustomInputUtil(
|
|
labelText: FFLocalizations.of(context)
|
|
.getVariableText(ptText: 'Raça', enText: 'Race'),
|
|
hintText: FFLocalizations.of(context)
|
|
.getVariableText(ptText: 'Raça', enText: 'Race'),
|
|
suffixIcon: Icons.pets,
|
|
haveMaxLength: false,
|
|
),
|
|
CustomInputUtil(
|
|
labelText: FFLocalizations.of(context)
|
|
.getVariableText(ptText: 'Cor', enText: 'Color'),
|
|
hintText: FFLocalizations.of(context)
|
|
.getVariableText(ptText: 'Cor', enText: 'Color'),
|
|
suffixIcon: Icons.invert_colors,
|
|
haveMaxLength: false,
|
|
),
|
|
CustomDatePickerUtil(
|
|
// controller: ,
|
|
hintText: FFLocalizations.of(context).getVariableText(
|
|
ptText: 'Data de Nascimento', enText: 'Birth Date'),
|
|
dateFormat: 'dd/MM/yyyy HH:mm:ss',
|
|
locale: FFLocalizations.of(context).languageCode,
|
|
firstDate: DateTime(2000),
|
|
lastDate: DateTime(2050),
|
|
validator: (value) {
|
|
if (value == null || value.isEmpty) {
|
|
return 'Por favor, selecione uma data';
|
|
}
|
|
return null;
|
|
},
|
|
),
|
|
])),
|
|
],
|
|
),
|
|
);
|
|
}
|