pennellato git da rosso ad arancio e verde
This commit is contained in:
83
lib/features/onboarding/ui/company_onboarding_form.dart
Normal file
83
lib/features/onboarding/ui/company_onboarding_form.dart
Normal file
@@ -0,0 +1,83 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:flux/core/utils/validators.dart';
|
||||
import 'package:flux/core/widgets/flux_text_field.dart';
|
||||
import 'package:flux/features/company/models/company_model.dart';
|
||||
import 'package:flux/features/onboarding/blocs/onboarding_cubit.dart';
|
||||
import 'package:flux/features/onboarding/blocs/onboarding_state.dart';
|
||||
|
||||
class CompanyOnboardingForm extends StatefulWidget {
|
||||
final OnboardingState state;
|
||||
const CompanyOnboardingForm({super.key, required this.state});
|
||||
|
||||
@override
|
||||
State<CompanyOnboardingForm> createState() => _CompanyOnboardingFormState();
|
||||
}
|
||||
|
||||
class _CompanyOnboardingFormState extends State<CompanyOnboardingForm> {
|
||||
final _formKey = GlobalKey<FormState>();
|
||||
final _nameCtrl = TextEditingController();
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_nameCtrl.dispose();
|
||||
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.all(32),
|
||||
child: Form(
|
||||
key: _formKey,
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
const Text(
|
||||
"Iniziamo! 🏢",
|
||||
style: TextStyle(fontSize: 32, fontWeight: FontWeight.bold),
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
const Text(
|
||||
"Inserisci i dati della tua attività per configurare il tuo ambiente FLUX.",
|
||||
style: TextStyle(fontSize: 16, color: Colors.grey),
|
||||
),
|
||||
const SizedBox(height: 48),
|
||||
|
||||
FluxTextField(
|
||||
label: 'Ragione Sociale / Nome Azienda',
|
||||
controller: _nameCtrl,
|
||||
validator: notEmptyValidator,
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
|
||||
const Spacer(),
|
||||
ElevatedButton(
|
||||
style: ElevatedButton.styleFrom(
|
||||
padding: const EdgeInsets.symmetric(vertical: 16),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
),
|
||||
),
|
||||
onPressed: () {
|
||||
if (_formKey.currentState!.validate()) {
|
||||
final newCompany = CompanyModel.empty().copyWith(
|
||||
ragioneSociale: _nameCtrl.text.trim(),
|
||||
);
|
||||
context.read<OnboardingCubit>().saveCompany(newCompany);
|
||||
}
|
||||
},
|
||||
child: const Text(
|
||||
"Salva e Prosegui",
|
||||
style: TextStyle(fontSize: 16),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user