feat-add-files-from-qr #8
@@ -130,4 +130,8 @@ class SessionCubit extends Cubit<SessionState> {
|
|||||||
await _supabase.auth.signOut();
|
await _supabase.auth.signOut();
|
||||||
// Non serve emettere stato qui, ci pensa il listener nel costruttore!
|
// Non serve emettere stato qui, ci pensa il listener nel costruttore!
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void setIsMobileDevice(bool isMobile) {
|
||||||
|
emit(state.copyWith(isMobileDevice: isMobile));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ class SessionState extends Equatable {
|
|||||||
final StoreModel? currentStore;
|
final StoreModel? currentStore;
|
||||||
final StaffMemberModel? currentStaff;
|
final StaffMemberModel? currentStaff;
|
||||||
final OnboardingStep onboardingStep;
|
final OnboardingStep onboardingStep;
|
||||||
|
final bool isMobileDevice;
|
||||||
|
|
||||||
const SessionState({
|
const SessionState({
|
||||||
this.status = SessionStatus.initial,
|
this.status = SessionStatus.initial,
|
||||||
@@ -32,6 +33,7 @@ class SessionState extends Equatable {
|
|||||||
this.currentStore,
|
this.currentStore,
|
||||||
this.currentStaff,
|
this.currentStaff,
|
||||||
this.onboardingStep = OnboardingStep.none,
|
this.onboardingStep = OnboardingStep.none,
|
||||||
|
this.isMobileDevice = false,
|
||||||
});
|
});
|
||||||
|
|
||||||
/// Metodo per creare una copia dello stato modificando solo i campi necessari
|
/// Metodo per creare una copia dello stato modificando solo i campi necessari
|
||||||
@@ -42,6 +44,7 @@ class SessionState extends Equatable {
|
|||||||
StoreModel? currentStore,
|
StoreModel? currentStore,
|
||||||
StaffMemberModel? currentStaff,
|
StaffMemberModel? currentStaff,
|
||||||
OnboardingStep? onboardingStep,
|
OnboardingStep? onboardingStep,
|
||||||
|
bool? isMobileDevice,
|
||||||
}) {
|
}) {
|
||||||
return SessionState(
|
return SessionState(
|
||||||
status: status ?? this.status,
|
status: status ?? this.status,
|
||||||
@@ -50,6 +53,7 @@ class SessionState extends Equatable {
|
|||||||
currentStore: currentStore ?? this.currentStore,
|
currentStore: currentStore ?? this.currentStore,
|
||||||
currentStaff: currentStaff ?? this.currentStaff,
|
currentStaff: currentStaff ?? this.currentStaff,
|
||||||
onboardingStep: onboardingStep ?? this.onboardingStep,
|
onboardingStep: onboardingStep ?? this.onboardingStep,
|
||||||
|
isMobileDevice: isMobileDevice ?? this.isMobileDevice,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -61,6 +65,7 @@ class SessionState extends Equatable {
|
|||||||
currentStore,
|
currentStore,
|
||||||
currentStaff,
|
currentStaff,
|
||||||
onboardingStep,
|
onboardingStep,
|
||||||
|
isMobileDevice,
|
||||||
];
|
];
|
||||||
|
|
||||||
// Helper rapidi per la UI
|
// Helper rapidi per la UI
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
import 'package:flux/features/auth/bloc/auth_cubit.dart';
|
|
||||||
import 'package:flux/features/company/bloc/company_bloc.dart';
|
import 'package:flux/features/company/bloc/company_bloc.dart';
|
||||||
import 'package:flux/core/blocs/session/session_cubit.dart';
|
import 'package:flux/core/blocs/session/session_cubit.dart';
|
||||||
import 'package:flux/core/theme/theme.dart';
|
import 'package:flux/core/theme/theme.dart';
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import 'package:flux/core/widgets/flux_text_field.dart';
|
|||||||
import 'package:flux/features/master_data/staff/blocs/staff_cubit.dart'; // Tuo percorso
|
import 'package:flux/features/master_data/staff/blocs/staff_cubit.dart'; // Tuo percorso
|
||||||
import 'package:flux/features/master_data/staff/models/staff_member_model.dart';
|
import 'package:flux/features/master_data/staff/models/staff_member_model.dart';
|
||||||
import 'package:flux/features/master_data/store/bloc/store_cubit.dart';
|
import 'package:flux/features/master_data/store/bloc/store_cubit.dart';
|
||||||
|
import 'package:get_it/get_it.dart';
|
||||||
|
|
||||||
class StaffScreen extends StatefulWidget {
|
class StaffScreen extends StatefulWidget {
|
||||||
const StaffScreen({super.key});
|
const StaffScreen({super.key});
|
||||||
@@ -268,25 +269,24 @@ class _StaffScreenState extends State<StaffScreen> {
|
|||||||
height: 50,
|
height: 50,
|
||||||
child: ElevatedButton(
|
child: ElevatedButton(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
final companyId = context
|
final updatedMember = StaffMemberModel(
|
||||||
.read<SessionCubit>()
|
|
||||||
.state
|
|
||||||
.company!
|
|
||||||
.id!;
|
|
||||||
//TODO sistemare StaffScreen per il nuovo modello
|
|
||||||
/* final updatedMember = StaffMemberModel(
|
|
||||||
id: member?.id,
|
id: member?.id,
|
||||||
name: nameController.text,
|
name: nameController.text,
|
||||||
email: emailController.text,
|
email: emailController.text,
|
||||||
phoneNumber: phoneController.text,
|
phoneNumber: phoneController.text,
|
||||||
companyId: companyId,
|
companyId: GetIt.I
|
||||||
|
.get<SessionCubit>()
|
||||||
|
.state
|
||||||
|
.company!
|
||||||
|
.id!,
|
||||||
|
userId: GetIt.I.get<SessionCubit>().state.user!.id,
|
||||||
);
|
);
|
||||||
|
|
||||||
// Chiamiamo il metodo atomico nel Cubit
|
// Chiamiamo il metodo atomico nel Cubit
|
||||||
context.read<StaffCubit>().saveStaffWithStores(
|
context.read<StaffCubit>().saveStaffWithStores(
|
||||||
member: updatedMember,
|
member: updatedMember,
|
||||||
selectedStoreIds: tempSelectedStores,
|
selectedStoreIds: tempSelectedStores,
|
||||||
); */
|
);
|
||||||
|
|
||||||
Navigator.pop(context);
|
Navigator.pop(context);
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
import 'package:flux/core/utils/validators.dart';
|
import 'package:flux/core/utils/validators.dart';
|
||||||
import 'package:flux/core/widgets/flux_text_field.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_cubit.dart';
|
||||||
import 'package:flux/features/onboarding/blocs/onboarding_state.dart';
|
import 'package:flux/features/onboarding/blocs/onboarding_state.dart';
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,6 @@
|
|||||||
|
import 'dart:io';
|
||||||
|
|
||||||
|
import 'package:flutter/foundation.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
import 'package:flutter_dotenv/flutter_dotenv.dart';
|
import 'package:flutter_dotenv/flutter_dotenv.dart';
|
||||||
@@ -109,6 +112,14 @@ class _FluxAppState extends State<FluxApp> {
|
|||||||
super.initState();
|
super.initState();
|
||||||
// Creiamo il router passandogli il Cubit per i redirect
|
// Creiamo il router passandogli il Cubit per i redirect
|
||||||
_router = AppRouter.createRouter(context.read<SessionCubit>());
|
_router = AppRouter.createRouter(context.read<SessionCubit>());
|
||||||
|
GetIt.I.get<SessionCubit>().setIsMobileDevice(isMobileDevice(context));
|
||||||
|
}
|
||||||
|
|
||||||
|
bool isMobileDevice(BuildContext context) {
|
||||||
|
if (kIsWeb) {
|
||||||
|
return false; // Il web non lo consideriamo "mobile nativo" per i deep link
|
||||||
|
}
|
||||||
|
return Platform.isAndroid || Platform.isIOS;
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|||||||
16
pubspec.lock
16
pubspec.lock
@@ -608,6 +608,22 @@ packages:
|
|||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.2.0"
|
version: "2.2.0"
|
||||||
|
qr:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: qr
|
||||||
|
sha256: "5a1d2586170e172b8a8c8470bbbffd5eb0cd38a66c0d77155ea138d3af3a4445"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "3.0.2"
|
||||||
|
qr_flutter:
|
||||||
|
dependency: "direct main"
|
||||||
|
description:
|
||||||
|
name: qr_flutter
|
||||||
|
sha256: "5095f0fc6e3f71d08adef8feccc8cea4f12eec18a2e31c2e8d82cb6019f4b097"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "4.1.0"
|
||||||
realtime_client:
|
realtime_client:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ dependencies:
|
|||||||
internet_file: ^1.3.0
|
internet_file: ^1.3.0
|
||||||
intl: ^0.20.2
|
intl: ^0.20.2
|
||||||
pdfx: ^2.9.2
|
pdfx: ^2.9.2
|
||||||
|
qr_flutter: ^4.1.0
|
||||||
shared_preferences: ^2.5.5
|
shared_preferences: ^2.5.5
|
||||||
supabase_flutter: ^2.12.2
|
supabase_flutter: ^2.12.2
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user