staff
This commit is contained in:
@@ -82,115 +82,110 @@ class _CreateStoreScreenState extends State<CreateStoreScreen> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return BlocProvider(
|
||||
create: (context) => StoreBloc(),
|
||||
child: Scaffold(
|
||||
appBar: AppBar(title: const Text('Il tuo primo Negozio')),
|
||||
body: BlocConsumer<StoreBloc, StoreState>(
|
||||
listener: (context, state) {
|
||||
if (state.status == StoreStatus.success) {
|
||||
context.read<SessionBloc>().add(AppStarted());
|
||||
}
|
||||
if (state.status == StoreStatus.failure) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: Text(state.errorMessage ?? 'Errore salvataggio'),
|
||||
),
|
||||
);
|
||||
}
|
||||
},
|
||||
builder: (context, state) {
|
||||
return SafeArea(
|
||||
child: SingleChildScrollView(
|
||||
padding: const EdgeInsets.all(24.0),
|
||||
child: Form(
|
||||
key: _formKey,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
_buildHeader(context),
|
||||
const SizedBox(height: 32),
|
||||
|
||||
// Nome del Negozio (Icona obbligatoria)
|
||||
FluxTextField(
|
||||
label: 'Nome del Negozio',
|
||||
icon: Icons.storefront_rounded,
|
||||
controller: _nomeController,
|
||||
),
|
||||
|
||||
const SizedBox(height: 24),
|
||||
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
_SectionTitle(title: 'LOCALIZZAZIONE'),
|
||||
TextButton.icon(
|
||||
onPressed: _useCompanyAddress,
|
||||
icon: const Icon(Icons.copy_rounded, size: 16),
|
||||
label: const Text(
|
||||
'Copia da Azienda',
|
||||
style: TextStyle(fontSize: 12),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
|
||||
// Indirizzo (Icona obbligatoria)
|
||||
FluxTextField(
|
||||
label: 'Indirizzo e n. civico',
|
||||
icon: Icons.map_outlined,
|
||||
controller: _indirizzoController,
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
|
||||
// RIGA TRIPLA: Comune, CAP, PR
|
||||
Row(
|
||||
crossAxisAlignment: CrossAxisAlignment
|
||||
.start, // Allinea in alto in caso di errori
|
||||
children: [
|
||||
Expanded(
|
||||
flex: 3,
|
||||
child: FluxTextField(
|
||||
label: 'Comune',
|
||||
icon:
|
||||
Icons.location_city_rounded, // Icona aggiunta
|
||||
controller: _comuneController,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
Expanded(
|
||||
flex: 2,
|
||||
child: FluxTextField(
|
||||
label: 'CAP',
|
||||
icon: Icons.post_add_rounded, // Icona aggiunta
|
||||
controller: _capController,
|
||||
keyboardType: TextInputType.number,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
Expanded(
|
||||
flex:
|
||||
2, // Aumentato leggermente per ospitare l'icona
|
||||
child: FluxTextField(
|
||||
label: 'PR',
|
||||
icon: Icons.explore_outlined, // Icona aggiunta
|
||||
controller: _provinciaController,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
const SizedBox(height: 48),
|
||||
|
||||
_buildSubmitButton(context, state),
|
||||
],
|
||||
),
|
||||
),
|
||||
return Scaffold(
|
||||
appBar: AppBar(title: const Text('Il tuo primo Negozio')),
|
||||
body: BlocConsumer<StoreBloc, StoreState>(
|
||||
listener: (context, state) {
|
||||
if (state.status == StoreStatus.success) {
|
||||
context.read<SessionBloc>().add(AppStarted());
|
||||
}
|
||||
if (state.status == StoreStatus.failure) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: Text(state.errorMessage ?? 'Errore salvataggio'),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
}
|
||||
},
|
||||
builder: (context, state) {
|
||||
return SafeArea(
|
||||
child: SingleChildScrollView(
|
||||
padding: const EdgeInsets.all(24.0),
|
||||
child: Form(
|
||||
key: _formKey,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
_buildHeader(context),
|
||||
const SizedBox(height: 32),
|
||||
|
||||
// Nome del Negozio (Icona obbligatoria)
|
||||
FluxTextField(
|
||||
label: 'Nome del Negozio',
|
||||
icon: Icons.storefront_rounded,
|
||||
controller: _nomeController,
|
||||
),
|
||||
|
||||
const SizedBox(height: 24),
|
||||
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
_SectionTitle(title: 'LOCALIZZAZIONE'),
|
||||
TextButton.icon(
|
||||
onPressed: _useCompanyAddress,
|
||||
icon: const Icon(Icons.copy_rounded, size: 16),
|
||||
label: const Text(
|
||||
'Copia da Azienda',
|
||||
style: TextStyle(fontSize: 12),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
|
||||
// Indirizzo (Icona obbligatoria)
|
||||
FluxTextField(
|
||||
label: 'Indirizzo e n. civico',
|
||||
icon: Icons.map_outlined,
|
||||
controller: _indirizzoController,
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
|
||||
// RIGA TRIPLA: Comune, CAP, PR
|
||||
Row(
|
||||
crossAxisAlignment: CrossAxisAlignment
|
||||
.start, // Allinea in alto in caso di errori
|
||||
children: [
|
||||
Expanded(
|
||||
flex: 3,
|
||||
child: FluxTextField(
|
||||
label: 'Comune',
|
||||
icon: Icons.location_city_rounded, // Icona aggiunta
|
||||
controller: _comuneController,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
Expanded(
|
||||
flex: 2,
|
||||
child: FluxTextField(
|
||||
label: 'CAP',
|
||||
icon: Icons.post_add_rounded, // Icona aggiunta
|
||||
controller: _capController,
|
||||
keyboardType: TextInputType.number,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
Expanded(
|
||||
flex: 2, // Aumentato leggermente per ospitare l'icona
|
||||
child: FluxTextField(
|
||||
label: 'PR',
|
||||
icon: Icons.explore_outlined, // Icona aggiunta
|
||||
controller: _provinciaController,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
const SizedBox(height: 48),
|
||||
|
||||
_buildSubmitButton(context, state),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user