rework-onboarding (#7)
Onboarding completato, ora super rapido e top Reviewed-on: http://catelliub.zapto.org:3000/brontomark/flux/pulls/7 Co-authored-by: Mark M2 Macbook <marco@catelli.it> Co-committed-by: Mark M2 Macbook <marco@catelli.it>
This commit is contained in:
@@ -2,7 +2,7 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:flux/features/master_data/store/bloc/store_cubit.dart';
|
||||
import 'package:flux/features/master_data/store/models/store_model.dart';
|
||||
import 'package:flux/core/blocs/session/session_bloc.dart';
|
||||
import 'package:flux/core/blocs/session/session_cubit.dart';
|
||||
import 'package:flux/core/theme/theme.dart';
|
||||
import 'package:flux/core/widgets/flux_text_field.dart';
|
||||
|
||||
@@ -34,7 +34,7 @@ class _CreateStoreScreenState extends State<CreateStoreScreen> {
|
||||
|
||||
/// Funzione magica per copiare i dati dall'azienda salvata in GetIt
|
||||
void _useCompanyAddress() {
|
||||
final company = context.read<SessionBloc>().state.company;
|
||||
final company = context.read<SessionCubit>().state.company;
|
||||
if (company != null) {
|
||||
setState(() {
|
||||
_indirizzoController.text = company.indirizzo;
|
||||
@@ -58,7 +58,7 @@ class _CreateStoreScreenState extends State<CreateStoreScreen> {
|
||||
|
||||
void _onSave() {
|
||||
if (_formKey.currentState!.validate()) {
|
||||
final company = context.read<SessionBloc>().state.company;
|
||||
final company = context.read<SessionCubit>().state.company;
|
||||
|
||||
if (company == null) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
@@ -69,7 +69,7 @@ class _CreateStoreScreenState extends State<CreateStoreScreen> {
|
||||
|
||||
final store = StoreModel(
|
||||
nome: _nomeController.text.trim(),
|
||||
companyId: company.id,
|
||||
companyId: company.id!,
|
||||
indirizzo: _indirizzoController.text.trim(),
|
||||
cap: _capController.text.trim(),
|
||||
comune: _comuneController.text.trim(),
|
||||
@@ -84,10 +84,10 @@ class _CreateStoreScreenState extends State<CreateStoreScreen> {
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(title: const Text('Il tuo primo Negozio')),
|
||||
body: BlocConsumer<StoreCubit, StoreState>(
|
||||
listener: (context, state) {
|
||||
body: BlocBuilder<StoreCubit, StoreState>(
|
||||
/* listener: (context, state) {
|
||||
if (state.status == StoreStatus.success) {
|
||||
context.read<SessionBloc>().add(AppStarted());
|
||||
context.read<SessionCubit>().;
|
||||
}
|
||||
if (state.status == StoreStatus.failure) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
@@ -96,7 +96,7 @@ class _CreateStoreScreenState extends State<CreateStoreScreen> {
|
||||
),
|
||||
);
|
||||
}
|
||||
},
|
||||
}, */
|
||||
builder: (context, state) {
|
||||
return SafeArea(
|
||||
child: SingleChildScrollView(
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:flux/core/blocs/session/session_bloc.dart';
|
||||
import 'package:flux/core/blocs/session/session_cubit.dart';
|
||||
import 'package:flux/core/widgets/flux_text_field.dart';
|
||||
import 'package:flux/features/master_data/store/bloc/store_cubit.dart';
|
||||
import 'package:flux/features/master_data/store/models/store_model.dart';
|
||||
@@ -130,10 +130,10 @@ class _StoreFormState extends State<StoreForm> {
|
||||
comune: comuneController.text,
|
||||
provincia: provinciaController.text,
|
||||
companyId: context
|
||||
.read<SessionBloc>()
|
||||
.read<SessionCubit>()
|
||||
.state
|
||||
.company!
|
||||
.id, // Recuperiamo la companyId
|
||||
.id!, // Recuperiamo la companyId
|
||||
isActive: widget.store?.isActive ?? true,
|
||||
isPaid: widget.store?.isPaid ?? false,
|
||||
paymentExpiration: widget.store?.paymentExpiration,
|
||||
|
||||
Reference in New Issue
Block a user